1 dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
3 dnl This program is free software; you can redistribute it and/or modify
4 dnl it under the terms of the GNU General Public License as published by
5 dnl the Free Software Foundation; either version 3 of the License, or
6 dnl (at your option) any later version.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program; if not, write to the Free Software
15 dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA.
17 dnl As a special exception to the GNU General Public License, if you
18 dnl distribute this file as part of a program that contains a configuration
19 dnl script generated by Autoconf, you may include it under the same
20 dnl distribution terms that you use for the rest of that program.
22 # --------------------------------------------------------------------------
23 # Check whether the C++ compiler accepts a certain flag
24 # If it does it adds the flag to CXXFLAGS
25 # If it does not then it returns an error to lf_ok
27 # LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...)
28 # -------------------------------------------------------------------------
30 AC_DEFUN([LF_CHECK_CXX_FLAG],[
31 echo 'void f(){}' > conftest.cc
34 AC_MSG_CHECKING([whether $CXX accepts $i])
35 if test -z "`${CXX} $i -c conftest.cc 2>&1`"
37 CXXFLAGS="${CXXFLAGS} $i"
43 rm -f conftest.cc conftest.o
46 # --------------------------------------------------------------------------
47 # Check whether the C compiler accepts a certain flag
48 # If it does it adds the flag to CFLAGS
49 # If it does not then it returns an error to lf_ok
51 # LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...)
52 # -------------------------------------------------------------------------
54 AC_DEFUN([LF_CHECK_CC_FLAG],[
55 echo 'void f(){}' > conftest.c
58 AC_MSG_CHECKING([whether $CC accepts $i])
59 if test -z "`${CC} $i -c conftest.c 2>&1`"
67 rm -f conftest.c conftest.o
70 # --------------------------------------------------------------------------
71 # Check whether the Fortran compiler accepts a certain flag
72 # If it does it adds the flag to FFLAGS
73 # If it does not then it returns an error to lf_ok
75 # LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...)
76 # -------------------------------------------------------------------------
78 AC_DEFUN([LF_CHECK_F77_FLAG],[
79 cat << EOF > conftest.f
80 c....:++++++++++++++++++++++++
87 AC_MSG_CHECKING([whether $F77 accepts $i])
88 if test -z "`${F77} $i -c conftest.f 2>&1`"
96 rm -f conftest.f conftest.o
99 # ----------------------------------------------------------------------
100 # Provide the configure script with an --with-warnings option that
101 # turns on warnings. Call this command AFTER you have configured ALL your
103 # ----------------------------------------------------------------------
105 AC_DEFUN([LF_SET_WARNINGS],[
106 dnl Check for --with-warnings
107 AC_MSG_CHECKING([whether user wants warnings])
108 AC_ARG_WITH(warnings,
109 [ --with-warnings Turn on warnings],
110 [ lf_warnings=yes ], [ lf_warnings=no ])
111 lf_warnings=yes # hard code for now -eb
112 AC_MSG_RESULT($lf_warnings)
114 dnl Warnings for the two main compilers
115 cc_warning_flags="-Wall"
116 cxx_warning_flags="-Wall -Woverloaded-virtual"
117 if test $lf_warnings = yes
121 LF_CHECK_CC_FLAG($cc_warning_flags)
125 LF_CHECK_CXX_FLAG($cxx_warning_flags)