acinclude/ltoptions.m4
changeset 3345 437378d409b1
child 6442 2d3caa191dc4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/acinclude/ltoptions.m4	Sun Oct 04 21:00:33 2009 +0000
     1.3 @@ -0,0 +1,370 @@
     1.4 +##############################################################################
     1.5 +# Helper functions for option handling.                    -*- Autoconf -*-
     1.6 +#
     1.7 +#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
     1.8 +#   Written by Gary V. Vaughan, 2004
     1.9 +#
    1.10 +# This file is free software; the Free Software Foundation gives
    1.11 +# unlimited permission to copy and/or distribute it, with or without
    1.12 +# modifications, as long as this notice is preserved.
    1.13 +
    1.14 +# serial 6 ltoptions.m4
    1.15 +
    1.16 +# This is to help aclocal find these macros, as it can't see m4_define.
    1.17 +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
    1.18 +
    1.19 +
    1.20 +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
    1.21 +# ------------------------------------------
    1.22 +m4_define([_LT_MANGLE_OPTION],
    1.23 +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
    1.24 +
    1.25 +
    1.26 +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
    1.27 +# ---------------------------------------
    1.28 +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
    1.29 +# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
    1.30 +# saved as a flag.
    1.31 +m4_define([_LT_SET_OPTION],
    1.32 +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
    1.33 +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
    1.34 +        _LT_MANGLE_DEFUN([$1], [$2]),
    1.35 +    [m4_warning([Unknown $1 option `$2'])])[]dnl
    1.36 +])
    1.37 +
    1.38 +
    1.39 +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
    1.40 +# ------------------------------------------------------------
    1.41 +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
    1.42 +m4_define([_LT_IF_OPTION],
    1.43 +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
    1.44 +
    1.45 +
    1.46 +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
    1.47 +# -------------------------------------------------------
    1.48 +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
    1.49 +# are set.
    1.50 +m4_define([_LT_UNLESS_OPTIONS],
    1.51 +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
    1.52 +	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
    1.53 +		      [m4_define([$0_found])])])[]dnl
    1.54 +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
    1.55 +])[]dnl
    1.56 +])
    1.57 +
    1.58 +
    1.59 +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
    1.60 +# ----------------------------------------
    1.61 +# OPTION-LIST is a space-separated list of Libtool options associated
    1.62 +# with MACRO-NAME.  If any OPTION has a matching handler declared with
    1.63 +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
    1.64 +# the unknown option and exit.
    1.65 +m4_defun([_LT_SET_OPTIONS],
    1.66 +[# Set options
    1.67 +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
    1.68 +    [_LT_SET_OPTION([$1], _LT_Option)])
    1.69 +
    1.70 +m4_if([$1],[LT_INIT],[
    1.71 +  dnl
    1.72 +  dnl Simply set some default values (i.e off) if boolean options were not
    1.73 +  dnl specified:
    1.74 +  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
    1.75 +  ])
    1.76 +  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
    1.77 +  ])
    1.78 +  dnl
    1.79 +  dnl If no reference was made to various pairs of opposing options, then
    1.80 +  dnl we run the default mode handler for the pair.  For example, if neither
    1.81 +  dnl `shared' nor `disable-shared' was passed, we enable building of shared
    1.82 +  dnl archives by default:
    1.83 +  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
    1.84 +  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
    1.85 +  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
    1.86 +  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
    1.87 +  		   [_LT_ENABLE_FAST_INSTALL])
    1.88 +  ])
    1.89 +])# _LT_SET_OPTIONS
    1.90 +
    1.91 +
    1.92 +## --------------------------------- ##
    1.93 +## Macros to handle LT_INIT options. ##
    1.94 +## --------------------------------- ##
    1.95 +
    1.96 +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
    1.97 +# -----------------------------------------
    1.98 +m4_define([_LT_MANGLE_DEFUN],
    1.99 +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
   1.100 +
   1.101 +
   1.102 +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
   1.103 +# -----------------------------------------------
   1.104 +m4_define([LT_OPTION_DEFINE],
   1.105 +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
   1.106 +])# LT_OPTION_DEFINE
   1.107 +
   1.108 +
   1.109 +# dlopen
   1.110 +# ------
   1.111 +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
   1.112 +])
   1.113 +
   1.114 +AU_DEFUN([AC_LIBTOOL_DLOPEN],
   1.115 +[_LT_SET_OPTION([LT_INIT], [dlopen])
   1.116 +AC_DIAGNOSE([obsolete],
   1.117 +[$0: Remove this warning and the call to _LT_SET_OPTION when you
   1.118 +put the `dlopen' option into LT_INIT's first parameter.])
   1.119 +])
   1.120 +
   1.121 +dnl aclocal-1.4 backwards compatibility:
   1.122 +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
   1.123 +
   1.124 +
   1.125 +# win32-dll
   1.126 +# ---------
   1.127 +# Declare package support for building win32 dll's.
   1.128 +LT_OPTION_DEFINE([LT_INIT], [win32-dll],
   1.129 +[enable_win32_dll=yes
   1.130 +
   1.131 +case $host in
   1.132 +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
   1.133 +  AC_CHECK_TOOL(AS, as, false)
   1.134 +  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   1.135 +  AC_CHECK_TOOL(OBJDUMP, objdump, false)
   1.136 +  ;;
   1.137 +esac
   1.138 +
   1.139 +test -z "$AS" && AS=as
   1.140 +_LT_DECL([], [AS],      [0], [Assembler program])dnl
   1.141 +
   1.142 +test -z "$DLLTOOL" && DLLTOOL=dlltool
   1.143 +_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
   1.144 +
   1.145 +test -z "$OBJDUMP" && OBJDUMP=objdump
   1.146 +_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
   1.147 +])# win32-dll
   1.148 +
   1.149 +AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
   1.150 +[AC_REQUIRE([AC_CANONICAL_HOST])dnl
   1.151 +_LT_SET_OPTION([LT_INIT], [win32-dll])
   1.152 +AC_DIAGNOSE([obsolete],
   1.153 +[$0: Remove this warning and the call to _LT_SET_OPTION when you
   1.154 +put the `win32-dll' option into LT_INIT's first parameter.])
   1.155 +])
   1.156 +
   1.157 +dnl aclocal-1.4 backwards compatibility:
   1.158 +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
   1.159 +
   1.160 +
   1.161 +# _LT_ENABLE_SHARED([DEFAULT])
   1.162 +# ----------------------------
   1.163 +# implement the --enable-shared flag, and supports the `shared' and
   1.164 +# `disable-shared' LT_INIT options.
   1.165 +# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
   1.166 +m4_define([_LT_ENABLE_SHARED],
   1.167 +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
   1.168 +AC_ARG_ENABLE([shared],
   1.169 +    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
   1.170 +	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
   1.171 +    [p=${PACKAGE-default}
   1.172 +    case $enableval in
   1.173 +    yes) enable_shared=yes ;;
   1.174 +    no) enable_shared=no ;;
   1.175 +    *)
   1.176 +      enable_shared=no
   1.177 +      # Look at the argument we got.  We use all the common list separators.
   1.178 +      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
   1.179 +      for pkg in $enableval; do
   1.180 +	IFS="$lt_save_ifs"
   1.181 +	if test "X$pkg" = "X$p"; then
   1.182 +	  enable_shared=yes
   1.183 +	fi
   1.184 +      done
   1.185 +      IFS="$lt_save_ifs"
   1.186 +      ;;
   1.187 +    esac],
   1.188 +    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
   1.189 +
   1.190 +    _LT_DECL([build_libtool_libs], [enable_shared], [0],
   1.191 +	[Whether or not to build shared libraries])
   1.192 +])# _LT_ENABLE_SHARED
   1.193 +
   1.194 +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
   1.195 +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
   1.196 +
   1.197 +# Old names:
   1.198 +AC_DEFUN([AC_ENABLE_SHARED],
   1.199 +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
   1.200 +])
   1.201 +
   1.202 +AC_DEFUN([AC_DISABLE_SHARED],
   1.203 +[_LT_SET_OPTION([LT_INIT], [disable-shared])
   1.204 +])
   1.205 +
   1.206 +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
   1.207 +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
   1.208 +
   1.209 +dnl aclocal-1.4 backwards compatibility:
   1.210 +dnl AC_DEFUN([AM_ENABLE_SHARED], [])
   1.211 +dnl AC_DEFUN([AM_DISABLE_SHARED], [])
   1.212 +
   1.213 +
   1.214 +
   1.215 +# _LT_ENABLE_STATIC([DEFAULT])
   1.216 +# ----------------------------
   1.217 +# implement the --enable-static flag, and support the `static' and
   1.218 +# `disable-static' LT_INIT options.
   1.219 +# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
   1.220 +m4_define([_LT_ENABLE_STATIC],
   1.221 +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
   1.222 +AC_ARG_ENABLE([static],
   1.223 +    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
   1.224 +	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
   1.225 +    [p=${PACKAGE-default}
   1.226 +    case $enableval in
   1.227 +    yes) enable_static=yes ;;
   1.228 +    no) enable_static=no ;;
   1.229 +    *)
   1.230 +     enable_static=no
   1.231 +      # Look at the argument we got.  We use all the common list separators.
   1.232 +      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
   1.233 +      for pkg in $enableval; do
   1.234 +	IFS="$lt_save_ifs"
   1.235 +	if test "X$pkg" = "X$p"; then
   1.236 +	  enable_static=yes
   1.237 +	fi
   1.238 +      done
   1.239 +      IFS="$lt_save_ifs"
   1.240 +      ;;
   1.241 +    esac],
   1.242 +    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
   1.243 +
   1.244 +    _LT_DECL([build_old_libs], [enable_static], [0],
   1.245 +	[Whether or not to build static libraries])
   1.246 +])# _LT_ENABLE_STATIC
   1.247 +
   1.248 +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
   1.249 +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
   1.250 +
   1.251 +# Old names:
   1.252 +AC_DEFUN([AC_ENABLE_STATIC],
   1.253 +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
   1.254 +])
   1.255 +
   1.256 +AC_DEFUN([AC_DISABLE_STATIC],
   1.257 +[_LT_SET_OPTION([LT_INIT], [disable-static])
   1.258 +])
   1.259 +
   1.260 +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
   1.261 +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
   1.262 +
   1.263 +dnl aclocal-1.4 backwards compatibility:
   1.264 +dnl AC_DEFUN([AM_ENABLE_STATIC], [])
   1.265 +dnl AC_DEFUN([AM_DISABLE_STATIC], [])
   1.266 +
   1.267 +
   1.268 +
   1.269 +# _LT_ENABLE_FAST_INSTALL([DEFAULT])
   1.270 +# ----------------------------------
   1.271 +# implement the --enable-fast-install flag, and support the `fast-install'
   1.272 +# and `disable-fast-install' LT_INIT options.
   1.273 +# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
   1.274 +m4_define([_LT_ENABLE_FAST_INSTALL],
   1.275 +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
   1.276 +AC_ARG_ENABLE([fast-install],
   1.277 +    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
   1.278 +    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
   1.279 +    [p=${PACKAGE-default}
   1.280 +    case $enableval in
   1.281 +    yes) enable_fast_install=yes ;;
   1.282 +    no) enable_fast_install=no ;;
   1.283 +    *)
   1.284 +      enable_fast_install=no
   1.285 +      # Look at the argument we got.  We use all the common list separators.
   1.286 +      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
   1.287 +      for pkg in $enableval; do
   1.288 +	IFS="$lt_save_ifs"
   1.289 +	if test "X$pkg" = "X$p"; then
   1.290 +	  enable_fast_install=yes
   1.291 +	fi
   1.292 +      done
   1.293 +      IFS="$lt_save_ifs"
   1.294 +      ;;
   1.295 +    esac],
   1.296 +    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
   1.297 +
   1.298 +_LT_DECL([fast_install], [enable_fast_install], [0],
   1.299 +	 [Whether or not to optimize for fast installation])dnl
   1.300 +])# _LT_ENABLE_FAST_INSTALL
   1.301 +
   1.302 +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
   1.303 +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
   1.304 +
   1.305 +# Old names:
   1.306 +AU_DEFUN([AC_ENABLE_FAST_INSTALL],
   1.307 +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
   1.308 +AC_DIAGNOSE([obsolete],
   1.309 +[$0: Remove this warning and the call to _LT_SET_OPTION when you put
   1.310 +the `fast-install' option into LT_INIT's first parameter.])
   1.311 +])
   1.312 +
   1.313 +AU_DEFUN([AC_DISABLE_FAST_INSTALL],
   1.314 +[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
   1.315 +AC_DIAGNOSE([obsolete],
   1.316 +[$0: Remove this warning and the call to _LT_SET_OPTION when you put
   1.317 +the `disable-fast-install' option into LT_INIT's first parameter.])
   1.318 +])
   1.319 +
   1.320 +dnl aclocal-1.4 backwards compatibility:
   1.321 +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
   1.322 +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
   1.323 +
   1.324 +
   1.325 +# _LT_WITH_PIC([MODE])
   1.326 +# --------------------
   1.327 +# implement the --with-pic flag, and support the `pic-only' and `no-pic'
   1.328 +# LT_INIT options.
   1.329 +# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
   1.330 +m4_define([_LT_WITH_PIC],
   1.331 +[AC_ARG_WITH([pic],
   1.332 +    [AS_HELP_STRING([--with-pic],
   1.333 +	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
   1.334 +    [pic_mode="$withval"],
   1.335 +    [pic_mode=default])
   1.336 +
   1.337 +test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
   1.338 +
   1.339 +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
   1.340 +])# _LT_WITH_PIC
   1.341 +
   1.342 +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
   1.343 +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
   1.344 +
   1.345 +# Old name:
   1.346 +AU_DEFUN([AC_LIBTOOL_PICMODE],
   1.347 +[_LT_SET_OPTION([LT_INIT], [pic-only])
   1.348 +AC_DIAGNOSE([obsolete],
   1.349 +[$0: Remove this warning and the call to _LT_SET_OPTION when you
   1.350 +put the `pic-only' option into LT_INIT's first parameter.])
   1.351 +])
   1.352 +
   1.353 +dnl aclocal-1.4 backwards compatibility:
   1.354 +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
   1.355 +
   1.356 +## ----------------- ##
   1.357 +## LTDL_INIT Options ##
   1.358 +## ----------------- ##
   1.359 +
   1.360 +m4_define([_LTDL_MODE], [])
   1.361 +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
   1.362 +		 [m4_define([_LTDL_MODE], [nonrecursive])])
   1.363 +LT_OPTION_DEFINE([LTDL_INIT], [recursive],
   1.364 +		 [m4_define([_LTDL_MODE], [recursive])])
   1.365 +LT_OPTION_DEFINE([LTDL_INIT], [subproject],
   1.366 +		 [m4_define([_LTDL_MODE], [subproject])])
   1.367 +
   1.368 +m4_define([_LTDL_TYPE], [])
   1.369 +LT_OPTION_DEFINE([LTDL_INIT], [installable],
   1.370 +		 [m4_define([_LTDL_TYPE], [installable])])
   1.371 +LT_OPTION_DEFINE([LTDL_INIT], [convenience],
   1.372 +		 [m4_define([_LTDL_TYPE], [convenience])])
   1.373 +