ltdl.m4 29 KB

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