annotate m4/ltoptions.m4 @ 1442:204ca664b5d6

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