1 # Helper functions for option handling.                    -*- Autoconf -*-
 
   3 # Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
   4 # Written by Gary V. Vaughan <gary@gnu.org>
 
   6 # This file is free software; the Free Software Foundation gives
 
   7 # unlimited permission to copy and/or distribute it, with or without
 
   8 # modifications, as long as this notice is preserved.
 
  10 # serial 3 ltoptions.m4
 
  12 # This is to help aclocal find these macros, as it can't see m4_define.
 
  13 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
 
  16 # _LT_MANGLE_OPTION(NAME)
 
  17 # -----------------------
 
  18 m4_define([_LT_MANGLE_OPTION],
 
  19 [[_LT_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
  22 # _LT_SET_OPTION(NAME)
 
  23 # --------------------
 
  24 # Set option NAME, and if there is a matching handler defined,
 
  25 # dispatch to it.  Other NAMEs are saved as a flag.
 
  26 m4_define([_LT_SET_OPTION],
 
  27 [m4_define(_LT_MANGLE_OPTION([$1]))dnl
 
  28 m4_ifdef(_LT_MANGLE_DEFUN([$1]),
 
  29         _LT_MANGLE_DEFUN([$1]),
 
  30     [m4_warning([Unknown Libtool option `$1'])])[]dnl
 
  34 # _LT_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
 
  35 # -------------------------------------------
 
  36 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
 
  37 m4_define([_LT_IF_OPTION],
 
  38 [m4_ifdef(_LT_MANGLE_OPTION([$1]), [$2], [$3])])
 
  41 # _LT_UNLESS_OPTIONS(OPTIONS, IF-NOT-SET)
 
  42 # ---------------------------------------
 
  43 # Execute IF-NOT-SET if all OPTIONS are not set.
 
  44 m4_define([_LT_UNLESS_OPTIONS],
 
  45 [m4_foreach([_LT_Option], m4_split(m4_normalize([$1])),
 
  46             [m4_ifdef(_LT_MANGLE_OPTION(_LT_Option),
 
  47                       [m4_define([$0_found])])])[]dnl
 
  48 m4_ifdef([$0_found], [m4_undefine([$0_found])], [$2
 
  53 # _LT_SET_OPTIONS(OPTIONS)
 
  54 # ------------------------
 
  55 # OPTIONS is a space-separated list of Libtool options.
 
  56 # If any OPTION has a handler macro declared with LT_OPTION_DEFINE,
 
  57 # dispatch to that macro; otherwise complain about the unknown option
 
  59 m4_defun([_LT_SET_OPTIONS],
 
  61 m4_foreach([_LT_Option], m4_split(m4_normalize([$1])),
 
  62     [_LT_SET_OPTION(_LT_Option)])
 
  64 dnl Simply set some default values (i.e off) if boolean options were not
 
  66 _LT_UNLESS_OPTIONS([dlopen], [enable_dlopen=no
 
  68 _LT_UNLESS_OPTIONS([win32-dll], [enable_win32_dll=no
 
  71 dnl If no reference was made to various pairs of opposing options, then
 
  72 dnl we run the default mode handler for the pair.  For example, if neither
 
  73 dnl `shared' nor `disable-shared' was passed, we enable building of shared
 
  74 dnl archives by default:
 
  75 _LT_UNLESS_OPTIONS([shared disable-shared], [_LT_ENABLE_SHARED])
 
  76 _LT_UNLESS_OPTIONS([static disable-static], [_LT_ENABLE_STATIC])
 
  77 _LT_UNLESS_OPTIONS([pic-only no-pic], [_LT_WITH_PIC])
 
  78 _LT_UNLESS_OPTIONS([fast-install disable-fast-install],
 
  79                    [_LT_ENABLE_FAST_INSTALL])
 
  83 ## --------------------------------- ##
 
  84 ## Macros to handle LT_INIT options. ##
 
  85 ## --------------------------------- ##
 
  87 m4_define([_LT_MANGLE_DEFUN],
 
  88 [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1]), [[^A-Z0-9_]], [_])])
 
  91 # LT_OPTION_DEFINE(NAME, CODE)
 
  92 # ----------------------------
 
  93 m4_define([LT_OPTION_DEFINE],
 
  94 [m4_define(_LT_MANGLE_DEFUN([$1]), [$2])[]dnl
 
 100 LT_OPTION_DEFINE([dlopen], [enable_dlopen=yes
 
 103 AU_DEFUN([AC_LIBTOOL_DLOPEN],
 
 104 [_LT_SET_OPTION([dlopen])
 
 105 AC_DIAGNOSE([obsolete],
 
 106 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 
 107 put the `dlopen' option into LT_INIT's first parameter.])
 
 110 dnl aclocal-1.4 backwards compatibility:
 
 111 dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
 
 116 # Declare package support for building win32 dll's.
 
 117 LT_OPTION_DEFINE([win32-dll],
 
 118 [enable_win32_dll=yes
 
 121 *-*-cygwin* | *-*-mingw* | *-*-pw32*)
 
 122   AC_CHECK_TOOL(AS, as, false)
 
 123   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
 
 124   AC_CHECK_TOOL(OBJDUMP, objdump, false)
 
 128 test -z "$AS" && AS=as
 
 129 _LT_DECL([], [AS],      [0], [Assembler program])dnl
 
 131 test -z "$DLLTOOL" && DLLTOOL=dlltool
 
 132 _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
 
 134 test -z "$OBJDUMP" && OBJDUMP=objdump
 
 135 _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
 
 138 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
 
 139 [_LT_SET_OPTION([win32-dll])
 
 140 AC_DIAGNOSE([obsolete],
 
 141 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 
 142 put the `win32-dll' option into LT_INIT's first parameter.])
 
 145 dnl aclocal-1.4 backwards compatibility:
 
 146 dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
 
 149 # _LT_ENABLE_SHARED([DEFAULT])
 
 150 # ----------------------------
 
 151 # implement the --enable-shared flag, and supports the `shared' and
 
 152 # `disable-shared' LT_INIT options.
 
 153 # DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
 
 154 m4_define([_LT_ENABLE_SHARED],
 
 155 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
 
 156 AC_ARG_ENABLE([shared],
 
 157     [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
 
 158         [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
 
 159     [p=${PACKAGE-default}
 
 161     yes) enable_shared=yes ;;
 
 162     no) enable_shared=no ;;
 
 165       # Look at the argument we got.  We use all the common list separators.
 
 166       lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
 
 167       for pkg in $enableval; do
 
 169         if test "X$pkg" = "X$p"; then
 
 176     [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
 
 178     _LT_DECL([build_libtool_libs], [enable_shared], [0],
 
 179         [Whether or not to build shared libraries])
 
 180 ])# _LT_ENABLE_SHARED
 
 182 LT_OPTION_DEFINE([shared], [_LT_ENABLE_SHARED([yes])])
 
 183 LT_OPTION_DEFINE([disable-shared], [_LT_ENABLE_SHARED([no])])
 
 186 AU_DEFUN([AC_ENABLE_SHARED],
 
 187 [_LT_SET_OPTION([shared])
 
 188 AC_DIAGNOSE([obsolete],
 
 189 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 
 190 put the `shared' option into LT_INIT's first parameter.])
 
 193 AU_DEFUN([AM_ENABLE_SHARED],
 
 194 [_LT_SET_OPTION([shared])
 
 195 AC_DIAGNOSE([obsolete],
 
 196 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 
 197 put the `shared' option into LT_INIT's first parameter.])
 
 200 AU_DEFUN([AC_DISABLE_SHARED],
 
 201 [_LT_SET_OPTION([disable-shared])
 
 202 AC_DIAGNOSE([obsolete],
 
 203 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 
 204 the `disable-shared' option into LT_INIT's first parameter.])
 
 207 AU_DEFUN([AM_DISABLE_SHARED],
 
 208 [_LT_SET_OPTION([disable-shared])
 
 209 AC_DIAGNOSE([obsolete],
 
 210 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 
 211 the `disable-shared' option into LT_INIT's first parameter.])
 
 214 dnl aclocal-1.4 backwards compatibility:
 
 215 dnl AC_DEFUN([AC_ENABLE_SHARED], [])
 
 216 dnl AC_DEFUN([AM_ENABLE_SHARED], [])
 
 217 dnl AC_DEFUN([AC_DISABLE_SHARED], [])
 
 218 dnl AC_DEFUN([AM_DISABLE_SHARED], [])
 
 222 # _LT_ENABLE_STATIC([DEFAULT])
 
 223 # ----------------------------
 
 224 # implement the --enable-static flag, and support the `static' and
 
 225 # `disable-static' LT_INIT options.
 
 226 # DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
 
 227 m4_define([_LT_ENABLE_STATIC],
 
 228 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
 
 229 AC_ARG_ENABLE([static],
 
 230     [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
 
 231         [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
 
 232     [p=${PACKAGE-default}
 
 234     yes) enable_static=yes ;;
 
 235     no) enable_static=no ;;
 
 238       # Look at the argument we got.  We use all the common list separators.
 
 239       lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
 
 240       for pkg in $enableval; do
 
 242         if test "X$pkg" = "X$p"; then
 
 249     [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
 
 251     _LT_DECL([build_old_libs], [enable_static], [0],
 
 252         [Whether or not to build static libraries])
 
 253 ])# _LT_ENABLE_STATIC
 
 255 LT_OPTION_DEFINE([static], [_LT_ENABLE_STATIC([yes])])
 
 256 LT_OPTION_DEFINE([disable-static], [_LT_ENABLE_STATIC([no])])
 
 259 AU_DEFUN([AC_ENABLE_STATIC],
 
 260 [_LT_SET_OPTION([static])
 
 261 AC_DIAGNOSE([obsolete],
 
 262 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 
 263 put the `static' option into LT_INIT's first parameter.])
 
 266 AU_DEFUN([AM_ENABLE_STATIC],
 
 267 [_LT_SET_OPTION([static])
 
 268 AC_DIAGNOSE([obsolete],
 
 269 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 
 270 put the `static' option into LT_INIT's first parameter.])
 
 273 AU_DEFUN([AC_DISABLE_STATIC],
 
 274 [_LT_SET_OPTION([disable-static])
 
 275 AC_DIAGNOSE([obsolete],
 
 276 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 
 277 the `disable-static' option into LT_INIT's first parameter.])
 
 280 AU_DEFUN([AM_DISABLE_STATIC],
 
 281 [_LT_SET_OPTION([disable-static])
 
 282 AC_DIAGNOSE([obsolete],
 
 283 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 
 284 the `disable-static' option into LT_INIT's first parameter.])
 
 287 dnl aclocal-1.4 backwards compatibility:
 
 288 dnl AC_DEFUN([AC_ENABLE_STATIC], [])
 
 289 dnl AC_DEFUN([AM_ENABLE_STATIC], [])
 
 290 dnl AC_DEFUN([AC_DISABLE_STATIC], [])
 
 291 dnl AC_DEFUN([AM_DISABLE_STATIC], [])
 
 295 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
 
 296 # ----------------------------------
 
 297 # implement the --enable-fast-install flag, and support the `fast-install'
 
 298 # and `disable-fast-install' LT_INIT options.
 
 299 # DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
 
 300 m4_define([_LT_ENABLE_FAST_INSTALL],
 
 301 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
 
 302 AC_ARG_ENABLE([fast-install],
 
 303     [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
 
 304     [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
 
 305     [p=${PACKAGE-default}
 
 307     yes) enable_fast_install=yes ;;
 
 308     no) enable_fast_install=no ;;
 
 310       enable_fast_install=no
 
 311       # Look at the argument we got.  We use all the common list separators.
 
 312       lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
 
 313       for pkg in $enableval; do
 
 315         if test "X$pkg" = "X$p"; then
 
 316           enable_fast_install=yes
 
 322     [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
 
 324 _LT_DECL([fast_install], [enable_fast_install], [0],
 
 325          [Whether or not to optimize for fast installation])dnl
 
 326 ])# _LT_ENABLE_FAST_INSTALL
 
 328 LT_OPTION_DEFINE([fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
 
 329 LT_OPTION_DEFINE([disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
 
 332 AU_DEFUN([AC_ENABLE_FAST_INSTALL],
 
 333 [_LT_SET_OPTION([fast-install])
 
 334 AC_DIAGNOSE([obsolete],
 
 335 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 
 336 the `fast-install' option into LT_INIT's first parameter.])
 
 339 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
 
 340 [_LT_SET_OPTION([disable-fast-install])
 
 341 AC_DIAGNOSE([obsolete],
 
 342 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 
 343 the `disable-fast-install' option into LT_INIT's first parameter.])
 
 346 dnl aclocal-1.4 backwards compatibility:
 
 347 dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
 
 348 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 
 351 # _LT_WITH_PIC([MODE])
 
 352 # --------------------
 
 353 # implement the --with-pic flag, and support the `pic-only' and `no-pic'
 
 355 # MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
 
 356 m4_define([_LT_WITH_PIC],
 
 358     [AS_HELP_STRING([--with-pic],
 
 359         [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
 
 360     [pic_mode="$withval"],
 
 363 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
 
 365 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
 
 368 LT_OPTION_DEFINE([pic-only], [_LT_WITH_PIC([yes])])
 
 369 LT_OPTION_DEFINE([no-pic], [_LT_WITH_PIC([no])])
 
 372 AU_DEFUN([AC_LIBTOOL_PICMODE],
 
 373 [_LT_SET_OPTION([pic-only])
 
 374 AC_DIAGNOSE([obsolete],
 
 375 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 
 376 put the `pic-only' option into LT_INIT's first parameter.])
 
 379 dnl aclocal-1.4 backwards compatibility:
 
 380 dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])