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