1 dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
3 dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
4 dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds
5 dnl the optionflag to CFLAGS if it is understood. You can override
6 dnl the shellvar-default of CFLAGS of course. The order of arguments
7 dnl stems from the explicit macros like AX_CFLAGS_WARN_ALL.
9 dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
10 dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
11 dnl (since it is possible to use different compilers for C and C++).
13 dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
14 dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
15 dnl However, if you use this macro in a few places, it would be great
16 dnl if you would make up a new function-macro and submit it to the
19 dnl - $1 option-to-check-for : required ("-option" as non-value)
20 dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
21 dnl - $3 action-if-found : add value to shellvariable
22 dnl - $4 action-if-not-found : nothing
24 dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
25 dnl situation and accept a $2=~/-/ as being the old option-to-check-for.
27 dnl also: there are other variants that emerged from the original macro
28 dnl variant which did just test an option to be possibly added. However,
29 dnl some compilers accept an option silently, or possibly for just
30 dnl another option that was not intended. Therefore, we have to do a
31 dnl generic test for a compiler family. For gcc we check "-pedantic"
32 dnl being accepted which is also understood by compilers who just want
33 dnl to be compatible with gcc even when not being made from gcc sources.
36 dnl AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
37 dnl AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION
39 dnl @, tested, experimental
40 dnl @version $Id: ax_cflags_gcc_option.m4,v 1.5 2003/11/29 08:13:25 guidod Exp $
41 dnl @author Guido Draheim <guidod@gmx.de>
42 dnl http://ac-archive.sourceforge.net/C_Support/ax_cflags_gcc_option.html
44 AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
45 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
46 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
47 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
48 VAR,[VAR="no, unknown"
51 ac_save_[]FLAGS="$[]FLAGS"
53 in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
55 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
56 AC_TRY_COMPILE([],[return 0;],
57 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
59 FLAGS="$ac_save_[]FLAGS"
63 .ok|.ok,*) m4_ifvaln($3,$3) ;;
64 .|.no|.no,*) m4_ifvaln($4,$4) ;;
66 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
67 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
68 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
69 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
72 AS_VAR_POPDEF([VAR])dnl
73 AS_VAR_POPDEF([FLAGS])dnl
77 dnl the only difference - the LANG selection... and the default FLAGS
79 AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl
80 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
81 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
82 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
83 VAR,[VAR="no, unknown"
86 ac_save_[]FLAGS="$[]FLAGS"
88 in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
90 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
91 AC_TRY_COMPILE([],[return 0;],
92 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
94 FLAGS="$ac_save_[]FLAGS"
98 .ok|.ok,*) m4_ifvaln($3,$3) ;;
99 .|.no|.no,*) m4_ifvaln($4,$4) ;;
101 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
102 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
103 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
104 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
107 AS_VAR_POPDEF([VAR])dnl
108 AS_VAR_POPDEF([FLAGS])dnl
111 dnl -------------------------------------------------------------------------
113 AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl
114 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
115 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
116 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
117 VAR,[VAR="no, unknown"
120 ac_save_[]FLAGS="$[]FLAGS"
122 in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
124 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
125 AC_TRY_COMPILE([],[return 0;],
126 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
128 FLAGS="$ac_save_[]FLAGS"
132 .ok|.ok,*) m4_ifvaln($3,$3) ;;
133 .|.no|.no,*) m4_ifvaln($4,$4) ;;
135 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
136 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
137 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
138 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
141 AS_VAR_POPDEF([VAR])dnl
142 AS_VAR_POPDEF([FLAGS])dnl
146 dnl the only difference - the LANG selection... and the default FLAGS
148 AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl
149 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
150 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
151 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
152 VAR,[VAR="no, unknown"
155 ac_save_[]FLAGS="$[]FLAGS"
157 in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
159 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
160 AC_TRY_COMPILE([],[return 0;],
161 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
163 FLAGS="$ac_save_[]FLAGS"
167 .ok|.ok,*) m4_ifvaln($3,$3) ;;
168 .|.no|.no,*) m4_ifvaln($4,$4) ;;
170 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
171 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
172 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
173 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
176 AS_VAR_POPDEF([VAR])dnl
177 AS_VAR_POPDEF([FLAGS])dnl
180 AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
181 [AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])])
183 AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
184 [AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])])
187 dnl @synopsis AX_CFLAGS_AIX_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
189 dnl AX_CFLAGS_AIX_OPTION(-qubicle) would show a message as like
190 dnl "checking CFLAGS for aix/cc -qubicle ... yes" and adds
191 dnl the optionflag to CFLAGS if it is understood. You can override
192 dnl the shellvar-default of CFLAGS of course. The order of arguments
193 dnl stems from the explicit macros like AX_CFLAGS_WARN_ALL.
195 dnl The cousin AX_CXXFLAGS_AIX_OPTION would check for an option to add
196 dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
197 dnl (since it is possible to use different compilers for C and C++).
199 dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
200 dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
201 dnl However, if you use this macro in a few places, it would be great
202 dnl if you would make up a new function-macro and submit it to the
204 dnl - $1 option-to-check-for : required ("-option" as non-value)
205 dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
206 dnl - $3 action-if-found : add value to shellvariable
207 dnl - $4 action-if-not-found : nothing
209 dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
210 dnl situation and accept a $2=~/-/ as being the old option-to-check-for.
212 dnl see also: AX_CFLAGS_GCC_OPTION for the widely used original variant.
214 dnl @, untested, experimental
215 dnl @version $Id: ax_cflags_aix_option.m4,v 1.1 2003/10/13 22:20:39 guidod Exp $
216 dnl @author Guido Draheim <guidod@gmx.de>
217 dnl http://ac-archive.sourceforge.net/guidod/ax_cflags_aix_option.m4
219 AC_DEFUN([AX_CFLAGS_AIX_OPTION_OLD], [dnl
220 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
221 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_aix_option_$2])dnl
222 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for aix/cc m4_ifval($2,$2,-option)],
223 VAR,[VAR="no, unknown"
226 ac_save_[]FLAGS="$[]FLAGS"
228 in "-qlanglvl=ansi -qsrcmsg % m4_ifval($2,$2,-option)" dnl AIX
230 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
231 AC_TRY_COMPILE([],[return 0;],
232 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
234 FLAGS="$ac_save_[]FLAGS"
238 .ok|.ok,*) m4_ifvaln($3,$3) ;;
239 .|.no|.no,*) m4_ifvaln($4,$4) ;;
241 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
242 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
243 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
244 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
247 AS_VAR_POPDEF([VAR])dnl
248 AS_VAR_POPDEF([FLAGS])dnl
251 dnl the only difference - the LANG selection... and the default FLAGS
253 AC_DEFUN([AX_CXXFLAGS_AIX_OPTION_OLD], [dnl
254 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
255 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_aix_option_$2])dnl
256 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for aix/cc m4_ifval($2,$2,-option)],
257 VAR,[VAR="no, unknown"
260 ac_save_[]FLAGS="$[]FLAGS"
262 in "-qlanglvl=ansi -qsrcmsg % m4_ifval($2,$2,-option)" dnl AIX
264 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
265 AC_TRY_COMPILE([],[return 0;],
266 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
268 FLAGS="$ac_save_[]FLAGS"
272 .ok|.ok,*) m4_ifvaln($3,$3) ;;
273 .|.no|.no,*) m4_ifvaln($4,$4) ;;
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"
281 AS_VAR_POPDEF([VAR])dnl
282 AS_VAR_POPDEF([FLAGS])dnl
285 dnl ------------------------------------------------------------------------
287 AC_DEFUN([AX_CFLAGS_AIX_OPTION_NEW], [dnl
288 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
289 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_aix_option_$1])dnl
290 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for aix/cc m4_ifval($1,$1,-option)],
291 VAR,[VAR="no, unknown"
294 ac_save_[]FLAGS="$[]FLAGS"
296 in "-qlanglvl=ansi -qsrcmsg % m4_ifval($1,$1,-option)" dnl AIX
298 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
299 AC_TRY_COMPILE([],[return 0;],
300 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
302 FLAGS="$ac_save_[]FLAGS"
306 .ok|.ok,*) m4_ifvaln($3,$3) ;;
307 .|.no|.no,*) m4_ifvaln($4,$4) ;;
309 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
310 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
311 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
312 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
315 AS_VAR_POPDEF([VAR])dnl
316 AS_VAR_POPDEF([FLAGS])dnl
319 dnl the only difference - the LANG selection... and the default FLAGS
321 AC_DEFUN([AX_CXXFLAGS_AIX_OPTION_NEW], [dnl
322 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
323 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_aix_option_$1])dnl
324 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for aix/cc m4_ifval($1,$1,-option)],
325 VAR,[VAR="no, unknown"
328 ac_save_[]FLAGS="$[]FLAGS"
330 in "-qlanglvl=ansi -qsrcmsg % m4_ifval($1,$1,-option)" dnl AIX
332 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
333 AC_TRY_COMPILE([],[return 0;],
334 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
336 FLAGS="$ac_save_[]FLAGS"
340 .ok|.ok,*) m4_ifvaln($3,$3) ;;
341 .|.no|.no,*) m4_ifvaln($4,$4) ;;
343 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
344 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
345 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
346 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
349 AS_VAR_POPDEF([VAR])dnl
350 AS_VAR_POPDEF([FLAGS])dnl
353 AC_DEFUN([AX_CFLAGS_AIX_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
354 [AX_CFLAGS_AIX_OPTION_NEW($@)],[AX_CFLAGS_AIX_OPTION_OLD($@)])])
356 AC_DEFUN([AX_CXXFLAGS_AIX_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
357 [AX_CXXFLAGS_AIX_OPTION_NEW($@)],[AX_CXXFLAGS_AIX_OPTION_OLD($@)])])
359 dnl @synopsis AX_CFLAGS_HPUX_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
361 dnl AX_CFLAGS_HPUX_OPTION(-Afresh) would show a message as like
362 dnl "checking CFLAGS for hpux/cc -Afresh ... yes" and adds
363 dnl the optionflag to CFLAGS if it is understood. You can override
364 dnl the shellvar-default of CFLAGS of course. The order of arguments
365 dnl stems from the explicit macros like AX_CFLAGS_WARN_ALL.
367 dnl The cousin AX_CXXFLAGS_HPUX_OPTION would check for an option to add
368 dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
369 dnl (since it is possible to use different compilers for C and C++).
371 dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
372 dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
373 dnl However, if you use this macro in a few places, it would be great
374 dnl if you would make up a new function-macro and submit it to the
376 dnl - $1 option-to-check-for : required ("-option" as non-value)
377 dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
378 dnl - $3 action-if-found : add value to shellvariable
379 dnl - $4 action-if-not-found : nothing
381 dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
382 dnl situation and accept a $2=~/-/ as being the old option-to-check-for.
384 dnl see also: AX_CFLAGS_GCC_OPTION for the widely used original variant.
386 dnl @, untested, experimental
387 dnl @version $Id: ax_cflags_hpux_option.m4,v 1.1 2003/10/13 22:20:39 guidod Exp $
388 dnl @author Guido Draheim <guidod@gmx.de>
389 dnl http://ac-archive.sourceforge.net/guidod/ax_cflags_hpux_option.m4
390 AC_DEFUN([AX_CFLAGS_HPUX_OPTION_OLD], [dnl
391 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
392 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_hpux_option_$2])dnl
393 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for hpux/cc m4_ifval($2,$2,-option)],
394 VAR,[VAR="no, unknown"
397 ac_save_[]FLAGS="$[]FLAGS"
399 in "+ESlit +w1 -Aa % m4_ifval($2,$2,-option)" dnl HP-UX C
401 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
402 AC_TRY_COMPILE([],[return 0;],
403 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
405 FLAGS="$ac_save_[]FLAGS"
409 .ok|.ok,*) m4_ifvaln($3,$3) ;;
410 .|.no|.no,*) m4_ifvaln($4,$4) ;;
412 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
413 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
414 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
415 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
418 AS_VAR_POPDEF([VAR])dnl
419 AS_VAR_POPDEF([FLAGS])dnl
422 dnl the only difference - the LANG selection... and the default FLAGS
424 AC_DEFUN([AX_CXXFLAGS_HPUX_OPTION_OLD], [dnl
425 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
426 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_hpux_option_$2])dnl
427 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for hpux/cc m4_ifval($2,$2,-option)],
428 VAR,[VAR="no, unknown"
431 ac_save_[]FLAGS="$[]FLAGS"
433 in "+ESlit +w1 -Aa % m4_ifval($2,$2,-option)" dnl HP-UX C
435 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
436 AC_TRY_COMPILE([],[return 0;],
437 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
439 FLAGS="$ac_save_[]FLAGS"
443 .ok|.ok,*) m4_ifvaln($3,$3) ;;
444 .|.no|.no,*) m4_ifvaln($4,$4) ;;
446 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
447 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
448 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
449 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
452 AS_VAR_POPDEF([VAR])dnl
453 AS_VAR_POPDEF([FLAGS])dnl
456 dnl ------------------------------------------------------------------------
458 AC_DEFUN([AX_CFLAGS_HPUX_OPTION_NEW], [dnl
459 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
460 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_hpux_option_$1])dnl
461 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for hpux/cc m4_ifval($1,$1,-option)],
462 VAR,[VAR="no, unknown"
465 ac_save_[]FLAGS="$[]FLAGS"
467 in "+ESlit +w1 -Aa % m4_ifval($1,$1,-option)" dnl HP-UX C
469 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
470 AC_TRY_COMPILE([],[return 0;],
471 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
473 FLAGS="$ac_save_[]FLAGS"
477 .ok|.ok,*) m4_ifvaln($3,$3) ;;
478 .|.no|.no,*) m4_ifvaln($4,$4) ;;
480 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
481 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
482 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
483 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
486 AS_VAR_POPDEF([VAR])dnl
487 AS_VAR_POPDEF([FLAGS])dnl
490 dnl the only difference - the LANG selection... and the default FLAGS
492 AC_DEFUN([AX_CXXFLAGS_HPUX_OPTION_NEW], [dnl
493 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
494 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_hpux_option_$1])dnl
495 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for hpux/cc m4_ifval($1,$1,-option)],
496 VAR,[VAR="no, unknown"
499 ac_save_[]FLAGS="$[]FLAGS"
501 in "+ESlit +w1 -Aa % m4_ifval($1,$1,-option)" dnl HP-UX C
503 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
504 AC_TRY_COMPILE([],[return 0;],
505 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
507 FLAGS="$ac_save_[]FLAGS"
511 .ok|.ok,*) m4_ifvaln($3,$3) ;;
512 .|.no|.no,*) m4_ifvaln($4,$4) ;;
514 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
515 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
516 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
517 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
520 AS_VAR_POPDEF([VAR])dnl
521 AS_VAR_POPDEF([FLAGS])dnl
524 AC_DEFUN([AX_CFLAGS_HPUX_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
525 [AX_CFLAGS_HPUX_OPTION_NEW($@)],[AX_CFLAGS_HPUX_OPTION_OLD($@)])])
527 AC_DEFUN([AX_CXXFLAGS_HPUX_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
528 [AX_CXXFLAGS_HPUX_OPTION_NEW($@)],[AX_CXXFLAGS_HPUX_OPTION_OLD($@)])])
531 dnl @synopsis AX_CFLAGS_IRIX_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
533 dnl AX_CFLAGS_IRIX_OPTION(-go_for_it) would show a message as like
534 dnl "checking CFLAGS for irix/cc -go_for_it ... yes" and adds
535 dnl the optionflag to CFLAGS if it is understood. You can override
536 dnl the shellvar-default of CFLAGS of course. The order of arguments
537 dnl stems from the explicit macros like AX_CFLAGS_WARN_ALL.
539 dnl The cousin AX_CXXFLAGS_IRIX_OPTION would check for an option to add
540 dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
541 dnl (since it is possible to use different compilers for C and C++).
543 dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
544 dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
545 dnl However, if you use this macro in a few places, it would be great
546 dnl if you would make up a new function-macro and submit it to the
548 dnl - $1 option-to-check-for : required ("-option" as non-value)
549 dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
550 dnl - $3 action-if-found : add value to shellvariable
551 dnl - $4 action-if-not-found : nothing
553 dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
554 dnl situation and accept a $2=~/-/ as being the old option-to-check-for.
556 dnl see also: AX_CFLAGS_GCC_OPTION for the widely used original variant.
558 dnl @, untested, experimental
559 dnl @version $Id: ax_cflags_irix_option.m4,v 1.1 2003/10/13 22:20:39 guidod Exp $
560 dnl @author Guido Draheim <guidod@gmx.de>
561 dnl http://ac-archive.sourceforge.net/guidod/ax_cflags_irix_option.m4
562 AC_DEFUN([AX_CFLAGS_IRIX_OPTION_OLD], [dnl
563 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
564 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_irix_option_$2])dnl
565 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for irix/cc m4_ifval($2,$2,-option)],
566 VAR,[VAR="no, unknown"
569 ac_save_[]FLAGS="$[]FLAGS"
571 in "-fullwarn -use_readonly_const % m4_ifval($2,$2,-option)" dnl IRIX C
573 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
574 AC_TRY_COMPILE([],[return 0;],
575 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
577 FLAGS="$ac_save_[]FLAGS"
581 .ok|.ok,*) m4_ifvaln($3,$3) ;;
582 .|.no|.no,*) m4_ifvaln($4,$4) ;;
584 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
585 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
586 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
587 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
590 AS_VAR_POPDEF([VAR])dnl
591 AS_VAR_POPDEF([FLAGS])dnl
594 dnl the only difference - the LANG selection... and the default FLAGS
596 AC_DEFUN([AX_CXXFLAGS_IRIX_OPTION_OLD], [dnl
597 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
598 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_irix_option_$2])dnl
599 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for irix/cc m4_ifval($2,$2,-option)],
600 VAR,[VAR="no, unknown"
603 ac_save_[]FLAGS="$[]FLAGS"
605 in "-fullwarn -use_readonly_const % m4_ifval($2,$2,-option)" dnl IRIX C
607 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
608 AC_TRY_COMPILE([],[return 0;],
609 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
611 FLAGS="$ac_save_[]FLAGS"
615 .ok|.ok,*) m4_ifvaln($3,$3) ;;
616 .|.no|.no,*) m4_ifvaln($4,$4) ;;
618 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
619 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
620 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
621 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
624 AS_VAR_POPDEF([VAR])dnl
625 AS_VAR_POPDEF([FLAGS])dnl
628 dnl --------------------------------------------------------------------------
630 AC_DEFUN([AX_CFLAGS_IRIX_OPTION_NEW], [dnl
631 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
632 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_irix_option_$1])dnl
633 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for irix/cc m4_ifval($1,$1,-option)],
634 VAR,[VAR="no, unknown"
637 ac_save_[]FLAGS="$[]FLAGS"
639 in "-fullwarn -use_readonly_const % m4_ifval($1,$1,-option)" dnl IRIX C
641 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
642 AC_TRY_COMPILE([],[return 0;],
643 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
645 FLAGS="$ac_save_[]FLAGS"
649 .ok|.ok,*) m4_ifvaln($3,$3) ;;
650 .|.no|.no,*) m4_ifvaln($4,$4) ;;
652 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
653 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
654 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
655 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
658 AS_VAR_POPDEF([VAR])dnl
659 AS_VAR_POPDEF([FLAGS])dnl
662 dnl the only difference - the LANG selection... and the default FLAGS
664 AC_DEFUN([AX_CXXFLAGS_IRIX_OPTION_NEW], [dnl
665 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
666 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_irix_option_$1])dnl
667 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for irix/cc m4_ifval($1,$1,-option)],
668 VAR,[VAR="no, unknown"
671 ac_save_[]FLAGS="$[]FLAGS"
673 in "-fullwarn -use_readonly_const % m4_ifval($1,$1,-option)" dnl IRIX C
675 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
676 AC_TRY_COMPILE([],[return 0;],
677 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
679 FLAGS="$ac_save_[]FLAGS"
683 .ok|.ok,*) m4_ifvaln($3,$3) ;;
684 .|.no|.no,*) m4_ifvaln($4,$4) ;;
686 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
687 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
688 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
689 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
692 AS_VAR_POPDEF([VAR])dnl
693 AS_VAR_POPDEF([FLAGS])dnl
696 AC_DEFUN([AX_CFLAGS_IRIX_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
697 [AX_CFLAGS_IRIX_OPTION_NEW($@)],[AX_CFLAGS_IRIX_OPTION_OLD($@)])])
699 AC_DEFUN([AX_CXXFLAGS_IRIX_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
700 [AX_CXXFLAGS_IRIX_OPTION_NEW($@)],[AX_CXXFLAGS_IRIX_OPTION_OLD($@)])])
703 dnl @synopsis AX_CFLAGS_SUN_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
705 dnl AX_CFLAGS_SUN_OPTION(+xtreme) would show a message as like
706 dnl "checking CFLAGS for sun/cc +xtreme ... yes" and adds
707 dnl the optionflag to CFLAGS if it is understood. You can override
708 dnl the shellvar-default of CFLAGS of course. The order of arguments
709 dnl stems from the explicit macros like AX_CFLAGS_WARN_ALL.
711 dnl The cousin AX_CXXFLAGS_SUN_OPTION would check for an option to add
712 dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
713 dnl (since it is possible to use different compilers for C and C++).
715 dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
716 dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
717 dnl However, if you use this macro in a few places, it would be great
718 dnl if you would make up a new function-macro and submit it to the
720 dnl - $1 option-to-check-for : required ("-option" as non-value)
721 dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
722 dnl - $3 action-if-found : add value to shellvariable
723 dnl - $4 action-if-not-found : nothing
725 dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
726 dnl situation and accept a $2=~/-/ as being the old option-to-check-for.
728 dnl see also: AX_CFLAGS_GCC_OPTION for the widely used original variant.
730 dnl @, untested, experimental
731 dnl @version $Id: ax_cflags_sun_option.m4,v 1.1 2003/10/13 22:20:39 guidod Exp $
732 dnl @author Guido Draheim <guidod@gmx.de>
733 dnl http://ac-archive.sourceforge.net/guidod/ax_cflags_sun_option.m4
734 AC_DEFUN([AX_CFLAGS_SUN_OPTION_OLD], [dnl
735 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
736 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$2])dnl
737 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)],
738 VAR,[VAR="no, unknown"
741 ac_save_[]FLAGS="$[]FLAGS"
743 in "+xstrconst -Xc % m4_ifval($2,$2,-option)" dnl Solaris C
745 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
746 AC_TRY_COMPILE([],[return 0;],
747 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
749 FLAGS="$ac_save_[]FLAGS"
753 .ok|.ok,*) m4_ifvaln($3,$3) ;;
754 .|.no|.no,*) m4_ifvaln($4,$4) ;;
756 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
757 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
758 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
759 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
762 AS_VAR_POPDEF([VAR])dnl
763 AS_VAR_POPDEF([FLAGS])dnl
766 dnl the only difference - the LANG selection... and the default FLAGS
768 AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_OLD], [dnl
769 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
770 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$2])dnl
771 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)],
772 VAR,[VAR="no, unknown"
775 ac_save_[]FLAGS="$[]FLAGS"
777 in "+xstrconst -Xc % m4_ifval($2,$2,-option)" dnl Solaris C
779 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
780 AC_TRY_COMPILE([],[return 0;],
781 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
783 FLAGS="$ac_save_[]FLAGS"
787 .ok|.ok,*) m4_ifvaln($3,$3) ;;
788 .|.no|.no,*) m4_ifvaln($4,$4) ;;
790 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
791 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
792 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
793 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
796 AS_VAR_POPDEF([VAR])dnl
797 AS_VAR_POPDEF([FLAGS])dnl
800 dnl -----------------------------------------------------------------------
802 AC_DEFUN([AX_CFLAGS_SUN_OPTION_NEW], [dnl
803 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
804 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$1])dnl
805 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)],
806 VAR,[VAR="no, unknown"
809 ac_save_[]FLAGS="$[]FLAGS"
811 in "+xstrconst -Xc % m4_ifval($1,$1,-option)" dnl Solaris C
813 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
814 AC_TRY_COMPILE([],[return 0;],
815 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
817 FLAGS="$ac_save_[]FLAGS"
821 .ok|.ok,*) m4_ifvaln($3,$3) ;;
822 .|.no|.no,*) m4_ifvaln($4,$4) ;;
824 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
825 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
826 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
827 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
830 AS_VAR_POPDEF([VAR])dnl
831 AS_VAR_POPDEF([FLAGS])dnl
834 dnl the only difference - the LANG selection... and the default FLAGS
836 AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_NEW], [dnl
837 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
838 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$1])dnl
839 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)],
840 VAR,[VAR="no, unknown"
843 ac_save_[]FLAGS="$[]FLAGS"
845 in "+xstrconst -Xc % m4_ifval($1,$1,-option)" dnl Solaris C
847 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
848 AC_TRY_COMPILE([],[return 0;],
849 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
851 FLAGS="$ac_save_[]FLAGS"
855 .ok|.ok,*) m4_ifvaln($3,$3) ;;
856 .|.no|.no,*) m4_ifvaln($4,$4) ;;
858 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
859 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
860 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
861 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
864 AS_VAR_POPDEF([VAR])dnl
865 AS_VAR_POPDEF([FLAGS])dnl
868 AC_DEFUN([AX_CFLAGS_SUN_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
869 [AX_CFLAGS_SUN_OPTION_NEW($@)],[AX_CFLAGS_SUN_OPTION_OLD($@)])])
871 AC_DEFUN([AX_CXXFLAGS_SUN_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
872 [AX_CXXFLAGS_SUN_OPTION_NEW($@)],[AX_CXXFLAGS_SUN_OPTION_OLD($@)])])
875 dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
877 dnl Try to find a compiler option that enables most reasonable warnings.
878 dnl This macro is directly derived from VL_PROG_CC_WARNINGS which is
879 dnl split up into two AX_CFLAGS_WARN_ALL and AX_CFLAGS_WARN_ALL_ANSI
881 dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic)
882 dnl The result is added to the shellvar being CFLAGS by default.
884 dnl Currently this macro knows about GCC, Solaris C compiler,
885 dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler,
886 dnl IRIX C compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90
887 dnl (Unicos 10.0.0.8) C compiler.
889 dnl - $1 shell-variable-to-add-to : CFLAGS
890 dnl - $2 add-value-if-not-found : nothing
891 dnl - $3 action-if-found : add value to shellvariable
892 dnl - $4 action-if-not-found : nothing
894 dnl @version $Id: ax_cflags_warn_all.m4,v 1.2 2003/10/12 14:56:07 guidod Exp $
895 dnl @author Guido Draheim <guidod@gmx.de>
896 dnl http://ac-archive.sourceforge.net/guidod/ax_cflags_warn_all.m4
897 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
898 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
899 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
900 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
901 VAR,[VAR="no, unknown"
904 ac_save_[]FLAGS="$[]FLAGS"
906 in "-pedantic % -Wall" dnl GCC
907 "-xstrconst % -v" dnl Solaris C
908 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
909 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
910 "-ansi -ansiE % -fullwarn" dnl IRIX
911 "+ESlit % +w1" dnl HP-UX C
912 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
913 "-h conform % -h msglevel 2" dnl Cray C (Unicos)
915 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
916 AC_TRY_COMPILE([],[return 0;],
917 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
919 FLAGS="$ac_save_[]FLAGS"
923 .ok|.ok,*) m4_ifvaln($3,$3) ;;
924 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
925 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
926 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
928 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
929 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
930 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
931 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
934 AS_VAR_POPDEF([VAR])dnl
935 AS_VAR_POPDEF([FLAGS])dnl
938 dnl the only difference - the LANG selection... and the default FLAGS
940 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
941 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
942 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl
943 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
944 VAR,[VAR="no, unknown"
947 ac_save_[]FLAGS="$[]FLAGS"
949 in "-pedantic % -Wall" dnl GCC
950 "-xstrconst % -v" dnl Solaris C
951 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
952 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
953 "-ansi -ansiE % -fullwarn" dnl IRIX
954 "+ESlit % +w1" dnl HP-UX C
955 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
956 "-h conform % -h msglevel 2" dnl Cray C (Unicos)
958 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
959 AC_TRY_COMPILE([],[return 0;],
960 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
962 FLAGS="$ac_save_[]FLAGS"
966 .ok|.ok,*) m4_ifvaln($3,$3) ;;
967 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
968 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
969 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
971 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
972 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
973 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
974 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
977 AS_VAR_POPDEF([VAR])dnl
978 AS_VAR_POPDEF([FLAGS])dnl
981 dnl implementation tactics:
982 dnl the for-argument contains a list of options. The first part of
983 dnl these does only exist to detect the compiler - usually it is
984 dnl a global option to enable -ansi or -extrawarnings. All other
985 dnl compilers will fail about it. That was needed since a lot of
986 dnl compilers will give false positives for some option-syntax
987 dnl like -Woption or -Xoption as they think of it is a pass-through
988 dnl to later compile stages or something. The "%" is used as a
989 dnl delimimiter. A non-option comment can be given after "%%" marks.