1
## ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
2
## Copyright (C) 1999-2004 Free Software Foundation, Inc.
4
## This program is free software; you can redistribute it and/or modify
5
## it under the terms of the GNU General Public License as published by
6
## the Free Software Foundation; either version 2 of the License, or
7
## (at your option) any later version.
9
## This program is distributed in the hope that it will be useful, but
10
## WITHOUT ANY WARRANTY; without even the implied warranty of
11
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
## General Public License for more details.
14
## You should have received a copy of the GNU General Public License
15
## along with this program; if not, write to the Free Software
16
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
## As a special exception to the GNU General Public License, if you
19
## distribute this file as part of a program that contains a
20
## configuration script generated by Autoconf, you may include it under
21
## the same distribution terms that you use for the rest of that program.
23
# serial 6 AC_LIB_LTDL
25
# AC_WITH_LTDL([DIRECTORY])
26
# -------------------------
27
# Clients of libltdl can use this macro to allow the installer to
28
# choose between a shipped copy of the ltdl sources or a preinstalled
29
# version of the library.
30
AC_DEFUN([AC_WITH_LTDL],
31
[AC_ARG_WITH([included_ltdl],
32
[AC_HELP_STRING([--with-included-ltdl],
33
[use the GNU ltdl sources included here])])
35
if test "x$with_included_ltdl" != xyes; then
36
# We are not being forced to use the included libltdl sources, so
37
# decide whether there is a useful installed version we can use.
38
AC_CHECK_HEADER([ltdl.h],
39
[AC_CHECK_LIB([ltdl], [lt_dlcaller_register],
40
[with_included_ltdl=no],
41
[with_included_ltdl=yes])],
48
if test "x$enable_ltdl_install" != xyes; then
49
# If the user did not specify an installable libltdl, then default
50
# to a convenience lib.
51
AC_LIBLTDL_CONVENIENCE
54
if test "x$with_included_ltdl" = xno; then
55
# If the included ltdl is not to be used. then Use the
56
# preinstalled libltdl we found.
57
AC_DEFINE([HAVE_LTDL], 1,
58
[Define this if a modern libltdl is already installed])
62
# Report our decision...
63
AC_MSG_CHECKING([whether to use included libltdl])
64
AC_MSG_RESULT([$with_included_ltdl])
66
AC_CONFIG_SUBDIRS(m4_if($#, 1, [$1], [libltdl]))
70
# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
71
# -----------------------------------
72
# sets LIBLTDL to the link flags for the libltdl convenience library and
73
# LTDLINCL to the include flags for the libltdl header and adds
74
# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL
75
# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If
76
# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will
77
# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with
78
# '${top_srcdir}/' (note the single quotes!). If your package is not
79
# flat and you're not using automake, define top_builddir and
80
# top_srcdir appropriately in the Makefiles.
81
AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
82
[case $enable_ltdl_convenience in
83
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
84
"") enable_ltdl_convenience=yes
85
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
87
LIBLTDL='${top_builddir}/'m4_if($#, 1, [$1], ['libltdl'])/libltdlc.la
88
LTDLINCL='-I${top_srcdir}/'m4_if($#, 1, [$1], ['libltdl'])
93
# For backwards non-gettext consistent compatibility...
96
])# AC_LIBLTDL_CONVENIENCE
99
# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
100
# -----------------------------------
101
# sets LIBLTDL to the link flags for the libltdl installable library and
102
# LTDLINCL to the include flags for the libltdl header and adds
103
# --enable-ltdl-install to the configure arguments. Note that LIBLTDL
104
# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If
105
# DIRECTORY is not provided and an installed libltdl is not found, it is
106
# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/'
107
# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single
108
# quotes!). If your package is not flat and you're not using automake,
109
# define top_builddir and top_srcdir appropriately in the Makefiles.
110
# In the future, this macro may have to be called after LT_INIT.
111
AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
112
[AC_CHECK_LIB(ltdl, lt_dlinit,
113
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
114
[if test x"$enable_ltdl_install" = xno; then
115
AC_MSG_WARN([libltdl not installed, but installation disabled])
117
enable_ltdl_install=yes
120
if test x"$enable_ltdl_install" = x"yes"; then
121
ac_configure_args="$ac_configure_args --enable-ltdl-install"
122
LIBLTDL='${top_builddir}/'m4_if($#, 1, [$1], ['libltdl'])/libltdl.la
123
LTDLINCL='-I${top_srcdir}/'m4_if($#, 1, [$1], ['libltdl'])
125
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
133
# For backwards non-gettext consistent compatibility...
136
])# AC_LIBLTDL_INSTALLABLE
141
# Perform all the checks necessary for compilation of the ltdl objects
142
# -- including compiler checks and header checks.
143
AC_DEFUN([AC_LIB_LTDL],
144
[AC_REQUIRE([AC_PROG_CC])
145
AC_REQUIRE([AC_C_CONST])
146
AC_REQUIRE([AC_HEADER_STDC])
147
AC_REQUIRE([AC_HEADER_DIRENT])
148
AC_REQUIRE([_LT_AC_CHECK_DLFCN])
149
AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])
150
AC_REQUIRE([AC_LTDL_SHLIBEXT])
151
AC_REQUIRE([AC_LTDL_SHLIBPATH])
152
AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])
153
AC_REQUIRE([AC_LTDL_OBJDIR])
154
AC_REQUIRE([AC_LTDL_DLPREOPEN])
155
AC_REQUIRE([AC_LTDL_DLLIB])
156
AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
157
AC_REQUIRE([AC_LTDL_DLSYM_USCORE])
158
AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])
159
AC_REQUIRE([gl_FUNC_ARGZ])
161
# In order that ltdl.c can compile, run AC_CONFIG_HEADERS for the user
162
# if they did not call it themself. This is so that ltdl.h can pick up
163
# the parent projects config.h file, The first file in AC_CONFIG_HEADERS
164
# must contain the definitions required by ltdl.c.
165
m4_ifset([AC_LIST_HEADERS],
166
[CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`],
167
[CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])])
170
AC_CHECK_HEADERS([memory.h unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h],
171
[], [], [AC_INCLUDES_DEFAULT])
172
AC_CHECK_HEADERS([string.h strings.h], [break], [], [AC_INCLUDES_DEFAULT])
174
AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
178
# AC_LTDL_ENABLE_INSTALL
179
# ----------------------
180
AC_DEFUN([AC_LTDL_ENABLE_INSTALL],
181
[AC_ARG_ENABLE([ltdl-install],
182
[AC_HELP_STRING([--enable-ltdl-install], [install libltdl])])
184
AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
185
AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
186
])])# AC_LTDL_ENABLE_INSTALL
189
# AC_LTDL_SYS_DLOPEN_DEPLIBS
190
# --------------------------
191
AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS],
192
[AC_REQUIRE([AC_CANONICAL_HOST])
193
AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
194
[libltdl_cv_sys_dlopen_deplibs],
195
[# PORTME does your system automatically load deplibs for dlopen?
196
# or its logical equivalent (e.g. shl_load for HP-UX < 11)
197
# For now, we just catch OSes we know something about -- in the
198
# future, we'll try test this programmatically.
199
libltdl_cv_sys_dlopen_deplibs=unknown
201
aix3*|aix4.1.*|aix4.2.*)
202
# Unknown whether this is true for these versions of AIX, but
203
# we want this `case' here to explicitly catch those versions.
204
libltdl_cv_sys_dlopen_deplibs=unknown
207
libltdl_cv_sys_dlopen_deplibs=yes
210
# Assuming the user has installed a libdl from somewhere, this is true
211
# If you are looking for one http://www.opendarwin.org/projects/dlcompat
212
libltdl_cv_sys_dlopen_deplibs=yes
214
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
215
# GNU and its variants, using gnu ld.so (Glibc)
216
libltdl_cv_sys_dlopen_deplibs=yes
219
libltdl_cv_sys_dlopen_deplibs=yes
221
irix[[12345]]*|irix6.[[01]]*)
222
# Catch all versions of IRIX before 6.2, and indicate that we don't
223
# know how it worked for any of those versions.
224
libltdl_cv_sys_dlopen_deplibs=unknown
227
# The case above catches anything before 6.2, and it's known that
228
# at 6.2 and later dlopen does load deplibs.
229
libltdl_cv_sys_dlopen_deplibs=yes
232
libltdl_cv_sys_dlopen_deplibs=yes
235
libltdl_cv_sys_dlopen_deplibs=yes
238
# dlopen did load deplibs (at least at 4.x), but until the 5.x series,
239
# it did *not* use an RPATH in a shared library to find objects the
240
# library depends on, so we explictly say `no'.
241
libltdl_cv_sys_dlopen_deplibs=no
243
osf5.0|osf5.0a|osf5.1)
244
# dlopen *does* load deplibs and with the right loader patch applied
245
# it even uses RPATH in a shared library to search for shared objects
246
# that the library depends on, but there's no easy way to know if that
247
# patch is installed. Since this is the case, all we can really
248
# say is unknown -- it depends on the patch being installed. If
249
# it is, this changes to `yes'. Without it, it would be `no'.
250
libltdl_cv_sys_dlopen_deplibs=unknown
253
# the two cases above should catch all versions of osf <= 5.1. Read
254
# the comments above for what we know about them.
255
# At > 5.1, deplibs are loaded *and* any RPATH in a shared library
256
# is used to find them so we can finally say `yes'.
257
libltdl_cv_sys_dlopen_deplibs=yes
260
libltdl_cv_sys_dlopen_deplibs=yes
263
libltdl_cv_sys_dlopen_deplibs=yes
267
if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then
268
AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1],
269
[Define if the OS needs help to load dependent libraries for dlopen().])
271
])# AC_LTDL_SYS_DLOPEN_DEPLIBS
276
AC_DEFUN([AC_LTDL_SHLIBEXT],
277
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
278
AC_CACHE_CHECK([which extension is used for loadable modules],
279
[libltdl_cv_shlibext],
282
eval libltdl_cv_shlibext=$shrext_cmds
284
if test -n "$libltdl_cv_shlibext"; then
285
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
286
[Define to the extension used for shared libraries, say, ".so".])
293
AC_DEFUN([AC_LTDL_SHLIBPATH],
294
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
295
AC_CACHE_CHECK([which variable specifies run-time library path],
296
[libltdl_cv_shlibpath_var], [libltdl_cv_shlibpath_var="$shlibpath_var"])
297
if test -n "$libltdl_cv_shlibpath_var"; then
298
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
299
[Define to the name of the environment variable that determines the dynamic library search path.])
301
])# AC_LTDL_SHLIBPATH
304
# AC_LTDL_SYSSEARCHPATH
305
# ---------------------
306
AC_DEFUN([AC_LTDL_SYSSEARCHPATH],
307
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
308
AC_CACHE_CHECK([for the default library search path],
309
[libltdl_cv_sys_search_path],
310
[libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
311
if test -n "$libltdl_cv_sys_search_path"; then
313
for dir in $libltdl_cv_sys_search_path; do
314
if test -z "$sys_search_path"; then
315
sys_search_path="$dir"
317
sys_search_path="$sys_search_path$PATH_SEPARATOR$dir"
320
AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path",
321
[Define to the system default library search path.])
323
])# AC_LTDL_SYSSEARCHPATH
328
AC_DEFUN([AC_LTDL_OBJDIR],
329
[AC_CACHE_CHECK([for objdir],
331
[libltdl_cv_objdir="$objdir"
332
if test -n "$objdir"; then
335
rm -f .libs 2>/dev/null
336
mkdir .libs 2>/dev/null
337
if test -d .libs; then
338
libltdl_cv_objdir=.libs
340
# MS-DOS does not allow filenames that begin with a dot.
341
libltdl_cv_objdir=_libs
343
rmdir .libs 2>/dev/null
346
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
347
[Define to the sub-directory in which libtool stores uninstalled libraries.])
353
AC_DEFUN([AC_LTDL_DLPREOPEN],
354
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
355
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
356
[libltdl_cv_preloaded_symbols],
357
[if test -n "$lt_cv_sys_global_symbol_pipe"; then
358
libltdl_cv_preloaded_symbols=yes
360
libltdl_cv_preloaded_symbols=no
363
if test x"$libltdl_cv_preloaded_symbols" = xyes; then
364
AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
365
[Define if libtool can extract symbol lists from object files.])
367
])# AC_LTDL_DLPREOPEN
372
AC_DEFUN([AC_LTDL_DLLIB],
373
[m4_pattern_allow([^LT_DLLOADERS$])
375
AC_SUBST([LT_DLLOADERS])
380
AC_CHECK_LIB([dl], [dlopen],
381
[AC_DEFINE([HAVE_LIBDL], [1],
382
[Define if you have the libdl library or equivalent.])
383
LIBADD_DLOPEN="-ldl" libltdl_cv_lib_dl_dlopen="yes"
384
LT_DLLOADERS="$LT_DLLOADERS dlopen.la"],
385
[AC_TRY_LINK([#if HAVE_DLFCN_H
389
[AC_DEFINE([HAVE_LIBDL], [1],
390
[Define if you have the libdl library or equivalent.])
391
libltdl_cv_func_dlopen="yes"
392
LT_DLLOADERS="$LT_DLLOADERS dlopen.la"],
393
[AC_CHECK_LIB([svld], [dlopen],
394
[AC_DEFINE([HAVE_LIBDL], [1],
395
[Define if you have the libdl library or equivalent.])
396
LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes"
397
LT_DLLOADERS="$LT_DLLOADERS dlopen.la"])])])
398
if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes
401
LIBS="$LIBS $LIBADD_DLOPEN"
402
AC_CHECK_FUNCS([dlerror])
405
AC_SUBST([LIBADD_DLOPEN])
408
AC_CHECK_FUNC([shl_load],
409
[AC_DEFINE([HAVE_SHL_LOAD], [1],
410
[Define if you have the shl_load function.])
411
LT_DLLOADERS="$LT_DLLOADERS shl_load.la"],
412
[AC_CHECK_LIB([dld], [shl_load],
413
[AC_DEFINE([HAVE_SHL_LOAD], [1],
414
[Define if you have the shl_load function.])
415
LT_DLLOADERS="$LT_DLLOADERS shl_load.la"
416
LIBADD_SHL_LOAD="-ldld"])])
417
AC_SUBST([LIBADD_SHL_LOAD])
419
AC_CHECK_FUNC([_dyld_func_lookup],
420
[AC_DEFINE([HAVE_DYLD], [1],
421
[Define if you have the _dyld_func_lookup function.])
422
LT_DLLOADERS="$LT_DLLOADERS dyld.la"])
426
LT_DLLOADERS="$LT_DLLOADERS load_add_on.la"
428
cygwin* | mingw* | os2* | pw32*)
429
LT_DLLOADERS="$LT_DLLOADERS loadlibrary.la"
433
AC_CHECK_LIB([dld], [dld_link],
434
[AC_DEFINE([HAVE_DLD], [1],
435
[Define if you have the GNU dld library.])
436
LT_DLLOADERS="$LT_DLLOADERS dld_link.la"])
437
AC_SUBST([LIBADD_DLD_LINK])
439
m4_pattern_allow([^LT_DLPREOPEN$])
441
for lt_loader in $LT_DLLOADERS; do
442
LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen loaders/$lt_loader "
444
AC_SUBST([LT_DLPREOPEN])
446
dnl This isn't used anymore, but set it for backwards compatibility
447
LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD"
448
AC_SUBST([LIBADD_DL])
454
# AC_LTDL_SYMBOL_USCORE
455
# ---------------------
456
# does the compiler prefix global symbols with an underscore?
457
AC_DEFUN([AC_LTDL_SYMBOL_USCORE],
458
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
459
AC_CACHE_CHECK([for _ prefix in compiled symbols],
460
[ac_cv_sys_symbol_underscore],
461
[ac_cv_sys_symbol_underscore=no
462
cat > conftest.$ac_ext <<EOF
463
void nm_test_func(){}
464
int main(){nm_test_func;return 0;}
466
if AC_TRY_EVAL(ac_compile); then
467
# Now try to grab the symbols.
469
if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
470
# See whether the symbols have a leading underscore.
471
if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
472
ac_cv_sys_symbol_underscore=yes
474
if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
477
echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD
481
echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
484
echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
485
cat conftest.c >&AS_MESSAGE_LOG_FD
489
])# AC_LTDL_SYMBOL_USCORE
492
# AC_LTDL_DLSYM_USCORE
493
# --------------------
494
AC_DEFUN([AC_LTDL_DLSYM_USCORE],
495
[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
496
if test x"$ac_cv_sys_symbol_underscore" = xyes; then
497
if test x"$libltdl_cv_func_dlopen" = xyes ||
498
test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then
499
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
500
[libltdl_cv_need_uscore],
501
[libltdl_cv_need_uscore=unknown
503
LIBS="$LIBS $LIBADD_DLOPEN"
504
_LT_AC_TRY_DLOPEN_SELF(
505
[libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes],
506
[], [libltdl_cv_need_uscore=cross])
512
if test x"$libltdl_cv_need_uscore" = xyes; then
513
AC_DEFINE(NEED_USCORE, 1,
514
[Define if dlsym() requires a leading underscore in symbol names.])
516
])# AC_LTDL_DLSYM_USCORE