summaryrefslogtreecommitdiff
path: root/Build/source/m4/kpse-warnings.m4
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-11-10 10:34:20 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-11-10 10:34:20 +0000
commite4cae97633d68af424aef1494462550cef2dadeb (patch)
tree0e82baf23b3900e995c132775fc75213c0984cf4 /Build/source/m4/kpse-warnings.m4
parent558303c70cdfd3bc2465cb99c2f8d81a64efcf31 (diff)
towards TL2010: build system
git-svn-id: svn://tug.org/texlive/trunk@15977 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/m4/kpse-warnings.m4')
-rw-r--r--Build/source/m4/kpse-warnings.m4170
1 files changed, 107 insertions, 63 deletions
diff --git a/Build/source/m4/kpse-warnings.m4 b/Build/source/m4/kpse-warnings.m4
index 406f3dd9a4e..1eab00b5425 100644
--- a/Build/source/m4/kpse-warnings.m4
+++ b/Build/source/m4/kpse-warnings.m4
@@ -15,77 +15,60 @@
# them a Makefile.am must use them, e.g., in AM_CFLAGS or AM_CXXFLAGS.
AC_DEFUN([KPSE_COMPILER_WARNINGS],
[AC_REQUIRE([_KPSE_COMPILER_WARNINGS_OPTION])[]dnl
-KPSE_WARNING_CFLAGS
-dnl arrange that AC_PROG_CXX uses _KPSE_WARNING_CXXFLAGS.
+dnl arrange that AC_PROG_CC uses _KPSE_WARNING_CFLAGS etc.
+AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_KPSE_WARNING_CFLAGS],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_KPSE_WARNING_CFLAGS])])
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_KPSE_WARNING_CXXFLAGS],
[m4_define([AC_PROG_CXX],
m4_defn([AC_PROG_CXX])[_KPSE_WARNING_CXXFLAGS])])
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_KPSE_WARNING_OBJCFLAGS],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_KPSE_WARNING_OBJCFLAGS])])
]) # KPSE_COMPILER_WARNINGS
-KPSE_WARNING_CFLAGS
-# -----------------
-# Determine and substitute WARNING_CFLAGS for C compiler.
-AC_DEFUN([KPSE_WARNING_CFLAGS],
-[AC_REQUIRE([_KPSE_COMPILER_WARNINGS_OPTION])[]dnl
-AC_REQUIRE([AC_PROG_CC])[]dnl
-AC_CACHE_CHECK([what warning flags to pass to the C compiler],
- [kpse_cv_warning_cflags],
- [dnl
-if test "x$enable_compiler_warnings" = xno; then
- kpse_cv_warning_cflags=
-elif test "x$GCC" = xyes; then
- kpse_cv_warning_cflags="-Wall -Wunused"
- AS_CASE([`$CC -dumpversion`],
- [3.4.* | 4.*],
- [kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wdeclaration-after-statement"])
- AS_CASE([`$CC -dumpversion`],
- [3.@<:@234@:>@.* | 4.*],
- [kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wno-unknown-pragmas"])
- if test "x$enable_compiler_warnings" != xmin; then
- kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wmissing-prototypes -Wmissing-declarations"
- if test "x$enable_compiler_warnings" != xyes; then
- kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wimplicit -Wparentheses -Wreturn-type"
- kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wswitch -Wtrigraphs -Wshadow -Wpointer-arith"
- kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wcast-qual -Wcast-align -Wwrite-strings"
- AS_CASE([`$CC -dumpversion`],
- [3.4.* | 4.*],
- [kpse_cv_warning_cflags="$kpse_cv_warning_cflags -Wold-style-definition"])
- fi
- fi
-else
- : # FIXME: warning flags for non-gcc compilers
-fi])
-WARNING_CFLAGS=$kpse_cv_warning_cflags
-AC_SUBST([WARNING_CFLAGS])
-]) # KPSE_WARNING_CFLAGS
-
-# KPSE_WARNING_CXXFLAGS
-# ---------------------
-# Determine and substitute WARNING_CXXFLAGS for C++ compiler.
-AC_DEFUN([KPSE_WARNING_CXXFLAGS],
-[AC_REQUIRE([_KPSE_COMPILER_WARNINGS_OPTION])[]dnl
-AC_REQUIRE([AC_PROG_CXX])[]dnl
-_KPSE_WARNING_CXXFLAGS
-]) # KPSE_WARNING_CXXFLAGS
-
# _KPSE_COMPILER_WARNINGS_OPTION
# ------------------------------
# Internal subroutine.
-# Provide configure option `--enable-compiler-warnings=[no|min|yes|max]'
+# Provide configure option `--enable-compiler-warnings=[no|min|yes|max|all]'
# to enable various degrees of compiler warnings.
AC_DEFUN([_KPSE_COMPILER_WARNINGS_OPTION],
[AC_ARG_ENABLE([compiler-warnings],
- AS_HELP_STRING([--enable-compiler-warnings=@<:@no|min|yes|max@:>@],
+ AS_HELP_STRING([--enable-compiler-warnings=@<:@no|min|yes|max|all@:>@],
[Turn on compiler warnings @<:@default: yes if maintainer-mode,
min otherwise@:>@]))[]dnl
AS_CASE([$enable_compiler_warnings],
- [no | min | yes | max], [],
+ [no | min | yes | max | all], [],
[AS_IF([test "x$enable_maintainer_mode" = xyes],
[enable_compiler_warnings=yes],
[enable_compiler_warnings=min])])
]) # _KPSE_COMPILER_WARNINGS_OPTION
+_KPSE_WARNING_CFLAGS
+# ------------------
+# Internal subroutine.
+# Determine and substitute WARNING_CFLAGS for C compiler.
+AC_DEFUN([_KPSE_WARNING_CFLAGS],
+[AC_REQUIRE([_KPSE_COMPILER_WARNINGS_OPTION])[]dnl
+AC_REQUIRE([AC_PROG_CC])[]dnl
+AC_CACHE_CHECK([what warning flags to pass to the C compiler],
+ [kpse_cv_warning_cflags],
+ [dnl
+if test "x$enable_compiler_warnings" = xno; then
+ kpse_cv_warning_cflags=
+elif test "x$GCC" = xyes; then
+ _KPSE_WARNING_GNU_CFLAGS([CC], [cflags])[]dnl
+else
+ : # FIXME: warning flags for non-GNU C compilers
+fi])
+WARNING_CFLAGS=$kpse_cv_warning_cflags
+AC_SUBST([WARNING_CFLAGS])
+m4_define([_KPSE_WARNING_CFLAGS], [])[]dnl
+]) # _KPSE_WARNING_CFLAGS
+
# _KPSE_WARNING_CXXFLAGS
# ----------------------
# Internal subroutine.
@@ -97,22 +80,83 @@ m4_define([_KPSE_WARNING_CXXFLAGS],
if test "x$enable_compiler_warnings" = xno; then
kpse_cv_warning_cxxflags=
elif test "x$GXX" = xyes; then
- kpse_cv_warning_cxxflags="-Wall -Wunused"
- AS_CASE([`$CXX -dumpversion`],
- [3.@<:@234@:>@.* | 4.*],
- [kpse_cv_warning_cxxflags="$kpse_cv_warning_cxxflags -Wno-unknown-pragmas"])
- if test "x$enable_compiler_warnings" != xmin; then
- if test "x$enable_compiler_warnings" != xyes; then
- kpse_cv_warning_cxxflags="$kpse_cv_warning_cxxflags -Wimplicit -Wparentheses -Wreturn-type"
- kpse_cv_warning_cxxflags="$kpse_cv_warning_cxxflags -Wswitch -Wtrigraphs -Wshadow -Wpointer-arith"
- kpse_cv_warning_cxxflags="$kpse_cv_warning_cxxflags -Wcast-qual -Wcast-align -Wwrite-strings"
- fi
- fi
+ _KPSE_WARNING_GNU_CXXFLAGS([CXX], [cxxflags])[]dnl
else
- : # FIXME: warning flags for non-g++ compilers
+ : # FIXME: warning flags for non-GNU C++ compilers
fi])
WARNING_CXXFLAGS=$kpse_cv_warning_cxxflags
AC_SUBST([WARNING_CXXFLAGS])
m4_define([_KPSE_WARNING_CXXFLAGS], [])[]dnl
]) # _KPSE_WARNING_CXXFLAGS
+_KPSE_WARNING_OBJCFLAGS
+# ---------------------
+# Internal subroutine.
+# Determine and substitute WARNING_OBJCFLAGS for Objective C compiler.
+AC_DEFUN([_KPSE_WARNING_OBJCFLAGS],
+[AC_REQUIRE([_KPSE_COMPILER_WARNINGS_OPTION])[]dnl
+AC_REQUIRE([AC_PROG_OBJC])[]dnl
+AC_CACHE_CHECK([what warning flags to pass to the Objective C compiler],
+ [kpse_cv_warning_objcflags],
+ [dnl
+if test "x$enable_compiler_warnings" = xno; then
+ kpse_cv_warning_objcflags=
+elif test "x$GOBJC" = xyes; then
+ _KPSE_WARNING_GNU_CFLAGS([OBJC], [objcflags])[]dnl
+else
+ : # FIXME: warning flags for non-GNU C compilers
+fi])
+WARNING_OBJCFLAGS=$kpse_cv_warning_objcflags
+AC_SUBST([WARNING_OBJCFLAGS])
+m4_define([_KPSE_WARNING_OBJCFLAGS], [])[]dnl
+]) # _KPSE_WARNING_OBJCFLAGS
+
+# _KPSE_WARNING_GNU_CFLAGS(COMPILER, TAG)
+# ---------------------------------------
+# Internal subroutine.
+# Determine warning flags for GNU (Objective) C compiler.
+m4_define([_KPSE_WARNING_GNU_CFLAGS],
+[kpse_cv_warning_$2="-Wall -Wunused"
+AS_CASE([`$[]$1 -dumpversion`],
+ [3.4.* | 4.*],
+ [kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wdeclaration-after-statement"])
+AS_CASE([`$[]$1 -dumpversion`],
+ [3.@<:@234@:>@.* | 4.*],
+ [kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wno-unknown-pragmas"])
+if test "x$enable_compiler_warnings" != xmin; then
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wmissing-prototypes -Wmissing-declarations"
+ if test "x$enable_compiler_warnings" != xyes; then
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wimplicit -Wparentheses -Wreturn-type"
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wswitch -Wtrigraphs -Wpointer-arith"
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wcast-qual -Wcast-align -Wwrite-strings"
+ AS_CASE([`$[]$1 -dumpversion`],
+ [3.4.* | 4.*],
+ [kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wold-style-definition"])
+ if test "x$enable_compiler_warnings" != xmax; then
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wshadow"
+ fi
+ fi
+fi
+]) # _KPSE_WARNING_GNU_CFLAGS
+
+# _KPSE_WARNING_GNU_CXXFLAGS(COMPILER, TAG)
+# -----------------------------------------
+# Internal subroutine.
+# Determine warning flags for GNU (Objective) C++ compiler.
+m4_define([_KPSE_WARNING_GNU_CXXFLAGS],
+[kpse_cv_warning_$2="-Wall -Wunused"
+AS_CASE([`$[]$1 -dumpversion`],
+ [3.@<:@234@:>@.* | 4.*],
+ [kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wno-unknown-pragmas"])
+if test "x$enable_compiler_warnings" != xmin; then
+ if test "x$enable_compiler_warnings" != xyes; then
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wimplicit -Wparentheses -Wreturn-type"
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wswitch -Wtrigraphs -Wpointer-arith"
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wcast-qual -Wcast-align -Wwrite-strings"
+ fi
+ if test "x$enable_compiler_warnings" != xmax; then
+ kpse_cv_warning_$2="$kpse_cv_warning_$2 -Wshadow"
+ fi
+fi
+]) # _KPSE_WARNING_GNU_CXXFLAGS
+