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