Mercurial > octave-nkf
comparison configure.ac @ 11514:a1386fab2a02
configure.ac: eliminate some code duplication when checking for extra compiler flags
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Jan 2011 08:04:23 -0500 |
parents | a2289858dcb2 |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
11513:a2289858dcb2 | 11514:a1386fab2a02 |
---|---|
1828 AC_SUBST(UGLY_DEFS) | 1828 AC_SUBST(UGLY_DEFS) |
1829 | 1829 |
1830 ### Maybe add -Wall, -W, and -Wshadow to compiler flags now that we're | 1830 ### Maybe add -Wall, -W, and -Wshadow to compiler flags now that we're |
1831 ### done feature testing. | 1831 ### done feature testing. |
1832 | 1832 |
1833 GCC_EXTRA_FLAGS="-Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual" | |
1834 | |
1835 GXX_EXTRA_FLAGS="-Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual" | |
1836 | |
1833 try_extra_warning_flags=true | 1837 try_extra_warning_flags=true |
1838 | |
1834 AC_ARG_ENABLE(extra-warning-flags, | 1839 AC_ARG_ENABLE(extra-warning-flags, |
1835 [AS_HELP_STRING([--enable-extra-warning-flags], | 1840 [AS_HELP_STRING([--enable-extra-warning-flags], |
1836 [add -Wall, -W, -Wshadow, and -Wold-style-cast options to CFLAGS and CXXFLAGS (on by default, but only if the compiler appears to accept them)])], | 1841 [add -Wall, -W, -Wshadow, and -Wold-style-cast options to CFLAGS and CXXFLAGS (on by default, but only if the compiler appears to accept them)])], |
1837 [if test "$enableval" = no; then | 1842 [if test "$enableval" = no; then |
1838 try_extra_warning_flags=false | 1843 try_extra_warning_flags=false |
1839 fi], []) | 1844 fi], []) |
1840 | 1845 |
1841 if $try_extra_warning_flags; then | 1846 if $try_extra_warning_flags; then |
1842 OCTAVE_CC_FLAG(-Wall, [ | 1847 for flag in $GCC_EXTRA_FLAGS; do |
1843 WARN_CFLAGS="$WARN_CFLAGS -Wall"; | 1848 OCTAVE_CC_FLAG($flag, [ |
1844 AC_MSG_RESULT([adding -Wall to WARN_CFLAGS])]) | 1849 WARN_CFLAGS="$WARN_CFLAGS $flag"; |
1845 OCTAVE_CC_FLAG(-W, [ | 1850 AC_MSG_RESULT([adding $flag to WARN_CFLAGS])]) |
1846 WARN_CFLAGS="$WARN_CFLAGS -W"; | 1851 done |
1847 AC_MSG_RESULT([adding -W to WARN_CFLAGS])]) | 1852 for flag in $GXX_EXTRA_FLAGS; do |
1848 OCTAVE_CC_FLAG(-Wshadow, [ | 1853 OCTAVE_CXX_FLAG($flag, [ |
1849 WARN_CFLAGS="$WARN_CFLAGS -Wshadow"; | 1854 WARN_CXXFLAGS="$WARN_CXXFLAGS $flag"; |
1850 AC_MSG_RESULT([adding -Wshadow to WARN_CFLAGS])]) | 1855 AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])]) |
1851 OCTAVE_CC_FLAG(-Wformat, [ | 1856 done |
1852 WARN_CFLAGS="$WARN_CFLAGS -Wformat"; | |
1853 AC_MSG_RESULT([adding -Wformat to WARN_CFLAGS])]) | |
1854 OCTAVE_CC_FLAG(-Wpointer-arith, [ | |
1855 WARN_CFLAGS="$WARN_CFLAGS -Wpointer-arith"; | |
1856 AC_MSG_RESULT([adding -Wpointer-arith to WARN_CFLAGS])]) | |
1857 OCTAVE_CC_FLAG(-Wmissing-prototypes, [ | |
1858 WARN_CFLAGS="$WARN_CFLAGS -Wmissing-prototypes"; | |
1859 AC_MSG_RESULT([adding -Wmissing-prototypes to WARN_CFLAGS])]) | |
1860 OCTAVE_CC_FLAG(-Wstrict-prototypes, [ | |
1861 WARN_CFLAGS="$WARN_CFLAGS -Wstrict-prototypes"; | |
1862 AC_MSG_RESULT([adding -Wstrict-prototypes to WARN_CFLAGS])]) | |
1863 OCTAVE_CC_FLAG(-Wwrite-strings, [ | |
1864 WARN_CFLAGS="$WARN_CFLAGS -Wwrite-strings"; | |
1865 AC_MSG_RESULT([adding -Wwrite-strings to WARN_CFLAGS])]) | |
1866 OCTAVE_CC_FLAG(-Wcast-align, [ | |
1867 WARN_CFLAGS="$WARN_CFLAGS -Wcast-align"; | |
1868 AC_MSG_RESULT([adding -Wcast-align to WARN_CFLAGS])]) | |
1869 OCTAVE_CC_FLAG(-Wcast-qual, [ | |
1870 WARN_CFLAGS="$WARN_CFLAGS -Wcast-qual"; | |
1871 AC_MSG_RESULT([adding -Wcast-qual to WARN_CFLAGS])]) | |
1872 | |
1873 OCTAVE_CXX_FLAG(-Wall, [ | |
1874 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wall"; | |
1875 AC_MSG_RESULT([adding -Wall to WARN_CXXFLAGS])]) | |
1876 OCTAVE_CXX_FLAG(-W, [ | |
1877 WARN_CXXFLAGS="$WARN_CXXFLAGS -W"; | |
1878 AC_MSG_RESULT([adding -W to WARN_CXXFLAGS])]) | |
1879 OCTAVE_CXX_FLAG(-Wshadow, [ | |
1880 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wshadow"; | |
1881 AC_MSG_RESULT([adding -Wshadow to WARN_CXXFLAGS])]) | |
1882 OCTAVE_CXX_FLAG(-Wold-style-cast, [ | |
1883 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wold-style-cast"; | |
1884 AC_MSG_RESULT([adding -Wold-style-cast to WARN_CXXFLAGS])]) | |
1885 OCTAVE_CXX_FLAG(-Wformat, [ | |
1886 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat"; | |
1887 AC_MSG_RESULT([adding -Wformat to WARN_CXXFLAGS])]) | |
1888 OCTAVE_CXX_FLAG(-Wpointer-arith, [ | |
1889 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wpointer-arith"; | |
1890 AC_MSG_RESULT([adding -Wpointer-arith to WARN_CXXFLAGS])]) | |
1891 OCTAVE_CXX_FLAG(-Wwrite-strings, [ | |
1892 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wwrite-strings"; | |
1893 AC_MSG_RESULT([adding -Wwrite-strings to WARN_CXXFLAGS])]) | |
1894 OCTAVE_CXX_FLAG(-Wcast-align, [ | |
1895 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wcast-align"; | |
1896 AC_MSG_RESULT([adding -Wcast-align to WARN_CXXFLAGS])]) | |
1897 OCTAVE_CXX_FLAG(-Wcast-qual, [ | |
1898 WARN_CXXFLAGS="$WARN_CXXFLAGS -Wcast-qual"; | |
1899 AC_MSG_RESULT([adding -Wcast-qual to WARN_CXXFLAGS])]) | |
1900 fi | 1857 fi |
1901 | 1858 |
1902 GCC_STRICT_FLAGS="-Wconversion" | 1859 GCC_STRICT_FLAGS="-Wconversion" |
1903 | 1860 |
1904 GXX_STRICT_FLAGS="-Wconversion -Weffc++" | 1861 GXX_STRICT_FLAGS="-Wconversion -Weffc++" |