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