ltdl.m4 27 KB

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