annotate m4/ltoptions.m4 @ 22:923e097e9ba3

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