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