00001 #ifndef _INCLUDE_LOG4CPP_CONFIG_VXWORKS_H 00002 #define _INCLUDE_LOG4CPP_CONFIG_VXWORKS_H 1 00003 00004 /* manually edited from include/log4cpp/config.h */ 00005 00006 /* Other fixes for building for VxWorks and other compiler/script warnings 00007 00008 * include/log4cpp/config-vxworks.h: Added for custom forcing settings 00009 * 00010 * include/log4cpp/PatternLayout.hh: doxygen syntax 00011 * include/log4cpp/Portability.hh: use config-vxworks.h on VxWorks. Note: Portability.hh for use in *.hh files; In *.cpp use PortabilityImpl.hh with added inlines. 00012 * include/log4cpp/Priority.hh: enum syntax (trailing comma) 00013 * src/Category.cpp: Superflous Scope specification 00014 * src/FileAppender.cpp: conflicting write() declaration - need const. for ioctl need ioLib.h 00015 * src/Localtime.cpp: use string.h not memory.h 00016 * src/Priority.cpp: log entry type keyword strings 00017 * tests/Clock.hh: sys/times.h not sys/time.h for struct timeval in Vxworks kernel. Portability.hh missing. 00018 * include/log4cpp/RemoteSyslogAppender.hh: enum syntax (trailing comma) 00019 * src/RemoteSyslogAppender.cpp: need hostLib.h for e.g. gethostbyname(0 00020 * src/RemoteSyslogAppender.cpp: #include <sockLib.h> for e.g. socket(), sendto() etc 00021 * src/BasicConfigurator.cpp: # include <ioLib.h> For dup() __RTP__: Also unistd.h 00022 * src/SimpleConfigurator.cpp: # include <ioLib.h> For dup() __RTP__: Also unistd.h 00023 * tests/Clock.cpp: in Kernel sys/times.h instead of Linux and __RTP__ sys/time.h for struct timeval; clock_gettime(CLOCK_REALTIME) not gettimeofday() PortabilityImpl.hh missing. 00024 * 00025 * log4cpp.spec: removed, generated by configure 00026 * 00027 * configure for pthreads, see below, optional 00028 * bcb5/log4cpp/Makefile.in - by mistake? 00029 * "INSTALL_c_PROGRAM = @INSTALL_STRIP_PROGRAM@" instead of "INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@" 00030 * 00031 * doc/Doxyfile.in: doxygen warning, obsolete parameter 00032 * 00033 */ 00034 00035 /* Add appropriate #include in Portability.h: 00036 * #if defined (_MSC_VER) || defined(__BORLANDC__) 00037 * ... 00038 #elif defined(__vxworks) 00039 #else 00040 # include <log4cpp/config-vxworks.h> 00041 #endif 00042 * Predefined Macros for powerpc-wrs-vxworks see: touch foo.h; cppppc -dM foo.h; rm foo.h 00043 * Check both GNU 2.96 for VxWorks 5.x and GNU 3.x or 4.x for VxWorks 6.x to prefer version independent Macros. 00044 * __vxworks 00045 * For VxWorks 6.x see also _WRS_KERNEL and __RTP__ to differentiate between kernel space and application process space 00046 * See also _ARCH_PPC, __BIG_ENDIAN__ 00047 */ 00048 00049 #if 0 00050 /* include/log4cpp/config.h. Generated automatically at end of configure. */ 00051 /* include/config.h. Generated from config.h.in by configure. */ 00052 /* include/config.h.in. Generated from configure.in by autoheader. */ 00053 #endif 00054 00055 /* Define to 1 if you have the <dlfcn.h> header file. */ 00056 /* Only in VxWorks application processes! */ 00057 /* #undef LOG4CPP_HAVE_DLFCN_H */ 00058 #ifndef LOG4CPP_HAVE_DLFCN_H 00059 #ifdef __RTP__ 00060 #define LOG4CPP_HAVE_DLFCN_H 1 00061 #endif 00062 #endif 00063 00064 /* Define to 1 if you have the `ftime' function. */ 00065 /* #undef LOG4CPP_HAVE_FTIME */ 00066 00067 /* Define to 1 if you have the `gettimeofday' function. */ 00068 /* Used despite the exclusion in Clock.cpp */ 00069 /* Anyway timezones undefined and not used, therefore clock_gettime(CLOCK_REALTIME) is as good as well. 00070 * Note conversion from nsec to usec, see timeval vs. timespec, note time.h not sys/time.h 00071 */ 00072 /* VxWorks __RTP__ : declared in sys/time.h but still not available */ 00073 /* VxWorks _WRS_KERNEL : not available */ 00074 /* #undef LOG4CPP_HAVE_GETTIMEOFDAY */ 00075 00076 /* define if the compiler has int64_t */ 00077 /* #undef LOG4CPP_HAVE_INT64_T */ 00078 #ifndef LOG4CPP_HAVE_INT64_T 00079 #define LOG4CPP_HAVE_INT64_T 1 00080 #endif 00081 00082 /* Define to 1 if you have the <inttypes.h> header file. */ 00083 /* Only in application processes!!!!! */ 00084 /* #undef LOG4CPP_HAVE_INTTYPES_H */ 00085 #ifndef LOG4CPP_HAVE_INTTYPES_H 00086 #ifdef __RTP__ 00087 #define LOG4CPP_HAVE_INTTYPES_H 1 00088 #endif 00089 #endif 00090 00091 /* Define to 1 if you have the <io.h> header file. */ 00092 /* #undef LOG4CPP_HAVE_IO_H */ 00093 00094 /* Define to 1 if you have the `idsa' library (-lidsa). */ 00095 /* #undef LOG4CPP_HAVE_LIBIDSA */ 00096 00097 /* Wrong by autoconfigure! */ 00098 /* Define to 1 if you have the `localtime_r' function. */ 00099 /* #undef LOG4CPP_HAVE_LOCALTIME_R */ 00100 #ifndef LOG4CPP_HAVE_LOCALTIME_R 00101 #define LOG4CPP_HAVE_LOCALTIME_R 1 00102 #endif 00103 00104 /* Wrong by autoconfigure! define to get around problems with ERROR and DEBUG in vxWorks.h 00105 * 00106 * ERROR and DEBUG used by Priority.hh as scoped C++ symbol. 00107 * but Macros override the value in all Scopes. 00108 * 00109 * In VxWorks Application Processes (#if defined(__RTP__) ), Name collision free pure Posix 00110 * conformance could be enforced by #define _POSIX_C_SOURCE 200112L. But this precludes 00111 * some VxWorks features in this application. 00112 * Don't taking care about further VxWorks Process details for now. 00113 * 00114 * For VxWorks Kernel Process: 00115 * DEBUG: 00116 * Used only as #ifdef by compiler command line. Value irrelevant. 00117 * Sufficient to override #define DEBUG DEBUG to keep meaning when used as C++ symbol. 00118 * ERROR: 00119 * Value is important, defined by VxWorks indirectly included header file. 00120 * 00121 * Need to put a variable ERROR with the correct value into global scope, in addition to 00122 * override #define ERROR ERROR. Then VxWorks as well as scoped use of ERROR expand to the 00123 * proper variable. static linkage is sufficient, because Priority.hh included in all conflicting files. 00124 * 00125 * It must be prevented, that #define ERROR is overriden by a later VxWorks header 00126 * after it got fixed in Priority.hh 00127 * Unfortunately system headers do not show a warning on override, see -isystem, -Wsystem-headers 00128 * Also the Priority.hh fix is only in effect, if the VxWorks value was already defined before. 00129 * Therefore in Portability.hh always refering the platform specific value by an 00130 * extern const int ERROR_platform variable in PortabilityImpl.cpp does not help. 00131 * Also it is not obvious what OS internal header file got indirectly included, and therefore 00132 * there is no specific correct log4cpp header inclusion order. 00133 * The only way is, to include the entire OS specific header which defines ERROR, to benefit from the 00134 * double inclusion protection. This must be done within a sub include of Portability.hh, to 00135 * be sure that it is available before Priority.hh 00136 * The minimum system header which fullfills this, and does not collide with VxWorks.h inclusion 00137 * order is vxWorksCommon.h 00138 */ 00139 #ifndef LOG4CPP_FIX_ERROR_COLLISION 00140 #define LOG4CPP_FIX_ERROR_COLLISION 1 00141 #endif 00142 #include <vxWorksCommon.h> 00143 00144 /* Define to 1 if you have the <memory.h> header file. */ 00145 /* Note: With VxWorks corresponding functions are in string.h instead 00146 * either create a forwarding memory.h in the application or handle at memory.h usage. 00147 * Anyway with log4cpp the only occurence in Localtime.cpp is not used because of available localtime_r 00148 * Alternatively: #include string.h or other memcpy declaration right here, to get by with skipping memory.h at usage locations. 00149 */ 00150 /* #undef LOG4CPP_HAVE_MEMORY_H */ 00151 00152 /* define if the compiler implements namespaces */ 00153 #ifndef LOG4CPP_HAVE_NAMESPACES 00154 #define LOG4CPP_HAVE_NAMESPACES 00155 #endif 00156 00157 /* src/m4/ACX_PTHREAD.m4 is one of the templates which together are making up the configure script 00158 * Near beginning of configure script see acx_pthread_ok=no 00159 * This activates the tests further below for pthread availability, compiler options and capability. 00160 * Alternate executable pthread-config to return necessary compiler options not present and fails. 00161 * With VxWorks it is unnecessary to set special compiler/linker options for pthread. 00162 * Further tests in configure fail, because on the fly building and executing a pthread executable 00163 * which does not work without access to target. 00164 * This will show misleading pthread off in ../configure.log, config.log and other config.h* 00165 * Note: config.log with #define HAVE_PTHREAD refers to non existing confdefs.h, similar to auto-generated 00166 * include/config.h with template include/config.h.in 00167 * include/log4cpp/config.h is the template of include/log4cpp/config-vxworks.h 00168 * Are other config* settings effective, or is always config-vxworks.h taking precedence after the other settings? 00169 * See Portability.hh - on platform specific config*.h, plain config.h completely ignored! 00170 * On *.hh #include Portability.hh, on *.cpp #include PortabilityImpl.hh with added inline functions! 00171 * Success of the configure test can be forced by setting acx_pthread_ok=yes at beginning of pthread tests in configure. 00172 * But this will affect both ws and lcu side. 00173 * 00174 * However forcing the pthreads availability in config-vxworks.h is not sufficient, because on original configure 00175 * behaviour on cross compiling the configure fails with: 00176 * 00177 * configure: error: unable to find pthreads, currently this is required 00178 * 00179 * This error is triggered by the log4cpp specific configure.in at ACX_PTHREAD, 00180 * which by autoconfigure gets converted to the configure script, 00181 * which involves inclusion of the *.m4 tests. 00182 * Since log4cpp seem to depends on pthreads, no point in removing this test. 00183 * Also for now it is not desired to regenerate so much of the build mechanism in the log4cpp package. 00184 * So patch configure and ACX_PTHREAD.m4 consistently to fake success on cross compiling. 00185 * But on the linux side the behaviour must be unchanged. 00186 * Therefore replace initial 'acx_pthread_ok=no' in ACX_PTHREAD.m4 and configure by the following: 00187 * 00188 * if test "$cross_compiling" != no; then 00189 * acx_pthread_ok=no 00190 * else 00191 * acx_pthread_ok=yes 00192 * AC_MSG_WARN([On cross compiling without remote execution, the pthreads capability probe application \ 00193 * cannot be executed. For now fake success of HAVE_PTHREAD, HAVE_THREADING, USE_PTHREADS \ 00194 * and assume no pthreads specific PTHREAD_LIBS and PTHREAD_CFLAGS ]) 00195 * fi 00196 * 00197 * In configure replace multi line 00198 * AC_MSG_WARN([...\ 00199 * ...]) 00200 * by 00201 * { echo "$as_me:$LINENO: WARNING: ... 00202 * ..." >&5 00203 * echo "$as_me: WARNING: ... 00204 * ..." >&2;} 00205 * 00206 */ 00207 00208 /* Define if you have POSIX threads libraries and header files. */ 00209 #ifndef LOG4CPP_HAVE_PTHREAD 00210 #define LOG4CPP_HAVE_PTHREAD 1 00211 #endif 00212 00213 /* define if the C library has snprintf */ 00214 /* Wrong by autoconf! */ 00215 /* #undef LOG4CPP_HAVE_SNPRINTF */ 00216 #ifndef LOG4CPP_HAVE_SNPRINTF 00217 #define LOG4CPP_HAVE_SNPRINTF 1 00218 #endif 00219 00220 /* define if the compiler has stringstream */ 00221 #ifndef LOG4CPP_HAVE_SSTREAM 00222 #define LOG4CPP_HAVE_SSTREAM 00223 #endif 00224 00225 /* define if you have the <stdint.h> header file. */ 00226 /* Only in application processes!!!!! */ 00227 /* #undef LOG4CPP_HAVE_STDINT_H */ 00228 #ifndef LOG4CPP_HAVE_STDINT_H 00229 #ifdef __RTP__ 00230 #define LOG4CPP_HAVE_STDINT_H 00231 #endif 00232 #endif 00233 00234 /* Define to 1 if you have the <stdlib.h> header file. */ 00235 #ifndef LOG4CPP_HAVE_STDLIB_H 00236 #define LOG4CPP_HAVE_STDLIB_H 1 00237 #endif 00238 00239 /* Define to 1 if you have the <strings.h> header file. */ 00240 #ifndef LOG4CPP_HAVE_STRINGS_H 00241 #define LOG4CPP_HAVE_STRINGS_H 1 00242 #endif 00243 00244 /* Define to 1 if you have the <string.h> header file. */ 00245 #ifndef LOG4CPP_HAVE_STRING_H 00246 #define LOG4CPP_HAVE_STRING_H 1 00247 #endif 00248 00249 /* Define to 1 if you have the `syslog' function. */ 00250 /* #undef LOG4CPP_HAVE_SYSLOG */ 00251 00252 /* Define to 1 if you have the <sys/stat.h> header file. */ 00253 #ifndef LOG4CPP_HAVE_SYS_STAT_H 00254 #define LOG4CPP_HAVE_SYS_STAT_H 1 00255 #endif 00256 00257 /* Define to 1 if you have the <sys/types.h> header file. */ 00258 #ifndef LOG4CPP_HAVE_SYS_TYPES_H 00259 #define LOG4CPP_HAVE_SYS_TYPES_H 1 00260 #endif 00261 00262 /* define if threading is enabled */ 00263 #ifndef LOG4CPP_HAVE_THREADING 00264 #define LOG4CPP_HAVE_THREADING 1 00265 #endif 00266 00267 /* Define to 1 if you have the <unistd.h> header file. */ 00268 /* Most is also in ioLib.h but with slightly different prototype. 00269 * Linux unistd.h: extern ssize_t write (int __fd, __const void *__buf, size_t __n) __wur; 00270 * VxWorks6.7 unistd.h: extern int write (int fd, char *buffer, size_t nbytes); 00271 * VxWorks 6.7 ioLib.h: extern ssize_t write (int, const void *, size_t); 00272 * All Vxworks variants result in a const or propagation violation in FileAppender.cpp 00273 * Instead of including unistd.h here and #define write temporarily to something else and providing the correct declaration, 00274 * So far workaround at occurence of unistd.h for FileAppender.cpp FileAppender::_append 00275 */ 00276 #ifndef LOG4CPP_HAVE_UNISTD_H 00277 #define LOG4CPP_HAVE_UNISTD_H 1 00278 #endif 00279 00280 /* Name of package */ 00281 #ifndef LOG4CPP_PACKAGE 00282 #define LOG4CPP_PACKAGE "log4cpp" 00283 #endif 00284 00285 /* Define to the address where bug reports for this package should be sent. */ 00286 #ifndef LOG4CPP_PACKAGE_BUGREPORT 00287 #define LOG4CPP_PACKAGE_BUGREPORT "" 00288 #endif 00289 00290 /* Define to the full name of this package. */ 00291 #ifndef LOG4CPP_PACKAGE_NAME 00292 #define LOG4CPP_PACKAGE_NAME "log4cpp" 00293 #endif 00294 00295 /* Define to the full name and version of this package. */ 00296 #ifndef LOG4CPP_PACKAGE_STRING 00297 #define LOG4CPP_PACKAGE_STRING "log4cpp 1.0" 00298 #endif 00299 00300 /* Define to the one symbol short name of this package. */ 00301 #ifndef LOG4CPP_PACKAGE_TARNAME 00302 #define LOG4CPP_PACKAGE_TARNAME "log4cpp" 00303 #endif 00304 00305 /* Define to the version of this package. */ 00306 #ifndef LOG4CPP_PACKAGE_VERSION 00307 #define LOG4CPP_PACKAGE_VERSION "1.0" 00308 #endif 00309 00310 /* Define to necessary symbol if this constant uses a non-standard name on 00311 your system. */ 00312 #ifndef LOG4CPP_PTHREAD_CREATE_JOINABLE 00313 #define LOG4CPP_PTHREAD_CREATE_JOINABLE unknown 00314 #endif 00315 00316 /* Define to 1 if you have the ANSI C header files. */ 00317 #ifndef LOG4CPP_STDC_HEADERS 00318 #define LOG4CPP_STDC_HEADERS 1 00319 #endif 00320 00321 /* define if pthread library is available */ 00322 #ifndef LOG4CPP_USE_PTHREADS 00323 #define LOG4CPP_USE_PTHREADS 1 00324 #endif 00325 00326 /* Version number of package */ 00327 #ifndef LOG4CPP_VERSION 00328 #define LOG4CPP_VERSION "1.0" 00329 #endif 00330 00331 #if defined(__vxworks) && !defined(__RTP__) 00332 /* This Macro should immediately precede all main definitions and contain the application name: 00333 * LOG4CPP_MAIN_DECL(example_appname) 00334 * int main(int argc, char *argv[]) { ... } 00335 * By default definition of Portability.hh expands to nothing, but config-xxx.h can redefine it. 00336 * 00337 * VxWorks loadable kernel modules are in the same already running process, 00338 * and therefore do not have the concept of a main function. 00339 * Therefore config-vxworks.h redefines the Macro to convert main into a suitable declaration. 00340 * 00341 * common name main needs to be static. Since the compiler treats main special, 00342 * need to redefine it to main_static by a Macrp. 00343 * 00344 * provide a C function which takes a const string for the arguments. 00345 * This converts the string to the argc/argv form and calls the local main function. 00346 * 00347 * argument conversion function centralized in PortabilityImpl.cpp 00348 */ 00349 00350 #define main main_static 00351 00352 int log4cpp_maincall(const char *args, int (*main)(int argc, char** argv), char *appname ); 00353 00354 #undef LOG4CPP_MAIN_DECL 00355 #define LOG4CPP_MAIN_DECL(appname) \ 00356 static int main(int argc, char** argv); \ 00357 extern "C" int appname( const char *args) \ 00358 { \ 00359 return log4cpp_maincall(args, main, #appname); \ 00360 } \ 00361 static 00362 00363 #endif 00364 00365 /* _INCLUDE_LOG4CPP_CONFIG_VXWORKS_H */ 00366 #endif