File indexing completed on 2024-12-22 04:04:07

0001 # Helper functions for option handling.                    -*- Autoconf -*-
0002 #
0003 #   Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
0004 #   Foundation, Inc.
0005 #   Written by Gary V. Vaughan, 2004
0006 #
0007 # This file is free software; the Free Software Foundation gives
0008 # unlimited permission to copy and/or distribute it, with or without
0009 # modifications, as long as this notice is preserved.
0010 
0011 # serial 8 ltoptions.m4
0012 
0013 # This is to help aclocal find these macros, as it can't see m4_define.
0014 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
0015 
0016 
0017 # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
0018 # ------------------------------------------
0019 m4_define([_LT_MANGLE_OPTION],
0020 [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
0021 
0022 
0023 # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
0024 # ---------------------------------------
0025 # Set option OPTION-NAME for macro MACRO-NAME, and if there is a
0026 # matching handler defined, dispatch to it.  Other OPTION-NAMEs are
0027 # saved as a flag.
0028 m4_define([_LT_SET_OPTION],
0029 [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
0030 m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
0031         _LT_MANGLE_DEFUN([$1], [$2]),
0032     [m4_warning([Unknown $1 option '$2'])])[]dnl
0033 ])
0034 
0035 
0036 # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
0037 # ------------------------------------------------------------
0038 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
0039 m4_define([_LT_IF_OPTION],
0040 [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
0041 
0042 
0043 # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
0044 # -------------------------------------------------------
0045 # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
0046 # are set.
0047 m4_define([_LT_UNLESS_OPTIONS],
0048 [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
0049             [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
0050                       [m4_define([$0_found])])])[]dnl
0051 m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
0052 ])[]dnl
0053 ])
0054 
0055 
0056 # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
0057 # ----------------------------------------
0058 # OPTION-LIST is a space-separated list of Libtool options associated
0059 # with MACRO-NAME.  If any OPTION has a matching handler declared with
0060 # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
0061 # the unknown option and exit.
0062 m4_defun([_LT_SET_OPTIONS],
0063 [# Set options
0064 m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
0065     [_LT_SET_OPTION([$1], _LT_Option)])
0066 
0067 m4_if([$1],[LT_INIT],[
0068   dnl
0069   dnl Simply set some default values (i.e off) if boolean options were not
0070   dnl specified:
0071   _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
0072   ])
0073   _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
0074   ])
0075   dnl
0076   dnl If no reference was made to various pairs of opposing options, then
0077   dnl we run the default mode handler for the pair.  For example, if neither
0078   dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
0079   dnl archives by default:
0080   _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
0081   _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
0082   _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
0083   _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
0084                    [_LT_ENABLE_FAST_INSTALL])
0085   _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
0086                    [_LT_WITH_AIX_SONAME([aix])])
0087   ])
0088 ])# _LT_SET_OPTIONS
0089 
0090 
0091 ## --------------------------------- ##
0092 ## Macros to handle LT_INIT options. ##
0093 ## --------------------------------- ##
0094 
0095 # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
0096 # -----------------------------------------
0097 m4_define([_LT_MANGLE_DEFUN],
0098 [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
0099 
0100 
0101 # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
0102 # -----------------------------------------------
0103 m4_define([LT_OPTION_DEFINE],
0104 [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
0105 ])# LT_OPTION_DEFINE
0106 
0107 
0108 # dlopen
0109 # ------
0110 LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
0111 ])
0112 
0113 AU_DEFUN([AC_LIBTOOL_DLOPEN],
0114 [_LT_SET_OPTION([LT_INIT], [dlopen])
0115 AC_DIAGNOSE([obsolete],
0116 [$0: Remove this warning and the call to _LT_SET_OPTION when you
0117 put the 'dlopen' option into LT_INIT's first parameter.])
0118 ])
0119 
0120 dnl aclocal-1.4 backwards compatibility:
0121 dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
0122 
0123 
0124 # win32-dll
0125 # ---------
0126 # Declare package support for building win32 dll's.
0127 LT_OPTION_DEFINE([LT_INIT], [win32-dll],
0128 [enable_win32_dll=yes
0129 
0130 case $host in
0131 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
0132   AC_CHECK_TOOL(AS, as, false)
0133   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
0134   AC_CHECK_TOOL(OBJDUMP, objdump, false)
0135   ;;
0136 esac
0137 
0138 test -z "$AS" && AS=as
0139 _LT_DECL([], [AS],      [1], [Assembler program])dnl
0140 
0141 test -z "$DLLTOOL" && DLLTOOL=dlltool
0142 _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
0143 
0144 test -z "$OBJDUMP" && OBJDUMP=objdump
0145 _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
0146 ])# win32-dll
0147 
0148 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
0149 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
0150 _LT_SET_OPTION([LT_INIT], [win32-dll])
0151 AC_DIAGNOSE([obsolete],
0152 [$0: Remove this warning and the call to _LT_SET_OPTION when you
0153 put the 'win32-dll' option into LT_INIT's first parameter.])
0154 ])
0155 
0156 dnl aclocal-1.4 backwards compatibility:
0157 dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
0158 
0159 
0160 # _LT_ENABLE_SHARED([DEFAULT])
0161 # ----------------------------
0162 # implement the --enable-shared flag, and supports the 'shared' and
0163 # 'disable-shared' LT_INIT options.
0164 # DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
0165 m4_define([_LT_ENABLE_SHARED],
0166 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
0167 AC_ARG_ENABLE([shared],
0168     [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
0169         [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
0170     [p=${PACKAGE-default}
0171     case $enableval in
0172     yes) enable_shared=yes ;;
0173     no) enable_shared=no ;;
0174     *)
0175       enable_shared=no
0176       # Look at the argument we got.  We use all the common list separators.
0177       lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
0178       for pkg in $enableval; do
0179         IFS=$lt_save_ifs
0180         if test "X$pkg" = "X$p"; then
0181           enable_shared=yes
0182         fi
0183       done
0184       IFS=$lt_save_ifs
0185       ;;
0186     esac],
0187     [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
0188 
0189     _LT_DECL([build_libtool_libs], [enable_shared], [0],
0190         [Whether or not to build shared libraries])
0191 ])# _LT_ENABLE_SHARED
0192 
0193 LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
0194 LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
0195 
0196 # Old names:
0197 AC_DEFUN([AC_ENABLE_SHARED],
0198 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
0199 ])
0200 
0201 AC_DEFUN([AC_DISABLE_SHARED],
0202 [_LT_SET_OPTION([LT_INIT], [disable-shared])
0203 ])
0204 
0205 AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
0206 AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
0207 
0208 dnl aclocal-1.4 backwards compatibility:
0209 dnl AC_DEFUN([AM_ENABLE_SHARED], [])
0210 dnl AC_DEFUN([AM_DISABLE_SHARED], [])
0211 
0212 
0213 
0214 # _LT_ENABLE_STATIC([DEFAULT])
0215 # ----------------------------
0216 # implement the --enable-static flag, and support the 'static' and
0217 # 'disable-static' LT_INIT options.
0218 # DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
0219 m4_define([_LT_ENABLE_STATIC],
0220 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
0221 AC_ARG_ENABLE([static],
0222     [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
0223         [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
0224     [p=${PACKAGE-default}
0225     case $enableval in
0226     yes) enable_static=yes ;;
0227     no) enable_static=no ;;
0228     *)
0229      enable_static=no
0230       # Look at the argument we got.  We use all the common list separators.
0231       lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
0232       for pkg in $enableval; do
0233         IFS=$lt_save_ifs
0234         if test "X$pkg" = "X$p"; then
0235           enable_static=yes
0236         fi
0237       done
0238       IFS=$lt_save_ifs
0239       ;;
0240     esac],
0241     [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
0242 
0243     _LT_DECL([build_old_libs], [enable_static], [0],
0244         [Whether or not to build static libraries])
0245 ])# _LT_ENABLE_STATIC
0246 
0247 LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
0248 LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
0249 
0250 # Old names:
0251 AC_DEFUN([AC_ENABLE_STATIC],
0252 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
0253 ])
0254 
0255 AC_DEFUN([AC_DISABLE_STATIC],
0256 [_LT_SET_OPTION([LT_INIT], [disable-static])
0257 ])
0258 
0259 AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
0260 AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
0261 
0262 dnl aclocal-1.4 backwards compatibility:
0263 dnl AC_DEFUN([AM_ENABLE_STATIC], [])
0264 dnl AC_DEFUN([AM_DISABLE_STATIC], [])
0265 
0266 
0267 
0268 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
0269 # ----------------------------------
0270 # implement the --enable-fast-install flag, and support the 'fast-install'
0271 # and 'disable-fast-install' LT_INIT options.
0272 # DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
0273 m4_define([_LT_ENABLE_FAST_INSTALL],
0274 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
0275 AC_ARG_ENABLE([fast-install],
0276     [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
0277     [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
0278     [p=${PACKAGE-default}
0279     case $enableval in
0280     yes) enable_fast_install=yes ;;
0281     no) enable_fast_install=no ;;
0282     *)
0283       enable_fast_install=no
0284       # Look at the argument we got.  We use all the common list separators.
0285       lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
0286       for pkg in $enableval; do
0287         IFS=$lt_save_ifs
0288         if test "X$pkg" = "X$p"; then
0289           enable_fast_install=yes
0290         fi
0291       done
0292       IFS=$lt_save_ifs
0293       ;;
0294     esac],
0295     [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
0296 
0297 _LT_DECL([fast_install], [enable_fast_install], [0],
0298          [Whether or not to optimize for fast installation])dnl
0299 ])# _LT_ENABLE_FAST_INSTALL
0300 
0301 LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
0302 LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
0303 
0304 # Old names:
0305 AU_DEFUN([AC_ENABLE_FAST_INSTALL],
0306 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
0307 AC_DIAGNOSE([obsolete],
0308 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
0309 the 'fast-install' option into LT_INIT's first parameter.])
0310 ])
0311 
0312 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
0313 [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
0314 AC_DIAGNOSE([obsolete],
0315 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
0316 the 'disable-fast-install' option into LT_INIT's first parameter.])
0317 ])
0318 
0319 dnl aclocal-1.4 backwards compatibility:
0320 dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
0321 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
0322 
0323 
0324 # _LT_WITH_AIX_SONAME([DEFAULT])
0325 # ----------------------------------
0326 # implement the --with-aix-soname flag, and support the `aix-soname=aix'
0327 # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
0328 # is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
0329 m4_define([_LT_WITH_AIX_SONAME],
0330 [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
0331 shared_archive_member_spec=
0332 case $host,$enable_shared in
0333 power*-*-aix[[5-9]]*,yes)
0334   AC_MSG_CHECKING([which variant of shared library versioning to provide])
0335   AC_ARG_WITH([aix-soname],
0336     [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
0337       [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
0338     [case $withval in
0339     aix|svr4|both)
0340       ;;
0341     *)
0342       AC_MSG_ERROR([Unknown argument to --with-aix-soname])
0343       ;;
0344     esac
0345     lt_cv_with_aix_soname=$with_aix_soname],
0346     [AC_CACHE_VAL([lt_cv_with_aix_soname],
0347       [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
0348     with_aix_soname=$lt_cv_with_aix_soname])
0349   AC_MSG_RESULT([$with_aix_soname])
0350   if test aix != "$with_aix_soname"; then
0351     # For the AIX way of multilib, we name the shared archive member
0352     # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
0353     # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
0354     # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
0355     # the AIX toolchain works better with OBJECT_MODE set (default 32).
0356     if test 64 = "${OBJECT_MODE-32}"; then
0357       shared_archive_member_spec=shr_64
0358     else
0359       shared_archive_member_spec=shr
0360     fi
0361   fi
0362   ;;
0363 *)
0364   with_aix_soname=aix
0365   ;;
0366 esac
0367 
0368 _LT_DECL([], [shared_archive_member_spec], [0],
0369     [Shared archive member basename, for filename based shared library versioning on AIX])dnl
0370 ])# _LT_WITH_AIX_SONAME
0371 
0372 LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
0373 LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
0374 LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
0375 
0376 
0377 # _LT_WITH_PIC([MODE])
0378 # --------------------
0379 # implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
0380 # LT_INIT options.
0381 # MODE is either 'yes' or 'no'.  If omitted, it defaults to 'both'.
0382 m4_define([_LT_WITH_PIC],
0383 [AC_ARG_WITH([pic],
0384     [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
0385         [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
0386     [lt_p=${PACKAGE-default}
0387     case $withval in
0388     yes|no) pic_mode=$withval ;;
0389     *)
0390       pic_mode=default
0391       # Look at the argument we got.  We use all the common list separators.
0392       lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
0393       for lt_pkg in $withval; do
0394         IFS=$lt_save_ifs
0395         if test "X$lt_pkg" = "X$lt_p"; then
0396           pic_mode=yes
0397         fi
0398       done
0399       IFS=$lt_save_ifs
0400       ;;
0401     esac],
0402     [pic_mode=m4_default([$1], [default])])
0403 
0404 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
0405 ])# _LT_WITH_PIC
0406 
0407 LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
0408 LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
0409 
0410 # Old name:
0411 AU_DEFUN([AC_LIBTOOL_PICMODE],
0412 [_LT_SET_OPTION([LT_INIT], [pic-only])
0413 AC_DIAGNOSE([obsolete],
0414 [$0: Remove this warning and the call to _LT_SET_OPTION when you
0415 put the 'pic-only' option into LT_INIT's first parameter.])
0416 ])
0417 
0418 dnl aclocal-1.4 backwards compatibility:
0419 dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
0420 
0421 ## ----------------- ##
0422 ## LTDL_INIT Options ##
0423 ## ----------------- ##
0424 
0425 m4_define([_LTDL_MODE], [])
0426 LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
0427                  [m4_define([_LTDL_MODE], [nonrecursive])])
0428 LT_OPTION_DEFINE([LTDL_INIT], [recursive],
0429                  [m4_define([_LTDL_MODE], [recursive])])
0430 LT_OPTION_DEFINE([LTDL_INIT], [subproject],
0431                  [m4_define([_LTDL_MODE], [subproject])])
0432 
0433 m4_define([_LTDL_TYPE], [])
0434 LT_OPTION_DEFINE([LTDL_INIT], [installable],
0435                  [m4_define([_LTDL_TYPE], [installable])])
0436 LT_OPTION_DEFINE([LTDL_INIT], [convenience],
0437                  [m4_define([_LTDL_TYPE], [convenience])])