ltdl.m4 26 KB

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