Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sandbox:master commit in: /, m4/
Date: Sat, 23 Jun 2012 21:22:18
Message-Id: 1340485956.10d063518923c1452b6ab75a52f71ed2ece4e859.vapier@gentoo
1 commit: 10d063518923c1452b6ab75a52f71ed2ece4e859
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 18 03:49:00 2012 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 23 21:12:36 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=commit;h=10d06351
7
8 update ax_*.m4 files from upstream
9
10 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
11
12 ---
13 autogen.sh | 23 +++-
14 configure.ac | 6 +-
15 m4/{ax_check_linker_flags.m4 => ax_append_flag.m4} | 64 ++++------
16 m4/ax_cflags_warn_all.m4 | 134 +++++---------------
17 ..._compiler_flags.m4 => ax_check_compile_flag.m4} | 64 +++++-----
18 ...check_linker_flags.m4 => ax_check_link_flag.m4} | 62 ++++-----
19 6 files changed, 137 insertions(+), 216 deletions(-)
20
21 diff --git a/autogen.sh b/autogen.sh
22 index e9fd6b3..8ff14d5 100755
23 --- a/autogen.sh
24 +++ b/autogen.sh
25 @@ -5,14 +5,27 @@ touch ChangeLog
26
27 # avoid ugly warnings due to mismatch between local libtool and
28 # whatever updated version is on the host
29 -find m4/*.m4 '!' -name 'ax_*.m4' -delete 2>/dev/null
30 +find m4/*.m4 '!' -name 'ax_*.m4' -delete 2>/dev/null || :
31
32 # not everyone has sys-devel/autoconf-archive installed
33 -for macro in $(grep -o '\<AX[A-Z_]*\>' configure.ac | sort -u) ; do
34 - if m4=$(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; then
35 - cp -v $m4 m4/
36 +has() { [[ " ${*:2} " == *" $1 "* ]] ; }
37 +import_ax() {
38 + local macro content m4 lm4s
39 + content=$(sed -e '/^[[:space:]]*#/d' -e 's:\<dnl\>.*::' "$@")
40 + for macro in $(echo "${content}" | grep -o '\<AX[A-Z_]*\>' | sort -u) ; do
41 + if m4=$(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; then
42 + has ${m4} "${m4s[@]}" || lm4s+=( ${m4} )
43 + fi
44 + done
45 + if [[ ${#lm4s[@]} -gt 0 ]] ; then
46 + cp -v `printf '%s\n' ${lm4s[@]} | sort -u` m4/
47 + m4s+=( "${lm4s[@]}" )
48 fi
49 -done
50 +}
51 +m4s=()
52 +import_ax configure.ac
53 +import_ax m4/ax_*.m4
54 +import_ax m4/ax_*.m4
55
56 autoreconf -i -f
57
58
59 diff --git a/configure.ac b/configure.ac
60 index de3926c..ad8cf9a 100644
61 --- a/configure.ac
62 +++ b/configure.ac
63 @@ -368,10 +368,10 @@ AC_SUBST([CFLAG_EXCEPTIONS])
64
65 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
66 AX_CFLAGS_WARN_ALL
67 -AC_DEFUN([SB_CHECK_CFLAG],[AX_CHECK_COMPILER_FLAGS([$1],[CFLAGS="$CFLAGS $1"])])
68 +AC_DEFUN([SB_CHECK_CFLAG],[AX_CHECK_COMPILE_FLAG([$1],[CFLAGS="$CFLAGS $1"])])
69 SB_CHECK_CFLAG([-fdata-sections])
70 SB_CHECK_CFLAG([-ffunction-sections])
71 -AC_DEFUN([SB_CHECK_LDFLAG],[AX_CHECK_LINKER_FLAGS([-Wl,$1],[LDFLAGS="$LDFLAGS -Wl,$1"])])
72 +AC_DEFUN([SB_CHECK_LDFLAG],[AX_CHECK_LINK_FLAG([-Wl,$1],[LDFLAGS="$LDFLAGS -Wl,$1"])])
73 SB_CHECK_LDFLAG([--as-needed])
74 SB_CHECK_LDFLAG([--gc-sections])
75 case $host_os in
76 @@ -382,7 +382,7 @@ esac
77 AC_DEFUN([SB_CHECK_LDFLAG_VER],[dnl
78 if test "x${LDFLAG_VER}" = "x" ; then
79 echo '{};' > conftest.map
80 - AX_CHECK_LINKER_FLAGS([-Wl,$1,conftest.map],[LDFLAG_VER="-Wl,$1"])
81 + AX_CHECK_LINK_FLAG([-Wl,$1,conftest.map],[LDFLAG_VER="-Wl,$1"])
82 rm -f conftest.map
83 fi])
84 LDFLAG_VER=
85
86 diff --git a/m4/ax_check_linker_flags.m4 b/m4/ax_append_flag.m4
87 similarity index 53%
88 copy from m4/ax_check_linker_flags.m4
89 copy to m4/ax_append_flag.m4
90 index 894713c..1d38b76 100644
91 --- a/m4/ax_check_linker_flags.m4
92 +++ b/m4/ax_append_flag.m4
93 @@ -1,26 +1,27 @@
94 # ===========================================================================
95 -# http://www.gnu.org/software/autoconf-archive/ax_check_linker_flags.html
96 +# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
97 # ===========================================================================
98 #
99 # SYNOPSIS
100 #
101 -# AX_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
102 +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
103 #
104 # DESCRIPTION
105 #
106 -# Check whether the given linker FLAGS work with the current language's
107 -# linker, or whether they give an error.
108 +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
109 +# added in between.
110 #
111 -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
112 -# success/failure.
113 +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
114 +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
115 +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
116 +# FLAG.
117 #
118 -# NOTE: Based on AX_CHECK_COMPILER_FLAGS.
119 +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
120 #
121 # LICENSE
122 #
123 -# Copyright (c) 2009 Mike Frysinger <vapier@g.o>
124 -# Copyright (c) 2009 Steven G. Johnson <stevenj@××××××××.edu>
125 -# Copyright (c) 2009 Matteo Frigo
126 +# Copyright (c) 2008 Guido U. Draheim <guidod@×××.de>
127 +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@×××××.com>
128 #
129 # This program is free software: you can redistribute it and/or modify it
130 # under the terms of the GNU General Public License as published by the
131 @@ -48,30 +49,21 @@
132 # modified version of the Autoconf Macro, you may extend this special
133 # exception to the GPL to apply to your modified version as well.
134
135 -#serial 6
136 +#serial 2
137
138 -AC_DEFUN([AX_CHECK_LINKER_FLAGS],
139 -[AC_MSG_CHECKING([whether the linker accepts $1])
140 -dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
141 -AS_LITERAL_IF([$1],
142 - [AC_CACHE_VAL(AS_TR_SH(ax_cv_linker_flags_[$1]), [
143 - ax_save_FLAGS=$LDFLAGS
144 - LDFLAGS="$1"
145 - AC_LINK_IFELSE([AC_LANG_PROGRAM()],
146 - AS_TR_SH(ax_cv_linker_flags_[$1])=yes,
147 - AS_TR_SH(ax_cv_linker_flags_[$1])=no)
148 - LDFLAGS=$ax_save_FLAGS])],
149 - [ax_save_FLAGS=$LDFLAGS
150 - LDFLAGS="$1"
151 - AC_LINK_IFELSE([AC_LANG_PROGRAM()],
152 - eval AS_TR_SH(ax_cv_linker_flags_[$1])=yes,
153 - eval AS_TR_SH(ax_cv_linker_flags_[$1])=no)
154 - LDFLAGS=$ax_save_FLAGS])
155 -eval ax_check_linker_flags=$AS_TR_SH(ax_cv_linker_flags_[$1])
156 -AC_MSG_RESULT($ax_check_linker_flags)
157 -if test "x$ax_check_linker_flags" = xyes; then
158 - m4_default([$2], :)
159 -else
160 - m4_default([$3], :)
161 -fi
162 -])dnl AX_CHECK_LINKER_FLAGS
163 +AC_DEFUN([AX_APPEND_FLAG],
164 +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
165 +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl
166 +AS_VAR_SET_IF(FLAGS,
167 + [case " AS_VAR_GET(FLAGS) " in
168 + *" $1 "*)
169 + AC_RUN_LOG([: FLAGS already contains $1])
170 + ;;
171 + *)
172 + AC_RUN_LOG([: FLAGS="$FLAGS $1"])
173 + AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"])
174 + ;;
175 + esac],
176 + [AS_VAR_SET(FLAGS,["$1"])])
177 +AS_VAR_POPDEF([FLAGS])dnl
178 +])dnl AX_APPEND_FLAG
179
180 diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4
181 index 7625580..c22e37f 100644
182 --- a/m4/ax_cflags_warn_all.m4
183 +++ b/m4/ax_cflags_warn_all.m4
184 @@ -25,6 +25,8 @@
185 # - $3 action-if-found : add value to shellvariable
186 # - $4 action-if-not-found : nothing
187 #
188 +# NOTE: These macros depend on AX_APPEND_FLAG.
189 +#
190 # LICENSE
191 #
192 # Copyright (c) 2008 Guido U. Draheim <guidod@×××.de>
193 @@ -56,99 +58,14 @@
194 # modified version of the Autoconf Macro, you may extend this special
195 # exception to the GPL to apply to your modified version as well.
196
197 -#serial 10
198 +#serial 13
199
200 -AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
201 -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
202 -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
203 +AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
204 +AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
205 +AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
206 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
207 VAR,[VAR="no, unknown"
208 - AC_LANG_PUSH([C])
209 - ac_save_[]FLAGS="$[]FLAGS"
210 -for ac_arg dnl
211 -in "-pedantic % -Wall" dnl GCC
212 - "-xstrconst % -v" dnl Solaris C
213 - "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
214 - "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
215 - "-ansi -ansiE % -fullwarn" dnl IRIX
216 - "+ESlit % +w1" dnl HP-UX C
217 - "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
218 - "-h conform % -h msglevel 2" dnl Cray C (Unicos)
219 - #
220 -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
221 - AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
222 - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
223 -done
224 - FLAGS="$ac_save_[]FLAGS"
225 - AC_LANG_POP([C])
226 -])
227 -case ".$VAR" in
228 - .ok|.ok,*) m4_ifvaln($3,$3) ;;
229 - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
230 - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
231 - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
232 - *) m4_ifvaln($3,$3,[
233 - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
234 - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
235 - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
236 - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
237 - fi ]) ;;
238 -esac
239 -AS_VAR_POPDEF([VAR])dnl
240 -AS_VAR_POPDEF([FLAGS])dnl
241 -])
242 -
243 -dnl the only difference - the LANG selection... and the default FLAGS
244 -
245 -AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
246 -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
247 -AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl
248 -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
249 -VAR,[VAR="no, unknown"
250 - AC_LANG_PUSH([C++])
251 - ac_save_[]FLAGS="$[]FLAGS"
252 -for ac_arg dnl
253 -in "-pedantic % -Wall" dnl GCC
254 - "-xstrconst % -v" dnl Solaris C
255 - "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
256 - "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
257 - "-ansi -ansiE % -fullwarn" dnl IRIX
258 - "+ESlit % +w1" dnl HP-UX C
259 - "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
260 - "-h conform % -h msglevel 2" dnl Cray C (Unicos)
261 - #
262 -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
263 - AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
264 - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
265 -done
266 - FLAGS="$ac_save_[]FLAGS"
267 - AC_LANG_POP([C++])
268 -])
269 -case ".$VAR" in
270 - .ok|.ok,*) m4_ifvaln($3,$3) ;;
271 - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
272 - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
273 - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
274 - *) m4_ifvaln($3,$3,[
275 - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
276 - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
277 - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
278 - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
279 - fi ]) ;;
280 -esac
281 -AS_VAR_POPDEF([VAR])dnl
282 -AS_VAR_POPDEF([FLAGS])dnl
283 -])
284 -
285 -dnl the only difference - the LANG selection... and the default FLAGS
286 -
287 -AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
288 -AS_VAR_PUSHDEF([FLAGS],[FCFLAGS])dnl
289 -AS_VAR_PUSHDEF([VAR],[ax_cv_fcflags_warn_all])dnl
290 -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
291 -VAR,[VAR="no, unknown"
292 - AC_LANG_PUSH([Fortran])
293 - ac_save_[]FLAGS="$[]FLAGS"
294 +ac_save_[]FLAGS="$[]FLAGS"
295 for ac_arg dnl
296 in "-warn all % -warn all" dnl Intel
297 "-pedantic % -Wall" dnl GCC
298 @@ -164,25 +81,16 @@ do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
299 AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
300 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
301 done
302 - FLAGS="$ac_save_[]FLAGS"
303 - AC_LANG_POP([Fortran])
304 +FLAGS="$ac_save_[]FLAGS"
305 ])
306 +AS_VAR_POPDEF([FLAGS])dnl
307 case ".$VAR" in
308 .ok|.ok,*) m4_ifvaln($3,$3) ;;
309 - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
310 - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
311 - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
312 - *) m4_ifvaln($3,$3,[
313 - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
314 - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
315 - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
316 - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
317 - fi ]) ;;
318 + .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
319 + *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;;
320 esac
321 AS_VAR_POPDEF([VAR])dnl
322 -AS_VAR_POPDEF([FLAGS])dnl
323 -])
324 -
325 +])dnl AX_FLAGS_WARN_ALL
326 dnl implementation tactics:
327 dnl the for-argument contains a list of options. The first part of
328 dnl these does only exist to detect the compiler - usually it is
329 @@ -193,3 +101,21 @@ dnl like -Woption or -Xoption as they think of it is a pass-through
330 dnl to later compile stages or something. The "%" is used as a
331 dnl delimiter. A non-option comment can be given after "%%" marks
332 dnl which will be shown but not added to the respective C/CXXFLAGS.
333 +
334 +AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
335 +AC_LANG_PUSH([C])
336 +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
337 +AC_LANG_POP([C])
338 +])
339 +
340 +AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
341 +AC_LANG_PUSH([C++])
342 +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
343 +AC_LANG_POP([C++])
344 +])
345 +
346 +AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
347 +AC_LANG_PUSH([Fortran])
348 +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
349 +AC_LANG_POP([Fortran])
350 +])
351
352 diff --git a/m4/ax_check_compiler_flags.m4 b/m4/ax_check_compile_flag.m4
353 similarity index 53%
354 rename from m4/ax_check_compiler_flags.m4
355 rename to m4/ax_check_compile_flag.m4
356 index 35bfd2a..c3a8d69 100644
357 --- a/m4/ax_check_compiler_flags.m4
358 +++ b/m4/ax_check_compile_flag.m4
359 @@ -1,24 +1,31 @@
360 # ===========================================================================
361 -# http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html
362 +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
363 # ===========================================================================
364 #
365 # SYNOPSIS
366 #
367 -# AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
368 +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
369 #
370 # DESCRIPTION
371 #
372 -# Check whether the given compiler FLAGS work with the current language's
373 -# compiler, or whether they give an error. (Warnings, however, are
374 -# ignored.)
375 +# Check whether the given FLAG works with the current language's compiler
376 +# or gives an error. (Warnings, however, are ignored)
377 #
378 # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
379 # success/failure.
380 #
381 +# If EXTRA-FLAGS is defined, it is added to the current language's default
382 +# flags (e.g. CFLAGS) when the check is done. The check is thus made with
383 +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
384 +# force the compiler to issue an error when a bad flag is given.
385 +#
386 +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
387 +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
388 +#
389 # LICENSE
390 #
391 -# Copyright (c) 2009 Steven G. Johnson <stevenj@××××××××.edu>
392 -# Copyright (c) 2009 Matteo Frigo
393 +# Copyright (c) 2008 Guido U. Draheim <guidod@×××.de>
394 +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@×××××.com>
395 #
396 # This program is free software: you can redistribute it and/or modify it
397 # under the terms of the GNU General Public License as published by the
398 @@ -46,31 +53,20 @@
399 # modified version of the Autoconf Macro, you may extend this special
400 # exception to the GPL to apply to your modified version as well.
401
402 -#serial 9
403 +#serial 2
404
405 -AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
406 -[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
407 -AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
408 -dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
409 -AS_LITERAL_IF([$1],
410 - [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [
411 - ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
412 - _AC_LANG_PREFIX[]FLAGS="$1"
413 - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
414 - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
415 - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
416 - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
417 - [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
418 - _AC_LANG_PREFIX[]FLAGS="$1"
419 - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
420 - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
421 - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
422 - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
423 -eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])
424 -AC_MSG_RESULT($ax_check_compiler_flags)
425 -if test "x$ax_check_compiler_flags" = xyes; then
426 - m4_default([$2], :)
427 -else
428 - m4_default([$3], :)
429 -fi
430 -])dnl AX_CHECK_COMPILER_FLAGS
431 +AC_DEFUN([AX_CHECK_COMPILE_FLAG],
432 +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
433 +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
434 +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
435 + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
436 + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
437 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
438 + [AS_VAR_SET(CACHEVAR,[yes])],
439 + [AS_VAR_SET(CACHEVAR,[no])])
440 + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
441 +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
442 + [m4_default([$2], :)],
443 + [m4_default([$3], :)])
444 +AS_VAR_POPDEF([CACHEVAR])dnl
445 +])dnl AX_CHECK_COMPILE_FLAGS
446
447 diff --git a/m4/ax_check_linker_flags.m4 b/m4/ax_check_link_flag.m4
448 similarity index 56%
449 rename from m4/ax_check_linker_flags.m4
450 rename to m4/ax_check_link_flag.m4
451 index 894713c..e2d0d36 100644
452 --- a/m4/ax_check_linker_flags.m4
453 +++ b/m4/ax_check_link_flag.m4
454 @@ -1,26 +1,31 @@
455 # ===========================================================================
456 -# http://www.gnu.org/software/autoconf-archive/ax_check_linker_flags.html
457 +# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
458 # ===========================================================================
459 #
460 # SYNOPSIS
461 #
462 -# AX_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
463 +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
464 #
465 # DESCRIPTION
466 #
467 -# Check whether the given linker FLAGS work with the current language's
468 -# linker, or whether they give an error.
469 +# Check whether the given FLAG works with the linker or gives an error.
470 +# (Warnings, however, are ignored)
471 #
472 # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
473 # success/failure.
474 #
475 -# NOTE: Based on AX_CHECK_COMPILER_FLAGS.
476 +# If EXTRA-FLAGS is defined, it is added to the linker's default flags
477 +# when the check is done. The check is thus made with the flags: "LDFLAGS
478 +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
479 +# issue an error when a bad flag is given.
480 +#
481 +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
482 +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
483 #
484 # LICENSE
485 #
486 -# Copyright (c) 2009 Mike Frysinger <vapier@g.o>
487 -# Copyright (c) 2009 Steven G. Johnson <stevenj@××××××××.edu>
488 -# Copyright (c) 2009 Matteo Frigo
489 +# Copyright (c) 2008 Guido U. Draheim <guidod@×××.de>
490 +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@×××××.com>
491 #
492 # This program is free software: you can redistribute it and/or modify it
493 # under the terms of the GNU General Public License as published by the
494 @@ -48,30 +53,19 @@
495 # modified version of the Autoconf Macro, you may extend this special
496 # exception to the GPL to apply to your modified version as well.
497
498 -#serial 6
499 +#serial 2
500
501 -AC_DEFUN([AX_CHECK_LINKER_FLAGS],
502 -[AC_MSG_CHECKING([whether the linker accepts $1])
503 -dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
504 -AS_LITERAL_IF([$1],
505 - [AC_CACHE_VAL(AS_TR_SH(ax_cv_linker_flags_[$1]), [
506 - ax_save_FLAGS=$LDFLAGS
507 - LDFLAGS="$1"
508 - AC_LINK_IFELSE([AC_LANG_PROGRAM()],
509 - AS_TR_SH(ax_cv_linker_flags_[$1])=yes,
510 - AS_TR_SH(ax_cv_linker_flags_[$1])=no)
511 - LDFLAGS=$ax_save_FLAGS])],
512 - [ax_save_FLAGS=$LDFLAGS
513 - LDFLAGS="$1"
514 - AC_LINK_IFELSE([AC_LANG_PROGRAM()],
515 - eval AS_TR_SH(ax_cv_linker_flags_[$1])=yes,
516 - eval AS_TR_SH(ax_cv_linker_flags_[$1])=no)
517 - LDFLAGS=$ax_save_FLAGS])
518 -eval ax_check_linker_flags=$AS_TR_SH(ax_cv_linker_flags_[$1])
519 -AC_MSG_RESULT($ax_check_linker_flags)
520 -if test "x$ax_check_linker_flags" = xyes; then
521 - m4_default([$2], :)
522 -else
523 - m4_default([$3], :)
524 -fi
525 -])dnl AX_CHECK_LINKER_FLAGS
526 +AC_DEFUN([AX_CHECK_LINK_FLAG],
527 +[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
528 +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
529 + ax_check_save_flags=$LDFLAGS
530 + LDFLAGS="$LDFLAGS $4 $1"
531 + AC_LINK_IFELSE([AC_LANG_PROGRAM()],
532 + [AS_VAR_SET(CACHEVAR,[yes])],
533 + [AS_VAR_SET(CACHEVAR,[no])])
534 + LDFLAGS=$ax_check_save_flags])
535 +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
536 + [m4_default([$2], :)],
537 + [m4_default([$3], :)])
538 +AS_VAR_POPDEF([CACHEVAR])dnl
539 +])dnl AX_CHECK_LINK_FLAGS