]> git.sesse.net Git - vlc/blob - m4/ltoptions.m4
Don't duplicate check for automake 1.7
[vlc] / m4 / ltoptions.m4
1 # 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.
24 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
25
26
27 # _LT_MANGLE_OPTION(NAME)
28 # -----------------------
29 m4_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.
36 m4_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.
42 m4_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.
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
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.
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])])
70     ])dnl
71 dnl
72 dnl Simply set some default values (i.e off) if boolean options were not
73 dnl specified:
74 _LT_UNLESS_OPTIONS([dlopen], enable_dlopen=no)
75 _LT_UNLESS_OPTIONS([win32-dll], enable_win32_dll=no)
76 dnl
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])
86 ])# _LT_SET_OPTIONS
87
88
89 ## ----------------------------------------- ##
90 ## Macros to handle LT_INIT_LIBTOOL options. ##
91 ## ----------------------------------------- ##
92
93 m4_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 # ----------------------------
99 m4_define([LT_OPTION_DEFINE],
100 [m4_define(_LT_MANGLE_DEFUN([$1]), [$2])[]dnl
101 ])# LT_OPTION_DEFINE
102
103
104 # dlopen
105 # ------
106 LT_OPTION_DEFINE([dlopen], [enable_dlopen=yes])
107
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.])
113 ])
114
115
116 # win32-dll
117 # ---------
118 # Declare package support for building win32 dll's.
119 LT_OPTION_DEFINE([win32-dll],
120 [enable_win32_dll=yes
121
122 case $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   ;;
128 esac
129
130 test -z "$AS" && AS=as
131 _LT_DECL([], [AS],      [0], [Assembler program])dnl
132
133 test -z "$DLLTOOL" && DLLTOOL=dlltool
134 _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
135
136 test -z "$OBJDUMP" && OBJDUMP=objdump
137 _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
138 ])# win32-dll
139
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.])
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'.
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}
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
181 LT_OPTION_DEFINE([shared], [_LT_ENABLE_SHARED([yes])])
182 LT_OPTION_DEFINE([disable-shared], [_LT_ENABLE_SHARED([no])])
183
184 # Old names:
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.])
190 ])
191
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.])
197 ])
198
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.])
204 ])
205
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.])
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'.
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}
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
247 LT_OPTION_DEFINE([static], [_LT_ENABLE_STATIC([yes])])
248 LT_OPTION_DEFINE([disable-static], [_LT_ENABLE_STATIC([no])])
249
250 # Old names:
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.])
256 ])
257
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.])
263 ])
264
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.])
270 ])
271
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.])
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'.
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}
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
313 LT_OPTION_DEFINE([fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
314 LT_OPTION_DEFINE([disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
315
316 # Old names:
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.])
322 ])
323
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.])
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'.
337 m4_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
344 test -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
349 LT_OPTION_DEFINE([pic-only], [_LT_WITH_PIC([yes])])
350 LT_OPTION_DEFINE([no-pic], [_LT_WITH_PIC([no])])
351
352 # Old name:
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.])
358 ])