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