Debian Codegraph @

m4/ltdl.m4

raw
1 # ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
2 #
3 # Copyright (C) 1999-2008, 2011-2019, 2021-2024 Free Software
4 # Foundation, Inc.
5 # Written by Thomas Tanner, 1999
6 #
7 # This file is free software; the Free Software Foundation gives
8 # unlimited permission to copy and/or distribute it, with or without
9 # modifications, as long as this notice is preserved.
10
11 # serial 24 LTDL_INIT
12
13 # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE])
14 # ------------------------------------------
15 # DIRECTORY contains the libltdl sources. It is okay to call this
16 # function multiple times, as long as the same DIRECTORY is always given.
17 AC_DEFUN([LT_CONFIG_LTDL_DIR],
18 [AC_BEFORE([$0], [LTDL_INIT])
19 _$0($*)
20 ])# LT_CONFIG_LTDL_DIR
21
22 # We break this out into a separate macro, so that we can call it safely
23 # internally without being caught accidentally by the sed scan in libtoolize.
24 m4_defun([_LT_CONFIG_LTDL_DIR],
25 [dnl remove trailing slashes
26 m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$]))
27 m4_case(_LTDL_DIR,
28 [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply '.'
29 m4_if(_ARG_DIR, [.],
30 [],
31 [m4_define([_LTDL_DIR], _ARG_DIR)
32 _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])],
33 [m4_if(_ARG_DIR, _LTDL_DIR,
34 [],
35 [m4_fatal([multiple libltdl directories: ']_LTDL_DIR[', ']_ARG_DIR['])])])
36 m4_popdef([_ARG_DIR])
37 ])# _LT_CONFIG_LTDL_DIR
38
39 # Initialise:
40 m4_define([_LTDL_DIR], [])
41
42
43 # _LT_BUILD_PREFIX
44 # ----------------
45 # If Autoconf is new enough, expand to '$(top_build_prefix)', otherwise
46 # to '$(top_builddir)/'.
47 m4_define([_LT_BUILD_PREFIX],
48 [m4_ifdef([AC_AUTOCONF_VERSION],
49 [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]),
50 [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX],
51 [$(top_build_prefix)],
52 [$(top_builddir)/])],
53 [$(top_build_prefix)])],
54 [$(top_builddir)/])[]dnl
55 ])
56
57
58 # LTDL_CONVENIENCE
59 # ----------------
60 # sets LIBLTDL to the link flags for the libltdl convenience library and
61 # LTDLINCL to the include flags for the libltdl header and adds
62 # --enable-ltdl-convenience to the configure arguments. Note that
63 # AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with
64 # '$(top_build_prefix)' if available, otherwise with '$(top_builddir)/',
65 # and LTDLINCL will be prefixed with '$(top_srcdir)/' (note the single
66 # quotes!). If your package is not flat and you're not using automake,
67 # define top_build_prefix, top_builddir, and top_srcdir appropriately
68 # in your Makefiles.
69 AC_DEFUN([LTDL_CONVENIENCE],
70 [AC_BEFORE([$0], [LTDL_INIT])dnl
71 dnl Although the argument is deprecated and no longer documented,
72 dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one
73 dnl here make sure it is the same as any other declaration of libltdl's
74 dnl location! This also ensures lt_ltdl_dir is set when configure.ac is
75 dnl not yet using an explicit LT_CONFIG_LTDL_DIR.
76 m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl
77 _$0()
78 ])# LTDL_CONVENIENCE
79
80 # AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools,
81 # now we have LT_CONFIG_LTDL_DIR:
82 AU_DEFUN([AC_LIBLTDL_CONVENIENCE],
83 [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])])
84 _LTDL_CONVENIENCE])
85
86 dnl aclocal-1.4 backwards compatibility:
87 dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [])
88
89
90 # _LTDL_CONVENIENCE
91 # -----------------
92 # Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]).
93 m4_defun([_LTDL_CONVENIENCE],
94 [case $enable_ltdl_convenience in
95 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
96 "") enable_ltdl_convenience=yes
97 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
98 esac
99 LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la"
100 LTDLDEPS=$LIBLTDL
101 LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}"
102
103 AC_SUBST([LIBLTDL])
104 AC_SUBST([LTDLDEPS])
105 AC_SUBST([LTDLINCL])
106
107 # For backwards non-gettext consistent compatibility...
108 INCLTDL=$LTDLINCL
109 AC_SUBST([INCLTDL])
110 ])# _LTDL_CONVENIENCE
111
112
113 # LTDL_INSTALLABLE
114 # ----------------
115 # sets LIBLTDL to the link flags for the libltdl installable library
116 # and LTDLINCL to the include flags for the libltdl header and adds
117 # --enable-ltdl-install to the configure arguments. Note that
118 # AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl
119 # is not found, LIBLTDL will be prefixed with '$(top_build_prefix)' if
120 # available, otherwise with '$(top_builddir)/', and LTDLINCL will be
121 # prefixed with '$(top_srcdir)/' (note the single quotes!). If your
122 # package is not flat and you're not using automake, define top_build_prefix,
123 # top_builddir, and top_srcdir appropriately in your Makefiles.
124 # In the future, this macro may have to be called after LT_INIT.
125 AC_DEFUN([LTDL_INSTALLABLE],
126 [AC_BEFORE([$0], [LTDL_INIT])dnl
127 dnl Although the argument is deprecated and no longer documented,
128 dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one
129 dnl here make sure it is the same as any other declaration of libltdl's
130 dnl location! This also ensures lt_ltdl_dir is set when configure.ac is
131 dnl not yet using an explicit LT_CONFIG_LTDL_DIR.
132 m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl
133 _$0()
134 ])# LTDL_INSTALLABLE
135
136 # AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools,
137 # now we have LT_CONFIG_LTDL_DIR:
138 AU_DEFUN([AC_LIBLTDL_INSTALLABLE],
139 [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])])
140 _LTDL_INSTALLABLE])
141
142 dnl aclocal-1.4 backwards compatibility:
143 dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [])
144
145
146 # _LTDL_INSTALLABLE
147 # -----------------
148 # Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]).
149 m4_defun([_LTDL_INSTALLABLE],
150 [if test -f "$prefix/lib/libltdl.la"; then
151 lt_save_LDFLAGS=$LDFLAGS
152 LDFLAGS="-L$prefix/lib $LDFLAGS"
153 AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes])
154 LDFLAGS=$lt_save_LDFLAGS
155 if test yes = "${lt_lib_ltdl-no}"; then
156 if test yes != "$enable_ltdl_install"; then
157 # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install
158 AC_MSG_WARN([not overwriting libltdl at $prefix, force with '--enable-ltdl-install'])
159 enable_ltdl_install=no
160 fi
161 elif test no = "$enable_ltdl_install"; then
162 AC_MSG_WARN([libltdl not installed, but installation disabled])
163 fi
164 fi
165
166 # If configure.ac declared an installable ltdl, and the user didn't override
167 # with --disable-ltdl-install, we will install the shipped libltdl.
168 case $enable_ltdl_install in
169 no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
170 LIBLTDL=-lltdl
171 LTDLDEPS=
172 LTDLINCL=
173 ;;
174 *) enable_ltdl_install=yes
175 ac_configure_args="$ac_configure_args --enable-ltdl-install"
176 LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la"
177 LTDLDEPS=$LIBLTDL
178 LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}"
179 ;;
180 esac
181
182 AC_SUBST([LIBLTDL])
183 AC_SUBST([LTDLDEPS])
184 AC_SUBST([LTDLINCL])
185
186 # For backwards non-gettext consistent compatibility...
187 INCLTDL=$LTDLINCL
188 AC_SUBST([INCLTDL])
189 ])# LTDL_INSTALLABLE
190
191
192 # _LTDL_MODE_DISPATCH
193 # -------------------
194 m4_define([_LTDL_MODE_DISPATCH],
195 [dnl If _LTDL_DIR is '.', then we are configuring libltdl itself:
196 m4_if(_LTDL_DIR, [],
197 [],
198 dnl if _LTDL_MODE was not set already, the default value is 'subproject':
199 [m4_case(m4_default(_LTDL_MODE, [subproject]),
200 [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR)
201 _LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir])],
202 [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir; lt_libobj_prefix=$lt_ltdl_dir/])],
203 [recursive], [],
204 [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl
205 dnl Be careful not to expand twice:
206 m4_define([$0], [])
207 ])# _LTDL_MODE_DISPATCH
208
209
210 # _LT_LIBOBJ(MODULE_NAME)
211 # -----------------------
212 # Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead
213 # of into LIBOBJS.
214 AC_DEFUN([_LT_LIBOBJ], [
215 m4_pattern_allow([^_LT_LIBOBJS$])
216 _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext"
217 ])# _LT_LIBOBJS
218
219
220 # LTDL_INIT([OPTIONS])
221 # --------------------
222 # Clients of libltdl can use this macro to allow the installer to
223 # choose between a shipped copy of the ltdl sources or a preinstalled
224 # version of the library. If the shipped ltdl sources are not in a
225 # subdirectory named libltdl, the directory name must be given by
226 # LT_CONFIG_LTDL_DIR.
227 AC_DEFUN([LTDL_INIT],
228 [dnl Parse OPTIONS
229 _LT_SET_OPTIONS([$0], [$1])
230
231 dnl We need to keep our own list of libobjs separate from our parent project,
232 dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while
233 dnl we look for our own LIBOBJs.
234 m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ]))
235 m4_pushdef([AC_LIBSOURCES])
236
237 dnl If not otherwise defined, default to the 1.5.x compatible subproject mode:
238 m4_if(_LTDL_MODE, [],
239 [m4_define([_LTDL_MODE], m4_default([$2], [subproject]))
240 m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])],
241 [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])
242
243 AC_ARG_WITH([included_ltdl],
244 [AS_HELP_STRING([--with-included-ltdl],
245 [use the GNU ltdl sources included here])])
246
247 if test yes != "$with_included_ltdl"; then
248 # We are not being forced to use the included libltdl sources, so
249 # decide whether there is a useful installed version we can use.
250 AC_CHECK_HEADER([ltdl.h],
251 [AC_CHECK_DECL([lt_dlinterface_register],
252 [AC_CHECK_LIB([ltdl], [lt_dladvise_preload],
253 [with_included_ltdl=no],
254 [with_included_ltdl=yes])],
255 [with_included_ltdl=yes],
256 [AC_INCLUDES_DEFAULT
257 #include <ltdl.h>])],
258 [with_included_ltdl=yes],
259 [AC_INCLUDES_DEFAULT]
260 )
261 fi
262
263 dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE
264 dnl was called yet, then for old times' sake, we assume libltdl is in an
265 dnl eponymous directory:
266 AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])])
267
268 AC_ARG_WITH([ltdl_include],
269 [AS_HELP_STRING([--with-ltdl-include=DIR],
270 [use the ltdl headers installed in DIR])])
271
272 if test -n "$with_ltdl_include"; then
273 if test -f "$with_ltdl_include/ltdl.h"; then :
274 else
275 AC_MSG_ERROR([invalid ltdl include directory: '$with_ltdl_include'])
276 fi
277 else
278 with_ltdl_include=no
279 fi
280
281 AC_ARG_WITH([ltdl_lib],
282 [AS_HELP_STRING([--with-ltdl-lib=DIR],
283 [use the libltdl.la installed in DIR])])
284
285 if test -n "$with_ltdl_lib"; then
286 if test -f "$with_ltdl_lib/libltdl.la"; then :
287 else
288 AC_MSG_ERROR([invalid ltdl library directory: '$with_ltdl_lib'])
289 fi
290 else
291 with_ltdl_lib=no
292 fi
293
294 case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in
295 ,yes,no,no,)
296 m4_case(m4_default(_LTDL_TYPE, [convenience]),
297 [convenience], [_LTDL_CONVENIENCE],
298 [installable], [_LTDL_INSTALLABLE],
299 [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)])
300 ;;
301 ,no,no,no,)
302 # If the included ltdl is not to be used, then use the
303 # preinstalled libltdl we found.
304 AC_DEFINE([HAVE_LTDL], [1],
305 [Define this if a modern libltdl is already installed])
306 LIBLTDL=-lltdl
307 LTDLDEPS=
308 LTDLINCL=
309 ;;
310 ,no*,no,*)
311 AC_MSG_ERROR(['--with-ltdl-include' and '--with-ltdl-lib' options must be used together])
312 ;;
313 *) with_included_ltdl=no
314 LIBLTDL="-L$with_ltdl_lib -lltdl"
315 LTDLDEPS=
316 LTDLINCL=-I$with_ltdl_include
317 ;;
318 esac
319 INCLTDL=$LTDLINCL
320
321 # Report our decision...
322 AC_MSG_CHECKING([where to find libltdl headers])
323 AC_MSG_RESULT([$LTDLINCL])
324 AC_MSG_CHECKING([where to find libltdl library])
325 AC_MSG_RESULT([$LIBLTDL])
326
327 _LTDL_SETUP
328
329 dnl restore autoconf definition.
330 m4_popdef([AC_LIBOBJ])
331 m4_popdef([AC_LIBSOURCES])
332
333 AC_CONFIG_COMMANDS_PRE([
334 _ltdl_libobjs=
335 _ltdl_ltlibobjs=
336 if test -n "$_LT_LIBOBJS"; then
337 # Remove the extension.
338 _lt_sed_drop_objext='s/\.o$//;s/\.obj$//'
339 for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | $SED "$_lt_sed_drop_objext" | sort -u`; do
340 _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext"
341 _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo"
342 done
343 fi
344 AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs])
345 AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs])
346 ])
347
348 # Only expand once:
349 m4_define([LTDL_INIT])
350 ])# LTDL_INIT
351
352 # Old names:
353 AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)])
354 AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)])
355 AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)])
356 dnl aclocal-1.4 backwards compatibility:
357 dnl AC_DEFUN([AC_LIB_LTDL], [])
358 dnl AC_DEFUN([AC_WITH_LTDL], [])
359 dnl AC_DEFUN([LT_WITH_LTDL], [])
360
361
362 # _LTDL_SETUP
363 # -----------
364 # Perform all the checks necessary for compilation of the ltdl objects
365 # -- including compiler checks and header checks. This is a public
366 # interface mainly for the benefit of libltdl's own configure.ac, most
367 # other users should call LTDL_INIT instead.
368 AC_DEFUN([_LTDL_SETUP],
369 [AC_REQUIRE([AC_PROG_CC])dnl
370 AC_REQUIRE([LT_SYS_MODULE_EXT])dnl
371 AC_REQUIRE([LT_SYS_MODULE_PATH])dnl
372 AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl
373 AC_REQUIRE([LT_LIB_DLLOAD])dnl
374 AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl
375 AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl
376 AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl
377 AC_REQUIRE([LT_FUNC_ARGZ])dnl
378
379 m4_require([_LT_CHECK_OBJDIR])dnl
380 m4_require([_LT_HEADER_DLFCN])dnl
381 m4_require([_LT_CHECK_DLPREOPEN])dnl
382 m4_require([_LT_DECL_SED])dnl
383
384 dnl Don't require this, or it will be expanded earlier than the code
385 dnl that sets the variables it relies on:
386 _LT_ENABLE_INSTALL
387
388 dnl _LTDL_MODE specific code must be called at least once:
389 _LTDL_MODE_DISPATCH
390
391 # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS
392 # the user used. This is so that ltdl.h can pick up the parent projects
393 # config.h file, The first file in AC_CONFIG_HEADERS must contain the
394 # definitions required by ltdl.c.
395 # FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility).
396 AC_CONFIG_COMMANDS_PRE([dnl
397 m4_pattern_allow([^LT_CONFIG_H$])dnl
398 m4_ifset([AH_HEADER],
399 [LT_CONFIG_H=AH_HEADER],
400 [m4_ifset([AC_LIST_HEADERS],
401 [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's|^[[ ]]*||;s|[[ :]].*$||'`],
402 [])])])
403 AC_SUBST([LT_CONFIG_H])
404
405 AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h],
406 [], [], [AC_INCLUDES_DEFAULT])
407
408 AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
409 AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
410
411 m4_pattern_allow([LT_LIBEXT])dnl
412 AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
413
414 name=
415 eval "lt_libprefix=\"$libname_spec\""
416 m4_pattern_allow([LT_LIBPREFIX])dnl
417 AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix])
418
419 name=ltdl
420 eval "LTDLOPEN=\"$libname_spec\""
421 AC_SUBST([LTDLOPEN])
422 ])# _LTDL_SETUP
423
424
425 # _LT_ENABLE_INSTALL
426 # ------------------
427 m4_define([_LT_ENABLE_INSTALL],
428 [AC_ARG_ENABLE([ltdl-install],
429 [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])])
430
431 case ,$enable_ltdl_install,$enable_ltdl_convenience in
432 *yes*) ;;
433 *) enable_ltdl_convenience=yes ;;
434 esac
435
436 m4_ifdef([AM_CONDITIONAL],
437 [AM_CONDITIONAL(INSTALL_LTDL, test no != "${enable_ltdl_install-no}")
438 AM_CONDITIONAL(CONVENIENCE_LTDL, test no != "${enable_ltdl_convenience-no}")
439 AM_CONDITIONAL(LTARGZH_EXISTS, test -n "$LT_ARGZ_H")])
440 ])# _LT_ENABLE_INSTALL
441
442
443 # LT_SYS_DLOPEN_DEPLIBS
444 # ---------------------
445 AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS],
446 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
447 AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
448 [lt_cv_sys_dlopen_deplibs],
449 [# PORTME does your system automatically load deplibs for dlopen?
450 # or its logical equivalent (e.g. shl_load for HP-UX < 11)
451 # For now, we just catch OSes we know something about -- in the
452 # future, we'll try test this programmatically.
453 lt_cv_sys_dlopen_deplibs=unknown
454 case $host_os in
455 aix3*|aix4.1.*|aix4.2.*)
456 # Unknown whether this is true for these versions of AIX, but
457 # we want this 'case' here to explicitly catch those versions.
458 lt_cv_sys_dlopen_deplibs=unknown
459 ;;
460 aix[[4-9]]*)
461 lt_cv_sys_dlopen_deplibs=yes
462 ;;
463 amigaos*)
464 case $host_cpu in
465 powerpc)
466 lt_cv_sys_dlopen_deplibs=no
467 ;;
468 esac
469 ;;
470 darwin*)
471 # Assuming the user has installed a libdl from somewhere, this is true
472 # If you are looking for one http://www.opendarwin.org/projects/dlcompat
473 lt_cv_sys_dlopen_deplibs=yes
474 ;;
475 freebsd* | dragonfly* | midnightbsd*)
476 lt_cv_sys_dlopen_deplibs=yes
477 ;;
478 gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu)
479 # GNU and its variants, using gnu ld.so (Glibc)
480 lt_cv_sys_dlopen_deplibs=yes
481 ;;
482 hpux10*|hpux11*)
483 lt_cv_sys_dlopen_deplibs=yes
484 ;;
485 interix*)
486 lt_cv_sys_dlopen_deplibs=yes
487 ;;
488 irix[[12345]]*|irix6.[[01]]*)
489 # Catch all versions of IRIX before 6.2, and indicate that we don't
490 # know how it worked for any of those versions.
491 lt_cv_sys_dlopen_deplibs=unknown
492 ;;
493 irix*)
494 # The case above catches anything before 6.2, and it's known that
495 # at 6.2 and later dlopen does load deplibs.
496 lt_cv_sys_dlopen_deplibs=yes
497 ;;
498 *-mlibc)
499 lt_cv_sys_dlopen_deplibs=yes
500 ;;
501 netbsd* | netbsdelf*-gnu)
502 lt_cv_sys_dlopen_deplibs=yes
503 ;;
504 openbsd*)
505 lt_cv_sys_dlopen_deplibs=yes
506 ;;
507 osf[[1234]]*)
508 # dlopen did load deplibs (at least at 4.x), but until the 5.x series,
509 # it did *not* use an RPATH in a shared library to find objects the
510 # library depends on, so we explicitly say 'no'.
511 lt_cv_sys_dlopen_deplibs=no
512 ;;
513 osf5.0|osf5.0a|osf5.1)
514 # dlopen *does* load deplibs and with the right loader patch applied
515 # it even uses RPATH in a shared library to search for shared objects
516 # that the library depends on, but there's no easy way to know if that
517 # patch is installed. Since this is the case, all we can really
518 # say is unknown -- it depends on the patch being installed. If
519 # it is, this changes to 'yes'. Without it, it would be 'no'.
520 lt_cv_sys_dlopen_deplibs=unknown
521 ;;
522 osf*)
523 # the two cases above should catch all versions of osf <= 5.1. Read
524 # the comments above for what we know about them.
525 # At > 5.1, deplibs are loaded *and* any RPATH in a shared library
526 # is used to find them so we can finally say 'yes'.
527 lt_cv_sys_dlopen_deplibs=yes
528 ;;
529 qnx*)
530 lt_cv_sys_dlopen_deplibs=yes
531 ;;
532 solaris*)
533 lt_cv_sys_dlopen_deplibs=yes
534 ;;
535 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
536 libltdl_cv_sys_dlopen_deplibs=yes
537 ;;
538 esac
539 ])
540 if test yes != "$lt_cv_sys_dlopen_deplibs"; then
541 AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1],
542 [Define if the OS needs help to load dependent libraries for dlopen().])
543 fi
544 ])# LT_SYS_DLOPEN_DEPLIBS
545
546 # Old name:
547 AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS])
548 dnl aclocal-1.4 backwards compatibility:
549 dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], [])
550
551
552 # LT_SYS_MODULE_EXT
553 # -----------------
554 AC_DEFUN([LT_SYS_MODULE_EXT],
555 [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
556 AC_CACHE_CHECK([what extension is used for runtime loadable modules],
557 [libltdl_cv_shlibext],
558 [
559 module=yes
560 eval libltdl_cv_shlibext=$shrext_cmds
561 module=no
562 eval libltdl_cv_shrext=$shrext_cmds
563 ])
564 if test -n "$libltdl_cv_shlibext"; then
565 m4_pattern_allow([LT_MODULE_EXT])dnl
566 AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"],
567 [Define to the extension used for runtime loadable modules, say, ".so".])
568 fi
569 if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then
570 m4_pattern_allow([LT_SHARED_EXT])dnl
571 AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"],
572 [Define to the shared library suffix, say, ".dylib".])
573 fi
574 if test -n "$shared_archive_member_spec"; then
575 m4_pattern_allow([LT_SHARED_LIB_MEMBER])dnl
576 AC_DEFINE_UNQUOTED([LT_SHARED_LIB_MEMBER], ["($shared_archive_member_spec.o)"],
577 [Define to the shared archive member specification, say "(shr.o)".])
578 fi
579 ])# LT_SYS_MODULE_EXT
580
581 # Old name:
582 AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT])
583 dnl aclocal-1.4 backwards compatibility:
584 dnl AC_DEFUN([AC_LTDL_SHLIBEXT], [])
585
586
587 # LT_SYS_MODULE_PATH
588 # ------------------
589 AC_DEFUN([LT_SYS_MODULE_PATH],
590 [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
591 AC_CACHE_CHECK([what variable specifies run-time module search path],
592 [lt_cv_module_path_var], [lt_cv_module_path_var=$shlibpath_var])
593 if test -n "$lt_cv_module_path_var"; then
594 m4_pattern_allow([LT_MODULE_PATH_VAR])dnl
595 AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"],
596 [Define to the name of the environment variable that determines the run-time module search path.])
597 fi
598 ])# LT_SYS_MODULE_PATH
599
600 # Old name:
601 AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH])
602 dnl aclocal-1.4 backwards compatibility:
603 dnl AC_DEFUN([AC_LTDL_SHLIBPATH], [])
604
605
606 # LT_SYS_DLSEARCH_PATH
607 # --------------------
608 AC_DEFUN([LT_SYS_DLSEARCH_PATH],
609 [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
610 AC_CACHE_CHECK([for the default library search path],
611 [lt_cv_sys_dlsearch_path],
612 [lt_cv_sys_dlsearch_path=$sys_lib_dlsearch_path_spec])
613 if test -n "$lt_cv_sys_dlsearch_path"; then
614 sys_dlsearch_path=
615 for dir in $lt_cv_sys_dlsearch_path; do
616 if test -z "$sys_dlsearch_path"; then
617 sys_dlsearch_path=$dir
618 else
619 sys_dlsearch_path=$sys_dlsearch_path$PATH_SEPARATOR$dir
620 fi
621 done
622 m4_pattern_allow([LT_DLSEARCH_PATH])dnl
623 AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"],
624 [Define to the system default library search path.])
625 fi
626 ])# LT_SYS_DLSEARCH_PATH
627
628 # Old name:
629 AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH])
630 dnl aclocal-1.4 backwards compatibility:
631 dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], [])
632
633
634 # _LT_CHECK_DLPREOPEN
635 # -------------------
636 m4_defun([_LT_CHECK_DLPREOPEN],
637 [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
638 AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
639 [libltdl_cv_preloaded_symbols],
640 [if test -n "$lt_cv_sys_global_symbol_pipe"; then
641 libltdl_cv_preloaded_symbols=yes
642 else
643 libltdl_cv_preloaded_symbols=no
644 fi
645 ])
646 if test yes = "$libltdl_cv_preloaded_symbols"; then
647 AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1],
648 [Define if libtool can extract symbol lists from object files.])
649 fi
650 ])# _LT_CHECK_DLPREOPEN
651
652
653 # LT_LIB_DLLOAD
654 # -------------
655 AC_DEFUN([LT_LIB_DLLOAD],
656 [m4_pattern_allow([^LT_DLLOADERS$])
657 LT_DLLOADERS=
658 AC_SUBST([LT_DLLOADERS])
659
660 AC_LANG_PUSH([C])
661 lt_dlload_save_LIBS=$LIBS
662
663 LIBADD_DLOPEN=
664 AC_SEARCH_LIBS([dlopen], [dl],
665 [AC_DEFINE([HAVE_LIBDL], [1],
666 [Define if you have the libdl library or equivalent.])
667 if test "$ac_cv_search_dlopen" != "none required"; then
668 LIBADD_DLOPEN=-ldl
669 fi
670 libltdl_cv_lib_dl_dlopen=yes
671 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"],
672 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H
673 # include <dlfcn.h>
674 #endif
675 ]], [[dlopen(0, 0);]])],
676 [AC_DEFINE([HAVE_LIBDL], [1],
677 [Define if you have the libdl library or equivalent.])
678 libltdl_cv_func_dlopen=yes
679 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"],
680 [AC_CHECK_LIB([svld], [dlopen],
681 [AC_DEFINE([HAVE_LIBDL], [1],
682 [Define if you have the libdl library or equivalent.])
683 LIBADD_DLOPEN=-lsvld libltdl_cv_func_dlopen=yes
684 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])])
685 if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen"
686 then
687 lt_save_LIBS=$LIBS
688 LIBS="$LIBS $LIBADD_DLOPEN"
689 AC_CHECK_FUNCS([dlerror])
690 LIBS=$lt_save_LIBS
691 fi
692 AC_SUBST([LIBADD_DLOPEN])
693
694 LIBADD_SHL_LOAD=
695 AC_CHECK_FUNC([shl_load],
696 [AC_DEFINE([HAVE_SHL_LOAD], [1],
697 [Define if you have the shl_load function.])
698 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"],
699 [AC_CHECK_LIB([dld], [shl_load],
700 [AC_DEFINE([HAVE_SHL_LOAD], [1],
701 [Define if you have the shl_load function.])
702 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"
703 LIBADD_SHL_LOAD=-ldld])])
704 AC_SUBST([LIBADD_SHL_LOAD])
705
706 case $host_os in
707 darwin[[1567]].*)
708 # We only want this for pre-Mac OS X 10.4.
709 AC_CHECK_FUNC([_dyld_func_lookup],
710 [AC_DEFINE([HAVE_DYLD], [1],
711 [Define if you have the _dyld_func_lookup function.])
712 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"])
713 ;;
714 beos*)
715 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la"
716 ;;
717 cygwin* | mingw* | windows* | pw32*)
718 AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include <sys/cygwin.h>]])
719 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la"
720 ;;
721 esac
722
723 AC_CHECK_LIB([dld], [dld_link],
724 [AC_DEFINE([HAVE_DLD], [1],
725 [Define if you have the GNU dld library.])
726 LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"])
727 AC_SUBST([LIBADD_DLD_LINK])
728
729 m4_pattern_allow([^LT_DLPREOPEN$])
730 LT_DLPREOPEN=
731 if test -n "$LT_DLLOADERS"
732 then
733 for lt_loader in $LT_DLLOADERS; do
734 LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader "
735 done
736 AC_DEFINE([HAVE_LIBDLLOADER], [1],
737 [Define if libdlloader will be built on this platform])
738 fi
739 AC_SUBST([LT_DLPREOPEN])
740
741 dnl This isn't used anymore, but set it for backwards compatibility
742 LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD"
743 AC_SUBST([LIBADD_DL])
744
745 LIBS=$lt_dlload_save_LIBS
746 AC_LANG_POP
747 ])# LT_LIB_DLLOAD
748
749 # Old name:
750 AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD])
751 dnl aclocal-1.4 backwards compatibility:
752 dnl AC_DEFUN([AC_LTDL_DLLIB], [])
753
754
755 # LT_SYS_SYMBOL_USCORE
756 # --------------------
757 # does the compiler prefix global symbols with an underscore?
758 AC_DEFUN([LT_SYS_SYMBOL_USCORE],
759 [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
760 AC_CACHE_CHECK([for _ prefix in compiled symbols],
761 [lt_cv_sys_symbol_underscore],
762 [lt_cv_sys_symbol_underscore=no
763 cat > conftest.$ac_ext <<_LT_EOF
764 void nm_test_func(){}
765 int main(void){nm_test_func;return 0;}
766 _LT_EOF
767 if AC_TRY_EVAL(ac_compile); then
768 # Now try to grab the symbols.
769 ac_nlist=conftest.nm
770 if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
771 # See whether the symbols have a leading underscore.
772 if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
773 lt_cv_sys_symbol_underscore=yes
774 else
775 if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
776 :
777 else
778 echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD
779 fi
780 fi
781 else
782 echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
783 fi
784 else
785 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
786 cat conftest.c >&AS_MESSAGE_LOG_FD
787 fi
788 rm -rf conftest*
789 ])
790 sys_symbol_underscore=$lt_cv_sys_symbol_underscore
791 AC_SUBST([sys_symbol_underscore])
792 ])# LT_SYS_SYMBOL_USCORE
793
794 # Old name:
795 AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE])
796 dnl aclocal-1.4 backwards compatibility:
797 dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], [])
798
799
800 # LT_FUNC_DLSYM_USCORE
801 # --------------------
802 AC_DEFUN([LT_FUNC_DLSYM_USCORE],
803 [AC_REQUIRE([_LT_COMPILER_PIC])dnl for lt_prog_compiler_wl
804 AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl for lt_cv_sys_symbol_underscore
805 AC_REQUIRE([LT_SYS_MODULE_EXT])dnl for libltdl_cv_shlibext
806 if test yes = "$lt_cv_sys_symbol_underscore"; then
807 if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen"; then
808 AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
809 [libltdl_cv_need_uscore],
810 [libltdl_cv_need_uscore=unknown
811 dlsym_uscore_save_LIBS=$LIBS
812 LIBS="$LIBS $LIBADD_DLOPEN"
813 libname=conftmod # stay within 8.3 filename limits!
814 cat >$libname.$ac_ext <<_LT_EOF
815 [#line $LINENO "configure"
816 #include "confdefs.h"
817 /* When -fvisibility=hidden is used, assume the code has been annotated
818 correspondingly for the symbols needed. */
819 #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
820 int fnord () __attribute__((visibility("default")));
821 #endif
822 int fnord () { return 42; }]
823 _LT_EOF
824
825 # ltfn_module_cmds module_cmds
826 # Execute tilde-delimited MODULE_CMDS with environment primed for
827 # $module_cmds or $archive_cmds type content.
828 ltfn_module_cmds ()
829 {( # subshell avoids polluting parent global environment
830 module_cmds_save_ifs=$IFS; IFS='~'
831 for cmd in @S|@1; do
832 IFS=$module_cmds_save_ifs
833 libobjs=$libname.$ac_objext; lib=$libname$libltdl_cv_shlibext
834 rpath=/not-exists; soname=$libname$libltdl_cv_shlibext; output_objdir=.
835 major=; versuffix=; verstring=; deplibs=
836 ECHO=echo; wl=$lt_prog_compiler_wl; allow_undefined_flag=
837 eval $cmd
838 done
839 IFS=$module_cmds_save_ifs
840 )}
841
842 # Compile a loadable module using libtool macro expansion results.
843 $CC $pic_flag -c $libname.$ac_ext
844 ltfn_module_cmds "${module_cmds:-$archive_cmds}"
845
846 # Try to fetch fnord with dlsym().
847 libltdl_dlunknown=0; libltdl_dlnouscore=1; libltdl_dluscore=2
848 cat >conftest.$ac_ext <<_LT_EOF
849 [#line $LINENO "configure"
850 #include "confdefs.h"
851 #if HAVE_DLFCN_H
852 #include <dlfcn.h>
853 #endif
854 #include <stdio.h>
855 #ifndef RTLD_GLOBAL
856 # ifdef DL_GLOBAL
857 # define RTLD_GLOBAL DL_GLOBAL
858 # else
859 # define RTLD_GLOBAL 0
860 # endif
861 #endif
862 #ifndef RTLD_NOW
863 # ifdef DL_NOW
864 # define RTLD_NOW DL_NOW
865 # else
866 # define RTLD_NOW 0
867 # endif
868 #endif
869 int main (void) {
870 void *handle = dlopen ("`pwd`/$libname$libltdl_cv_shlibext", RTLD_GLOBAL|RTLD_NOW);
871 int status = $libltdl_dlunknown;
872 if (handle) {
873 if (dlsym (handle, "fnord"))
874 status = $libltdl_dlnouscore;
875 else {
876 if (dlsym (handle, "_fnord"))
877 status = $libltdl_dluscore;
878 else
879 puts (dlerror ());
880 }
881 dlclose (handle);
882 } else
883 puts (dlerror ());
884 return status;
885 }]
886 _LT_EOF
887 if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then
888 (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
889 libltdl_status=$?
890 case x$libltdl_status in
891 x$libltdl_dlnouscore) libltdl_cv_need_uscore=no ;;
892 x$libltdl_dluscore) libltdl_cv_need_uscore=yes ;;
893 x*) libltdl_cv_need_uscore=unknown ;;
894 esac
895 fi
896 rm -rf conftest* $libname*
897 LIBS=$dlsym_uscore_save_LIBS
898 ])
899 fi
900 fi
901
902 if test yes = "$libltdl_cv_need_uscore"; then
903 AC_DEFINE([NEED_USCORE], [1],
904 [Define if dlsym() requires a leading underscore in symbol names.])
905 fi
906 ])# LT_FUNC_DLSYM_USCORE
907
908 # Old name:
909 AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE])
910 dnl aclocal-1.4 backwards compatibility:
911 dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])