1
# Helper functions for option handling. -*- Autoconf -*-
2
# Written by Gary V. Vaughan <gary@gnu.org>
4
# Copyright (C) 2004 Free Software Foundation, Inc.
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2, or (at your option)
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23
# This is to help aclocal find these macros, as it can't see m4_define.
24
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
27
# _LT_MANGLE_OPTION(NAME)
28
# -----------------------
29
m4_define([_LT_MANGLE_OPTION],
30
[[_LT_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
33
# _LT_SET_OPTION(NAME)
34
# ------------------------------
35
# Set option NAME. Other NAMEs are saved as a flag.
36
m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1]))])
39
# _LT_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
40
# -------------------------------------------
41
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
42
m4_define([_LT_IF_OPTION],
43
[m4_ifdef(_LT_MANGLE_OPTION([$1]), [$2], [$3])])
46
# _LT_UNLESS_OPTIONS(OPTIONS, IF-NOT-SET)
47
# ---------------------------------------
48
# Execute IF-NOT-SET if all OPTIONS are not set.
49
m4_define([_LT_UNLESS_OPTIONS],
50
[AC_FOREACH([_LT_Option], [$1],
51
[m4_ifdef(_LT_MANGLE_OPTION(_LT_Option),
52
[m4_define([$0_found])])])[]dnl
53
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$2
58
# _LT_SET_OPTIONS(OPTIONS)
59
# ------------------------
60
# OPTIONS is a space-separated list of Automake options.
61
# If any OPTION has a handler macro declared with LT_OPTION_DEFINE,
62
# despatch to that macro; otherwise complain about the unknown option
64
m4_define([_LT_SET_OPTIONS],
65
[AC_FOREACH([_LT_Option], [$1],
66
[_LT_SET_OPTION(_LT_Option)
67
m4_ifdef(_LT_MANGLE_DEFUN(_LT_Option),
68
_LT_MANGLE_DEFUN(_LT_Option),
69
[m4_fatal([Unknown option `]_LT_Option[' to LT][_INIT_LIBTOOL])])
72
dnl Simply set some default values (i.e off) if boolean options were not
74
_LT_UNLESS_OPTIONS([dlopen], enable_dlopen=no)
75
_LT_UNLESS_OPTIONS([win32-dll], enable_win32_dll=no)
77
dnl If no reference was made to various pairs of opposing options, then
78
dnl we run the default mode handler for the pair. For example, if neither
79
dnl `shared' nor `disable-shared' was passed, we enable building of shared
80
dnl archives by default:
81
_LT_UNLESS_OPTIONS([shared disable-shared], [_LT_ENABLE_SHARED])
82
_LT_UNLESS_OPTIONS([static disable-static], [_LT_ENABLE_STATIC])
83
_LT_UNLESS_OPTIONS([pic-only no-pic], [_LT_WITH_PIC])
84
_LT_UNLESS_OPTIONS([fast-install disable-fast-install],
85
[_LT_ENABLE_FAST_INSTALL])
89
## ----------------------------------------- ##
90
## Macros to handle LT_INIT_LIBTOOL options. ##
91
## ----------------------------------------- ##
93
m4_define([_LT_MANGLE_DEFUN],
94
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1]), [[^A-Z0-9_]], [_])])
97
# LT_OPTION_DEFINE(NAME, CODE)
98
# ----------------------------
99
m4_define([LT_OPTION_DEFINE],
100
[m4_define(_LT_MANGLE_DEFUN([$1]), [$2])[]dnl
106
LT_OPTION_DEFINE([dlopen], [enable_dlopen=yes])
108
AU_DEFUN([AC_LIBTOOL_DLOPEN],
109
[_LT_SET_OPTION([dlopen])
110
AC_DIAGNOSE([obsolete],
111
[$0: Remove this warning and the call to _LT_SET_OPTION when you
112
put the `dlopen' option into LT_LIBTOOL_INIT's first parameter.])
118
# Declare package support for building win32 dll's.
119
LT_OPTION_DEFINE([win32-dll],
120
[enable_win32_dll=yes
123
*-*-cygwin* | *-*-mingw* | *-*-pw32*)
124
AC_CHECK_TOOL(AS, as, false)
125
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
126
AC_CHECK_TOOL(OBJDUMP, objdump, false)
130
test -z "$AS" && AS=as
131
_LT_DECL([], [AS], [0], [Assembler program])dnl
133
test -z "$DLLTOOL" && DLLTOOL=dlltool
134
_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
136
test -z "$OBJDUMP" && OBJDUMP=objdump
137
_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
140
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
141
[_LT_SET_OPTION([win32-dll])
142
AC_DIAGNOSE([obsolete],
143
[$0: Remove this warning and the call to _LT_SET_OPTION when you
144
put the `win32-dll' option into LT_LIBTOOL_INIT's first parameter.])
148
# _LT_ENABLE_SHARED([DEFAULT])
149
# ----------------------------
150
# implement the --enable-shared flag, and supports the `shared' and
151
# `disable-shared' LT_INIT_LIBTOOL options.
152
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
153
m4_define([_LT_ENABLE_SHARED],
154
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
155
AC_ARG_ENABLE([shared],
156
[AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
157
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
158
[p=${PACKAGE-default}
160
yes) enable_shared=yes ;;
161
no) enable_shared=no ;;
164
# Look at the argument we got. We use all the common list separators.
165
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
166
for pkg in $enableval; do
168
if test "X$pkg" = "X$p"; then
175
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
177
_LT_DECL([build_libtool_libs], [enable_shared], [0],
178
[Whether or not to build shared libraries])
179
])# _LT_ENABLE_SHARED
181
LT_OPTION_DEFINE([shared], [_LT_ENABLE_SHARED([yes])])
182
LT_OPTION_DEFINE([disable-shared], [_LT_ENABLE_SHARED([no])])
185
AU_DEFUN([AC_ENABLE_SHARED],
186
[_LT_SET_OPTION([shared])
187
AC_DIAGNOSE([obsolete],
188
[$0: Remove this warning and the call to _LT_SET_OPTION when you
189
put the `shared' option into LT_LIBTOOL_INIT's first parameter.])
192
AU_DEFUN([AM_ENABLE_SHARED],
193
[_LT_SET_OPTION([shared])
194
AC_DIAGNOSE([obsolete],
195
[$0: Remove this warning and the call to _LT_SET_OPTION when you
196
put the `shared' option into LT_LIBTOOL_INIT's first parameter.])
199
AU_DEFUN([AC_DISABLE_SHARED],
200
[_LT_SET_OPTION([disable-shared])
201
AC_DIAGNOSE([obsolete],
202
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
203
the `disable-shared' option into LT_LIBTOOL_INIT's first parameter.])
206
AU_DEFUN([AM_DISABLE_SHARED],
207
[_LT_SET_OPTION([disable-shared])
208
AC_DIAGNOSE([obsolete],
209
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
210
the `disable-shared' option into LT_LIBTOOL_INIT's first parameter.])
214
# _LT_ENABLE_STATIC([DEFAULT])
215
# ----------------------------
216
# implement the --enable-static flag, and support the `static' and
217
# `disable-static' LT_INIT_LIBTOOL options.
218
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
219
m4_define([_LT_ENABLE_STATIC],
220
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
221
AC_ARG_ENABLE([static],
222
[AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
223
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
224
[p=${PACKAGE-default}
226
yes) enable_static=yes ;;
227
no) enable_static=no ;;
230
# Look at the argument we got. We use all the common list separators.
231
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
232
for pkg in $enableval; do
234
if test "X$pkg" = "X$p"; then
241
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
243
_LT_DECL([build_old_libs], [enable_static], [0],
244
[Whether or not to build static libraries])
245
])# _LT_ENABLE_STATIC
247
LT_OPTION_DEFINE([static], [_LT_ENABLE_STATIC([yes])])
248
LT_OPTION_DEFINE([disable-static], [_LT_ENABLE_STATIC([no])])
251
AU_DEFUN([AC_ENABLE_STATIC],
252
[_LT_SET_OPTION([static])
253
AC_DIAGNOSE([obsolete],
254
[$0: Remove this warning and the call to _LT_SET_OPTION when you
255
put the `static' option into LT_LIBTOOL_INIT's first parameter.])
258
AU_DEFUN([AM_ENABLE_STATIC],
259
[_LT_SET_OPTION([static])
260
AC_DIAGNOSE([obsolete],
261
[$0: Remove this warning and the call to _LT_SET_OPTION when you
262
put the `static' option into LT_LIBTOOL_INIT's first parameter.])
265
AU_DEFUN([AC_DISABLE_STATIC],
266
[_LT_SET_OPTION([disable-static])
267
AC_DIAGNOSE([obsolete],
268
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
269
the `disable-static' option into LT_LIBTOOL_INIT's first parameter.])
272
AU_DEFUN([AM_DISABLE_STATIC],
273
[_LT_SET_OPTION([disable-static])
274
AC_DIAGNOSE([obsolete],
275
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
276
the `disable-static' option into LT_LIBTOOL_INIT's first parameter.])
280
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
281
# ----------------------------------
282
# implement the --enable-fast-install flag, and support the `fast-install'
283
# and `disable-fast-install' LT_INIT_LIBTOOL options.
284
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
285
m4_define([_LT_ENABLE_FAST_INSTALL],
286
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
287
AC_ARG_ENABLE([fast-install],
288
[AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
289
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
290
[p=${PACKAGE-default}
292
yes) enable_fast_install=yes ;;
293
no) enable_fast_install=no ;;
295
enable_fast_install=no
296
# Look at the argument we got. We use all the common list separators.
297
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
298
for pkg in $enableval; do
300
if test "X$pkg" = "X$p"; then
301
enable_fast_install=yes
307
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
309
_LT_DECL([fast_install], [enable_fast_install], [0],
310
[Whether or not to optimize for fast installation])dnl
311
])# _LT_ENABLE_FAST_INSTALL
313
LT_OPTION_DEFINE([fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
314
LT_OPTION_DEFINE([disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
317
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
318
[_LT_SET_OPTION([fast-install])
319
AC_DIAGNOSE([obsolete],
320
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
321
the `fast-install' option into LT_LIBTOOL_INIT's first parameter.])
324
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
325
[_LT_SET_OPTION([disable-fast-install])
326
AC_DIAGNOSE([obsolete],
327
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
328
the `disable-fast-install' option into LT_LIBTOOL_INIT's first parameter.])
332
# _LT_WITH_PIC([MODE])
333
# --------------------
334
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
335
# LT_INIT_LIBTOOL options.
336
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
337
m4_define([_LT_WITH_PIC],
339
[AC_HELP_STRING([--with-pic],
340
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
341
[pic_mode="$withval"],
344
test -z "$pic_mode" && pic_mode=m4_if($#, 1, $1, default)
346
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
349
LT_OPTION_DEFINE([pic-only], [_LT_WITH_PIC([yes])])
350
LT_OPTION_DEFINE([no-pic], [_LT_WITH_PIC([no])])
353
AU_DEFUN([AC_LIBTOOL_PIC_MODE],
354
[_LT_SET_OPTION([pic-only])
355
AC_DIAGNOSE([obsolete],
356
[$0: Remove this warning and the call to _LT_SET_OPTION when you
357
put the `pic-only' option into LT_LIBTOOL_INIT's first parameter.])