1 1.1 christos # Helper functions for option handling. -*- Autoconf -*- 2 1.1 christos # 3 1.1 christos # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, 4 1.1 christos # Inc. 5 1.1 christos # Written by Gary V. Vaughan, 2004 6 1.1 christos # 7 1.1 christos # This file is free software; the Free Software Foundation gives 8 1.1 christos # unlimited permission to copy and/or distribute it, with or without 9 1.1 christos # modifications, as long as this notice is preserved. 10 1.1 christos 11 1.1 christos # serial 6 ltoptions.m4 12 1.1 christos 13 1.1 christos # This is to help aclocal find these macros, as it can't see m4_define. 14 1.1 christos AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15 1.1 christos 16 1.1 christos 17 1.1 christos # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18 1.1 christos # ------------------------------------------ 19 1.1 christos m4_define([_LT_MANGLE_OPTION], 20 1.1 christos [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21 1.1 christos 22 1.1 christos 23 1.1 christos # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24 1.1 christos # --------------------------------------- 25 1.1 christos # Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26 1.1 christos # matching handler defined, dispatch to it. Other OPTION-NAMEs are 27 1.1 christos # saved as a flag. 28 1.1 christos m4_define([_LT_SET_OPTION], 29 1.1 christos [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30 1.1 christos m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31 1.1 christos _LT_MANGLE_DEFUN([$1], [$2]), 32 1.1 christos [m4_warning([Unknown $1 option `$2'])])[]dnl 33 1.1 christos ]) 34 1.1 christos 35 1.1 christos 36 1.1 christos # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37 1.1 christos # ------------------------------------------------------------ 38 1.1 christos # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39 1.1 christos m4_define([_LT_IF_OPTION], 40 1.1 christos [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41 1.1 christos 42 1.1 christos 43 1.1 christos # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44 1.1 christos # ------------------------------------------------------- 45 1.1 christos # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46 1.1 christos # are set. 47 1.1 christos m4_define([_LT_UNLESS_OPTIONS], 48 1.1 christos [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49 1.1 christos [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50 1.1 christos [m4_define([$0_found])])])[]dnl 51 1.1 christos m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52 1.1 christos ])[]dnl 53 1.1 christos ]) 54 1.1 christos 55 1.1 christos 56 1.1 christos # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57 1.1 christos # ---------------------------------------- 58 1.1 christos # OPTION-LIST is a space-separated list of Libtool options associated 59 1.1 christos # with MACRO-NAME. If any OPTION has a matching handler declared with 60 1.1 christos # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61 1.1 christos # the unknown option and exit. 62 1.1 christos m4_defun([_LT_SET_OPTIONS], 63 1.1 christos [# Set options 64 1.1 christos m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65 1.1 christos [_LT_SET_OPTION([$1], _LT_Option)]) 66 1.1 christos 67 1.1 christos m4_if([$1],[LT_INIT],[ 68 1.1 christos dnl 69 1.1 christos dnl Simply set some default values (i.e off) if boolean options were not 70 1.1 christos dnl specified: 71 1.1 christos _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72 1.1 christos ]) 73 1.1 christos _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74 1.1 christos ]) 75 1.1 christos dnl 76 1.1 christos dnl If no reference was made to various pairs of opposing options, then 77 1.1 christos dnl we run the default mode handler for the pair. For example, if neither 78 1.1 christos dnl `shared' nor `disable-shared' was passed, we enable building of shared 79 1.1 christos dnl archives by default: 80 1.1 christos _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81 1.1 christos _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82 1.1 christos _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83 1.1 christos _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84 1.1 christos [_LT_ENABLE_FAST_INSTALL]) 85 1.1 christos ]) 86 1.1 christos ])# _LT_SET_OPTIONS 87 1.1 christos 88 1.1 christos 89 1.1 christos ## --------------------------------- ## 90 1.1 christos ## Macros to handle LT_INIT options. ## 91 1.1 christos ## --------------------------------- ## 92 1.1 christos 93 1.1 christos # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 94 1.1 christos # ----------------------------------------- 95 1.1 christos m4_define([_LT_MANGLE_DEFUN], 96 1.1 christos [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 97 1.1 christos 98 1.1 christos 99 1.1 christos # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 100 1.1 christos # ----------------------------------------------- 101 1.1 christos m4_define([LT_OPTION_DEFINE], 102 1.1 christos [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 103 1.1 christos ])# LT_OPTION_DEFINE 104 1.1 christos 105 1.1 christos 106 1.1 christos # dlopen 107 1.1 christos # ------ 108 1.1 christos LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 109 1.1 christos ]) 110 1.1 christos 111 1.1 christos AU_DEFUN([AC_LIBTOOL_DLOPEN], 112 1.1 christos [_LT_SET_OPTION([LT_INIT], [dlopen]) 113 1.1 christos AC_DIAGNOSE([obsolete], 114 1.1 christos [$0: Remove this warning and the call to _LT_SET_OPTION when you 115 1.1 christos put the `dlopen' option into LT_INIT's first parameter.]) 116 1.1 christos ]) 117 1.1 christos 118 1.1 christos dnl aclocal-1.4 backwards compatibility: 119 1.1 christos dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 120 1.1 christos 121 1.1 christos 122 1.1 christos # win32-dll 123 1.1 christos # --------- 124 1.1 christos # Declare package support for building win32 dll's. 125 1.1 christos LT_OPTION_DEFINE([LT_INIT], [win32-dll], 126 1.1 christos [enable_win32_dll=yes 127 1.1 christos 128 1.1 christos case $host in 129 1.1 christos *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 130 1.1 christos AC_CHECK_TOOL(AS, as, false) 131 1.1 christos AC_CHECK_TOOL(DLLTOOL, dlltool, false) 132 1.1 christos AC_CHECK_TOOL(OBJDUMP, objdump, false) 133 1.1 christos ;; 134 1.1 christos esac 135 1.1 christos 136 1.1 christos test -z "$AS" && AS=as 137 1.1 christos _LT_DECL([], [AS], [1], [Assembler program])dnl 138 1.1 christos 139 1.1 christos test -z "$DLLTOOL" && DLLTOOL=dlltool 140 1.1 christos _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 141 1.1 christos 142 1.1 christos test -z "$OBJDUMP" && OBJDUMP=objdump 143 1.1 christos _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 144 1.1 christos ])# win32-dll 145 1.1 christos 146 1.1 christos AU_DEFUN([AC_LIBTOOL_WIN32_DLL], 147 1.1 christos [AC_REQUIRE([AC_CANONICAL_HOST])dnl 148 1.1 christos _LT_SET_OPTION([LT_INIT], [win32-dll]) 149 1.1 christos AC_DIAGNOSE([obsolete], 150 1.1 christos [$0: Remove this warning and the call to _LT_SET_OPTION when you 151 1.1 christos put the `win32-dll' option into LT_INIT's first parameter.]) 152 1.1 christos ]) 153 1.1 christos 154 1.1 christos dnl aclocal-1.4 backwards compatibility: 155 1.1 christos dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 156 1.1 christos 157 1.1 christos 158 1.1 christos # _LT_ENABLE_SHARED([DEFAULT]) 159 1.1 christos # ---------------------------- 160 1.1 christos # implement the --enable-shared flag, and supports the `shared' and 161 1.1 christos # `disable-shared' LT_INIT options. 162 1.1 christos # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 163 1.1 christos m4_define([_LT_ENABLE_SHARED], 164 1.1 christos [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 165 1.1 christos AC_ARG_ENABLE([shared], 166 1.1 christos [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 167 1.1 christos [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 168 1.1 christos [p=${PACKAGE-default} 169 1.1 christos case $enableval in 170 1.1 christos yes) enable_shared=yes ;; 171 1.1 christos no) enable_shared=no ;; 172 1.1 christos *) 173 1.1 christos enable_shared=no 174 1.1 christos # Look at the argument we got. We use all the common list separators. 175 1.1 christos lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 176 1.1 christos for pkg in $enableval; do 177 1.1 christos IFS="$lt_save_ifs" 178 1.1 christos if test "X$pkg" = "X$p"; then 179 1.1 christos enable_shared=yes 180 1.1 christos fi 181 1.1 christos done 182 1.1 christos IFS="$lt_save_ifs" 183 1.1 christos ;; 184 1.1 christos esac], 185 1.1 christos [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 186 1.1 christos 187 1.1 christos _LT_DECL([build_libtool_libs], [enable_shared], [0], 188 1.1 christos [Whether or not to build shared libraries]) 189 1.1 christos ])# _LT_ENABLE_SHARED 190 1.1 christos 191 1.1 christos LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 192 1.1 christos LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 193 1.1 christos 194 1.1 christos # Old names: 195 1.1 christos AC_DEFUN([AC_ENABLE_SHARED], 196 1.1 christos [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 197 1.1 christos ]) 198 1.1 christos 199 1.1 christos AC_DEFUN([AC_DISABLE_SHARED], 200 1.1 christos [_LT_SET_OPTION([LT_INIT], [disable-shared]) 201 1.1 christos ]) 202 1.1 christos 203 1.1 christos AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 204 1.1 christos AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 205 1.1 christos 206 1.1 christos dnl aclocal-1.4 backwards compatibility: 207 1.1 christos dnl AC_DEFUN([AM_ENABLE_SHARED], []) 208 1.1 christos dnl AC_DEFUN([AM_DISABLE_SHARED], []) 209 1.1 christos 210 1.1 christos 211 1.1 christos 212 1.1 christos # _LT_ENABLE_STATIC([DEFAULT]) 213 1.1 christos # ---------------------------- 214 1.1 christos # implement the --enable-static flag, and support the `static' and 215 1.1 christos # `disable-static' LT_INIT options. 216 1.1 christos # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 217 1.1 christos m4_define([_LT_ENABLE_STATIC], 218 1.1 christos [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 219 1.1 christos AC_ARG_ENABLE([static], 220 1.1 christos [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 221 1.1 christos [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 222 1.1 christos [p=${PACKAGE-default} 223 1.1 christos case $enableval in 224 1.1 christos yes) enable_static=yes ;; 225 1.1 christos no) enable_static=no ;; 226 1.1 christos *) 227 1.1 christos enable_static=no 228 1.1 christos # Look at the argument we got. We use all the common list separators. 229 1.1 christos lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 230 1.1 christos for pkg in $enableval; do 231 1.1 christos IFS="$lt_save_ifs" 232 1.1 christos if test "X$pkg" = "X$p"; then 233 1.1 christos enable_static=yes 234 1.1 christos fi 235 1.1 christos done 236 1.1 christos IFS="$lt_save_ifs" 237 1.1 christos ;; 238 1.1 christos esac], 239 1.1 christos [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 240 1.1 christos 241 1.1 christos _LT_DECL([build_old_libs], [enable_static], [0], 242 1.1 christos [Whether or not to build static libraries]) 243 1.1 christos ])# _LT_ENABLE_STATIC 244 1.1 christos 245 1.1 christos LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 246 1.1 christos LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 247 1.1 christos 248 1.1 christos # Old names: 249 1.1 christos AC_DEFUN([AC_ENABLE_STATIC], 250 1.1 christos [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 251 1.1 christos ]) 252 1.1 christos 253 1.1 christos AC_DEFUN([AC_DISABLE_STATIC], 254 1.1 christos [_LT_SET_OPTION([LT_INIT], [disable-static]) 255 1.1 christos ]) 256 1.1 christos 257 1.1 christos AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 258 1.1 christos AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 259 1.1 christos 260 1.1 christos dnl aclocal-1.4 backwards compatibility: 261 1.1 christos dnl AC_DEFUN([AM_ENABLE_STATIC], []) 262 1.1 christos dnl AC_DEFUN([AM_DISABLE_STATIC], []) 263 1.1 christos 264 1.1 christos 265 1.1 christos 266 1.1 christos # _LT_ENABLE_FAST_INSTALL([DEFAULT]) 267 1.1 christos # ---------------------------------- 268 1.1 christos # implement the --enable-fast-install flag, and support the `fast-install' 269 1.1 christos # and `disable-fast-install' LT_INIT options. 270 1.1 christos # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 271 1.1 christos m4_define([_LT_ENABLE_FAST_INSTALL], 272 1.1 christos [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 273 1.1 christos AC_ARG_ENABLE([fast-install], 274 1.1 christos [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 275 1.1 christos [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 276 1.1 christos [p=${PACKAGE-default} 277 1.1 christos case $enableval in 278 1.1 christos yes) enable_fast_install=yes ;; 279 1.1 christos no) enable_fast_install=no ;; 280 1.1 christos *) 281 1.1 christos enable_fast_install=no 282 1.1 christos # Look at the argument we got. We use all the common list separators. 283 1.1 christos lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 284 1.1 christos for pkg in $enableval; do 285 1.1 christos IFS="$lt_save_ifs" 286 1.1 christos if test "X$pkg" = "X$p"; then 287 1.1 christos enable_fast_install=yes 288 1.1 christos fi 289 1.1 christos done 290 1.1 christos IFS="$lt_save_ifs" 291 1.1 christos ;; 292 1.1 christos esac], 293 1.1 christos [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 294 1.1 christos 295 1.1 christos _LT_DECL([fast_install], [enable_fast_install], [0], 296 1.1 christos [Whether or not to optimize for fast installation])dnl 297 1.1 christos ])# _LT_ENABLE_FAST_INSTALL 298 1.1 christos 299 1.1 christos LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 300 1.1 christos LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 301 1.1 christos 302 1.1 christos # Old names: 303 1.1 christos AU_DEFUN([AC_ENABLE_FAST_INSTALL], 304 1.1 christos [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 305 1.1 christos AC_DIAGNOSE([obsolete], 306 1.1 christos [$0: Remove this warning and the call to _LT_SET_OPTION when you put 307 1.1 christos the `fast-install' option into LT_INIT's first parameter.]) 308 1.1 christos ]) 309 1.1 christos 310 1.1 christos AU_DEFUN([AC_DISABLE_FAST_INSTALL], 311 1.1 christos [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 312 1.1 christos AC_DIAGNOSE([obsolete], 313 1.1 christos [$0: Remove this warning and the call to _LT_SET_OPTION when you put 314 1.1 christos the `disable-fast-install' option into LT_INIT's first parameter.]) 315 1.1 christos ]) 316 1.1 christos 317 1.1 christos dnl aclocal-1.4 backwards compatibility: 318 1.1 christos dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 319 1.1 christos dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 320 1.1 christos 321 1.1 christos 322 1.1 christos # _LT_WITH_PIC([MODE]) 323 1.1 christos # -------------------- 324 1.1 christos # implement the --with-pic flag, and support the `pic-only' and `no-pic' 325 1.1 christos # LT_INIT options. 326 1.1 christos # MODE is either `yes' or `no'. If omitted, it defaults to `both'. 327 1.1 christos m4_define([_LT_WITH_PIC], 328 1.1 christos [AC_ARG_WITH([pic], 329 1.1 christos [AS_HELP_STRING([--with-pic], 330 1.1 christos [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 331 1.1 christos [pic_mode="$withval"], 332 1.1 christos [pic_mode=default]) 333 1.1 christos 334 1.1 christos test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 335 1.1 christos 336 1.1 christos _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 337 1.1 christos ])# _LT_WITH_PIC 338 1.1 christos 339 1.1 christos LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 340 1.1 christos LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 341 1.1 christos 342 1.1 christos # Old name: 343 1.1 christos AU_DEFUN([AC_LIBTOOL_PICMODE], 344 1.1 christos [_LT_SET_OPTION([LT_INIT], [pic-only]) 345 1.1 christos AC_DIAGNOSE([obsolete], 346 1.1 christos [$0: Remove this warning and the call to _LT_SET_OPTION when you 347 1.1 christos put the `pic-only' option into LT_INIT's first parameter.]) 348 1.1 christos ]) 349 1.1 christos 350 1.1 christos dnl aclocal-1.4 backwards compatibility: 351 1.1 christos dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 352 1.1 christos 353 1.1 christos ## ----------------- ## 354 1.1 christos ## LTDL_INIT Options ## 355 1.1 christos ## ----------------- ## 356 1.1 christos 357 1.1 christos m4_define([_LTDL_MODE], []) 358 1.1 christos LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 359 1.1 christos [m4_define([_LTDL_MODE], [nonrecursive])]) 360 1.1 christos LT_OPTION_DEFINE([LTDL_INIT], [recursive], 361 1.1 christos [m4_define([_LTDL_MODE], [recursive])]) 362 1.1 christos LT_OPTION_DEFINE([LTDL_INIT], [subproject], 363 1.1 christos [m4_define([_LTDL_MODE], [subproject])]) 364 1.1 christos 365 1.1 christos m4_define([_LTDL_TYPE], []) 366 1.1 christos LT_OPTION_DEFINE([LTDL_INIT], [installable], 367 1.1 christos [m4_define([_LTDL_TYPE], [installable])]) 368 1.1 christos LT_OPTION_DEFINE([LTDL_INIT], [convenience], 369 1.1 christos [m4_define([_LTDL_TYPE], [convenience])]) 370