Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/freealut-1.1.0/admin/autotools/m4/alut_check_cflags_wall.m4 @ 14

Last change on this file since 14 was 14, checked in by landauf, 16 years ago

added freealut

File size: 4.9 KB
Line 
1dnl NOTE: This is a modified version of ax_cflags_warn_all_ansi.m4
2dnl from the autoconf archive, updated to conform to more recent
3dnl autoconf standards. The original header follows...
4
5dnl @synopsis AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
6dnl
7dnl Try to find a compiler option that enables most reasonable
8dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
9dnl which is split up into two AX_CFLAGS_WARN_ALL and
10dnl AX_CFLAGS_WARN_ALL_ANSI
11dnl
12dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
13dnl result is added to the shellvar being CFLAGS by default.
14dnl
15dnl Currently this macro knows about GCC, Solaris C compiler, Digital
16dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
17dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
18dnl 10.0.0.8) C compiler.
19dnl
20dnl  - $1 shell-variable-to-add-to : CFLAGS
21dnl  - $2 add-value-if-not-found : nothing
22dnl  - $3 action-if-found : add value to shellvariable
23dnl  - $4 action-if-not-found : nothing
24dnl
25dnl @category C
26dnl @author Guido Draheim <guidod@gmx.de>
27dnl @version 2003-01-06
28dnl @license GPLWithACException
29
30AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl
31AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
32AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all_ansi])dnl
33AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ANSI warnings],
34VAR,[VAR="no, unknown"
35 AC_LANG_PUSH([C])
36 ac_save_[]FLAGS="$[]FLAGS"
37# IRIX C compiler:
38#      -use_readonly_const is the default for IRIX C,
39#       puts them into .rodata, but they are copied later.
40#       need to be "-G0 -rdatashared" for strictmode but
41#       I am not sure what effect that has really.         - guidod
42for ac_arg dnl
43in "-pedantic  % -Wall -ansi -pedantic"       dnl   GCC
44   "-xstrconst % -v -Xc"                      dnl Solaris C
45   "-std1      % -verbose -w0 -warnprotos -std1" dnl Digital Unix
46   " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
47   " % -ansi -ansiE -fullwarn"                dnl IRIX
48   "+ESlit     % +w1 -Aa"                     dnl HP-UX C
49   "-Xc        % -pvctl[,]fullmsg -Xc"        dnl NEC SX-5 (Super-UX 10)
50   "-h conform % -h msglevel 2 -h conform"    dnl Cray C (Unicos)
51   #
52do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
53   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
54   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
55done
56 FLAGS="$ac_save_[]FLAGS"
57 AC_LANG_POP([C])
58])
59case ".$VAR" in
60     .ok|.ok,*) m4_ifvaln($3,$3) ;;
61   .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
62        AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
63                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
64   *) m4_ifvaln($3,$3,[
65   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
66   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
67   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
68                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
69   fi ]) ;;
70esac
71AS_VAR_POPDEF([VAR])dnl
72AS_VAR_POPDEF([FLAGS])dnl
73])
74
75dnl the only difference - the LANG selection... and the default FLAGS
76
77AC_DEFUN([AX_CXXFLAGS_WARN_ALL_ANSI],[dnl
78AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
79AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl
80AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ANSI warnings],
81VAR,[VAR="no, unknown"
82 AC_LANG_PUSH([C++])
83 ac_save_[]FLAGS="$[]FLAGS"
84# IRIX C compiler:
85#      -use_readonly_const is the default for IRIX C,
86#       puts them into .rodata, but they are copied later.
87#       need to be "-G0 -rdatashared" for strictmode but
88#       I am not sure what effect that has really.         - guidod
89for ac_arg dnl
90in "-pedantic  % -Wall -ansi -pedantic"       dnl   GCC
91   "-xstrconst % -v -Xc"                      dnl Solaris C
92   "-std1      % -verbose -w0 -warnprotos -std1" dnl Digital Unix
93   " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
94   " % -ansi -ansiE -fullwarn"                dnl IRIX
95   "+ESlit     % +w1 -Aa"                     dnl HP-UX C
96   "-Xc        % -pvctl[,]fullmsg -Xc"        dnl NEC SX-5 (Super-UX 10)
97   "-h conform % -h msglevel 2 -h conform"    dnl Cray C (Unicos)
98   #
99do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
100   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
101   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
102done
103 FLAGS="$ac_save_[]FLAGS"
104 AC_LANG_POP([C++])
105])
106case ".$VAR" in
107     .ok|.ok,*) m4_ifvaln($3,$3) ;;
108   .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
109        AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
110                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
111   *) m4_ifvaln($3,$3,[
112   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
113   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
114   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
115                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
116   fi ]) ;;
117esac
118AS_VAR_POPDEF([VAR])dnl
119AS_VAR_POPDEF([FLAGS])dnl
120])
Note: See TracBrowser for help on using the repository browser.