ltoptions.m4 revision 266072
1266072Sdes# Helper functions for option handling. -*- Autoconf -*- 2266072Sdes# 3266072Sdes# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, 4266072Sdes# Inc. 5266072Sdes# Written by Gary V. Vaughan, 2004 6266072Sdes# 7266072Sdes# This file is free software; the Free Software Foundation gives 8266072Sdes# unlimited permission to copy and/or distribute it, with or without 9266072Sdes# modifications, as long as this notice is preserved. 10266072Sdes 11266072Sdes# serial 7 ltoptions.m4 12266072Sdes 13266072Sdes# This is to help aclocal find these macros, as it can't see m4_define. 14266072SdesAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15266072Sdes 16266072Sdes 17266072Sdes# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18266072Sdes# ------------------------------------------ 19266072Sdesm4_define([_LT_MANGLE_OPTION], 20266072Sdes[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21266072Sdes 22266072Sdes 23266072Sdes# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24266072Sdes# --------------------------------------- 25266072Sdes# Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26266072Sdes# matching handler defined, dispatch to it. Other OPTION-NAMEs are 27266072Sdes# saved as a flag. 28266072Sdesm4_define([_LT_SET_OPTION], 29266072Sdes[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30266072Sdesm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31266072Sdes _LT_MANGLE_DEFUN([$1], [$2]), 32266072Sdes [m4_warning([Unknown $1 option `$2'])])[]dnl 33266072Sdes]) 34266072Sdes 35266072Sdes 36266072Sdes# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37266072Sdes# ------------------------------------------------------------ 38266072Sdes# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39266072Sdesm4_define([_LT_IF_OPTION], 40266072Sdes[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41266072Sdes 42266072Sdes 43266072Sdes# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44266072Sdes# ------------------------------------------------------- 45266072Sdes# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46266072Sdes# are set. 47266072Sdesm4_define([_LT_UNLESS_OPTIONS], 48266072Sdes[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49266072Sdes [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50266072Sdes [m4_define([$0_found])])])[]dnl 51266072Sdesm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52266072Sdes])[]dnl 53266072Sdes]) 54266072Sdes 55266072Sdes 56266072Sdes# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57266072Sdes# ---------------------------------------- 58266072Sdes# OPTION-LIST is a space-separated list of Libtool options associated 59266072Sdes# with MACRO-NAME. If any OPTION has a matching handler declared with 60266072Sdes# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61266072Sdes# the unknown option and exit. 62266072Sdesm4_defun([_LT_SET_OPTIONS], 63266072Sdes[# Set options 64266072Sdesm4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65266072Sdes [_LT_SET_OPTION([$1], _LT_Option)]) 66266072Sdes 67266072Sdesm4_if([$1],[LT_INIT],[ 68266072Sdes dnl 69266072Sdes dnl Simply set some default values (i.e off) if boolean options were not 70266072Sdes dnl specified: 71266072Sdes _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72266072Sdes ]) 73266072Sdes _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74266072Sdes ]) 75266072Sdes dnl 76266072Sdes dnl If no reference was made to various pairs of opposing options, then 77266072Sdes dnl we run the default mode handler for the pair. For example, if neither 78266072Sdes dnl `shared' nor `disable-shared' was passed, we enable building of shared 79266072Sdes dnl archives by default: 80266072Sdes _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81266072Sdes _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82266072Sdes _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83266072Sdes _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84266072Sdes [_LT_ENABLE_FAST_INSTALL]) 85266072Sdes ]) 86266072Sdes])# _LT_SET_OPTIONS 87266072Sdes 88266072Sdes 89266072Sdes## --------------------------------- ## 90266072Sdes## Macros to handle LT_INIT options. ## 91266072Sdes## --------------------------------- ## 92266072Sdes 93266072Sdes# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 94266072Sdes# ----------------------------------------- 95266072Sdesm4_define([_LT_MANGLE_DEFUN], 96266072Sdes[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 97266072Sdes 98266072Sdes 99266072Sdes# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 100266072Sdes# ----------------------------------------------- 101266072Sdesm4_define([LT_OPTION_DEFINE], 102266072Sdes[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 103266072Sdes])# LT_OPTION_DEFINE 104266072Sdes 105266072Sdes 106266072Sdes# dlopen 107266072Sdes# ------ 108266072SdesLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 109266072Sdes]) 110266072Sdes 111266072SdesAU_DEFUN([AC_LIBTOOL_DLOPEN], 112266072Sdes[_LT_SET_OPTION([LT_INIT], [dlopen]) 113266072SdesAC_DIAGNOSE([obsolete], 114266072Sdes[$0: Remove this warning and the call to _LT_SET_OPTION when you 115266072Sdesput the `dlopen' option into LT_INIT's first parameter.]) 116266072Sdes]) 117266072Sdes 118266072Sdesdnl aclocal-1.4 backwards compatibility: 119266072Sdesdnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 120266072Sdes 121266072Sdes 122266072Sdes# win32-dll 123266072Sdes# --------- 124266072Sdes# Declare package support for building win32 dll's. 125266072SdesLT_OPTION_DEFINE([LT_INIT], [win32-dll], 126266072Sdes[enable_win32_dll=yes 127266072Sdes 128266072Sdescase $host in 129266072Sdes*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 130266072Sdes AC_CHECK_TOOL(AS, as, false) 131266072Sdes AC_CHECK_TOOL(DLLTOOL, dlltool, false) 132266072Sdes AC_CHECK_TOOL(OBJDUMP, objdump, false) 133266072Sdes ;; 134266072Sdesesac 135266072Sdes 136266072Sdestest -z "$AS" && AS=as 137266072Sdes_LT_DECL([], [AS], [1], [Assembler program])dnl 138266072Sdes 139266072Sdestest -z "$DLLTOOL" && DLLTOOL=dlltool 140266072Sdes_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 141266072Sdes 142266072Sdestest -z "$OBJDUMP" && OBJDUMP=objdump 143266072Sdes_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 144266072Sdes])# win32-dll 145266072Sdes 146266072SdesAU_DEFUN([AC_LIBTOOL_WIN32_DLL], 147266072Sdes[AC_REQUIRE([AC_CANONICAL_HOST])dnl 148266072Sdes_LT_SET_OPTION([LT_INIT], [win32-dll]) 149266072SdesAC_DIAGNOSE([obsolete], 150266072Sdes[$0: Remove this warning and the call to _LT_SET_OPTION when you 151266072Sdesput the `win32-dll' option into LT_INIT's first parameter.]) 152266072Sdes]) 153266072Sdes 154266072Sdesdnl aclocal-1.4 backwards compatibility: 155266072Sdesdnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 156266072Sdes 157266072Sdes 158266072Sdes# _LT_ENABLE_SHARED([DEFAULT]) 159266072Sdes# ---------------------------- 160266072Sdes# implement the --enable-shared flag, and supports the `shared' and 161266072Sdes# `disable-shared' LT_INIT options. 162266072Sdes# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 163266072Sdesm4_define([_LT_ENABLE_SHARED], 164266072Sdes[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 165266072SdesAC_ARG_ENABLE([shared], 166266072Sdes [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 167266072Sdes [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 168266072Sdes [p=${PACKAGE-default} 169266072Sdes case $enableval in 170266072Sdes yes) enable_shared=yes ;; 171266072Sdes no) enable_shared=no ;; 172266072Sdes *) 173266072Sdes enable_shared=no 174266072Sdes # Look at the argument we got. We use all the common list separators. 175266072Sdes lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 176266072Sdes for pkg in $enableval; do 177266072Sdes IFS="$lt_save_ifs" 178266072Sdes if test "X$pkg" = "X$p"; then 179266072Sdes enable_shared=yes 180266072Sdes fi 181266072Sdes done 182266072Sdes IFS="$lt_save_ifs" 183266072Sdes ;; 184266072Sdes esac], 185266072Sdes [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 186266072Sdes 187266072Sdes _LT_DECL([build_libtool_libs], [enable_shared], [0], 188266072Sdes [Whether or not to build shared libraries]) 189266072Sdes])# _LT_ENABLE_SHARED 190266072Sdes 191266072SdesLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 192266072SdesLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 193266072Sdes 194266072Sdes# Old names: 195266072SdesAC_DEFUN([AC_ENABLE_SHARED], 196266072Sdes[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 197266072Sdes]) 198266072Sdes 199266072SdesAC_DEFUN([AC_DISABLE_SHARED], 200266072Sdes[_LT_SET_OPTION([LT_INIT], [disable-shared]) 201266072Sdes]) 202266072Sdes 203266072SdesAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 204266072SdesAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 205266072Sdes 206266072Sdesdnl aclocal-1.4 backwards compatibility: 207266072Sdesdnl AC_DEFUN([AM_ENABLE_SHARED], []) 208266072Sdesdnl AC_DEFUN([AM_DISABLE_SHARED], []) 209266072Sdes 210266072Sdes 211266072Sdes 212266072Sdes# _LT_ENABLE_STATIC([DEFAULT]) 213266072Sdes# ---------------------------- 214266072Sdes# implement the --enable-static flag, and support the `static' and 215266072Sdes# `disable-static' LT_INIT options. 216266072Sdes# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 217266072Sdesm4_define([_LT_ENABLE_STATIC], 218266072Sdes[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 219266072SdesAC_ARG_ENABLE([static], 220266072Sdes [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 221266072Sdes [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 222266072Sdes [p=${PACKAGE-default} 223266072Sdes case $enableval in 224266072Sdes yes) enable_static=yes ;; 225266072Sdes no) enable_static=no ;; 226266072Sdes *) 227266072Sdes enable_static=no 228266072Sdes # Look at the argument we got. We use all the common list separators. 229266072Sdes lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 230266072Sdes for pkg in $enableval; do 231266072Sdes IFS="$lt_save_ifs" 232266072Sdes if test "X$pkg" = "X$p"; then 233266072Sdes enable_static=yes 234266072Sdes fi 235266072Sdes done 236266072Sdes IFS="$lt_save_ifs" 237266072Sdes ;; 238266072Sdes esac], 239266072Sdes [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 240266072Sdes 241266072Sdes _LT_DECL([build_old_libs], [enable_static], [0], 242266072Sdes [Whether or not to build static libraries]) 243266072Sdes])# _LT_ENABLE_STATIC 244266072Sdes 245266072SdesLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 246266072SdesLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 247266072Sdes 248266072Sdes# Old names: 249266072SdesAC_DEFUN([AC_ENABLE_STATIC], 250266072Sdes[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 251266072Sdes]) 252266072Sdes 253266072SdesAC_DEFUN([AC_DISABLE_STATIC], 254266072Sdes[_LT_SET_OPTION([LT_INIT], [disable-static]) 255266072Sdes]) 256266072Sdes 257266072SdesAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 258266072SdesAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 259266072Sdes 260266072Sdesdnl aclocal-1.4 backwards compatibility: 261266072Sdesdnl AC_DEFUN([AM_ENABLE_STATIC], []) 262266072Sdesdnl AC_DEFUN([AM_DISABLE_STATIC], []) 263266072Sdes 264266072Sdes 265266072Sdes 266266072Sdes# _LT_ENABLE_FAST_INSTALL([DEFAULT]) 267266072Sdes# ---------------------------------- 268266072Sdes# implement the --enable-fast-install flag, and support the `fast-install' 269266072Sdes# and `disable-fast-install' LT_INIT options. 270266072Sdes# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 271266072Sdesm4_define([_LT_ENABLE_FAST_INSTALL], 272266072Sdes[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 273266072SdesAC_ARG_ENABLE([fast-install], 274266072Sdes [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 275266072Sdes [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 276266072Sdes [p=${PACKAGE-default} 277266072Sdes case $enableval in 278266072Sdes yes) enable_fast_install=yes ;; 279266072Sdes no) enable_fast_install=no ;; 280266072Sdes *) 281266072Sdes enable_fast_install=no 282266072Sdes # Look at the argument we got. We use all the common list separators. 283266072Sdes lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 284266072Sdes for pkg in $enableval; do 285266072Sdes IFS="$lt_save_ifs" 286266072Sdes if test "X$pkg" = "X$p"; then 287266072Sdes enable_fast_install=yes 288266072Sdes fi 289266072Sdes done 290266072Sdes IFS="$lt_save_ifs" 291266072Sdes ;; 292266072Sdes esac], 293266072Sdes [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 294266072Sdes 295266072Sdes_LT_DECL([fast_install], [enable_fast_install], [0], 296266072Sdes [Whether or not to optimize for fast installation])dnl 297266072Sdes])# _LT_ENABLE_FAST_INSTALL 298266072Sdes 299266072SdesLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 300266072SdesLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 301266072Sdes 302266072Sdes# Old names: 303266072SdesAU_DEFUN([AC_ENABLE_FAST_INSTALL], 304266072Sdes[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 305266072SdesAC_DIAGNOSE([obsolete], 306266072Sdes[$0: Remove this warning and the call to _LT_SET_OPTION when you put 307266072Sdesthe `fast-install' option into LT_INIT's first parameter.]) 308266072Sdes]) 309266072Sdes 310266072SdesAU_DEFUN([AC_DISABLE_FAST_INSTALL], 311266072Sdes[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 312266072SdesAC_DIAGNOSE([obsolete], 313266072Sdes[$0: Remove this warning and the call to _LT_SET_OPTION when you put 314266072Sdesthe `disable-fast-install' option into LT_INIT's first parameter.]) 315266072Sdes]) 316266072Sdes 317266072Sdesdnl aclocal-1.4 backwards compatibility: 318266072Sdesdnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 319266072Sdesdnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 320266072Sdes 321266072Sdes 322266072Sdes# _LT_WITH_PIC([MODE]) 323266072Sdes# -------------------- 324266072Sdes# implement the --with-pic flag, and support the `pic-only' and `no-pic' 325266072Sdes# LT_INIT options. 326266072Sdes# MODE is either `yes' or `no'. If omitted, it defaults to `both'. 327266072Sdesm4_define([_LT_WITH_PIC], 328266072Sdes[AC_ARG_WITH([pic], 329266072Sdes [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], 330266072Sdes [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 331266072Sdes [lt_p=${PACKAGE-default} 332266072Sdes case $withval in 333266072Sdes yes|no) pic_mode=$withval ;; 334266072Sdes *) 335266072Sdes pic_mode=default 336266072Sdes # Look at the argument we got. We use all the common list separators. 337266072Sdes lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 338266072Sdes for lt_pkg in $withval; do 339266072Sdes IFS="$lt_save_ifs" 340266072Sdes if test "X$lt_pkg" = "X$lt_p"; then 341266072Sdes pic_mode=yes 342266072Sdes fi 343266072Sdes done 344266072Sdes IFS="$lt_save_ifs" 345266072Sdes ;; 346266072Sdes esac], 347266072Sdes [pic_mode=default]) 348266072Sdes 349266072Sdestest -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 350266072Sdes 351266072Sdes_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 352266072Sdes])# _LT_WITH_PIC 353266072Sdes 354266072SdesLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 355266072SdesLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 356266072Sdes 357266072Sdes# Old name: 358266072SdesAU_DEFUN([AC_LIBTOOL_PICMODE], 359266072Sdes[_LT_SET_OPTION([LT_INIT], [pic-only]) 360266072SdesAC_DIAGNOSE([obsolete], 361266072Sdes[$0: Remove this warning and the call to _LT_SET_OPTION when you 362266072Sdesput the `pic-only' option into LT_INIT's first parameter.]) 363266072Sdes]) 364266072Sdes 365266072Sdesdnl aclocal-1.4 backwards compatibility: 366266072Sdesdnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 367266072Sdes 368266072Sdes## ----------------- ## 369266072Sdes## LTDL_INIT Options ## 370266072Sdes## ----------------- ## 371266072Sdes 372266072Sdesm4_define([_LTDL_MODE], []) 373266072SdesLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 374266072Sdes [m4_define([_LTDL_MODE], [nonrecursive])]) 375266072SdesLT_OPTION_DEFINE([LTDL_INIT], [recursive], 376266072Sdes [m4_define([_LTDL_MODE], [recursive])]) 377266072SdesLT_OPTION_DEFINE([LTDL_INIT], [subproject], 378266072Sdes [m4_define([_LTDL_MODE], [subproject])]) 379266072Sdes 380266072Sdesm4_define([_LTDL_TYPE], []) 381266072SdesLT_OPTION_DEFINE([LTDL_INIT], [installable], 382266072Sdes [m4_define([_LTDL_TYPE], [installable])]) 383266072SdesLT_OPTION_DEFINE([LTDL_INIT], [convenience], 384266072Sdes [m4_define([_LTDL_TYPE], [convenience])]) 385