1275970Scy# Helper functions for option handling. -*- Autoconf -*- 2275970Scy# 3275970Scy# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, 4275970Scy# Inc. 5275970Scy# Written by Gary V. Vaughan, 2004 6275970Scy# 7275970Scy# This file is free software; the Free Software Foundation gives 8275970Scy# unlimited permission to copy and/or distribute it, with or without 9275970Scy# modifications, as long as this notice is preserved. 10275970Scy 11275970Scy# serial 7 ltoptions.m4 12275970Scy 13275970Scy# This is to help aclocal find these macros, as it can't see m4_define. 14275970ScyAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15275970Scy 16275970Scy 17275970Scy# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18275970Scy# ------------------------------------------ 19275970Scym4_define([_LT_MANGLE_OPTION], 20275970Scy[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21275970Scy 22275970Scy 23275970Scy# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24275970Scy# --------------------------------------- 25275970Scy# Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26275970Scy# matching handler defined, dispatch to it. Other OPTION-NAMEs are 27275970Scy# saved as a flag. 28275970Scym4_define([_LT_SET_OPTION], 29275970Scy[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30275970Scym4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31275970Scy _LT_MANGLE_DEFUN([$1], [$2]), 32275970Scy [m4_warning([Unknown $1 option `$2'])])[]dnl 33275970Scy]) 34275970Scy 35275970Scy 36275970Scy# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37275970Scy# ------------------------------------------------------------ 38275970Scy# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39275970Scym4_define([_LT_IF_OPTION], 40275970Scy[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41275970Scy 42275970Scy 43275970Scy# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44275970Scy# ------------------------------------------------------- 45275970Scy# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46275970Scy# are set. 47275970Scym4_define([_LT_UNLESS_OPTIONS], 48275970Scy[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49275970Scy [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50275970Scy [m4_define([$0_found])])])[]dnl 51275970Scym4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52275970Scy])[]dnl 53275970Scy]) 54275970Scy 55275970Scy 56275970Scy# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57275970Scy# ---------------------------------------- 58275970Scy# OPTION-LIST is a space-separated list of Libtool options associated 59275970Scy# with MACRO-NAME. If any OPTION has a matching handler declared with 60275970Scy# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61275970Scy# the unknown option and exit. 62275970Scym4_defun([_LT_SET_OPTIONS], 63275970Scy[# Set options 64275970Scym4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65275970Scy [_LT_SET_OPTION([$1], _LT_Option)]) 66275970Scy 67275970Scym4_if([$1],[LT_INIT],[ 68275970Scy dnl 69275970Scy dnl Simply set some default values (i.e off) if boolean options were not 70275970Scy dnl specified: 71275970Scy _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72275970Scy ]) 73275970Scy _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74275970Scy ]) 75275970Scy dnl 76275970Scy dnl If no reference was made to various pairs of opposing options, then 77275970Scy dnl we run the default mode handler for the pair. For example, if neither 78275970Scy dnl `shared' nor `disable-shared' was passed, we enable building of shared 79275970Scy dnl archives by default: 80275970Scy _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81275970Scy _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82275970Scy _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83275970Scy _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84275970Scy [_LT_ENABLE_FAST_INSTALL]) 85275970Scy ]) 86275970Scy])# _LT_SET_OPTIONS 87275970Scy 88275970Scy 89275970Scy## --------------------------------- ## 90275970Scy## Macros to handle LT_INIT options. ## 91275970Scy## --------------------------------- ## 92275970Scy 93275970Scy# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 94275970Scy# ----------------------------------------- 95275970Scym4_define([_LT_MANGLE_DEFUN], 96275970Scy[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 97275970Scy 98275970Scy 99275970Scy# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 100275970Scy# ----------------------------------------------- 101275970Scym4_define([LT_OPTION_DEFINE], 102275970Scy[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 103275970Scy])# LT_OPTION_DEFINE 104275970Scy 105275970Scy 106275970Scy# dlopen 107275970Scy# ------ 108275970ScyLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 109275970Scy]) 110275970Scy 111275970ScyAU_DEFUN([AC_LIBTOOL_DLOPEN], 112275970Scy[_LT_SET_OPTION([LT_INIT], [dlopen]) 113275970ScyAC_DIAGNOSE([obsolete], 114275970Scy[$0: Remove this warning and the call to _LT_SET_OPTION when you 115275970Scyput the `dlopen' option into LT_INIT's first parameter.]) 116275970Scy]) 117275970Scy 118275970Scydnl aclocal-1.4 backwards compatibility: 119275970Scydnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 120275970Scy 121275970Scy 122275970Scy# win32-dll 123275970Scy# --------- 124275970Scy# Declare package support for building win32 dll's. 125275970ScyLT_OPTION_DEFINE([LT_INIT], [win32-dll], 126275970Scy[enable_win32_dll=yes 127275970Scy 128275970Scycase $host in 129275970Scy*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 130275970Scy AC_CHECK_TOOL(AS, as, false) 131275970Scy AC_CHECK_TOOL(DLLTOOL, dlltool, false) 132275970Scy AC_CHECK_TOOL(OBJDUMP, objdump, false) 133275970Scy ;; 134275970Scyesac 135275970Scy 136275970Scytest -z "$AS" && AS=as 137275970Scy_LT_DECL([], [AS], [1], [Assembler program])dnl 138275970Scy 139275970Scytest -z "$DLLTOOL" && DLLTOOL=dlltool 140275970Scy_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 141275970Scy 142275970Scytest -z "$OBJDUMP" && OBJDUMP=objdump 143275970Scy_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 144275970Scy])# win32-dll 145275970Scy 146275970ScyAU_DEFUN([AC_LIBTOOL_WIN32_DLL], 147275970Scy[AC_REQUIRE([AC_CANONICAL_HOST])dnl 148275970Scy_LT_SET_OPTION([LT_INIT], [win32-dll]) 149275970ScyAC_DIAGNOSE([obsolete], 150275970Scy[$0: Remove this warning and the call to _LT_SET_OPTION when you 151275970Scyput the `win32-dll' option into LT_INIT's first parameter.]) 152275970Scy]) 153275970Scy 154275970Scydnl aclocal-1.4 backwards compatibility: 155275970Scydnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 156275970Scy 157275970Scy 158275970Scy# _LT_ENABLE_SHARED([DEFAULT]) 159275970Scy# ---------------------------- 160275970Scy# implement the --enable-shared flag, and supports the `shared' and 161275970Scy# `disable-shared' LT_INIT options. 162275970Scy# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 163275970Scym4_define([_LT_ENABLE_SHARED], 164275970Scy[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 165275970ScyAC_ARG_ENABLE([shared], 166275970Scy [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 167275970Scy [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 168275970Scy [p=${PACKAGE-default} 169275970Scy case $enableval in 170275970Scy yes) enable_shared=yes ;; 171275970Scy no) enable_shared=no ;; 172275970Scy *) 173275970Scy enable_shared=no 174275970Scy # Look at the argument we got. We use all the common list separators. 175275970Scy lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 176275970Scy for pkg in $enableval; do 177275970Scy IFS="$lt_save_ifs" 178275970Scy if test "X$pkg" = "X$p"; then 179275970Scy enable_shared=yes 180275970Scy fi 181275970Scy done 182275970Scy IFS="$lt_save_ifs" 183275970Scy ;; 184275970Scy esac], 185275970Scy [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 186275970Scy 187275970Scy _LT_DECL([build_libtool_libs], [enable_shared], [0], 188275970Scy [Whether or not to build shared libraries]) 189275970Scy])# _LT_ENABLE_SHARED 190275970Scy 191275970ScyLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 192275970ScyLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 193275970Scy 194275970Scy# Old names: 195275970ScyAC_DEFUN([AC_ENABLE_SHARED], 196275970Scy[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 197275970Scy]) 198275970Scy 199275970ScyAC_DEFUN([AC_DISABLE_SHARED], 200275970Scy[_LT_SET_OPTION([LT_INIT], [disable-shared]) 201275970Scy]) 202275970Scy 203275970ScyAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 204275970ScyAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 205275970Scy 206275970Scydnl aclocal-1.4 backwards compatibility: 207275970Scydnl AC_DEFUN([AM_ENABLE_SHARED], []) 208275970Scydnl AC_DEFUN([AM_DISABLE_SHARED], []) 209275970Scy 210275970Scy 211275970Scy 212275970Scy# _LT_ENABLE_STATIC([DEFAULT]) 213275970Scy# ---------------------------- 214275970Scy# implement the --enable-static flag, and support the `static' and 215275970Scy# `disable-static' LT_INIT options. 216275970Scy# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 217275970Scym4_define([_LT_ENABLE_STATIC], 218275970Scy[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 219275970ScyAC_ARG_ENABLE([static], 220275970Scy [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 221275970Scy [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 222275970Scy [p=${PACKAGE-default} 223275970Scy case $enableval in 224275970Scy yes) enable_static=yes ;; 225275970Scy no) enable_static=no ;; 226275970Scy *) 227275970Scy enable_static=no 228275970Scy # Look at the argument we got. We use all the common list separators. 229275970Scy lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 230275970Scy for pkg in $enableval; do 231275970Scy IFS="$lt_save_ifs" 232275970Scy if test "X$pkg" = "X$p"; then 233275970Scy enable_static=yes 234275970Scy fi 235275970Scy done 236275970Scy IFS="$lt_save_ifs" 237275970Scy ;; 238275970Scy esac], 239275970Scy [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 240275970Scy 241275970Scy _LT_DECL([build_old_libs], [enable_static], [0], 242275970Scy [Whether or not to build static libraries]) 243275970Scy])# _LT_ENABLE_STATIC 244275970Scy 245275970ScyLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 246275970ScyLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 247275970Scy 248275970Scy# Old names: 249275970ScyAC_DEFUN([AC_ENABLE_STATIC], 250275970Scy[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 251275970Scy]) 252275970Scy 253275970ScyAC_DEFUN([AC_DISABLE_STATIC], 254275970Scy[_LT_SET_OPTION([LT_INIT], [disable-static]) 255275970Scy]) 256275970Scy 257275970ScyAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 258275970ScyAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 259275970Scy 260275970Scydnl aclocal-1.4 backwards compatibility: 261275970Scydnl AC_DEFUN([AM_ENABLE_STATIC], []) 262275970Scydnl AC_DEFUN([AM_DISABLE_STATIC], []) 263275970Scy 264275970Scy 265275970Scy 266275970Scy# _LT_ENABLE_FAST_INSTALL([DEFAULT]) 267275970Scy# ---------------------------------- 268275970Scy# implement the --enable-fast-install flag, and support the `fast-install' 269275970Scy# and `disable-fast-install' LT_INIT options. 270275970Scy# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 271275970Scym4_define([_LT_ENABLE_FAST_INSTALL], 272275970Scy[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 273275970ScyAC_ARG_ENABLE([fast-install], 274275970Scy [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 275275970Scy [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 276275970Scy [p=${PACKAGE-default} 277275970Scy case $enableval in 278275970Scy yes) enable_fast_install=yes ;; 279275970Scy no) enable_fast_install=no ;; 280275970Scy *) 281275970Scy enable_fast_install=no 282275970Scy # Look at the argument we got. We use all the common list separators. 283275970Scy lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 284275970Scy for pkg in $enableval; do 285275970Scy IFS="$lt_save_ifs" 286275970Scy if test "X$pkg" = "X$p"; then 287275970Scy enable_fast_install=yes 288275970Scy fi 289275970Scy done 290275970Scy IFS="$lt_save_ifs" 291275970Scy ;; 292275970Scy esac], 293275970Scy [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 294275970Scy 295275970Scy_LT_DECL([fast_install], [enable_fast_install], [0], 296275970Scy [Whether or not to optimize for fast installation])dnl 297275970Scy])# _LT_ENABLE_FAST_INSTALL 298275970Scy 299275970ScyLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 300275970ScyLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 301275970Scy 302275970Scy# Old names: 303275970ScyAU_DEFUN([AC_ENABLE_FAST_INSTALL], 304275970Scy[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 305275970ScyAC_DIAGNOSE([obsolete], 306275970Scy[$0: Remove this warning and the call to _LT_SET_OPTION when you put 307275970Scythe `fast-install' option into LT_INIT's first parameter.]) 308275970Scy]) 309275970Scy 310275970ScyAU_DEFUN([AC_DISABLE_FAST_INSTALL], 311275970Scy[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 312275970ScyAC_DIAGNOSE([obsolete], 313275970Scy[$0: Remove this warning and the call to _LT_SET_OPTION when you put 314275970Scythe `disable-fast-install' option into LT_INIT's first parameter.]) 315275970Scy]) 316275970Scy 317275970Scydnl aclocal-1.4 backwards compatibility: 318275970Scydnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 319275970Scydnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 320275970Scy 321275970Scy 322275970Scy# _LT_WITH_PIC([MODE]) 323275970Scy# -------------------- 324275970Scy# implement the --with-pic flag, and support the `pic-only' and `no-pic' 325275970Scy# LT_INIT options. 326275970Scy# MODE is either `yes' or `no'. If omitted, it defaults to `both'. 327275970Scym4_define([_LT_WITH_PIC], 328275970Scy[AC_ARG_WITH([pic], 329275970Scy [AS_HELP_STRING([--with-pic], 330275970Scy [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 331275970Scy [pic_mode="$withval"], 332275970Scy [pic_mode=default]) 333275970Scy 334275970Scytest -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 335275970Scy 336275970Scy_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 337275970Scy])# _LT_WITH_PIC 338275970Scy 339275970ScyLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 340275970ScyLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 341275970Scy 342275970Scy# Old name: 343275970ScyAU_DEFUN([AC_LIBTOOL_PICMODE], 344275970Scy[_LT_SET_OPTION([LT_INIT], [pic-only]) 345275970ScyAC_DIAGNOSE([obsolete], 346275970Scy[$0: Remove this warning and the call to _LT_SET_OPTION when you 347275970Scyput the `pic-only' option into LT_INIT's first parameter.]) 348275970Scy]) 349275970Scy 350275970Scydnl aclocal-1.4 backwards compatibility: 351275970Scydnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 352275970Scy 353275970Scy## ----------------- ## 354275970Scy## LTDL_INIT Options ## 355275970Scy## ----------------- ## 356275970Scy 357275970Scym4_define([_LTDL_MODE], []) 358275970ScyLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 359275970Scy [m4_define([_LTDL_MODE], [nonrecursive])]) 360275970ScyLT_OPTION_DEFINE([LTDL_INIT], [recursive], 361275970Scy [m4_define([_LTDL_MODE], [recursive])]) 362275970ScyLT_OPTION_DEFINE([LTDL_INIT], [subproject], 363275970Scy [m4_define([_LTDL_MODE], [subproject])]) 364275970Scy 365275970Scym4_define([_LTDL_TYPE], []) 366275970ScyLT_OPTION_DEFINE([LTDL_INIT], [installable], 367275970Scy [m4_define([_LTDL_TYPE], [installable])]) 368275970ScyLT_OPTION_DEFINE([LTDL_INIT], [convenience], 369275970Scy [m4_define([_LTDL_TYPE], [convenience])]) 370