1 dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
2 dnl Copyright (C) 2009 Free Software Foundation, Inc.
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA.
18 dnl As a special exception to the GNU General Public License, if you
19 dnl distribute this file as part of a program that contains a configuration
20 dnl script generated by Autoconf, you may include it under the same
21 dnl distribution terms that you use for the rest of that program.
23 # --------------------------------------------------------------------------
24 # Check whether the C++ compiler accepts a certain flag
25 # If it does it adds the flag to lf_CXXFLAGS
26 # If it does not then it returns an error to lf_ok
28 # LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...)
29 # -------------------------------------------------------------------------
31 AC_DEFUN([LF_CHECK_CXX_FLAG],[
32 echo 'void f(){}' > conftest.cc
35 AC_MSG_CHECKING([whether $CXX accepts $i])
36 if test -z "`${CXX} $i -c conftest.cc 2>&1`"
38 lf_CXXFLAGS="${lf_CXXFLAGS} $i"
44 rm -f conftest.cc conftest.o
48 # --------------------------------------------------------------------------
49 # Check whether the C compiler accepts a certain flag
50 # If it does it adds the flag to lf_CFLAGS
51 # If it does not then it returns an error to lf_ok
53 # LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...)
54 # -------------------------------------------------------------------------
56 AC_DEFUN([LF_CHECK_CC_FLAG],[
57 echo 'void f(){}' > conftest.c
60 AC_MSG_CHECKING([whether $CC accepts $i])
61 if test -z "`${CC} $i -c conftest.c 2>&1`"
63 lf_CFLAGS="${lf_CFLAGS} $i"
69 rm -f conftest.c conftest.o
73 # --------------------------------------------------------------------------
74 # Check whether the Fortran compiler accepts a certain flag
75 # If it does it adds the flag to lf_FFLAGS
76 # If it does not then it returns an error to lf_ok
78 # LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...)
79 # -------------------------------------------------------------------------
81 AC_DEFUN([LF_CHECK_F77_FLAG],[
82 cat << EOF > conftest.f
83 c....:++++++++++++++++++++++++
90 AC_MSG_CHECKING([whether $F77 accepts $i])
91 if test -z "`${F77} $i -c conftest.f 2>&1`"
93 lf_FFLAGS="${lf_FFLAGS} $i"
99 rm -f conftest.f conftest.o
103 # ----------------------------------------------------------------------
104 # Enable compiler warnings.
105 # Call this command AFTER you have configured ALL your compilers.
106 # ----------------------------------------------------------------------
108 AC_DEFUN([LF_SET_WARNINGS],[
109 dnl Warnings for the two main compilers
110 dnl add -Wextra when you're got time to fix a bunch of them ;-)
111 cc_warning_flags="-Wall -Werror-implicit-function-declaration"
112 cxx_warning_flags="-Wall -Woverloaded-virtual"
115 LF_CHECK_CC_FLAG($cc_warning_flags)
119 LF_CHECK_CXX_FLAG($cxx_warning_flags)