1706f2543Smrg# Helper functions for option handling. -*- Autoconf -*- 2706f2543Smrg# 3706f2543Smrg# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, 4706f2543Smrg# Inc. 5706f2543Smrg# Written by Gary V. Vaughan, 2004 6706f2543Smrg# 7706f2543Smrg# This file is free software; the Free Software Foundation gives 8706f2543Smrg# unlimited permission to copy and/or distribute it, with or without 9706f2543Smrg# modifications, as long as this notice is preserved. 10706f2543Smrg 11706f2543Smrg# serial 7 ltoptions.m4 12706f2543Smrg 13706f2543Smrg# This is to help aclocal find these macros, as it can't see m4_define. 14706f2543SmrgAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15706f2543Smrg 16706f2543Smrg 17706f2543Smrg# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18706f2543Smrg# ------------------------------------------ 19706f2543Smrgm4_define([_LT_MANGLE_OPTION], 20706f2543Smrg[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21706f2543Smrg 22706f2543Smrg 23706f2543Smrg# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24706f2543Smrg# --------------------------------------- 25706f2543Smrg# Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26706f2543Smrg# matching handler defined, dispatch to it. Other OPTION-NAMEs are 27706f2543Smrg# saved as a flag. 28706f2543Smrgm4_define([_LT_SET_OPTION], 29706f2543Smrg[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30706f2543Smrgm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31706f2543Smrg _LT_MANGLE_DEFUN([$1], [$2]), 32706f2543Smrg [m4_warning([Unknown $1 option `$2'])])[]dnl 33706f2543Smrg]) 34706f2543Smrg 35706f2543Smrg 36706f2543Smrg# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37706f2543Smrg# ------------------------------------------------------------ 38706f2543Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39706f2543Smrgm4_define([_LT_IF_OPTION], 40706f2543Smrg[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41706f2543Smrg 42706f2543Smrg 43706f2543Smrg# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44706f2543Smrg# ------------------------------------------------------- 45706f2543Smrg# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46706f2543Smrg# are set. 47706f2543Smrgm4_define([_LT_UNLESS_OPTIONS], 48706f2543Smrg[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49706f2543Smrg [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50706f2543Smrg [m4_define([$0_found])])])[]dnl 51706f2543Smrgm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52706f2543Smrg])[]dnl 53706f2543Smrg]) 54706f2543Smrg 55706f2543Smrg 56706f2543Smrg# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57706f2543Smrg# ---------------------------------------- 58706f2543Smrg# OPTION-LIST is a space-separated list of Libtool options associated 59706f2543Smrg# with MACRO-NAME. If any OPTION has a matching handler declared with 60706f2543Smrg# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61706f2543Smrg# the unknown option and exit. 62706f2543Smrgm4_defun([_LT_SET_OPTIONS], 63706f2543Smrg[# Set options 64706f2543Smrgm4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65706f2543Smrg [_LT_SET_OPTION([$1], _LT_Option)]) 66706f2543Smrg 67706f2543Smrgm4_if([$1],[LT_INIT],[ 68706f2543Smrg dnl 69706f2543Smrg dnl Simply set some default values (i.e off) if boolean options were not 70706f2543Smrg dnl specified: 71706f2543Smrg _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72706f2543Smrg ]) 73706f2543Smrg _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74706f2543Smrg ]) 75706f2543Smrg dnl 76706f2543Smrg dnl If no reference was made to various pairs of opposing options, then 77706f2543Smrg dnl we run the default mode handler for the pair. For example, if neither 78706f2543Smrg dnl `shared' nor `disable-shared' was passed, we enable building of shared 79706f2543Smrg dnl archives by default: 80706f2543Smrg _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81706f2543Smrg _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82706f2543Smrg _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83706f2543Smrg _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84706f2543Smrg [_LT_ENABLE_FAST_INSTALL]) 85706f2543Smrg ]) 86706f2543Smrg])# _LT_SET_OPTIONS 87706f2543Smrg 88706f2543Smrg 89706f2543Smrg## --------------------------------- ## 90706f2543Smrg## Macros to handle LT_INIT options. ## 91706f2543Smrg## --------------------------------- ## 92706f2543Smrg 93706f2543Smrg# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 94706f2543Smrg# ----------------------------------------- 95706f2543Smrgm4_define([_LT_MANGLE_DEFUN], 96706f2543Smrg[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 97706f2543Smrg 98706f2543Smrg 99706f2543Smrg# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 100706f2543Smrg# ----------------------------------------------- 101706f2543Smrgm4_define([LT_OPTION_DEFINE], 102706f2543Smrg[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 103706f2543Smrg])# LT_OPTION_DEFINE 104706f2543Smrg 105706f2543Smrg 106706f2543Smrg# dlopen 107706f2543Smrg# ------ 108706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 109706f2543Smrg]) 110706f2543Smrg 111706f2543SmrgAU_DEFUN([AC_LIBTOOL_DLOPEN], 112706f2543Smrg[_LT_SET_OPTION([LT_INIT], [dlopen]) 113706f2543SmrgAC_DIAGNOSE([obsolete], 114706f2543Smrg[$0: Remove this warning and the call to _LT_SET_OPTION when you 115706f2543Smrgput the `dlopen' option into LT_INIT's first parameter.]) 116706f2543Smrg]) 117706f2543Smrg 118706f2543Smrgdnl aclocal-1.4 backwards compatibility: 119706f2543Smrgdnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 120706f2543Smrg 121706f2543Smrg 122706f2543Smrg# win32-dll 123706f2543Smrg# --------- 124706f2543Smrg# Declare package support for building win32 dll's. 125706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [win32-dll], 126706f2543Smrg[enable_win32_dll=yes 127706f2543Smrg 128706f2543Smrgcase $host in 129706f2543Smrg*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 130706f2543Smrg AC_CHECK_TOOL(AS, as, false) 131706f2543Smrg AC_CHECK_TOOL(DLLTOOL, dlltool, false) 132706f2543Smrg AC_CHECK_TOOL(OBJDUMP, objdump, false) 133706f2543Smrg ;; 134706f2543Smrgesac 135706f2543Smrg 136706f2543Smrgtest -z "$AS" && AS=as 137706f2543Smrg_LT_DECL([], [AS], [1], [Assembler program])dnl 138706f2543Smrg 139706f2543Smrgtest -z "$DLLTOOL" && DLLTOOL=dlltool 140706f2543Smrg_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 141706f2543Smrg 142706f2543Smrgtest -z "$OBJDUMP" && OBJDUMP=objdump 143706f2543Smrg_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 144706f2543Smrg])# win32-dll 145706f2543Smrg 146706f2543SmrgAU_DEFUN([AC_LIBTOOL_WIN32_DLL], 147706f2543Smrg[AC_REQUIRE([AC_CANONICAL_HOST])dnl 148706f2543Smrg_LT_SET_OPTION([LT_INIT], [win32-dll]) 149706f2543SmrgAC_DIAGNOSE([obsolete], 150706f2543Smrg[$0: Remove this warning and the call to _LT_SET_OPTION when you 151706f2543Smrgput the `win32-dll' option into LT_INIT's first parameter.]) 152706f2543Smrg]) 153706f2543Smrg 154706f2543Smrgdnl aclocal-1.4 backwards compatibility: 155706f2543Smrgdnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 156706f2543Smrg 157706f2543Smrg 158706f2543Smrg# _LT_ENABLE_SHARED([DEFAULT]) 159706f2543Smrg# ---------------------------- 160706f2543Smrg# implement the --enable-shared flag, and supports the `shared' and 161706f2543Smrg# `disable-shared' LT_INIT options. 162706f2543Smrg# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 163706f2543Smrgm4_define([_LT_ENABLE_SHARED], 164706f2543Smrg[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 165706f2543SmrgAC_ARG_ENABLE([shared], 166706f2543Smrg [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 167706f2543Smrg [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 168706f2543Smrg [p=${PACKAGE-default} 169706f2543Smrg case $enableval in 170706f2543Smrg yes) enable_shared=yes ;; 171706f2543Smrg no) enable_shared=no ;; 172706f2543Smrg *) 173706f2543Smrg enable_shared=no 174706f2543Smrg # Look at the argument we got. We use all the common list separators. 175706f2543Smrg lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 176706f2543Smrg for pkg in $enableval; do 177706f2543Smrg IFS="$lt_save_ifs" 178706f2543Smrg if test "X$pkg" = "X$p"; then 179706f2543Smrg enable_shared=yes 180706f2543Smrg fi 181706f2543Smrg done 182706f2543Smrg IFS="$lt_save_ifs" 183706f2543Smrg ;; 184706f2543Smrg esac], 185706f2543Smrg [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 186706f2543Smrg 187706f2543Smrg _LT_DECL([build_libtool_libs], [enable_shared], [0], 188706f2543Smrg [Whether or not to build shared libraries]) 189706f2543Smrg])# _LT_ENABLE_SHARED 190706f2543Smrg 191706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 192706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 193706f2543Smrg 194706f2543Smrg# Old names: 195706f2543SmrgAC_DEFUN([AC_ENABLE_SHARED], 196706f2543Smrg[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 197706f2543Smrg]) 198706f2543Smrg 199706f2543SmrgAC_DEFUN([AC_DISABLE_SHARED], 200706f2543Smrg[_LT_SET_OPTION([LT_INIT], [disable-shared]) 201706f2543Smrg]) 202706f2543Smrg 203706f2543SmrgAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 204706f2543SmrgAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 205706f2543Smrg 206706f2543Smrgdnl aclocal-1.4 backwards compatibility: 207706f2543Smrgdnl AC_DEFUN([AM_ENABLE_SHARED], []) 208706f2543Smrgdnl AC_DEFUN([AM_DISABLE_SHARED], []) 209706f2543Smrg 210706f2543Smrg 211706f2543Smrg 212706f2543Smrg# _LT_ENABLE_STATIC([DEFAULT]) 213706f2543Smrg# ---------------------------- 214706f2543Smrg# implement the --enable-static flag, and support the `static' and 215706f2543Smrg# `disable-static' LT_INIT options. 216706f2543Smrg# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 217706f2543Smrgm4_define([_LT_ENABLE_STATIC], 218706f2543Smrg[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 219706f2543SmrgAC_ARG_ENABLE([static], 220706f2543Smrg [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 221706f2543Smrg [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 222706f2543Smrg [p=${PACKAGE-default} 223706f2543Smrg case $enableval in 224706f2543Smrg yes) enable_static=yes ;; 225706f2543Smrg no) enable_static=no ;; 226706f2543Smrg *) 227706f2543Smrg enable_static=no 228706f2543Smrg # Look at the argument we got. We use all the common list separators. 229706f2543Smrg lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 230706f2543Smrg for pkg in $enableval; do 231706f2543Smrg IFS="$lt_save_ifs" 232706f2543Smrg if test "X$pkg" = "X$p"; then 233706f2543Smrg enable_static=yes 234706f2543Smrg fi 235706f2543Smrg done 236706f2543Smrg IFS="$lt_save_ifs" 237706f2543Smrg ;; 238706f2543Smrg esac], 239706f2543Smrg [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 240706f2543Smrg 241706f2543Smrg _LT_DECL([build_old_libs], [enable_static], [0], 242706f2543Smrg [Whether or not to build static libraries]) 243706f2543Smrg])# _LT_ENABLE_STATIC 244706f2543Smrg 245706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 246706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 247706f2543Smrg 248706f2543Smrg# Old names: 249706f2543SmrgAC_DEFUN([AC_ENABLE_STATIC], 250706f2543Smrg[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 251706f2543Smrg]) 252706f2543Smrg 253706f2543SmrgAC_DEFUN([AC_DISABLE_STATIC], 254706f2543Smrg[_LT_SET_OPTION([LT_INIT], [disable-static]) 255706f2543Smrg]) 256706f2543Smrg 257706f2543SmrgAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 258706f2543SmrgAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 259706f2543Smrg 260706f2543Smrgdnl aclocal-1.4 backwards compatibility: 261706f2543Smrgdnl AC_DEFUN([AM_ENABLE_STATIC], []) 262706f2543Smrgdnl AC_DEFUN([AM_DISABLE_STATIC], []) 263706f2543Smrg 264706f2543Smrg 265706f2543Smrg 266706f2543Smrg# _LT_ENABLE_FAST_INSTALL([DEFAULT]) 267706f2543Smrg# ---------------------------------- 268706f2543Smrg# implement the --enable-fast-install flag, and support the `fast-install' 269706f2543Smrg# and `disable-fast-install' LT_INIT options. 270706f2543Smrg# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 271706f2543Smrgm4_define([_LT_ENABLE_FAST_INSTALL], 272706f2543Smrg[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 273706f2543SmrgAC_ARG_ENABLE([fast-install], 274706f2543Smrg [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 275706f2543Smrg [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 276706f2543Smrg [p=${PACKAGE-default} 277706f2543Smrg case $enableval in 278706f2543Smrg yes) enable_fast_install=yes ;; 279706f2543Smrg no) enable_fast_install=no ;; 280706f2543Smrg *) 281706f2543Smrg enable_fast_install=no 282706f2543Smrg # Look at the argument we got. We use all the common list separators. 283706f2543Smrg lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 284706f2543Smrg for pkg in $enableval; do 285706f2543Smrg IFS="$lt_save_ifs" 286706f2543Smrg if test "X$pkg" = "X$p"; then 287706f2543Smrg enable_fast_install=yes 288706f2543Smrg fi 289706f2543Smrg done 290706f2543Smrg IFS="$lt_save_ifs" 291706f2543Smrg ;; 292706f2543Smrg esac], 293706f2543Smrg [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 294706f2543Smrg 295706f2543Smrg_LT_DECL([fast_install], [enable_fast_install], [0], 296706f2543Smrg [Whether or not to optimize for fast installation])dnl 297706f2543Smrg])# _LT_ENABLE_FAST_INSTALL 298706f2543Smrg 299706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 300706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 301706f2543Smrg 302706f2543Smrg# Old names: 303706f2543SmrgAU_DEFUN([AC_ENABLE_FAST_INSTALL], 304706f2543Smrg[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 305706f2543SmrgAC_DIAGNOSE([obsolete], 306706f2543Smrg[$0: Remove this warning and the call to _LT_SET_OPTION when you put 307706f2543Smrgthe `fast-install' option into LT_INIT's first parameter.]) 308706f2543Smrg]) 309706f2543Smrg 310706f2543SmrgAU_DEFUN([AC_DISABLE_FAST_INSTALL], 311706f2543Smrg[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 312706f2543SmrgAC_DIAGNOSE([obsolete], 313706f2543Smrg[$0: Remove this warning and the call to _LT_SET_OPTION when you put 314706f2543Smrgthe `disable-fast-install' option into LT_INIT's first parameter.]) 315706f2543Smrg]) 316706f2543Smrg 317706f2543Smrgdnl aclocal-1.4 backwards compatibility: 318706f2543Smrgdnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 319706f2543Smrgdnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 320706f2543Smrg 321706f2543Smrg 322706f2543Smrg# _LT_WITH_PIC([MODE]) 323706f2543Smrg# -------------------- 324706f2543Smrg# implement the --with-pic flag, and support the `pic-only' and `no-pic' 325706f2543Smrg# LT_INIT options. 326706f2543Smrg# MODE is either `yes' or `no'. If omitted, it defaults to `both'. 327706f2543Smrgm4_define([_LT_WITH_PIC], 328706f2543Smrg[AC_ARG_WITH([pic], 329706f2543Smrg [AS_HELP_STRING([--with-pic], 330706f2543Smrg [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 331706f2543Smrg [pic_mode="$withval"], 332706f2543Smrg [pic_mode=default]) 333706f2543Smrg 334706f2543Smrgtest -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 335706f2543Smrg 336706f2543Smrg_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 337706f2543Smrg])# _LT_WITH_PIC 338706f2543Smrg 339706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 340706f2543SmrgLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 341706f2543Smrg 342706f2543Smrg# Old name: 343706f2543SmrgAU_DEFUN([AC_LIBTOOL_PICMODE], 344706f2543Smrg[_LT_SET_OPTION([LT_INIT], [pic-only]) 345706f2543SmrgAC_DIAGNOSE([obsolete], 346706f2543Smrg[$0: Remove this warning and the call to _LT_SET_OPTION when you 347706f2543Smrgput the `pic-only' option into LT_INIT's first parameter.]) 348706f2543Smrg]) 349706f2543Smrg 350706f2543Smrgdnl aclocal-1.4 backwards compatibility: 351706f2543Smrgdnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 352706f2543Smrg 353706f2543Smrg## ----------------- ## 354706f2543Smrg## LTDL_INIT Options ## 355706f2543Smrg## ----------------- ## 356706f2543Smrg 357706f2543Smrgm4_define([_LTDL_MODE], []) 358706f2543SmrgLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 359706f2543Smrg [m4_define([_LTDL_MODE], [nonrecursive])]) 360706f2543SmrgLT_OPTION_DEFINE([LTDL_INIT], [recursive], 361706f2543Smrg [m4_define([_LTDL_MODE], [recursive])]) 362706f2543SmrgLT_OPTION_DEFINE([LTDL_INIT], [subproject], 363706f2543Smrg [m4_define([_LTDL_MODE], [subproject])]) 364706f2543Smrg 365706f2543Smrgm4_define([_LTDL_TYPE], []) 366706f2543SmrgLT_OPTION_DEFINE([LTDL_INIT], [installable], 367706f2543Smrg [m4_define([_LTDL_TYPE], [installable])]) 368706f2543SmrgLT_OPTION_DEFINE([LTDL_INIT], [convenience], 369706f2543Smrg [m4_define([_LTDL_TYPE], [convenience])]) 370