You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
12 KiB

  1. # Helper functions for option handling. -*- Autoconf -*-
  2. #
  3. # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
  4. # Written by Gary V. Vaughan, 2004
  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 6 ltoptions.m4
  10. # This is to help aclocal find these macros, as it can't see m4_define.
  11. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
  12. # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
  13. # ------------------------------------------
  14. m4_define([_LT_MANGLE_OPTION],
  15. [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
  16. # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
  17. # ---------------------------------------
  18. # Set option OPTION-NAME for macro MACRO-NAME, and if there is a
  19. # matching handler defined, dispatch to it. Other OPTION-NAMEs are
  20. # saved as a flag.
  21. m4_define([_LT_SET_OPTION],
  22. [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
  23. m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
  24. _LT_MANGLE_DEFUN([$1], [$2]),
  25. [m4_warning([Unknown $1 option `$2'])])[]dnl
  26. ])
  27. # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
  28. # ------------------------------------------------------------
  29. # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
  30. m4_define([_LT_IF_OPTION],
  31. [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
  32. # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
  33. # -------------------------------------------------------
  34. # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
  35. # are set.
  36. m4_define([_LT_UNLESS_OPTIONS],
  37. [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
  38. [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
  39. [m4_define([$0_found])])])[]dnl
  40. m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
  41. ])[]dnl
  42. ])
  43. # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
  44. # ----------------------------------------
  45. # OPTION-LIST is a space-separated list of Libtool options associated
  46. # with MACRO-NAME. If any OPTION has a matching handler declared with
  47. # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
  48. # the unknown option and exit.
  49. m4_defun([_LT_SET_OPTIONS],
  50. [# Set options
  51. m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
  52. [_LT_SET_OPTION([$1], _LT_Option)])
  53. m4_if([$1],[LT_INIT],[
  54. dnl
  55. dnl Simply set some default values (i.e off) if boolean options were not
  56. dnl specified:
  57. _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
  58. ])
  59. _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
  60. ])
  61. dnl
  62. dnl If no reference was made to various pairs of opposing options, then
  63. dnl we run the default mode handler for the pair. For example, if neither
  64. dnl `shared' nor `disable-shared' was passed, we enable building of shared
  65. dnl archives by default:
  66. _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
  67. _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
  68. _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
  69. _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
  70. [_LT_ENABLE_FAST_INSTALL])
  71. ])
  72. ])# _LT_SET_OPTIONS
  73. ## --------------------------------- ##
  74. ## Macros to handle LT_INIT options. ##
  75. ## --------------------------------- ##
  76. # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
  77. # -----------------------------------------
  78. m4_define([_LT_MANGLE_DEFUN],
  79. [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
  80. # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
  81. # -----------------------------------------------
  82. m4_define([LT_OPTION_DEFINE],
  83. [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
  84. ])# LT_OPTION_DEFINE
  85. # dlopen
  86. # ------
  87. LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
  88. ])
  89. AU_DEFUN([AC_LIBTOOL_DLOPEN],
  90. [_LT_SET_OPTION([LT_INIT], [dlopen])
  91. AC_DIAGNOSE([obsolete],
  92. [$0: Remove this warning and the call to _LT_SET_OPTION when you
  93. put the `dlopen' option into LT_INIT's first parameter.])
  94. ])
  95. dnl aclocal-1.4 backwards compatibility:
  96. dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
  97. # win32-dll
  98. # ---------
  99. # Declare package support for building win32 dll's.
  100. LT_OPTION_DEFINE([LT_INIT], [win32-dll],
  101. [enable_win32_dll=yes
  102. case $host in
  103. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
  104. AC_CHECK_TOOL(AS, as, false)
  105. AC_CHECK_TOOL(DLLTOOL, dlltool, false)
  106. AC_CHECK_TOOL(OBJDUMP, objdump, false)
  107. ;;
  108. esac
  109. test -z "$AS" && AS=as
  110. _LT_DECL([], [AS], [0], [Assembler program])dnl
  111. test -z "$DLLTOOL" && DLLTOOL=dlltool
  112. _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
  113. test -z "$OBJDUMP" && OBJDUMP=objdump
  114. _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
  115. ])# win32-dll
  116. AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
  117. [AC_REQUIRE([AC_CANONICAL_HOST])dnl
  118. _LT_SET_OPTION([LT_INIT], [win32-dll])
  119. AC_DIAGNOSE([obsolete],
  120. [$0: Remove this warning and the call to _LT_SET_OPTION when you
  121. put the `win32-dll' option into LT_INIT's first parameter.])
  122. ])
  123. dnl aclocal-1.4 backwards compatibility:
  124. dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
  125. # _LT_ENABLE_SHARED([DEFAULT])
  126. # ----------------------------
  127. # implement the --enable-shared flag, and supports the `shared' and
  128. # `disable-shared' LT_INIT options.
  129. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
  130. m4_define([_LT_ENABLE_SHARED],
  131. [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
  132. AC_ARG_ENABLE([shared],
  133. [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
  134. [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
  135. [p=${PACKAGE-default}
  136. case $enableval in
  137. yes) enable_shared=yes ;;
  138. no) enable_shared=no ;;
  139. *)
  140. enable_shared=no
  141. # Look at the argument we got. We use all the common list separators.
  142. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
  143. for pkg in $enableval; do
  144. IFS="$lt_save_ifs"
  145. if test "X$pkg" = "X$p"; then
  146. enable_shared=yes
  147. fi
  148. done
  149. IFS="$lt_save_ifs"
  150. ;;
  151. esac],
  152. [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
  153. _LT_DECL([build_libtool_libs], [enable_shared], [0],
  154. [Whether or not to build shared libraries])
  155. ])# _LT_ENABLE_SHARED
  156. LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
  157. LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
  158. # Old names:
  159. AC_DEFUN([AC_ENABLE_SHARED],
  160. [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
  161. ])
  162. AC_DEFUN([AC_DISABLE_SHARED],
  163. [_LT_SET_OPTION([LT_INIT], [disable-shared])
  164. ])
  165. AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
  166. AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
  167. dnl aclocal-1.4 backwards compatibility:
  168. dnl AC_DEFUN([AM_ENABLE_SHARED], [])
  169. dnl AC_DEFUN([AM_DISABLE_SHARED], [])
  170. # _LT_ENABLE_STATIC([DEFAULT])
  171. # ----------------------------
  172. # implement the --enable-static flag, and support the `static' and
  173. # `disable-static' LT_INIT options.
  174. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
  175. m4_define([_LT_ENABLE_STATIC],
  176. [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
  177. AC_ARG_ENABLE([static],
  178. [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
  179. [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
  180. [p=${PACKAGE-default}
  181. case $enableval in
  182. yes) enable_static=yes ;;
  183. no) enable_static=no ;;
  184. *)
  185. enable_static=no
  186. # Look at the argument we got. We use all the common list separators.
  187. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
  188. for pkg in $enableval; do
  189. IFS="$lt_save_ifs"
  190. if test "X$pkg" = "X$p"; then
  191. enable_static=yes
  192. fi
  193. done
  194. IFS="$lt_save_ifs"
  195. ;;
  196. esac],
  197. [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
  198. _LT_DECL([build_old_libs], [enable_static], [0],
  199. [Whether or not to build static libraries])
  200. ])# _LT_ENABLE_STATIC
  201. LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
  202. LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
  203. # Old names:
  204. AC_DEFUN([AC_ENABLE_STATIC],
  205. [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
  206. ])
  207. AC_DEFUN([AC_DISABLE_STATIC],
  208. [_LT_SET_OPTION([LT_INIT], [disable-static])
  209. ])
  210. AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
  211. AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
  212. dnl aclocal-1.4 backwards compatibility:
  213. dnl AC_DEFUN([AM_ENABLE_STATIC], [])
  214. dnl AC_DEFUN([AM_DISABLE_STATIC], [])
  215. # _LT_ENABLE_FAST_INSTALL([DEFAULT])
  216. # ----------------------------------
  217. # implement the --enable-fast-install flag, and support the `fast-install'
  218. # and `disable-fast-install' LT_INIT options.
  219. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
  220. m4_define([_LT_ENABLE_FAST_INSTALL],
  221. [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
  222. AC_ARG_ENABLE([fast-install],
  223. [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
  224. [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
  225. [p=${PACKAGE-default}
  226. case $enableval in
  227. yes) enable_fast_install=yes ;;
  228. no) enable_fast_install=no ;;
  229. *)
  230. enable_fast_install=no
  231. # Look at the argument we got. We use all the common list separators.
  232. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
  233. for pkg in $enableval; do
  234. IFS="$lt_save_ifs"
  235. if test "X$pkg" = "X$p"; then
  236. enable_fast_install=yes
  237. fi
  238. done
  239. IFS="$lt_save_ifs"
  240. ;;
  241. esac],
  242. [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
  243. _LT_DECL([fast_install], [enable_fast_install], [0],
  244. [Whether or not to optimize for fast installation])dnl
  245. ])# _LT_ENABLE_FAST_INSTALL
  246. LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
  247. LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
  248. # Old names:
  249. AU_DEFUN([AC_ENABLE_FAST_INSTALL],
  250. [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
  251. AC_DIAGNOSE([obsolete],
  252. [$0: Remove this warning and the call to _LT_SET_OPTION when you put
  253. the `fast-install' option into LT_INIT's first parameter.])
  254. ])
  255. AU_DEFUN([AC_DISABLE_FAST_INSTALL],
  256. [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
  257. AC_DIAGNOSE([obsolete],
  258. [$0: Remove this warning and the call to _LT_SET_OPTION when you put
  259. the `disable-fast-install' option into LT_INIT's first parameter.])
  260. ])
  261. dnl aclocal-1.4 backwards compatibility:
  262. dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
  263. dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
  264. # _LT_WITH_PIC([MODE])
  265. # --------------------
  266. # implement the --with-pic flag, and support the `pic-only' and `no-pic'
  267. # LT_INIT options.
  268. # MODE is either `yes' or `no'. If omitted, it defaults to `both'.
  269. m4_define([_LT_WITH_PIC],
  270. [AC_ARG_WITH([pic],
  271. [AS_HELP_STRING([--with-pic],
  272. [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
  273. [pic_mode="$withval"],
  274. [pic_mode=default])
  275. test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
  276. _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
  277. ])# _LT_WITH_PIC
  278. LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
  279. LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
  280. # Old name:
  281. AU_DEFUN([AC_LIBTOOL_PICMODE],
  282. [_LT_SET_OPTION([LT_INIT], [pic-only])
  283. AC_DIAGNOSE([obsolete],
  284. [$0: Remove this warning and the call to _LT_SET_OPTION when you
  285. put the `pic-only' option into LT_INIT's first parameter.])
  286. ])
  287. dnl aclocal-1.4 backwards compatibility:
  288. dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
  289. ## ----------------- ##
  290. ## LTDL_INIT Options ##
  291. ## ----------------- ##
  292. m4_define([_LTDL_MODE], [])
  293. LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
  294. [m4_define([_LTDL_MODE], [nonrecursive])])
  295. LT_OPTION_DEFINE([LTDL_INIT], [recursive],
  296. [m4_define([_LTDL_MODE], [recursive])])
  297. LT_OPTION_DEFINE([LTDL_INIT], [subproject],
  298. [m4_define([_LTDL_MODE], [subproject])])
  299. m4_define([_LTDL_TYPE], [])
  300. LT_OPTION_DEFINE([LTDL_INIT], [installable],
  301. [m4_define([_LTDL_TYPE], [installable])])
  302. LT_OPTION_DEFINE([LTDL_INIT], [convenience],
  303. [m4_define([_LTDL_TYPE], [convenience])])