blob: ea3089d330387f58b23082efe0e8f30992743bba [file] [log] [blame]
paule0a29622004-08-19 04:34:29 +00001# Helper functions for option handling. -*- Autoconf -*-
2# Written by Gary V. Vaughan <gary@gnu.org>
3
4# Copyright (C) 2004 Free Software Foundation, Inc.
5
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)
9# any later version.
10#
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.
15#
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
19# 02111-1307, USA.
20
21# serial 1
22
23# This is to help aclocal find these macros, as it can't see m4_define.
24AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
25
26
27# _LT_MANGLE_OPTION(NAME)
28# -----------------------
29m4_define([_LT_MANGLE_OPTION],
30[[_LT_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
31
32
33# _LT_SET_OPTION(NAME)
34# ------------------------------
35# Set option NAME. Other NAMEs are saved as a flag.
36m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1]))])
37
38
39# _LT_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
40# -------------------------------------------
41# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
42m4_define([_LT_IF_OPTION],
43[m4_ifdef(_LT_MANGLE_OPTION([$1]), [$2], [$3])])
44
45
46# _LT_UNLESS_OPTIONS(OPTIONS, IF-NOT-SET)
47# ---------------------------------------
48# Execute IF-NOT-SET if all OPTIONS are not set.
49m4_define([_LT_UNLESS_OPTIONS],
50[AC_FOREACH([_LT_Option], [$1],
51 [m4_ifdef(_LT_MANGLE_OPTION(_LT_Option),
52 [m4_define([$0_found])])])[]dnl
53m4_ifdef([$0_found], [m4_undefine([$0_found])], [$2
54])[]dnl
55])
56
57
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
63# and exit.
64m4_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])])
70 ])dnl
71dnl
72dnl Simply set some default values (i.e off) if boolean options were not
73dnl specified:
74_LT_UNLESS_OPTIONS([dlopen], enable_dlopen=no)
75_LT_UNLESS_OPTIONS([win32-dll], enable_win32_dll=no)
76dnl
77dnl If no reference was made to various pairs of opposing options, then
78dnl we run the default mode handler for the pair. For example, if neither
79dnl `shared' nor `disable-shared' was passed, we enable building of shared
80dnl 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])
86])# _LT_SET_OPTIONS
87
88
89## ----------------------------------------- ##
90## Macros to handle LT_INIT_LIBTOOL options. ##
91## ----------------------------------------- ##
92
93m4_define([_LT_MANGLE_DEFUN],
94[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1]), [[^A-Z0-9_]], [_])])
95
96
97# LT_OPTION_DEFINE(NAME, CODE)
98# ----------------------------
99m4_define([LT_OPTION_DEFINE],
100[m4_define(_LT_MANGLE_DEFUN([$1]), [$2])[]dnl
101])# LT_OPTION_DEFINE
102
103
104# dlopen
105# ------
106LT_OPTION_DEFINE([dlopen], [enable_dlopen=yes])
107
108AU_DEFUN([AC_LIBTOOL_DLOPEN],
109[_LT_SET_OPTION([dlopen])
110AC_DIAGNOSE([obsolete],
111[$0: Remove this warning and the call to _LT_SET_OPTION when you
112put the `dlopen' option into LT_LIBTOOL_INIT's first parameter.])
113])
114
115
116# win32-dll
117# ---------
118# Declare package support for building win32 dll's.
119LT_OPTION_DEFINE([win32-dll],
120[enable_win32_dll=yes
121
122case $host in
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)
127 ;;
128esac
129
130test -z "$AS" && AS=as
131_LT_DECL([], [AS], [0], [Assembler program])dnl
132
133test -z "$DLLTOOL" && DLLTOOL=dlltool
134_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
135
136test -z "$OBJDUMP" && OBJDUMP=objdump
137_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
138])# win32-dll
139
140AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
141[_LT_SET_OPTION([win32-dll])
142AC_DIAGNOSE([obsolete],
143[$0: Remove this warning and the call to _LT_SET_OPTION when you
144put the `win32-dll' option into LT_LIBTOOL_INIT's first parameter.])
145])
146
147
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'.
153m4_define([_LT_ENABLE_SHARED],
154[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
155AC_ARG_ENABLE([shared],
156 [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
157 [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
158 [p=${PACKAGE-default}
159 case $enableval in
160 yes) enable_shared=yes ;;
161 no) enable_shared=no ;;
162 *)
163 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
167 IFS="$lt_save_ifs"
168 if test "X$pkg" = "X$p"; then
169 enable_shared=yes
170 fi
171 done
172 IFS="$lt_save_ifs"
173 ;;
174 esac],
175 [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
176
177 _LT_DECL([build_libtool_libs], [enable_shared], [0],
178 [Whether or not to build shared libraries])
179])# _LT_ENABLE_SHARED
180
181LT_OPTION_DEFINE([shared], [_LT_ENABLE_SHARED([yes])])
182LT_OPTION_DEFINE([disable-shared], [_LT_ENABLE_SHARED([no])])
183
184# Old names:
185AU_DEFUN([AC_ENABLE_SHARED],
186[_LT_SET_OPTION([shared])
187AC_DIAGNOSE([obsolete],
188[$0: Remove this warning and the call to _LT_SET_OPTION when you
189put the `shared' option into LT_LIBTOOL_INIT's first parameter.])
190])
191
192AU_DEFUN([AM_ENABLE_SHARED],
193[_LT_SET_OPTION([shared])
194AC_DIAGNOSE([obsolete],
195[$0: Remove this warning and the call to _LT_SET_OPTION when you
196put the `shared' option into LT_LIBTOOL_INIT's first parameter.])
197])
198
199AU_DEFUN([AC_DISABLE_SHARED],
200[_LT_SET_OPTION([disable-shared])
201AC_DIAGNOSE([obsolete],
202[$0: Remove this warning and the call to _LT_SET_OPTION when you put
203the `disable-shared' option into LT_LIBTOOL_INIT's first parameter.])
204])
205
206AU_DEFUN([AM_DISABLE_SHARED],
207[_LT_SET_OPTION([disable-shared])
208AC_DIAGNOSE([obsolete],
209[$0: Remove this warning and the call to _LT_SET_OPTION when you put
210the `disable-shared' option into LT_LIBTOOL_INIT's first parameter.])
211])
212
213
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'.
219m4_define([_LT_ENABLE_STATIC],
220[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
221AC_ARG_ENABLE([static],
222 [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
223 [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
224 [p=${PACKAGE-default}
225 case $enableval in
226 yes) enable_static=yes ;;
227 no) enable_static=no ;;
228 *)
229 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
233 IFS="$lt_save_ifs"
234 if test "X$pkg" = "X$p"; then
235 enable_static=yes
236 fi
237 done
238 IFS="$lt_save_ifs"
239 ;;
240 esac],
241 [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
242
243 _LT_DECL([build_old_libs], [enable_static], [0],
244 [Whether or not to build static libraries])
245])# _LT_ENABLE_STATIC
246
247LT_OPTION_DEFINE([static], [_LT_ENABLE_STATIC([yes])])
248LT_OPTION_DEFINE([disable-static], [_LT_ENABLE_STATIC([no])])
249
250# Old names:
251AU_DEFUN([AC_ENABLE_STATIC],
252[_LT_SET_OPTION([static])
253AC_DIAGNOSE([obsolete],
254[$0: Remove this warning and the call to _LT_SET_OPTION when you
255put the `static' option into LT_LIBTOOL_INIT's first parameter.])
256])
257
258AU_DEFUN([AM_ENABLE_STATIC],
259[_LT_SET_OPTION([static])
260AC_DIAGNOSE([obsolete],
261[$0: Remove this warning and the call to _LT_SET_OPTION when you
262put the `static' option into LT_LIBTOOL_INIT's first parameter.])
263])
264
265AU_DEFUN([AC_DISABLE_STATIC],
266[_LT_SET_OPTION([disable-static])
267AC_DIAGNOSE([obsolete],
268[$0: Remove this warning and the call to _LT_SET_OPTION when you put
269the `disable-static' option into LT_LIBTOOL_INIT's first parameter.])
270])
271
272AU_DEFUN([AM_DISABLE_STATIC],
273[_LT_SET_OPTION([disable-static])
274AC_DIAGNOSE([obsolete],
275[$0: Remove this warning and the call to _LT_SET_OPTION when you put
276the `disable-static' option into LT_LIBTOOL_INIT's first parameter.])
277])
278
279
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'.
285m4_define([_LT_ENABLE_FAST_INSTALL],
286[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
287AC_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}
291 case $enableval in
292 yes) enable_fast_install=yes ;;
293 no) enable_fast_install=no ;;
294 *)
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
299 IFS="$lt_save_ifs"
300 if test "X$pkg" = "X$p"; then
301 enable_fast_install=yes
302 fi
303 done
304 IFS="$lt_save_ifs"
305 ;;
306 esac],
307 [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
308
309_LT_DECL([fast_install], [enable_fast_install], [0],
310 [Whether or not to optimize for fast installation])dnl
311])# _LT_ENABLE_FAST_INSTALL
312
313LT_OPTION_DEFINE([fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
314LT_OPTION_DEFINE([disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
315
316# Old names:
317AU_DEFUN([AC_ENABLE_FAST_INSTALL],
318[_LT_SET_OPTION([fast-install])
319AC_DIAGNOSE([obsolete],
320[$0: Remove this warning and the call to _LT_SET_OPTION when you put
321the `fast-install' option into LT_LIBTOOL_INIT's first parameter.])
322])
323
324AU_DEFUN([AC_DISABLE_FAST_INSTALL],
325[_LT_SET_OPTION([disable-fast-install])
326AC_DIAGNOSE([obsolete],
327[$0: Remove this warning and the call to _LT_SET_OPTION when you put
328the `disable-fast-install' option into LT_LIBTOOL_INIT's first parameter.])
329])
330
331
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'.
337m4_define([_LT_WITH_PIC],
338[AC_ARG_WITH([pic],
339 [AC_HELP_STRING([--with-pic],
340 [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
341 [pic_mode="$withval"],
342 [pic_mode=default])
343
344test -z "$pic_mode" && pic_mode=m4_if($#, 1, $1, default)
345
346_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
347])# _LT_WITH_PIC
348
349LT_OPTION_DEFINE([pic-only], [_LT_WITH_PIC([yes])])
350LT_OPTION_DEFINE([no-pic], [_LT_WITH_PIC([no])])
351
352# Old name:
353AU_DEFUN([AC_LIBTOOL_PIC_MODE],
354[_LT_SET_OPTION([pic-only])
355AC_DIAGNOSE([obsolete],
356[$0: Remove this warning and the call to _LT_SET_OPTION when you
357put the `pic-only' option into LT_LIBTOOL_INIT's first parameter.])
358])