|
Packit |
0b5880 |
# ===========================================================================
|
|
Packit |
0b5880 |
# http://autoconf-archive.cryp.to/ax_cflags_warn_all_ansi.html
|
|
Packit |
0b5880 |
# ===========================================================================
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# SYNOPSIS
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# DESCRIPTION
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# Try to find a compiler option that enables most reasonable warnings.
|
|
Packit |
0b5880 |
# This macro is directly derived from VL_PROG_CC_WARNINGS which is split
|
|
Packit |
0b5880 |
# up into two AX_CFLAGS_WARN_ALL and AX_CFLAGS_WARN_ALL_ANSI
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
|
Packit |
0b5880 |
# result is added to the shellvar being CFLAGS by default.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# Currently this macro knows about GCC, Solaris C compiler, Digital Unix C
|
|
Packit |
0b5880 |
# compiler, C for AIX Compiler, HP-UX C compiler, IRIX C compiler, NEC
|
|
Packit |
0b5880 |
# SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos 10.0.0.8) C
|
|
Packit |
0b5880 |
# compiler.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# - $1 shell-variable-to-add-to : CFLAGS
|
|
Packit |
0b5880 |
# - $2 add-value-if-not-found : nothing
|
|
Packit |
0b5880 |
# - $3 action-if-found : add value to shellvariable
|
|
Packit |
0b5880 |
# - $4 action-if-not-found : nothing
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# LAST MODIFICATION
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# 2008-04-12
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# COPYLEFT
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# This program is free software; you can redistribute it and/or modify it
|
|
Packit |
0b5880 |
# under the terms of the GNU General Public License as published by the
|
|
Packit |
0b5880 |
# Free Software Foundation; either version 2 of the License, or (at your
|
|
Packit |
0b5880 |
# option) any later version.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# This program is distributed in the hope that it will be useful, but
|
|
Packit |
0b5880 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
0b5880 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
Packit |
0b5880 |
# Public License for more details.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# You should have received a copy of the GNU General Public License along
|
|
Packit |
0b5880 |
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# As a special exception, the respective Autoconf Macro's copyright owner
|
|
Packit |
0b5880 |
# gives unlimited permission to copy, distribute and modify the configure
|
|
Packit |
0b5880 |
# scripts that are the output of Autoconf when processing the Macro. You
|
|
Packit |
0b5880 |
# need not follow the terms of the GNU General Public License when using
|
|
Packit |
0b5880 |
# or distributing such scripts, even though portions of the text of the
|
|
Packit |
0b5880 |
# Macro appear in them. The GNU General Public License (GPL) does govern
|
|
Packit |
0b5880 |
# all other use of the material that constitutes the Autoconf Macro.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# This special exception to the GPL applies to versions of the Autoconf
|
|
Packit |
0b5880 |
# Macro released by the Autoconf Macro Archive. When you make and
|
|
Packit |
0b5880 |
# distribute a modified version of the Autoconf Macro, you may extend this
|
|
Packit |
0b5880 |
# special exception to the GPL to apply to your modified version as well.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl
|
|
Packit |
0b5880 |
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
|
Packit |
0b5880 |
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all_ansi])dnl
|
|
Packit |
0b5880 |
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
|
Packit |
0b5880 |
VAR,[VAR="no, unknown"
|
|
Packit |
0b5880 |
AC_LANG_SAVE
|
|
Packit |
0b5880 |
AC_LANG_C
|
|
Packit |
0b5880 |
ac_save_[]FLAGS="$[]FLAGS"
|
|
Packit |
0b5880 |
# IRIX C compiler:
|
|
Packit |
0b5880 |
# -use_readonly_const is the default for IRIX C,
|
|
Packit |
0b5880 |
# puts them into .rodata, but they are copied later.
|
|
Packit |
0b5880 |
# need to be "-G0 -rdatashared" for strictmode but
|
|
Packit |
0b5880 |
# I am not sure what effect that has really. - guidod
|
|
Packit |
0b5880 |
for ac_arg dnl
|
|
Packit |
0b5880 |
in "-pedantic % -Wall -ansi -pedantic" dnl GCC
|
|
Packit |
0b5880 |
"-xstrconst % -v -Xc" dnl Solaris C
|
|
Packit |
0b5880 |
"-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix
|
|
Packit |
0b5880 |
" % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
|
|
Packit |
0b5880 |
" % -ansi -ansiE -fullwarn" dnl IRIX
|
|
Packit |
0b5880 |
"+ESlit % +w1 -Aa" dnl HP-UX C
|
|
Packit |
0b5880 |
"-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10)
|
|
Packit |
0b5880 |
"-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos)
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
|
Packit |
0b5880 |
AC_TRY_COMPILE([],[return 0;],
|
|
Packit |
0b5880 |
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
|
Packit |
0b5880 |
done
|
|
Packit |
0b5880 |
FLAGS="$ac_save_[]FLAGS"
|
|
Packit |
0b5880 |
AC_LANG_RESTORE
|
|
Packit |
0b5880 |
])
|
|
Packit |
0b5880 |
case ".$VAR" in
|
|
Packit |
0b5880 |
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
|
Packit |
0b5880 |
.|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
|
|
Packit |
0b5880 |
AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
|
|
Packit |
0b5880 |
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
|
|
Packit |
0b5880 |
*) m4_ifvaln($3,$3,[
|
|
Packit |
0b5880 |
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
|
Packit |
0b5880 |
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
|
Packit |
0b5880 |
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
|
Packit |
0b5880 |
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
|
Packit |
0b5880 |
fi ]) ;;
|
|
Packit |
0b5880 |
esac
|
|
Packit |
0b5880 |
AS_VAR_POPDEF([VAR])dnl
|
|
Packit |
0b5880 |
AS_VAR_POPDEF([FLAGS])dnl
|
|
Packit |
0b5880 |
])
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
dnl the only difference - the LANG selection... and the default FLAGS
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
AC_DEFUN([AX_CXXFLAGS_WARN_ALL_ANSI],[dnl
|
|
Packit |
0b5880 |
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
|
|
Packit |
0b5880 |
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl
|
|
Packit |
0b5880 |
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
|
Packit |
0b5880 |
VAR,[VAR="no, unknown"
|
|
Packit |
0b5880 |
AC_LANG_SAVE
|
|
Packit |
0b5880 |
AC_LANG_CPLUSPLUS
|
|
Packit |
0b5880 |
ac_save_[]FLAGS="$[]FLAGS"
|
|
Packit |
0b5880 |
# IRIX C compiler:
|
|
Packit |
0b5880 |
# -use_readonly_const is the default for IRIX C,
|
|
Packit |
0b5880 |
# puts them into .rodata, but they are copied later.
|
|
Packit |
0b5880 |
# need to be "-G0 -rdatashared" for strictmode but
|
|
Packit |
0b5880 |
# I am not sure what effect that has really. - guidod
|
|
Packit |
0b5880 |
for ac_arg dnl
|
|
Packit |
0b5880 |
in "-pedantic % -Wall -ansi -pedantic" dnl GCC
|
|
Packit |
0b5880 |
"-xstrconst % -v -Xc" dnl Solaris C
|
|
Packit |
0b5880 |
"-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix
|
|
Packit |
0b5880 |
" % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
|
|
Packit |
0b5880 |
" % -ansi -ansiE -fullwarn" dnl IRIX
|
|
Packit |
0b5880 |
"+ESlit % +w1 -Aa" dnl HP-UX C
|
|
Packit |
0b5880 |
"-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10)
|
|
Packit |
0b5880 |
"-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos)
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
|
Packit |
0b5880 |
AC_TRY_COMPILE([],[return 0;],
|
|
Packit |
0b5880 |
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
|
Packit |
0b5880 |
done
|
|
Packit |
0b5880 |
FLAGS="$ac_save_[]FLAGS"
|
|
Packit |
0b5880 |
AC_LANG_RESTORE
|
|
Packit |
0b5880 |
])
|
|
Packit |
0b5880 |
case ".$VAR" in
|
|
Packit |
0b5880 |
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
|
Packit |
0b5880 |
.|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
|
|
Packit |
0b5880 |
AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
|
|
Packit |
0b5880 |
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
|
|
Packit |
0b5880 |
*) m4_ifvaln($3,$3,[
|
|
Packit |
0b5880 |
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
|
Packit |
0b5880 |
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
|
Packit |
0b5880 |
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
|
Packit |
0b5880 |
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
|
Packit |
0b5880 |
fi ]) ;;
|
|
Packit |
0b5880 |
esac
|
|
Packit |
0b5880 |
AS_VAR_POPDEF([VAR])dnl
|
|
Packit |
0b5880 |
AS_VAR_POPDEF([FLAGS])dnl
|
|
Packit |
0b5880 |
])
|