Annotation of sql/pgsql/libltdl/configure.in, revision 1.2

1.1       parser      1: dnl Process this file with autoconf to create configure.
                      2: 
                      3: AC_INIT(ltdl.c)
                      4: 
                      5:     enable_ltdl_install=yes
                      6: 
                      7: AM_INIT_AUTOMAKE(libltdl,1.0,-)
                      8: AM_CONFIG_HEADER(config_auto.h)
                      9: AM_MAINTAINER_MODE
                     10: 
                     11: AC_PROG_CC
                     12: AC_C_CONST
                     13: AC_C_INLINE
                     14: AM_PROG_LIBTOOL
                     15: AC_SUBST(LIBTOOL_DEPS)
                     16: 
                     17: AC_ARG_ENABLE(ltdl-install,
                     18: [  --enable-ltdl-install   install libltdl])
                     19: 
                     20: AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
                     21: AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
                     22: 
                     23: dnl Read the libtool configuration
                     24: rm -f conftest
1.2     ! paf        25: $LIBTOOL --config > conftest
1.1       parser     26: . ./conftest
                     27: rm -f conftest
                     28: 
                     29: AC_CACHE_CHECK([which extension is used for shared libraries],
                     30:   libltdl_cv_shlibext, [dnl
                     31: (
                     32:   last=
                     33:   for spec in $library_names_spec; do
                     34:     last="$spec"
                     35:   done
                     36: changequote(, )
                     37:   echo "$last" | sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
                     38: changequote([, ])
                     39: )
                     40: libltdl_cv_shlibext=`cat conftest`
                     41: rm -f conftest
                     42: ])
                     43: if test -n "$libltdl_cv_shlibext"; then
                     44:   AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
                     45:     [Define to the extension used for shared libraries, say, ".so". ])
                     46: fi
                     47: 
                     48: AC_CACHE_CHECK([which variable specifies run-time library path],
                     49:   libltdl_cv_shlibpath_var, [libltdl_cv_shlibpath_var="$shlibpath_var"])
                     50: if test -n "$libltdl_cv_shlibpath_var"; then
                     51:   AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
                     52:     [Define to the name of the environment variable that determines the dynamic library search path. ])
                     53: fi
                     54: 
                     55: AC_CACHE_CHECK([for objdir],
                     56:   libltdl_cv_objdir, [libltdl_cv_objdir="$objdir"])
                     57: test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
                     58: AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
                     59:   [Define to the sub-directory in which libtool stores uninstalled libraries. ])
                     60: 
                     61: AC_HEADER_STDC
                     62: AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h dld.h)
                     63: AC_CHECK_HEADERS(string.h strings.h, break)
                     64: AC_CHECK_FUNCS(strchr index, break)
                     65: AC_CHECK_FUNCS(strrchr rindex, break)
                     66: 
                     67: AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
                     68:        libltdl_cv_preloaded_symbols, [dnl
                     69:   if test -n "$global_symbol_pipe"; then
                     70:     libltdl_cv_preloaded_symbols=yes
                     71:   else
                     72:     libltdl_cv_preloaded_symbols=no
                     73:   fi
                     74: ])
                     75: if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
                     76:   AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
                     77:     [Define if libtool can extract symbol lists from object files. ])
                     78: fi
                     79: 
                     80: LIBADD_DL=
                     81: AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1) LIBADD_DL="-ldl"],
                     82: [AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1)])])
                     83: AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1)],
                     84: [AC_CHECK_LIB(dld, shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1) LIBADD_DL="$LIBADD_DL -ldld"])])
                     85: AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1)dnl
                     86: test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"])
                     87: AC_SUBST(LIBADD_DL)
                     88: 
                     89: if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; then
                     90:  LIBS_SAVE="$LIBS"
                     91:  LIBS="$LIBS $LIBADD_DL"
                     92:  AC_CHECK_FUNCS(dlerror)
                     93:  LIBS="$LIBS_SAVE"
                     94: fi
                     95: 
                     96: dnl Check for command to grab the raw symbol name followed
                     97: dnl by C symbol name from nm.
                     98: AC_REQUIRE([AC_CANONICAL_HOST])dnl
                     99: AC_REQUIRE([AC_PROG_NM])dnl
                    100: # Check for command to grab the raw symbol name followed by C symbol from nm.
                    101: AC_MSG_CHECKING([command to parse $NM output])
                    102: AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
                    103: [# These are sane defaults that work on at least a few old systems.
                    104: # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
                    105: 
                    106: changequote(,)dnl
                    107: # Character class describing NM global symbol codes.
                    108: ac_symcode='[BCDEGRST]'
                    109: 
                    110: # Regexp to match symbols that can be accessed directly from C.
                    111: ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
                    112: 
                    113: # Transform the above into a raw symbol and a C symbol.
                    114: ac_symxfrm='\1 \2\3 \3'
                    115: 
                    116: # Transform an extracted symbol line into a proper C declaration
                    117: ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
                    118: 
                    119: # Define system-specific variables.
                    120: case "$host_os" in
                    121: aix*)
                    122:   ac_symcode='[BCDT]'
                    123:   ;;
                    124: cygwin* | mingw*)
                    125:   ac_symcode='[ABCDGISTW]'
                    126:   ;;
                    127: hpux*)
                    128:   ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
                    129:   ;;
                    130: irix*)
                    131:   ac_symcode='[BCDEGRST]'
                    132:   ;;
                    133: solaris*)
                    134:   ac_symcode='[BDT]'
                    135:   ;;
                    136: esac
                    137: 
                    138: # If we're using GNU nm, then use its standard symbol codes.
                    139: if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
                    140:   ac_symcode='[ABCDGISTW]'
                    141: fi
                    142: changequote([,])dnl
                    143: 
                    144: # Try without a prefix undercore, then with it.
                    145: for ac_symprfx in "" "_"; do
                    146: 
                    147:   ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[      ]\($ac_symcode\)[       ][      ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
                    148: 
                    149:   # Check to see that the pipe works correctly.
                    150:   ac_pipe_works=no
                    151:   rm -f conftest.$ac_ext
                    152:   cat > conftest.$ac_ext <<EOF
                    153: #ifdef __cplusplus
                    154: extern "C" {
                    155: #endif
                    156: char nm_test_var;
                    157: void nm_test_func(){}
                    158: #ifdef __cplusplus
                    159: }
                    160: #endif
                    161: int main(){nm_test_var='a';nm_test_func;return 0;}
                    162: EOF
                    163: 
                    164:   if AC_TRY_EVAL(ac_compile); then
                    165:     # Now try to grab the symbols.
                    166:     ac_nlist=conftest.nm
                    167:   
                    168:     if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
                    169: 
                    170:       # Try sorting and uniquifying the output.
                    171:       if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
                    172:        mv -f "$ac_nlist"T "$ac_nlist"
                    173:       else
                    174:        rm -f "$ac_nlist"T
                    175:       fi
                    176: 
                    177:       # Make sure that we snagged all the symbols we need.
                    178:       if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
                    179:        if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
                    180:          cat <<EOF > conftest.c
                    181: #ifdef __cplusplus
                    182: extern "C" {
                    183: #endif
                    184: 
                    185: EOF
                    186:          # Now generate the symbol file.
                    187:          eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
                    188: 
                    189:          cat <<EOF >> conftest.c
                    190: #if defined (__STDC__) && __STDC__
                    191: # define lt_ptr_t void *
                    192: #else
                    193: # define lt_ptr_t char *
                    194: # define const
                    195: #endif
                    196: 
                    197: /* The mapping between symbol names and symbols. */
                    198: const struct {
                    199:   const char *name;
                    200:   lt_ptr_t address;
                    201: }
                    202: changequote(,)dnl
                    203: lt_preloaded_symbols[] =
                    204: changequote([,])dnl
                    205: {
                    206: EOF
                    207:        sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
                    208:        cat <<\EOF >> conftest.c
                    209:   {0, (lt_ptr_t) 0}
                    210: };
                    211: 
                    212: #ifdef __cplusplus
                    213: }
                    214: #endif
                    215: EOF
                    216:          # Now try linking the two files.
                    217:          mv conftest.$ac_objext conftstm.$ac_objext
                    218:          ac_save_LIBS="$LIBS"
                    219:          ac_save_CFLAGS="$CFLAGS"
                    220:          LIBS="conftstm.$ac_objext"
                    221:          CFLAGS="$CFLAGS$no_builtin_flag"
                    222:          if AC_TRY_EVAL(ac_link) && test -s conftest; then
                    223:            ac_pipe_works=yes
                    224:          else
                    225:            echo "configure: failed program was:" >&AC_FD_CC
                    226:            cat conftest.c >&AC_FD_CC
                    227:          fi
                    228:          LIBS="$ac_save_LIBS"
                    229:          CFLAGS="$ac_save_CFLAGS"
                    230:        else
                    231:          echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
                    232:        fi
                    233:       else
                    234:        echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
                    235:       fi
                    236:     else
                    237:       echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
                    238:     fi
                    239:   else
                    240:     echo "$progname: failed program was:" >&AC_FD_CC
                    241:     cat conftest.c >&AC_FD_CC
                    242:   fi
                    243:   rm -rf conftest* conftst*
                    244: 
                    245:   # Do not use the global_symbol_pipe unless it works.
                    246:   if test "$ac_pipe_works" = yes; then
                    247:     if test x"$ac_symprfx" = x"_"; then
                    248:       ac_cv_sys_symbol_underscore=yes
                    249:     else
                    250:       ac_cv_sys_symbol_underscore=no
                    251:     fi
                    252:     break
                    253:   else
                    254:     ac_cv_sys_global_symbol_pipe=
                    255:   fi
                    256: done
                    257: ])
                    258: 
                    259: ac_result=yes
                    260: if test -z "$ac_cv_sys_global_symbol_pipe"; then
                    261:    ac_result=no
                    262: fi
                    263: AC_MSG_RESULT($ac_result)
                    264: 
                    265: dnl does the compiler prefix global symbols with an underscore?
                    266: AC_MSG_CHECKING([for _ prefix in compiled symbols])
                    267: AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
                    268: [ac_cv_sys_symbol_underscore=no
                    269: cat > conftest.$ac_ext <<EOF
                    270: void nm_test_func(){}
                    271: int main(){nm_test_func;return 0;}
                    272: EOF
                    273: if AC_TRY_EVAL(ac_compile); then
                    274:   # Now try to grab the symbols.
                    275:   ac_nlist=conftest.nm
                    276:   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
                    277:     # See whether the symbols have a leading underscore.
                    278:     if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
                    279:       ac_cv_sys_symbol_underscore=yes
                    280:     else
                    281:       if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
                    282:        :
                    283:       else
                    284:        echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
                    285:       fi
                    286:     fi
                    287:   else
                    288:     echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
                    289:   fi
                    290: else
                    291:   echo "configure: failed program was:" >&AC_FD_CC
                    292:   cat conftest.c >&AC_FD_CC
                    293: fi
                    294: rm -rf conftest*
                    295: ])
                    296: AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
                    297: 
                    298: if test x"$ac_cv_sys_symbol_underscore" = xyes; then
                    299:   if test x"$ac_cv_func_dlopen" = xyes ||
                    300:      test x"$ac_cv_lib_dl_dlopen" = xyes ; then
                    301:        AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
                    302:                libltdl_cv_need_uscore, [dnl
                    303:                AC_TRY_RUN([
                    304: #if HAVE_DLFCN_H
                    305: #include <dlfcn.h>
                    306: #endif
                    307: 
                    308: #include <stdio.h>
                    309: 
                    310: #ifdef RTLD_GLOBAL
                    311: # define LTDL_GLOBAL   RTLD_GLOBAL
                    312: #else
                    313: # ifdef DL_GLOBAL
                    314: #  define LTDL_GLOBAL  DL_GLOBAL
                    315: # else
                    316: #  define LTDL_GLOBAL  0
                    317: # endif
                    318: #endif
                    319: 
                    320: /* We may have to define LTDL_LAZY_OR_NOW in the command line if we
                    321:    find out it does not work in some platform. */
                    322: #ifndef LTDL_LAZY_OR_NOW
                    323: # ifdef RTLD_LAZY
                    324: #  define LTDL_LAZY_OR_NOW     RTLD_LAZY
                    325: # else
                    326: #  ifdef DL_LAZY
                    327: #   define LTDL_LAZY_OR_NOW    DL_LAZY
                    328: #  else
                    329: #   ifdef RTLD_NOW
                    330: #    define LTDL_LAZY_OR_NOW   RTLD_NOW
                    331: #   else
                    332: #    ifdef DL_NOW
                    333: #     define LTDL_LAZY_OR_NOW  DL_NOW
                    334: #    else
                    335: #     define LTDL_LAZY_OR_NOW  0
                    336: #    endif
                    337: #   endif
                    338: #  endif
                    339: # endif
                    340: #endif
                    341: 
                    342: fnord() { int i=42;}
                    343: main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
                    344:     if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
                    345:               if(ptr1 && !ptr2) { dlclose(self); exit(0); } } exit(1); } 
                    346: ],     libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
                    347:        libltdl_cv_need_uscore=cross
                    348: )])
                    349:   fi
                    350: fi
                    351: 
                    352: if test x"$libltdl_cv_need_uscore" = xyes; then
                    353:   AC_DEFINE(NEED_USCORE, 1,
                    354:     [Define if dlsym() requires a leading underscode in symbol names. ])
                    355: fi
                    356: 
                    357: dnl Output the makefile
                    358: AC_OUTPUT(Makefile)
                    359: 
                    360: # Local Variables:
                    361: # mode:shell-script
                    362: # sh-indentation:2
                    363: # End:

E-mail: