annotate m4/ltoptions.m4 @ 39:f6b3fbf10dac

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