1243730Srwatson# Helper functions for option handling. -*- Autoconf -*- 2243730Srwatson# 3243730Srwatson# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, 4243730Srwatson# Inc. 5243730Srwatson# Written by Gary V. Vaughan, 2004 6243730Srwatson# 7243730Srwatson# This file is free software; the Free Software Foundation gives 8243730Srwatson# unlimited permission to copy and/or distribute it, with or without 9243730Srwatson# modifications, as long as this notice is preserved. 10243730Srwatson 11243730Srwatson# serial 7 ltoptions.m4 12243730Srwatson 13243730Srwatson# This is to help aclocal find these macros, as it can't see m4_define. 14243730SrwatsonAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15243730Srwatson 16243730Srwatson 17243730Srwatson# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18243730Srwatson# ------------------------------------------ 19243730Srwatsonm4_define([_LT_MANGLE_OPTION], 20243730Srwatson[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21243730Srwatson 22243730Srwatson 23243730Srwatson# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24243730Srwatson# --------------------------------------- 25243730Srwatson# Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26243730Srwatson# matching handler defined, dispatch to it. Other OPTION-NAMEs are 27243730Srwatson# saved as a flag. 28243730Srwatsonm4_define([_LT_SET_OPTION], 29243730Srwatson[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30243730Srwatsonm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31243730Srwatson _LT_MANGLE_DEFUN([$1], [$2]), 32243730Srwatson [m4_warning([Unknown $1 option `$2'])])[]dnl 33243730Srwatson]) 34243730Srwatson 35243730Srwatson 36243730Srwatson# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37243730Srwatson# ------------------------------------------------------------ 38243730Srwatson# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39243730Srwatsonm4_define([_LT_IF_OPTION], 40243730Srwatson[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41243730Srwatson 42243730Srwatson 43243730Srwatson# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44243730Srwatson# ------------------------------------------------------- 45243730Srwatson# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46243730Srwatson# are set. 47243730Srwatsonm4_define([_LT_UNLESS_OPTIONS], 48243730Srwatson[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49243730Srwatson [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50243730Srwatson [m4_define([$0_found])])])[]dnl 51243730Srwatsonm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52243730Srwatson])[]dnl 53243730Srwatson]) 54243730Srwatson 55243730Srwatson 56243730Srwatson# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57243730Srwatson# ---------------------------------------- 58243730Srwatson# OPTION-LIST is a space-separated list of Libtool options associated 59243730Srwatson# with MACRO-NAME. If any OPTION has a matching handler declared with 60243730Srwatson# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61243730Srwatson# the unknown option and exit. 62243730Srwatsonm4_defun([_LT_SET_OPTIONS], 63243730Srwatson[# Set options 64243730Srwatsonm4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65243730Srwatson [_LT_SET_OPTION([$1], _LT_Option)]) 66243730Srwatson 67243730Srwatsonm4_if([$1],[LT_INIT],[ 68243730Srwatson dnl 69243730Srwatson dnl Simply set some default values (i.e off) if boolean options were not 70243730Srwatson dnl specified: 71243730Srwatson _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72243730Srwatson ]) 73243730Srwatson _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74243730Srwatson ]) 75243730Srwatson dnl 76243730Srwatson dnl If no reference was made to various pairs of opposing options, then 77243730Srwatson dnl we run the default mode handler for the pair. For example, if neither 78243730Srwatson dnl `shared' nor `disable-shared' was passed, we enable building of shared 79243730Srwatson dnl archives by default: 80243730Srwatson _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81243730Srwatson _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82243730Srwatson _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83243730Srwatson _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84243730Srwatson [_LT_ENABLE_FAST_INSTALL]) 85243730Srwatson ]) 86243730Srwatson])# _LT_SET_OPTIONS 87243730Srwatson 88243730Srwatson 89243730Srwatson## --------------------------------- ## 90243730Srwatson## Macros to handle LT_INIT options. ## 91243730Srwatson## --------------------------------- ## 92243730Srwatson 93243730Srwatson# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 94243730Srwatson# ----------------------------------------- 95243730Srwatsonm4_define([_LT_MANGLE_DEFUN], 96243730Srwatson[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 97243730Srwatson 98243730Srwatson 99243730Srwatson# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 100243730Srwatson# ----------------------------------------------- 101243730Srwatsonm4_define([LT_OPTION_DEFINE], 102243730Srwatson[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 103243730Srwatson])# LT_OPTION_DEFINE 104243730Srwatson 105243730Srwatson 106243730Srwatson# dlopen 107243730Srwatson# ------ 108243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 109243730Srwatson]) 110243730Srwatson 111243730SrwatsonAU_DEFUN([AC_LIBTOOL_DLOPEN], 112243730Srwatson[_LT_SET_OPTION([LT_INIT], [dlopen]) 113243730SrwatsonAC_DIAGNOSE([obsolete], 114243730Srwatson[$0: Remove this warning and the call to _LT_SET_OPTION when you 115243730Srwatsonput the `dlopen' option into LT_INIT's first parameter.]) 116243730Srwatson]) 117243730Srwatson 118243730Srwatsondnl aclocal-1.4 backwards compatibility: 119243730Srwatsondnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 120243730Srwatson 121243730Srwatson 122243730Srwatson# win32-dll 123243730Srwatson# --------- 124243730Srwatson# Declare package support for building win32 dll's. 125243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [win32-dll], 126243730Srwatson[enable_win32_dll=yes 127243730Srwatson 128243730Srwatsoncase $host in 129243730Srwatson*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 130243730Srwatson AC_CHECK_TOOL(AS, as, false) 131243730Srwatson AC_CHECK_TOOL(DLLTOOL, dlltool, false) 132243730Srwatson AC_CHECK_TOOL(OBJDUMP, objdump, false) 133243730Srwatson ;; 134243730Srwatsonesac 135243730Srwatson 136243730Srwatsontest -z "$AS" && AS=as 137243730Srwatson_LT_DECL([], [AS], [1], [Assembler program])dnl 138243730Srwatson 139243730Srwatsontest -z "$DLLTOOL" && DLLTOOL=dlltool 140243730Srwatson_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 141243730Srwatson 142243730Srwatsontest -z "$OBJDUMP" && OBJDUMP=objdump 143243730Srwatson_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 144243730Srwatson])# win32-dll 145243730Srwatson 146243730SrwatsonAU_DEFUN([AC_LIBTOOL_WIN32_DLL], 147243730Srwatson[AC_REQUIRE([AC_CANONICAL_HOST])dnl 148243730Srwatson_LT_SET_OPTION([LT_INIT], [win32-dll]) 149243730SrwatsonAC_DIAGNOSE([obsolete], 150243730Srwatson[$0: Remove this warning and the call to _LT_SET_OPTION when you 151243730Srwatsonput the `win32-dll' option into LT_INIT's first parameter.]) 152243730Srwatson]) 153243730Srwatson 154243730Srwatsondnl aclocal-1.4 backwards compatibility: 155243730Srwatsondnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 156243730Srwatson 157243730Srwatson 158243730Srwatson# _LT_ENABLE_SHARED([DEFAULT]) 159243730Srwatson# ---------------------------- 160243730Srwatson# implement the --enable-shared flag, and supports the `shared' and 161243730Srwatson# `disable-shared' LT_INIT options. 162243730Srwatson# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 163243730Srwatsonm4_define([_LT_ENABLE_SHARED], 164243730Srwatson[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 165243730SrwatsonAC_ARG_ENABLE([shared], 166243730Srwatson [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 167243730Srwatson [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 168243730Srwatson [p=${PACKAGE-default} 169243730Srwatson case $enableval in 170243730Srwatson yes) enable_shared=yes ;; 171243730Srwatson no) enable_shared=no ;; 172243730Srwatson *) 173243730Srwatson enable_shared=no 174243730Srwatson # Look at the argument we got. We use all the common list separators. 175243730Srwatson lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 176243730Srwatson for pkg in $enableval; do 177243730Srwatson IFS="$lt_save_ifs" 178243730Srwatson if test "X$pkg" = "X$p"; then 179243730Srwatson enable_shared=yes 180243730Srwatson fi 181243730Srwatson done 182243730Srwatson IFS="$lt_save_ifs" 183243730Srwatson ;; 184243730Srwatson esac], 185243730Srwatson [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 186243730Srwatson 187243730Srwatson _LT_DECL([build_libtool_libs], [enable_shared], [0], 188243730Srwatson [Whether or not to build shared libraries]) 189243730Srwatson])# _LT_ENABLE_SHARED 190243730Srwatson 191243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 192243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 193243730Srwatson 194243730Srwatson# Old names: 195243730SrwatsonAC_DEFUN([AC_ENABLE_SHARED], 196243730Srwatson[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 197243730Srwatson]) 198243730Srwatson 199243730SrwatsonAC_DEFUN([AC_DISABLE_SHARED], 200243730Srwatson[_LT_SET_OPTION([LT_INIT], [disable-shared]) 201243730Srwatson]) 202243730Srwatson 203243730SrwatsonAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 204243730SrwatsonAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 205243730Srwatson 206243730Srwatsondnl aclocal-1.4 backwards compatibility: 207243730Srwatsondnl AC_DEFUN([AM_ENABLE_SHARED], []) 208243730Srwatsondnl AC_DEFUN([AM_DISABLE_SHARED], []) 209243730Srwatson 210243730Srwatson 211243730Srwatson 212243730Srwatson# _LT_ENABLE_STATIC([DEFAULT]) 213243730Srwatson# ---------------------------- 214243730Srwatson# implement the --enable-static flag, and support the `static' and 215243730Srwatson# `disable-static' LT_INIT options. 216243730Srwatson# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 217243730Srwatsonm4_define([_LT_ENABLE_STATIC], 218243730Srwatson[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 219243730SrwatsonAC_ARG_ENABLE([static], 220243730Srwatson [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 221243730Srwatson [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 222243730Srwatson [p=${PACKAGE-default} 223243730Srwatson case $enableval in 224243730Srwatson yes) enable_static=yes ;; 225243730Srwatson no) enable_static=no ;; 226243730Srwatson *) 227243730Srwatson enable_static=no 228243730Srwatson # Look at the argument we got. We use all the common list separators. 229243730Srwatson lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 230243730Srwatson for pkg in $enableval; do 231243730Srwatson IFS="$lt_save_ifs" 232243730Srwatson if test "X$pkg" = "X$p"; then 233243730Srwatson enable_static=yes 234243730Srwatson fi 235243730Srwatson done 236243730Srwatson IFS="$lt_save_ifs" 237243730Srwatson ;; 238243730Srwatson esac], 239243730Srwatson [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 240243730Srwatson 241243730Srwatson _LT_DECL([build_old_libs], [enable_static], [0], 242243730Srwatson [Whether or not to build static libraries]) 243243730Srwatson])# _LT_ENABLE_STATIC 244243730Srwatson 245243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 246243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 247243730Srwatson 248243730Srwatson# Old names: 249243730SrwatsonAC_DEFUN([AC_ENABLE_STATIC], 250243730Srwatson[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 251243730Srwatson]) 252243730Srwatson 253243730SrwatsonAC_DEFUN([AC_DISABLE_STATIC], 254243730Srwatson[_LT_SET_OPTION([LT_INIT], [disable-static]) 255243730Srwatson]) 256243730Srwatson 257243730SrwatsonAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 258243730SrwatsonAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 259243730Srwatson 260243730Srwatsondnl aclocal-1.4 backwards compatibility: 261243730Srwatsondnl AC_DEFUN([AM_ENABLE_STATIC], []) 262243730Srwatsondnl AC_DEFUN([AM_DISABLE_STATIC], []) 263243730Srwatson 264243730Srwatson 265243730Srwatson 266243730Srwatson# _LT_ENABLE_FAST_INSTALL([DEFAULT]) 267243730Srwatson# ---------------------------------- 268243730Srwatson# implement the --enable-fast-install flag, and support the `fast-install' 269243730Srwatson# and `disable-fast-install' LT_INIT options. 270243730Srwatson# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 271243730Srwatsonm4_define([_LT_ENABLE_FAST_INSTALL], 272243730Srwatson[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 273243730SrwatsonAC_ARG_ENABLE([fast-install], 274243730Srwatson [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 275243730Srwatson [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 276243730Srwatson [p=${PACKAGE-default} 277243730Srwatson case $enableval in 278243730Srwatson yes) enable_fast_install=yes ;; 279243730Srwatson no) enable_fast_install=no ;; 280243730Srwatson *) 281243730Srwatson enable_fast_install=no 282243730Srwatson # Look at the argument we got. We use all the common list separators. 283243730Srwatson lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 284243730Srwatson for pkg in $enableval; do 285243730Srwatson IFS="$lt_save_ifs" 286243730Srwatson if test "X$pkg" = "X$p"; then 287243730Srwatson enable_fast_install=yes 288243730Srwatson fi 289243730Srwatson done 290243730Srwatson IFS="$lt_save_ifs" 291243730Srwatson ;; 292243730Srwatson esac], 293243730Srwatson [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 294243730Srwatson 295243730Srwatson_LT_DECL([fast_install], [enable_fast_install], [0], 296243730Srwatson [Whether or not to optimize for fast installation])dnl 297243730Srwatson])# _LT_ENABLE_FAST_INSTALL 298243730Srwatson 299243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 300243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 301243730Srwatson 302243730Srwatson# Old names: 303243730SrwatsonAU_DEFUN([AC_ENABLE_FAST_INSTALL], 304243730Srwatson[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 305243730SrwatsonAC_DIAGNOSE([obsolete], 306243730Srwatson[$0: Remove this warning and the call to _LT_SET_OPTION when you put 307243730Srwatsonthe `fast-install' option into LT_INIT's first parameter.]) 308243730Srwatson]) 309243730Srwatson 310243730SrwatsonAU_DEFUN([AC_DISABLE_FAST_INSTALL], 311243730Srwatson[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 312243730SrwatsonAC_DIAGNOSE([obsolete], 313243730Srwatson[$0: Remove this warning and the call to _LT_SET_OPTION when you put 314243730Srwatsonthe `disable-fast-install' option into LT_INIT's first parameter.]) 315243730Srwatson]) 316243730Srwatson 317243730Srwatsondnl aclocal-1.4 backwards compatibility: 318243730Srwatsondnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 319243730Srwatsondnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 320243730Srwatson 321243730Srwatson 322243730Srwatson# _LT_WITH_PIC([MODE]) 323243730Srwatson# -------------------- 324243730Srwatson# implement the --with-pic flag, and support the `pic-only' and `no-pic' 325243730Srwatson# LT_INIT options. 326243730Srwatson# MODE is either `yes' or `no'. If omitted, it defaults to `both'. 327243730Srwatsonm4_define([_LT_WITH_PIC], 328243730Srwatson[AC_ARG_WITH([pic], 329243730Srwatson [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], 330243730Srwatson [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 331243730Srwatson [lt_p=${PACKAGE-default} 332243730Srwatson case $withval in 333243730Srwatson yes|no) pic_mode=$withval ;; 334243730Srwatson *) 335243730Srwatson pic_mode=default 336243730Srwatson # Look at the argument we got. We use all the common list separators. 337243730Srwatson lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 338243730Srwatson for lt_pkg in $withval; do 339243730Srwatson IFS="$lt_save_ifs" 340243730Srwatson if test "X$lt_pkg" = "X$lt_p"; then 341243730Srwatson pic_mode=yes 342243730Srwatson fi 343243730Srwatson done 344243730Srwatson IFS="$lt_save_ifs" 345243730Srwatson ;; 346243730Srwatson esac], 347243730Srwatson [pic_mode=default]) 348243730Srwatson 349243730Srwatsontest -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 350243730Srwatson 351243730Srwatson_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 352243730Srwatson])# _LT_WITH_PIC 353243730Srwatson 354243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 355243730SrwatsonLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 356243730Srwatson 357243730Srwatson# Old name: 358243730SrwatsonAU_DEFUN([AC_LIBTOOL_PICMODE], 359243730Srwatson[_LT_SET_OPTION([LT_INIT], [pic-only]) 360243730SrwatsonAC_DIAGNOSE([obsolete], 361243730Srwatson[$0: Remove this warning and the call to _LT_SET_OPTION when you 362243730Srwatsonput the `pic-only' option into LT_INIT's first parameter.]) 363243730Srwatson]) 364243730Srwatson 365243730Srwatsondnl aclocal-1.4 backwards compatibility: 366243730Srwatsondnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 367243730Srwatson 368243730Srwatson## ----------------- ## 369243730Srwatson## LTDL_INIT Options ## 370243730Srwatson## ----------------- ## 371243730Srwatson 372243730Srwatsonm4_define([_LTDL_MODE], []) 373243730SrwatsonLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 374243730Srwatson [m4_define([_LTDL_MODE], [nonrecursive])]) 375243730SrwatsonLT_OPTION_DEFINE([LTDL_INIT], [recursive], 376243730Srwatson [m4_define([_LTDL_MODE], [recursive])]) 377243730SrwatsonLT_OPTION_DEFINE([LTDL_INIT], [subproject], 378243730Srwatson [m4_define([_LTDL_MODE], [subproject])]) 379243730Srwatson 380243730Srwatsonm4_define([_LTDL_TYPE], []) 381243730SrwatsonLT_OPTION_DEFINE([LTDL_INIT], [installable], 382243730Srwatson [m4_define([_LTDL_TYPE], [installable])]) 383243730SrwatsonLT_OPTION_DEFINE([LTDL_INIT], [convenience], 384243730Srwatson [m4_define([_LTDL_TYPE], [convenience])]) 385