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.

369 lines
12 KiB

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