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