ltoptions.m4 revision 475c125c
1475c125cSmrg# Helper functions for option handling.                    -*- Autoconf -*-
2475c125cSmrg#
3475c125cSmrg#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
4475c125cSmrg#   Inc.
5475c125cSmrg#   Written by Gary V. Vaughan, 2004
6475c125cSmrg#
7475c125cSmrg# This file is free software; the Free Software Foundation gives
8475c125cSmrg# unlimited permission to copy and/or distribute it, with or without
9475c125cSmrg# modifications, as long as this notice is preserved.
10475c125cSmrg
11475c125cSmrg# serial 7 ltoptions.m4
12475c125cSmrg
13475c125cSmrg# This is to help aclocal find these macros, as it can't see m4_define.
14475c125cSmrgAC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
15475c125cSmrg
16475c125cSmrg
17475c125cSmrg# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
18475c125cSmrg# ------------------------------------------
19475c125cSmrgm4_define([_LT_MANGLE_OPTION],
20475c125cSmrg[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
21475c125cSmrg
22475c125cSmrg
23475c125cSmrg# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
24475c125cSmrg# ---------------------------------------
25475c125cSmrg# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
26475c125cSmrg# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
27475c125cSmrg# saved as a flag.
28475c125cSmrgm4_define([_LT_SET_OPTION],
29475c125cSmrg[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
30475c125cSmrgm4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
31475c125cSmrg        _LT_MANGLE_DEFUN([$1], [$2]),
32475c125cSmrg    [m4_warning([Unknown $1 option `$2'])])[]dnl
33475c125cSmrg])
34475c125cSmrg
35475c125cSmrg
36475c125cSmrg# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
37475c125cSmrg# ------------------------------------------------------------
38475c125cSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
39475c125cSmrgm4_define([_LT_IF_OPTION],
40475c125cSmrg[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
41475c125cSmrg
42475c125cSmrg
43475c125cSmrg# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
44475c125cSmrg# -------------------------------------------------------
45475c125cSmrg# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
46475c125cSmrg# are set.
47475c125cSmrgm4_define([_LT_UNLESS_OPTIONS],
48475c125cSmrg[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
49475c125cSmrg	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
50475c125cSmrg		      [m4_define([$0_found])])])[]dnl
51475c125cSmrgm4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
52475c125cSmrg])[]dnl
53475c125cSmrg])
54475c125cSmrg
55475c125cSmrg
56475c125cSmrg# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
57475c125cSmrg# ----------------------------------------
58475c125cSmrg# OPTION-LIST is a space-separated list of Libtool options associated
59475c125cSmrg# with MACRO-NAME.  If any OPTION has a matching handler declared with
60475c125cSmrg# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
61475c125cSmrg# the unknown option and exit.
62475c125cSmrgm4_defun([_LT_SET_OPTIONS],
63475c125cSmrg[# Set options
64475c125cSmrgm4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
65475c125cSmrg    [_LT_SET_OPTION([$1], _LT_Option)])
66475c125cSmrg
67475c125cSmrgm4_if([$1],[LT_INIT],[
68475c125cSmrg  dnl
69475c125cSmrg  dnl Simply set some default values (i.e off) if boolean options were not
70475c125cSmrg  dnl specified:
71475c125cSmrg  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
72475c125cSmrg  ])
73475c125cSmrg  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
74475c125cSmrg  ])
75475c125cSmrg  dnl
76475c125cSmrg  dnl If no reference was made to various pairs of opposing options, then
77475c125cSmrg  dnl we run the default mode handler for the pair.  For example, if neither
78475c125cSmrg  dnl `shared' nor `disable-shared' was passed, we enable building of shared
79475c125cSmrg  dnl archives by default:
80475c125cSmrg  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
81475c125cSmrg  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
82475c125cSmrg  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
83475c125cSmrg  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
84475c125cSmrg  		   [_LT_ENABLE_FAST_INSTALL])
85475c125cSmrg  ])
86475c125cSmrg])# _LT_SET_OPTIONS
87475c125cSmrg
88475c125cSmrg
89475c125cSmrg## --------------------------------- ##
90475c125cSmrg## Macros to handle LT_INIT options. ##
91475c125cSmrg## --------------------------------- ##
92475c125cSmrg
93475c125cSmrg# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
94475c125cSmrg# -----------------------------------------
95475c125cSmrgm4_define([_LT_MANGLE_DEFUN],
96475c125cSmrg[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
97475c125cSmrg
98475c125cSmrg
99475c125cSmrg# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
100475c125cSmrg# -----------------------------------------------
101475c125cSmrgm4_define([LT_OPTION_DEFINE],
102475c125cSmrg[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
103475c125cSmrg])# LT_OPTION_DEFINE
104475c125cSmrg
105475c125cSmrg
106475c125cSmrg# dlopen
107475c125cSmrg# ------
108475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
109475c125cSmrg])
110475c125cSmrg
111475c125cSmrgAU_DEFUN([AC_LIBTOOL_DLOPEN],
112475c125cSmrg[_LT_SET_OPTION([LT_INIT], [dlopen])
113475c125cSmrgAC_DIAGNOSE([obsolete],
114475c125cSmrg[$0: Remove this warning and the call to _LT_SET_OPTION when you
115475c125cSmrgput the `dlopen' option into LT_INIT's first parameter.])
116475c125cSmrg])
117475c125cSmrg
118475c125cSmrgdnl aclocal-1.4 backwards compatibility:
119475c125cSmrgdnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
120475c125cSmrg
121475c125cSmrg
122475c125cSmrg# win32-dll
123475c125cSmrg# ---------
124475c125cSmrg# Declare package support for building win32 dll's.
125475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [win32-dll],
126475c125cSmrg[enable_win32_dll=yes
127475c125cSmrg
128475c125cSmrgcase $host in
129475c125cSmrg*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
130475c125cSmrg  AC_CHECK_TOOL(AS, as, false)
131475c125cSmrg  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
132475c125cSmrg  AC_CHECK_TOOL(OBJDUMP, objdump, false)
133475c125cSmrg  ;;
134475c125cSmrgesac
135475c125cSmrg
136475c125cSmrgtest -z "$AS" && AS=as
137475c125cSmrg_LT_DECL([], [AS],      [1], [Assembler program])dnl
138475c125cSmrg
139475c125cSmrgtest -z "$DLLTOOL" && DLLTOOL=dlltool
140475c125cSmrg_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
141475c125cSmrg
142475c125cSmrgtest -z "$OBJDUMP" && OBJDUMP=objdump
143475c125cSmrg_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
144475c125cSmrg])# win32-dll
145475c125cSmrg
146475c125cSmrgAU_DEFUN([AC_LIBTOOL_WIN32_DLL],
147475c125cSmrg[AC_REQUIRE([AC_CANONICAL_HOST])dnl
148475c125cSmrg_LT_SET_OPTION([LT_INIT], [win32-dll])
149475c125cSmrgAC_DIAGNOSE([obsolete],
150475c125cSmrg[$0: Remove this warning and the call to _LT_SET_OPTION when you
151475c125cSmrgput the `win32-dll' option into LT_INIT's first parameter.])
152475c125cSmrg])
153475c125cSmrg
154475c125cSmrgdnl aclocal-1.4 backwards compatibility:
155475c125cSmrgdnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
156475c125cSmrg
157475c125cSmrg
158475c125cSmrg# _LT_ENABLE_SHARED([DEFAULT])
159475c125cSmrg# ----------------------------
160475c125cSmrg# implement the --enable-shared flag, and supports the `shared' and
161475c125cSmrg# `disable-shared' LT_INIT options.
162475c125cSmrg# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
163475c125cSmrgm4_define([_LT_ENABLE_SHARED],
164475c125cSmrg[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
165475c125cSmrgAC_ARG_ENABLE([shared],
166475c125cSmrg    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
167475c125cSmrg	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
168475c125cSmrg    [p=${PACKAGE-default}
169475c125cSmrg    case $enableval in
170475c125cSmrg    yes) enable_shared=yes ;;
171475c125cSmrg    no) enable_shared=no ;;
172475c125cSmrg    *)
173475c125cSmrg      enable_shared=no
174475c125cSmrg      # Look at the argument we got.  We use all the common list separators.
175475c125cSmrg      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
176475c125cSmrg      for pkg in $enableval; do
177475c125cSmrg	IFS="$lt_save_ifs"
178475c125cSmrg	if test "X$pkg" = "X$p"; then
179475c125cSmrg	  enable_shared=yes
180475c125cSmrg	fi
181475c125cSmrg      done
182475c125cSmrg      IFS="$lt_save_ifs"
183475c125cSmrg      ;;
184475c125cSmrg    esac],
185475c125cSmrg    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
186475c125cSmrg
187475c125cSmrg    _LT_DECL([build_libtool_libs], [enable_shared], [0],
188475c125cSmrg	[Whether or not to build shared libraries])
189475c125cSmrg])# _LT_ENABLE_SHARED
190475c125cSmrg
191475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
192475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
193475c125cSmrg
194475c125cSmrg# Old names:
195475c125cSmrgAC_DEFUN([AC_ENABLE_SHARED],
196475c125cSmrg[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
197475c125cSmrg])
198475c125cSmrg
199475c125cSmrgAC_DEFUN([AC_DISABLE_SHARED],
200475c125cSmrg[_LT_SET_OPTION([LT_INIT], [disable-shared])
201475c125cSmrg])
202475c125cSmrg
203475c125cSmrgAU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
204475c125cSmrgAU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
205475c125cSmrg
206475c125cSmrgdnl aclocal-1.4 backwards compatibility:
207475c125cSmrgdnl AC_DEFUN([AM_ENABLE_SHARED], [])
208475c125cSmrgdnl AC_DEFUN([AM_DISABLE_SHARED], [])
209475c125cSmrg
210475c125cSmrg
211475c125cSmrg
212475c125cSmrg# _LT_ENABLE_STATIC([DEFAULT])
213475c125cSmrg# ----------------------------
214475c125cSmrg# implement the --enable-static flag, and support the `static' and
215475c125cSmrg# `disable-static' LT_INIT options.
216475c125cSmrg# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
217475c125cSmrgm4_define([_LT_ENABLE_STATIC],
218475c125cSmrg[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
219475c125cSmrgAC_ARG_ENABLE([static],
220475c125cSmrg    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
221475c125cSmrg	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
222475c125cSmrg    [p=${PACKAGE-default}
223475c125cSmrg    case $enableval in
224475c125cSmrg    yes) enable_static=yes ;;
225475c125cSmrg    no) enable_static=no ;;
226475c125cSmrg    *)
227475c125cSmrg     enable_static=no
228475c125cSmrg      # Look at the argument we got.  We use all the common list separators.
229475c125cSmrg      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
230475c125cSmrg      for pkg in $enableval; do
231475c125cSmrg	IFS="$lt_save_ifs"
232475c125cSmrg	if test "X$pkg" = "X$p"; then
233475c125cSmrg	  enable_static=yes
234475c125cSmrg	fi
235475c125cSmrg      done
236475c125cSmrg      IFS="$lt_save_ifs"
237475c125cSmrg      ;;
238475c125cSmrg    esac],
239475c125cSmrg    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
240475c125cSmrg
241475c125cSmrg    _LT_DECL([build_old_libs], [enable_static], [0],
242475c125cSmrg	[Whether or not to build static libraries])
243475c125cSmrg])# _LT_ENABLE_STATIC
244475c125cSmrg
245475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
246475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
247475c125cSmrg
248475c125cSmrg# Old names:
249475c125cSmrgAC_DEFUN([AC_ENABLE_STATIC],
250475c125cSmrg[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
251475c125cSmrg])
252475c125cSmrg
253475c125cSmrgAC_DEFUN([AC_DISABLE_STATIC],
254475c125cSmrg[_LT_SET_OPTION([LT_INIT], [disable-static])
255475c125cSmrg])
256475c125cSmrg
257475c125cSmrgAU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
258475c125cSmrgAU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
259475c125cSmrg
260475c125cSmrgdnl aclocal-1.4 backwards compatibility:
261475c125cSmrgdnl AC_DEFUN([AM_ENABLE_STATIC], [])
262475c125cSmrgdnl AC_DEFUN([AM_DISABLE_STATIC], [])
263475c125cSmrg
264475c125cSmrg
265475c125cSmrg
266475c125cSmrg# _LT_ENABLE_FAST_INSTALL([DEFAULT])
267475c125cSmrg# ----------------------------------
268475c125cSmrg# implement the --enable-fast-install flag, and support the `fast-install'
269475c125cSmrg# and `disable-fast-install' LT_INIT options.
270475c125cSmrg# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
271475c125cSmrgm4_define([_LT_ENABLE_FAST_INSTALL],
272475c125cSmrg[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
273475c125cSmrgAC_ARG_ENABLE([fast-install],
274475c125cSmrg    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
275475c125cSmrg    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
276475c125cSmrg    [p=${PACKAGE-default}
277475c125cSmrg    case $enableval in
278475c125cSmrg    yes) enable_fast_install=yes ;;
279475c125cSmrg    no) enable_fast_install=no ;;
280475c125cSmrg    *)
281475c125cSmrg      enable_fast_install=no
282475c125cSmrg      # Look at the argument we got.  We use all the common list separators.
283475c125cSmrg      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
284475c125cSmrg      for pkg in $enableval; do
285475c125cSmrg	IFS="$lt_save_ifs"
286475c125cSmrg	if test "X$pkg" = "X$p"; then
287475c125cSmrg	  enable_fast_install=yes
288475c125cSmrg	fi
289475c125cSmrg      done
290475c125cSmrg      IFS="$lt_save_ifs"
291475c125cSmrg      ;;
292475c125cSmrg    esac],
293475c125cSmrg    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
294475c125cSmrg
295475c125cSmrg_LT_DECL([fast_install], [enable_fast_install], [0],
296475c125cSmrg	 [Whether or not to optimize for fast installation])dnl
297475c125cSmrg])# _LT_ENABLE_FAST_INSTALL
298475c125cSmrg
299475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
300475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
301475c125cSmrg
302475c125cSmrg# Old names:
303475c125cSmrgAU_DEFUN([AC_ENABLE_FAST_INSTALL],
304475c125cSmrg[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
305475c125cSmrgAC_DIAGNOSE([obsolete],
306475c125cSmrg[$0: Remove this warning and the call to _LT_SET_OPTION when you put
307475c125cSmrgthe `fast-install' option into LT_INIT's first parameter.])
308475c125cSmrg])
309475c125cSmrg
310475c125cSmrgAU_DEFUN([AC_DISABLE_FAST_INSTALL],
311475c125cSmrg[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
312475c125cSmrgAC_DIAGNOSE([obsolete],
313475c125cSmrg[$0: Remove this warning and the call to _LT_SET_OPTION when you put
314475c125cSmrgthe `disable-fast-install' option into LT_INIT's first parameter.])
315475c125cSmrg])
316475c125cSmrg
317475c125cSmrgdnl aclocal-1.4 backwards compatibility:
318475c125cSmrgdnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
319475c125cSmrgdnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
320475c125cSmrg
321475c125cSmrg
322475c125cSmrg# _LT_WITH_PIC([MODE])
323475c125cSmrg# --------------------
324475c125cSmrg# implement the --with-pic flag, and support the `pic-only' and `no-pic'
325475c125cSmrg# LT_INIT options.
326475c125cSmrg# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
327475c125cSmrgm4_define([_LT_WITH_PIC],
328475c125cSmrg[AC_ARG_WITH([pic],
329475c125cSmrg    [AS_HELP_STRING([--with-pic],
330475c125cSmrg	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
331475c125cSmrg    [pic_mode="$withval"],
332475c125cSmrg    [pic_mode=default])
333475c125cSmrg
334475c125cSmrgtest -z "$pic_mode" && pic_mode=m4_default([$1], [default])
335475c125cSmrg
336475c125cSmrg_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
337475c125cSmrg])# _LT_WITH_PIC
338475c125cSmrg
339475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
340475c125cSmrgLT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
341475c125cSmrg
342475c125cSmrg# Old name:
343475c125cSmrgAU_DEFUN([AC_LIBTOOL_PICMODE],
344475c125cSmrg[_LT_SET_OPTION([LT_INIT], [pic-only])
345475c125cSmrgAC_DIAGNOSE([obsolete],
346475c125cSmrg[$0: Remove this warning and the call to _LT_SET_OPTION when you
347475c125cSmrgput the `pic-only' option into LT_INIT's first parameter.])
348475c125cSmrg])
349475c125cSmrg
350475c125cSmrgdnl aclocal-1.4 backwards compatibility:
351475c125cSmrgdnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
352475c125cSmrg
353475c125cSmrg## ----------------- ##
354475c125cSmrg## LTDL_INIT Options ##
355475c125cSmrg## ----------------- ##
356475c125cSmrg
357475c125cSmrgm4_define([_LTDL_MODE], [])
358475c125cSmrgLT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
359475c125cSmrg		 [m4_define([_LTDL_MODE], [nonrecursive])])
360475c125cSmrgLT_OPTION_DEFINE([LTDL_INIT], [recursive],
361475c125cSmrg		 [m4_define([_LTDL_MODE], [recursive])])
362475c125cSmrgLT_OPTION_DEFINE([LTDL_INIT], [subproject],
363475c125cSmrg		 [m4_define([_LTDL_MODE], [subproject])])
364475c125cSmrg
365475c125cSmrgm4_define([_LTDL_TYPE], [])
366475c125cSmrgLT_OPTION_DEFINE([LTDL_INIT], [installable],
367475c125cSmrg		 [m4_define([_LTDL_TYPE], [installable])])
368475c125cSmrgLT_OPTION_DEFINE([LTDL_INIT], [convenience],
369475c125cSmrg		 [m4_define([_LTDL_TYPE], [convenience])])
370