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