annotate m4/ltoptions.m4 @ 1594:d9de8b3f8167

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