From: Gary V. Vaughan Date: Tue, 13 Apr 2004 15:30:10 +0000 (+0000) Subject: * libltdl/lt__pre89.h, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/argz.c, X-Git-Tag: release-1-9b~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3431a0ab9633e06743152ca49c1607e0aa662a98;p=thirdparty%2Flibtool.git * libltdl/lt__pre89.h, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/argz.c, libltdl/argz.h, libltdl/lt__glibc.h, libltdl/lt_dlloader.h, libltdl/lt__dirent.c, libltdl/lt__dirent.h, libltdl/lt__private.h, libltdl/lt__alloc.c, libltdl/lt__alloc.h, libltdl/lt_system.h, libltdl/loader-dld_link.c, libltdl/loader-dlopen.c, libltdl/loader-dyld.c, libltdl/loader-loadlibrary.c, libltdl/loader-shl_load.c, libltdl/lt_error.h, libltdl/lt_mutex.h: Autoconf either defines to 1 or undefs the discovery macros it puts in config.h, and many (non-GNU) compilers throw a spurious warning when testing an #undef macro with #if. For consistency, while we are touching all these lines, use defined(MACRO) style throughout. Reported by Bob Friesenhahn --- diff --git a/ChangeLog b/ChangeLog index 15d7e576b..234f93b6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-04-13 Gary V. Vaughan + + * libltdl/lt__pre89.h, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/argz.c, + libltdl/argz.h, libltdl/lt__glibc.h, libltdl/lt_dlloader.h, + libltdl/lt__dirent.c, libltdl/lt__dirent.h, libltdl/lt__private.h, + libltdl/lt__alloc.c, libltdl/lt__alloc.h, libltdl/lt_system.h, + libltdl/loader-dld_link.c, libltdl/loader-dlopen.c, + libltdl/loader-dyld.c, libltdl/loader-loadlibrary.c, + libltdl/loader-shl_load.c, libltdl/lt_error.h, libltdl/lt_mutex.h: + Autoconf either defines to 1 or undefs the discovery macros it + puts in config.h, and many (non-GNU) compilers throw a spurious + warning when testing an #undef macro with #if. For consistency, + while we are touching all these lines, use defined(MACRO) style + throughout. + Reported by Bob Friesenhahn + 2004-04-13 Gary V. Vaughan Factor out the individual loaders, in preparation for preloading diff --git a/libltdl/argz.c b/libltdl/argz.c index 9762e96d4..8bda7a890 100644 --- a/libltdl/argz.c +++ b/libltdl/argz.c @@ -35,12 +35,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include #include -#if HAVE_STRING_H +#if defined(HAVE_STRING_H) # include -#elif HAVE_STRINGS_H +#elif defined(HAVE_STRINGS_H) # include #endif -#if HAVE_MEMORY_H +#if defined(HAVE_MEMORY_H) # include #endif diff --git a/libltdl/argz.h b/libltdl/argz.h index 4958cbb04..6344fc5b0 100644 --- a/libltdl/argz.h +++ b/libltdl/argz.h @@ -27,14 +27,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ -#ifndef ARGZ_H +#if !defined(ARGZ_H) #define ARGZ_H 1 -#if LTDL +#if defined(LTDL) # include "lt__glibc.h" #endif -#ifdef _cplusplus +#if defined(_cplusplus) extern "C" { #endif @@ -47,8 +47,8 @@ error_t argz_insert (char **pargz, size_t *pargz_len, char * argz_next (char *argz, size_t argz_len, const char *entry); void argz_stringify (char *argz, size_t argz_len, int sep); -#ifdef _cplusplus +#if defined(_cplusplus) } #endif -#endif /*!ARGZ_H*/ +#endif /*!defined(ARGZ_H)*/ diff --git a/libltdl/loader-dld_link.c b/libltdl/loader-dld_link.c index 0f97be0f8..d43b62217 100644 --- a/libltdl/loader-dld_link.c +++ b/libltdl/loader-dld_link.c @@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include "lt__private.h" #include "lt_dlloader.h" -#if HAVE_DLD_H -#include +#if defined(HAVE_DLD_H) +# include #endif static lt_module diff --git a/libltdl/loader-dlopen.c b/libltdl/loader-dlopen.c index 986a1a0ab..2f4c2d56d 100644 --- a/libltdl/loader-dlopen.c +++ b/libltdl/loader-dlopen.c @@ -30,39 +30,39 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include "lt__private.h" #include "lt_dlloader.h" -#if HAVE_DLFCN_H +#if defined(HAVE_DLFCN_H) # include #endif -#if HAVE_SYS_DL_H +#if defined(HAVE_SYS_DL_H) # include #endif /* We may have to define LT_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ -#ifndef LT_LAZY_OR_NOW -# ifdef RTLD_LAZY +#if !defined(LT_LAZY_OR_NOW) +# if defined(RTLD_LAZY) # define LT_LAZY_OR_NOW RTLD_LAZY # else -# ifdef DL_LAZY +# if defined(DL_LAZY) # define LT_LAZY_OR_NOW DL_LAZY # endif # endif /* !RTLD_LAZY */ #endif -#ifndef LT_LAZY_OR_NOW -# ifdef RTLD_NOW +#if !defined(LT_LAZY_OR_NOW) +# ifd efined(RTLD_NOW) # define LT_LAZY_OR_NOW RTLD_NOW # else -# ifdef DL_NOW +# if defined(DL_NOW) # define LT_LAZY_OR_NOW DL_NOW # endif # endif /* !RTLD_NOW */ #endif -#ifndef LT_LAZY_OR_NOW +#if !defined(LT_LAZY_OR_NOW) # define LT_LAZY_OR_NOW 0 #endif /* !LT_LAZY_OR_NOW */ -#if HAVE_DLERROR +#if defined(HAVE_DLERROR) # define DLERROR(arg) dlerror () #else # define DLERROR(arg) LT__STRERROR (arg) @@ -113,7 +113,7 @@ sys_dl_sym (lt_user_data loader_data, lt_module module, const char *symbol) struct lt_user_dlloader lt__sys_dl = { -# ifdef NEED_USCORE +# if defined(NEED_USCORE) "_", # else 0, diff --git a/libltdl/loader-dyld.c b/libltdl/loader-dyld.c index 71fe82370..6c0f2523b 100644 --- a/libltdl/loader-dyld.c +++ b/libltdl/loader-dyld.c @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include "lt__private.h" #include "lt_dlloader.h" -#if HAVE_MACH_O_DYLD_H +#if defined(HAVE_MACH_O_DYLD_H) # if !defined(__APPLE_CC__) && !defined(__MWERKS__) && !defined(__private_extern__) /* Is this correct? Does it still function properly? */ # define __private_extern__ extern @@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include /* We have to put some stuff here that isn't in older dyld.h files */ -#ifndef ENUM_DYLD_BOOL +#if !defined(ENUM_DYLD_BOOL) # define ENUM_DYLD_BOOL # undef FALSE # undef TRUE @@ -50,10 +50,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA TRUE }; #endif -#ifndef LC_REQ_DYLD +#if !defined(LC_REQ_DYLD) # define LC_REQ_DYLD 0x80000000 #endif -#ifndef LC_LOAD_WEAK_DYLIB +#if !defined(LC_LOAD_WEAK_DYLIB) # define LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD) #endif @@ -71,39 +71,39 @@ static enum DYLD_BOOL (*lt__module_export) (NSModule module) = 0; static int dyld_cannot_close = 0; -#ifndef NSADDIMAGE_OPTION_NONE +#if !defined(NSADDIMAGE_OPTION_NONE) # define NSADDIMAGE_OPTION_NONE 0x0 #endif -#ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR +#if !defined(NSADDIMAGE_OPTION_RETURN_ON_ERROR) # define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1 #endif -#ifndef NSADDIMAGE_OPTION_WITH_SEARCHING +#if !defined(NSADDIMAGE_OPTION_WITH_SEARCHING) # define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2 #endif -#ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED +#if !defined(NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED) # define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4 #endif -#ifndef NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME +#if !defined(NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME) # define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8 #endif -#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND +#if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_BIND) # define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0 #endif -#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW +#if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW) # define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1 #endif -#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY +#if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY) # define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2 #endif -#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR +#if !defined(NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) # define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4 #endif #define LT__SYMLOOKUP_OPTS (NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW \ | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) -#ifdef __BIG_ENDIAN__ +#if defined(__BIG_ENDIAN__) # define LT__MAGIC MH_MAGIC #else # define LT__MAGIC MH_CIGAM @@ -339,7 +339,6 @@ sys_dyld_close (lt_user_data loader_data, lt_module module) } else { -#if 1 /* Currently, if a module contains c++ static destructors and it is unloaded, we get a segfault in atexit(), due to compiler and dynamic loader differences of opinion, this works around that. */ @@ -349,8 +348,7 @@ sys_dyld_close (lt_user_data loader_data, lt_module module) { flags |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED; } -#endif -#ifdef __ppc__ +#if defined(__ppc__) flags |= NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES; #endif if (!NSUnLinkModule (module, flags)) diff --git a/libltdl/loader-loadlibrary.c b/libltdl/loader-loadlibrary.c index a240fd24c..ab28797b1 100644 --- a/libltdl/loader-loadlibrary.c +++ b/libltdl/loader-loadlibrary.c @@ -73,7 +73,7 @@ sys_wll_open (lt_user_data loader_data, const char *filename) if (!searchname) return 0; -#if __CYGWIN__ +#if defined(__CYGWIN__) { char wpath[MAX_PATH]; cygwin_conv_to_full_win32_path(searchname, wpath); diff --git a/libltdl/loader-shl_load.c b/libltdl/loader-shl_load.c index 7ba0f3164..49d9283df 100644 --- a/libltdl/loader-shl_load.c +++ b/libltdl/loader-shl_load.c @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include "lt__private.h" #include "lt_dlloader.h" -#ifdef HAVE_DL_H +#if defined(HAVE_DL_H) # include #endif @@ -65,10 +65,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * library specified by the path argument. */ -#ifndef DYNAMIC_PATH +#if !defined(DYNAMIC_PATH) # define DYNAMIC_PATH 0 #endif -#ifndef BIND_RESTRICTED +#if !defined(BIND_RESTRICTED) # define BIND_RESTRICTED 0 #endif diff --git a/libltdl/lt__alloc.c b/libltdl/lt__alloc.c index 8d740d78d..93275d192 100644 --- a/libltdl/lt__alloc.c +++ b/libltdl/lt__alloc.c @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ -#ifdef HAVE_CONFIG_H +#if defined(HAVE_CONFIG_H) # include HAVE_CONFIG_H #endif diff --git a/libltdl/lt__alloc.h b/libltdl/lt__alloc.h index 48c91447d..fd88e7752 100644 --- a/libltdl/lt__alloc.h +++ b/libltdl/lt__alloc.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ -#ifndef LT__ALLOC_H +#if !defined(LT__ALLOC_H) #define LT__ALLOC_H 1 #include "lt_system.h" @@ -53,4 +53,4 @@ char *lt__strdup (const char *string); LT_END_C_DECLS -#endif /*!LT__ALLOC_H*/ +#endif /*!defined(LT__ALLOC_H)*/ diff --git a/libltdl/lt__dirent.c b/libltdl/lt__dirent.c index 511572d14..6f0d68948 100644 --- a/libltdl/lt__dirent.c +++ b/libltdl/lt__dirent.c @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include "lt__dirent.h" -#if __WINDOWS__ +#if defined(__WINDOWS__) void closedir (DIR *entry) @@ -98,4 +98,4 @@ readdir (DIR *entry) return &entry->file_info; } -#endif /*__WINDOWS__*/ +#endif /*defined(__WINDOWS__)*/ diff --git a/libltdl/lt__dirent.h b/libltdl/lt__dirent.h index 203e4867b..4c2b4e219 100644 --- a/libltdl/lt__dirent.h +++ b/libltdl/lt__dirent.h @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ -#ifndef LT__DIRENT_H +#if !defined(LT__DIRENT_H) #define LT__DIRENT_H 1 -#ifdef HAVE_CONFIG_H +#if defined(HAVE_CONFIG_H) # include HAVE_CONFIG_H #endif @@ -46,13 +46,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA `direct' API. */ # define dirent direct # define D_NAMLEN(dirent) ((dirent)->d_namlen) -# if HAVE_SYS_NDIR_H +# if defined(HAVE_SYS_NDIR_H) # include # endif -# if HAVE_SYS_DIR_H +# if defined(HAVE_SYS_DIR_H) # include # endif -# if HAVE_NDIR_H +# if defined(HAVE_NDIR_H) # include # endif @@ -92,6 +92,6 @@ void closedir (DIR *entry); LT_END_C_DECLS -#endif /*!__WINDOWS__*/ +#endif /*!defined(__WINDOWS__)*/ -#endif /*!LT__DIRENT_H*/ +#endif /*!defined(LT__DIRENT_H)*/ diff --git a/libltdl/lt__glibc.h b/libltdl/lt__glibc.h index 9d3af3b99..0e91c918b 100644 --- a/libltdl/lt__glibc.h +++ b/libltdl/lt__glibc.h @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ -#ifndef LT__GLIBC_H +#if !defined(LT__GLIBC_H) #define LT__GLIBC_H 1 -#ifdef HAVE_CONFIG_H +#if defined(HAVE_CONFIG_H) # include HAVE_CONFIG_H #endif @@ -54,20 +54,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA /* ...finally, we revert to the library implementations of any symbols that are provided by the host since they may be more optimised (say with inline assembler) than the generic versions we provide here. */ -#if HAVE_ARGZ_APPEND +#if defined(HAVE_ARGZ_APPEND) # undef argz_append #endif -#if HAVE_ARGZ_CREATE_SEP +#if defined(HAVE_ARGZ_CREATE_SEP) # undef argz_create_sep #endif -#if HAVE_ARGZ_INSERT +#if defined(HAVE_ARGZ_INSERT) # undef argz_insert #endif -#if HAVE_ARGZ_NEXT +#if defined(HAVE_ARGZ_NEXT) # undef argz_next #endif -#if HAVE_ARGZ_STRINGIFY +#if defined(HAVE_ARGZ_STRINGIFY) # undef argz_stringify #endif -#endif /*!LT__GLIBC_H*/ +#endif /*!defined(LT__GLIBC_H)*/ diff --git a/libltdl/lt__pre89.h b/libltdl/lt__pre89.h index c410f6e6a..c184e501d 100644 --- a/libltdl/lt__pre89.h +++ b/libltdl/lt__pre89.h @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ -#ifndef LT__PREC89_H +#if !defined(LT__PREC89_H) #define LT__PREC89_H 1 -#ifdef HAVE_CONFIG_H +#if defined(HAVE_CONFIG_H) # include HAVE_CONFIG_H #endif @@ -38,14 +38,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA LT_BEGIN_C_DECLS -#if ! HAVE_STRCMP +#if !defined(HAVE_STRCMP) # undef strcmp # define strcmp lt__strcmp int strcmp (const char *str1, const char *str2); #endif -#if ! HAVE_STRCHR -# if HAVE_INDEX +#if !defined(HAVE_STRCHR) +# if defined(HAVE_INDEX) # define strchr index # else # undef strchr @@ -54,8 +54,8 @@ const char *strchr (const char *str, int ch); # endif #endif -#if ! HAVE_STRRCHR -# if HAVE_RINDEX +#if !defined(HAVE_STRRCHR) +# if defined(HAVE_RINDEX) # define strrchr rindex # else # undef strcmp @@ -64,8 +64,8 @@ const char *strrchr (const char *str, int ch); # endif #endif -#if ! HAVE_MEMCPY -# if HAVE_BCOPY +#if !defined(HAVE_MEMCPY) +# if defined(HAVE_BCOPY) # define memcpy(dest, src, size) bcopy((src), (dest), (size)) # else # undef memcpy @@ -74,7 +74,7 @@ void *memcpy (void *dest, const void *src, size_t size); # endif #endif -#if ! HAVE_MEMMOVE +#if !defined(HAVE_MEMMOVE) # undef memmove # define memmove lt__memmove void *memmove (void *dest, const void *src, size_t size); @@ -82,4 +82,4 @@ void *memmove (void *dest, const void *src, size_t size); LT_END_C_DECLS -#endif /*!LT__PREC89*/ +#endif /*!defined(LT__PREC89)*/ diff --git a/libltdl/lt__private.h b/libltdl/lt__private.h index d1776c645..61cdd67da 100644 --- a/libltdl/lt__private.h +++ b/libltdl/lt__private.h @@ -27,10 +27,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ -#ifndef LT__PRIVATE_H +#if !defined(LT__PRIVATE_H) #define LT__PRIVATE_H 1 -#ifdef HAVE_CONFIG_H +#if defined(HAVE_CONFIG_H) # include HAVE_CONFIG_H #endif @@ -39,18 +39,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include #include -#if HAVE_UNISTD_H +#if defined(HAVE_UNISTD_H) # include #endif -#if HAVE_STRING_H +#if defined(HAVE_STRING_H) # include #else -# if HAVE_STRINGS_H +# if defined(HAVE_STRINGS_H) # include # endif #endif -#if HAVE_MEMORY_H +#if defined(HAVE_MEMORY_H) # include #endif @@ -63,11 +63,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA /* ...and all exported interfaces. */ #include "ltdl.h" -#if WITH_DMALLOC +#if defined(WITH_DMALLOC) # include #endif -#ifdef DLL_EXPORT +#if defined(DLL_EXPORT) # define LT_GLOBAL_DATA __declspec(dllexport) #else # define LT_GLOBAL_DATA @@ -76,7 +76,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA LT_BEGIN_C_DECLS -#ifndef errno +#if !defined(errno) extern int errno; #endif @@ -135,4 +135,4 @@ LT_SCOPE const char *lt__last_error; LT_END_C_DECLS -#endif /*!LT__PRIVATE_H*/ +#endif /*!defined(LT__PRIVATE_H)*/ diff --git a/libltdl/lt_error.h b/libltdl/lt_error.h index 7043db2f2..b25089960 100644 --- a/libltdl/lt_error.h +++ b/libltdl/lt_error.h @@ -27,7 +27,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ /* Only include this header file once. */ -#ifndef LT_ERROR_H +#if !defined(LT_ERROR_H) #define LT_ERROR_H 1 #include @@ -75,4 +75,4 @@ LT_SCOPE int lt_dlseterror (int errorcode); LT_END_C_DECLS -#endif /*!LT_ERROR_H*/ +#endif /*!defined(LT_ERROR_H)*/ diff --git a/libltdl/lt_mutex.h b/libltdl/lt_mutex.h index 53eb4ce01..ae0dd7480 100644 --- a/libltdl/lt_mutex.h +++ b/libltdl/lt_mutex.h @@ -27,7 +27,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ /* Only include this header file once. */ -#ifndef LT_MUTEX_H +#if !defined(LT_MUTEX_H) #define LT_MUTEX_H 1 #include @@ -46,4 +46,4 @@ LT_SCOPE int lt_dlmutex_register (lt_dlmutex_lock *lock, LT_END_C_DECLS -#endif /*!LT_MUTEX_H*/ +#endif /*!defined(LT_MUTEX_H)*/ diff --git a/libltdl/lt_system.h b/libltdl/lt_system.h index ad0f26cf1..802930cfd 100644 --- a/libltdl/lt_system.h +++ b/libltdl/lt_system.h @@ -26,7 +26,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef LT_SYSTEM_H +#if !defined(LT_SYSTEM_H) #define LT_SYSTEM_H 1 #include @@ -34,10 +34,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include /* Some systems do not define EXIT_*, even with STDC_HEADERS. */ -#ifndef EXIT_SUCCESS +#if !defined(EXIT_SUCCESS) # define EXIT_SUCCESS 0 #endif -#ifndef EXIT_FAILURE +#if !defined(EXIT_FAILURE) # define EXIT_FAILURE 1 #endif @@ -51,7 +51,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA /* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations, so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at the end of C declarations. */ -#ifdef __cplusplus +#if defined(__cplusplus) # define LT_BEGIN_C_DECLS extern "C" { # define LT_END_C_DECLS } #else @@ -96,37 +96,21 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA /* DLL building support on win32 hosts; mostly to workaround their ridiculous implementation of data symbol exporting. */ -#ifndef LT_SCOPE -# ifdef __WINDOWS__ -# ifdef DLL_EXPORT /* defined by libtool (if required) */ +#if !defined(LT_SCOPE) +# if defined(__WINDOWS__) +# if defined(DLL_EXPORT) /* defined by libtool (if required) */ # define LT_SCOPE __declspec(dllexport) # endif -# ifdef LIBLTDL_DLL_IMPORT /* define if linking with this dll */ +# if defined(LIBLTDL_DLL_IMPORT) /* define if linking with this dll */ # define LT_SCOPE extern __declspec(dllimport) # endif # endif -# ifndef LT_SCOPE /* static linking or !__WINDOWS__ */ +# if !defined(LT_SCOPE) /* static linking or !__WINDOWS__ */ # define LT_SCOPE extern # endif #endif -/* DLL building support on win32 hosts; mostly to workaround their - ridiculous implementation of data symbol exporting. */ -#ifndef LT_SCOPE -# ifdef __WINDOWS__ -# ifdef DLL_EXPORT /* defined by libtool (if required) */ -# define LT_SCOPE __declspec(dllexport) -# endif -# ifdef LIBLTDL_DLL_IMPORT /* define if linking with this dll */ -# define LT_SCOPE extern __declspec(dllimport) -# endif -# endif -# ifndef LT_SCOPE /* static linking or !__WINDOWS__ */ -# define LT_SCOPE extern -# endif -#endif - -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) /* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory separator when it is set. */ # define LT_DIRSEP_CHAR '\\' @@ -155,4 +139,4 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # define LT_CONC(s,t) s/**/t #endif -#endif /*!LT__SYSTEM_H */ +#endif /*!defined(LT__SYSTEM_H)*/ diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 9280cf704..c685ba2d4 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #define LTDL_ARCHIVE_EXT ".la" /* max. filename length */ -#ifndef LT_FILENAME_MAX +#if !defined(LT_FILENAME_MAX) # define LT_FILENAME_MAX 1024 #endif @@ -110,10 +110,10 @@ struct lt_dlhandle_struct { static const char objdir[] = LTDL_OBJDIR; static const char archive_ext[] = LTDL_ARCHIVE_EXT; -#ifdef LTDL_SHLIB_EXT +#if defined(LTDL_SHLIB_EXT) static const char shlib_ext[] = LTDL_SHLIB_EXT; #endif -#ifdef LTDL_SYSSEARCHPATH +#if defined(LTDL_SYSSEARCHPATH) static const char sys_search_path[] = LTDL_SYSSEARCHPATH; #endif @@ -121,22 +121,22 @@ static const char sys_search_path[] = LTDL_SYSSEARCHPATH; /* --- DLLOADER VIRTUAL FUNCTION TABLES --- */ -#if HAVE_LIBDL +#if defined(HAVE_LIBDL) LT_SCOPE struct lt_user_dlloader lt__sys_dl; #endif -#if HAVE_SHL_LOAD +#if defined(HAVE_SHL_LOAD) LT_SCOPE struct lt_user_dlloader lt__sys_shl; #endif #if defined(__WINDOWS__) || defined(__CYGWIN__) LT_SCOPE struct lt_user_dlloader lt__sys_wll; #endif -#ifdef __BEOS__ +#if defined(__BEOS__) LT_SCOPE struct lt_user_dlloader lt__sys_bedl; #endif -#if HAVE_DLD +#if defined(HAVE_DLD) LT_SCOPE struct lt_user_dlloader lt__sys_dld; #endif -#if HAVE_DYLD +#if defined(HAVE_DYLD) LT_SCOPE struct lt_user_dlloader lt__sys_dyld; LT_SCOPE int lt__sys_dyld_init (void); #endif @@ -232,20 +232,20 @@ lt_dlinit (void) /* All ltdl supplied loaders are in the /dl[a-z-]+/ namespace. */ errors += lt_dlloader_add (LOADER_APPEND, <__presym, "dlpreload"); -#if HAVE_DLD +#if defined(HAVE_DLD) errors += lt_dlloader_add (LOADER_APPEND, <__sys_dld, "dld"); #endif -#if HAVE_DYLD +#if defined(HAVE_DYLD) errors += lt_dlloader_add (LOADER_APPEND, <__sys_dyld, "dldyld"); errors += lt__sys_dyld_init(); #endif -#ifdef __BEOS__ +#if defined(__BEOS__) errors += lt_dlloader_add (LOADER_APPEND, <__sys_bedl, "dlopen"); #endif -#if HAVE_SHL_LOAD +#if defined(HAVE_SHL_LOAD) errors += lt_dlloader_add (LOADER_APPEND, <__sys_shl, "dlopen"); #endif -#if HAVE_LIBDL +#if defined(HAVE_LIBDL) errors += lt_dlloader_add (LOADER_APPEND, <__sys_dl, "dlopen"); #endif #if defined(__WINDOWS__) || defined(__CYGWIN__) @@ -448,7 +448,7 @@ tryall_dlopen_module (lt_dlhandle *handle, const char *prefix, assert (handle); assert (dirname); assert (dlname); -#ifdef LT_DIRSEP_CHAR +#if defined(LT_DIRSEP_CHAR) /* Only canonicalized names (i.e. with DIRSEP chars already converted) should make it into this function: */ assert (strchr (dirname, LT_DIRSEP_CHAR) == 0); @@ -556,7 +556,7 @@ canonicalize_path (const char *path, char **pcanonical) /* Anything other than a directory separator is copied verbatim. */ if ((path[src] != '/') -#ifdef LT_DIRSEP_CHAR +#if defined(LT_DIRSEP_CHAR) && (path[src] != LT_DIRSEP_CHAR) #endif ) @@ -568,7 +568,7 @@ canonicalize_path (const char *path, char **pcanonical) NULL terminator. */ else if ((path[1+ src] != LT_PATHSEP_CHAR) && (path[1+ src] != LT_EOS_CHAR) -#ifdef LT_DIRSEP_CHAR +#if defined(LT_DIRSEP_CHAR) && (path[1+ src] != LT_DIRSEP_CHAR) #endif && (path[1+ src] != '/')) @@ -762,7 +762,7 @@ find_handle (const char *search_path, const char *base_name, static int load_deplibs (lt_dlhandle handle, char *deplibs) { -#if LTDL_DLOPEN_DEPLIBS +#if defined(LTDL_DLOPEN_DEPLIBS) char *p, *save_search_path = 0; int depcount = 0; int i; @@ -772,7 +772,7 @@ load_deplibs (lt_dlhandle handle, char *deplibs) handle->depcount = 0; -#if LTDL_DLOPEN_DEPLIBS +#if defined(LTDL_DLOPEN_DEPLIBS) if (!deplibs) { return errors; @@ -1104,7 +1104,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename) file = find_file (search_path, base_name, &dir); } -#ifdef LTDL_SHLIBPATH_VAR +#if defined(LTDL_SHLIBPATH_VAR) if (!file) { search_path = getenv (LTDL_SHLIBPATH_VAR); @@ -1112,7 +1112,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename) file = find_file (search_path, base_name, &dir); } #endif -#ifdef LTDL_SYSSEARCHPATH +#if defined(LTDL_SYSSEARCHPATH) if (!file && sys_search_path) { file = find_file (sys_search_path, base_name, &dir); @@ -1307,11 +1307,11 @@ try_dlopen (lt_dlhandle *phandle, const char *filename) if ((dir || (!find_handle (user_search_path, base_name, &newhandle) && !find_handle (getenv (LTDL_SEARCHPATH_VAR), base_name, &newhandle) -#ifdef LTDL_SHLIBPATH_VAR +#if defined(LTDL_SHLIBPATH_VAR) && !find_handle (getenv (LTDL_SHLIBPATH_VAR), base_name, &newhandle) #endif -#ifdef LTDL_SYSSEARCHPATH +#if defined(LTDL_SYSSEARCHPATH) && !find_handle (sys_search_path, base_name, &newhandle) #endif ))) @@ -1407,7 +1407,7 @@ lt_dlopenext (const char *filename) /* If FILENAME already bears a suitable extension, there is no need to try appending additional extensions. */ if (ext && ((strcmp (ext, archive_ext) == 0) -#ifdef LTDL_SHLIB_EXT +#if defined(LTDL_SHLIB_EXT) || (strcmp (ext, shlib_ext) == 0) #endif )) @@ -1435,7 +1435,7 @@ lt_dlopenext (const char *filename) return handle; } -#ifdef LTDL_SHLIB_EXT +#if defined(LTDL_SHLIB_EXT) /* Try appending SHLIB_EXT. */ if (LT_STRLEN (shlib_ext) > LT_STRLEN (archive_ext)) { @@ -1673,14 +1673,14 @@ lt_dlforeachfile (const char *search_path, foreachfile_callback, func, data); } -#ifdef LTDL_SHLIBPATH_VAR +#if defined(LTDL_SHLIBPATH_VAR) if (!is_done) { is_done = foreach_dirinpath (getenv(LTDL_SHLIBPATH_VAR), 0, foreachfile_callback, func, data); } #endif -#ifdef LTDL_SYSSEARCHPATH +#if defined(LTDL_SYSSEARCHPATH) if (!is_done) { is_done = foreach_dirinpath (getenv(LTDL_SYSSEARCHPATH), 0, diff --git a/libltdl/ltdl.h b/libltdl/ltdl.h index 7db190d0f..3e93a8376 100644 --- a/libltdl/ltdl.h +++ b/libltdl/ltdl.h @@ -27,7 +27,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ /* Only include this header file once. */ -#ifndef LTDL_H +#if !defined(LTDL_H) #define LTDL_H 1 #include @@ -139,7 +139,7 @@ LT_SCOPE void (*lt_dlfree) (void *ptr); /* --- SOURCE COMPATIBILITY WITH ANCIENT LIBLTDL --- */ -#ifdef LT_NON_POSIX_NAMESPACE +#if defined(LT_NON_POSIX_NAMESPACE) # define lt_ptr_t void * # define lt_module_t lt_module # define lt_module_open_t lt_module_open @@ -152,4 +152,4 @@ LT_SCOPE void (*lt_dlfree) (void *ptr); LT_END_C_DECLS -#endif /* !LTDL_H */ +#endif /*!defined(LTDL_H)*/