ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/ac-tools/aclocal.m4
(Generate patch)

Comparing trunk/OOPSE/ac-tools/aclocal.m4 (file contents):
Revision 378 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
Revision 1233 by gezelter, Fri Jun 4 02:38:23 2004 UTC

# Line 1 | Line 1
1 < dnl ACX_SAVE_STATE/ACX_RESTORE_STATE
2 < dnl Save/restore flags
3 < dnl
4 < dnl ACX_SAVE_STATE
5 < AC_DEFUN(ACX_SAVE_STATE,
6 < [
7 <    save_CFLAGS=$CFLAGS
8 <    save_CPPFLAGS=$CPPFLAGS
9 <    save_LDFLAGS=$LDFLAGS
10 <    save_LIBS=$LIBS
11 < ])
12 < dnl ACX_RESTORE_STATE
13 < AC_DEFUN(ACX_RESTORE_STATE,
14 < [
15 <    CFLAGS=$save_CFLAGS
16 <    CPPFLAGS=$save_CPPFLAGS
17 <    LDFLAGS=$save_LDFLAGS
18 <    LIBS=$save_LIBS
19 < ])
1 > dnl
2 > dnl AC_CHECK_MODSUFFIX
3 > dnl
4 > AC_DEFUN([AC_CHECK_MODSUFFIX],[
5  
6 <
7 < AC_DEFUN(ACX_CHECK_CC_FLAGS,
8 < [
9 < AC_REQUIRE([AC_PROG_CC])
10 < AC_CACHE_CHECK(whether ${CC-cc} accepts $1, ac_$2,
11 < [echo 'void f(){}' > conftest.c
12 < if test -z "`${CC-cc} $1 -c conftest.c 2>&1`"; then
13 <        ac_$2=yes
6 > AC_MSG_CHECKING(for module suffix)
7 > rm -f conftest*
8 > # Intel ifc compiler generates files by the name of work.pc and work.pcl (!)
9 > rm -f work*
10 > cat >conftest.f90 <<EOF
11 >        module conftest
12 >        integer n
13 >        parameter (n=1)
14 >        end module conftest
15 > EOF
16 > # SGI and absoft compilers generates module name in upper case!
17 > testname="conftest"
18 > modcase="lower"
19 > if $F90 -c conftest.f90 > conftest.out 2>&1 ; then
20 >    MOD=`ls conftest* | grep -v conftest.f | grep -v conftest.o`
21 >    MOD=`echo "$MOD" | sed -e 's/conftest\.//g'`
22 >    if test -z "$MOD" ; then
23 >        MOD=`ls CONFTEST* 2>/dev/null \
24 >                | grep -v CONFTEST.f | grep -v CONFTEST.o`
25 >        MOD=`echo "$MOD" | sed -e 's/CONFTEST\.//g'`
26 >        if test -n "$MOD" ; then
27 >            testname="CONFTEST"
28 >            modcase="upper"
29 >        fi
30 >    fi
31 >    if test -z "$MOD" ; then
32 >        AC_MSG_RESULT(unknown)
33 >        # Use mod if we can't figure it out
34 >        MOD="mod"
35 >    else
36 >        AC_MSG_RESULT($MOD)
37 >    fi
38 >    if test -s work.pcl ; then
39 >        AC_MSG_WARN([Compiler generates auxillery files!])
40 >    fi
41   else
42 <        ac_$2=no
42 >    AC_MSG_RESULT(unknown)
43   fi
44 < rm -f conftest*
44 > AC_SUBST(MOD)
45 >
46   ])
47 < if test "$ac_$2" = yes; then
48 <        :
49 <        $3
50 < else
51 <        :
52 <        $4
47 >
48 >
49 > dnl
50 > dnl AC_CHECK_MODDIRFLAG
51 > dnl
52 > AC_DEFUN([AC_CHECK_MODDIRFLAG],[
53 >
54 > # Check for module include path (some use -I, some (Solaris) use -M, some
55 > # (absoft) use -p).
56 > # Intel compilers use a wierd system: -cl,filename.pcl .  If no file is
57 > # specified, work.pcl and work.pc are created.  However, if you specify
58 > # a file, it must contain a the name of a file ending in .pc .  Ugh!
59 > # Use the module made above
60 > AC_MSG_CHECKING(for module directory path flag)
61 > rm -f conftest*
62 > # Intel ifc compiler generates files by the name of work.pc and work.pcl (!)
63 > rm -f work*
64 > cat >conftest.f90 <<EOF
65 >        module conftest
66 >        integer n
67 >        parameter (n=1)
68 >        end module conftest
69 > EOF
70 > # SGI and absoft compilers generates module name in upper case!
71 > testname="conftest"
72 > if $F90 -c conftest.f90 > conftest.out 2>&1 ; then
73 >   mod=`ls CONFTEST* 2>/dev/null | grep -v CONFTEST.f | grep -v CONFTEST.o`
74 >   mod=`echo "$mod" | sed -e 's/CONFTEST\.//g'`
75 >   if test -n "$mod" ; then
76 >      testname="CONFTEST"
77 >   fi
78 >   madedir=0
79 >   if test ! -d conf ; then mkdir conf ; madedir=1; fi
80 >   cp $testname.$MOD conf
81 >   rm -f conftest* CONFTEST*
82 >   cat >conftest1.f90 <<EOF
83 >        program main
84 >        use conftest
85 >        print *, n
86 >        end
87 > EOF
88 >   F90_WORK_FILES_ARG=""
89 >   F90MODINCSPEC=""
90 >   if $F90 -c -Iconf conftest1.f90 > conftest.out 2>&1 ; then
91 >       MODDIRFLAG="-I"
92 >       F90MODINCSPEC="-I<dir>"
93 >       AC_MSG_RESULT(-I)
94 >   elif $F90 -c -Mconf conftest1.f90 >> conftest.out 2>&1 ; then
95 >       MODDIRFLAG="-M"
96 >       F90MODINCSPEC="-M<dir>"
97 >       AC_MSG_RESULT(-M)
98 >   elif $F90 -c -pconf conftest1.f90 >> conftest.out 2>&1 ; then
99 >       MODDIRFLAG="-p"
100 >       F90MODINCSPEC="-p<dir>"
101 >       AC_MSG_RESULT(-p)
102 >   elif test -s work.pc ; then
103 >        cp work.pc conf/mpimod.pc
104 >        echo "mpimod.pc" > conf/mpimod.pcl
105 >        echo "`pwd`/conf/mpimod.pc" >> conf/mpimod.pcl
106 >        if $F90 -c -cl,conf/mpimod.pcl conftest1.f >>conftest.out 2>&1 ; then
107 >            MODDIRFLAG='-cl,mpimod.pcl'
108 >            AC_MSG_RESULT([-cl,filename where filename contains a list of files and directories])
109 >            F90_WORK_FILES_ARG="-cl,mpimod.pcl"
110 >            F90MODINCSPEC="-cl,<dir>/<file>mod.pcl"
111 >            AC_SUBST(F90_WORK_FILES_ARG)
112 >        else
113 >            # The version of the Intel compiler that I have refuses to let
114 >            # you put the "work catalog" list anywhere but the current
115 >            # directory. For example, you cannot in
116 >         :
117 >        fi
118 >   fi
119 >   if test -z "MODDIRFLAG" ; then
120 >       AC_MSG_RESULT(unknown)
121 >   fi
122 >   AC_SUBST(MODDIRFLAG)
123 >   AC_SUBST(F90MODINCSPEC)
124 >   rm -f conftest* conf/conftest* conf/CONFTEST* CONFTEST* conf/mpimod*
125 >   if test $madedir = 1 ; then rmdir conf ; fi
126   fi
127 +
128   ])
129  
43 dnl **** Check for gcc strength-reduce bug ****
44 AC_DEFUN(ACX_GCC_STRENGTH_REDUCE,
45 [
46 AC_REQUIRE([AC_PROG_CC])
47 AC_CACHE_CHECK([for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug,
48  AC_TRY_RUN([
49    int main(void) {
50      static int Array[[3]];
51      unsigned int B = 3;
52      int i;
53      for(i=0; i<B; i++) Array[[i]] = i - 3;
54      exit( Array[[1]] != -2 );
55    }
56    ],
130  
131 <    ac_cv_c_gcc_strength_bug="no",
132 <    ac_cv_c_gcc_strength_bug="yes",
133 <    ac_cv_c_gcc_strength_bug="yes")
134 <  )
135 <  
136 <  if test "$ac_cv_c_gcc_strength_bug" = "yes"
137 <  then
138 <    :
139 <    $1
131 > dnl
132 > dnl AC_CHECK_MPI_F90MOD
133 > dnl
134 > AC_DEFUN([AC_CHECK_MPI_F90MOD],[
135 >
136 >  AC_ARG_WITH(mpi_f90_mods, [  --with-mpi_f90_mods=<dir>
137 >                          Location where MPI f90 modules are installed ],
138 >                           mpi_f90_mods="$withval",
139 >                           mpi_f90_mods="/usr/local/include/f90choice")
140 >
141 >  AC_MSG_CHECKING(for MPI F90 modules)
142 >  AC_LANG_SAVE()
143 >  AC_LANG([Fortran 90])
144 >  ac_save_F90FLAGS=$F90FLAGS
145 >
146 >  AS_IF([test "$mpi_f90_mods"], [F90FLAGS="${F90FLAGS} ${MODDIRFLAG}${mpi_f90_mods}"])
147 >    _AC_COMPILE_IFELSE([
148 >    AC_LANG_PROGRAM([
149 > use mpi
150 > integer :: ierr
151 > call MPI_Init(ierr)
152 > ])], [HAVE_MPI_MOD=1], [HAVE_MPI_MOD=0])
153 >
154 >  F90FLAGS=$ac_save_F90FLAGS
155 >  AC_LANG_RESTORE()
156 >
157 >  if test "$HAVE_MPI_MOD" = 1; then
158 >    AC_MSG_RESULT(yes)
159 >    AC_DEFINE(MPI_MOD, 1, [have mpi module])
160 >    MPI_F90_MODS="${mpi_f90_mods}"
161 >    AC_SUBST(MPI_F90_MODS)        
162 >    # The library name:
163 >    if test -z "$MPI_LIB" ; then
164 >       MPI_LIBNAME=-lmpich
165 >    else
166 >       MPI_LIBNAME="$MPI_LIB"
167 >    fi
168 >    if test -z "$MPIMODLIBNAME" ; then
169 >       MPIMODLIBNAME="${MPI_LIBNAME}f90"
170 >    fi
171 >    AC_SUBST(MPIMODLIBNAME)
172    else
173 <    :
174 <    $2
173 >    AC_MSG_RESULT(no)
174 >    AC_MSG_WARN([Couldn't locate MPI F90 Modules])
175    fi
176 +
177   ])
178  
73 dnl **** Checks for FPU arithmetics
74 AC_DEFUN(ACX_CHECK_FPU,
75 [
76 AC_CACHE_CHECK([for FPU arithmetics type], ac_cv_c_fpu_arithmetics_type,
77                  AC_TRY_RUN([
78 #include <stdio.h>
79 #include <string.h>
179  
81 #define LOG2EA 0.44269504088896340735992
82 #define ACCURACY "%1.4f"
180  
84 typedef union {unsigned short s[[4]]; double d;} XTYPE;
181  
182 < XTYPE X[[]] = {
183 <              {{0,0,0,0}},                          /* Unknown             */
184 <              {{0x3fdc,0x551d,0x94ae,0x0bf8}},      /* Big endian     IEEE */
185 <              {{0x0bf8,0x94ae,0x551d,0x3fdc}},      /* Littile endian IEEE */
90 <              {{0037742,0124354,0122560,0057703}}   /* DEC                 */
91 <            };
92 <            
93 < int main (void)
94 < {
95 <    int i; char TMPSTR[[1024]]; char LOG2EA_STR[[80]];
96 <    i = 0;
97 <
98 <    sprintf(LOG2EA_STR, ACCURACY, LOG2EA);
99 <
100 <    for (i=3; i >= 0; i--)
101 <    {
102 <        sprintf(TMPSTR, ACCURACY, X[[i]].d);
103 <        if (strcmp(TMPSTR, LOG2EA_STR) == 0) {
104 <            break;
105 <        }
106 <    }
107 <
108 <    exit(i);
109 < }],
110 <    ac_cv_c_fpu_arithmetics_type="Unknown",
111 <    [case "$?" in
112 <      "1"[)] ac_cv_c_fpu_arithmetics_type="Big endian IEEE" ;;
113 <      "2"[)] ac_cv_c_fpu_arithmetics_type="Little endian IEEE" ;;
114 <      "3"[)] ac_cv_c_fpu_arithmetics_type="DEC" ;;
115 <    esac],
116 <    ac_cv_c_fpu_arithmetics_type="Unknown") )
182 > dnl
183 > dnl AM_PATH_SPRNG
184 > dnl
185 > AC_DEFUN([AM_PATH_SPRNG],[
186  
187 < case "$ac_cv_c_fpu_arithmetics_type" in
188 <  "DEC")                AC_DEFINE(HAVE_DEC_FPU) ;;
189 <  "Little endian IEEE") AC_DEFINE(HAVE_LIEEE_FPU) ;;
190 <  "Big endian IEEE")    AC_DEFINE(HAVE_BIEEE_FPU) ;;
191 < esac
187 >  AC_ARG_WITH(sprng_prefix, [  --with-sprng_prefix=PREFIX
188 >                          Prefix where SPRNG is installed ],
189 >                           sprng_prefix="$withval",
190 >                           sprng_prefix="/usr/local")
191 >  AC_ARG_WITH(sprng-libdir, [  --with-sprng-libdir=PREFIX  SPRNG library directory],
192 >                           sprng_libdir="$withval",
193 >                           sprng_libdir="/usr/local/lib")
194 >  AC_ARG_WITH(sprng-include, [  --with-sprng-include=PREFIX
195 >                          SPRNG include directory],
196 >                           sprng_include="$withval",
197 >                           sprng_include="/usr/local/include/sprng")
198  
199 < ])
199 >  if test x$sprng_libdir = x ; then
200 >    sprng_libdir=${sprng_prefix}/lib
201 >  fi
202  
203 +  if test x$sprng_include = x ; then
204 +    sprng_include=${sprng_prefix}/include
205 +  fi
206  
207 < AC_DEFUN(ACX_ANSI_TYPES,
208 < [
209 <  dnl **** Check which ANSI integer type is 16 bit
210 <  AC_CACHE_CHECK( "which ANSI integer type is 16 bit", ac_16bit_type,
131 <                  AC_TRY_RUN([
132 <  int main(void) {
133 <    if (sizeof(short)==2)
134 <      return(0);
135 <    else if (sizeof(int)==2)
136 <      return(1);
137 <    else
138 <      return(2);
139 <  }], ac_16bit_type="short", ac_16bit_type="int", ac_16bit_type=))
140 <  if test "$ac_16bit_type" = "short"
141 <  then
142 <    T1_AA_TYPE16="short"
207 >  AC_MSG_CHECKING(for SPRNG include files in $sprng_include)
208 >  if test -f ${sprng_include}/sprng.h; then
209 >    have_sprngincl=yes
210 >    AC_MSG_RESULT(yes)
211    else
212 <    T1_AA_TYPE16="int"
212 >    have_sprngincl=no
213 >    AC_MSG_RESULT(no)
214 >    AC_MSG_ERROR(Could not locate the SPRNG include files)
215    fi
216  
217 <  dnl **** Check which ANSI integer type is 32 bit
218 <  AC_CACHE_CHECK( "which ANSI integer type is 32 bit", ac_32bit_type,
219 <                  AC_TRY_RUN([
220 <  int main(void) {
151 <    if (sizeof(int)==4)
152 <      return(0);
153 <    else if (sizeof(long)==4)
154 <      return(1);
155 <    else
156 <      return(2);
157 <  }], ac_32bit_type="int", ac_32bit_type="long", ac_32bit_type=))
158 <  if test "$ac_32bit_type" = "int"
159 <  then
160 <    T1_AA_TYPE32="int"
217 >  AC_MSG_CHECKING(for SPRNG libraries in $sprng_libdir)
218 >  if test -f ${sprng_libdir}/libsprng.a; then
219 >    have_sprnglib=yes
220 >    AC_MSG_RESULT(yes)
221    else
222 <    T1_AA_TYPE32="long"
222 >    have_sprnglib=no
223 >    AC_MSG_RESULT(no)
224 >    AC_MSG_ERROR(Could not locate the SPRNG libraries)
225    fi
226  
227 <  dnl **** Check which ANSI integer type is 64 bit
228 <  AC_CACHE_CHECK( "which ANSI integer type is 64 bit", ac_64bit_type,
229 <                  AC_TRY_RUN([
230 <  int main(void) {
231 <    if (sizeof(long)==8)
232 <      return(0);
227 >  AC_LANG_SAVE()
228 >  AC_LANG([C])
229 >  ac_save_CPPFLAGS=$CPPFLAGS
230 >  CPPFLAGS="${CPPFLAGS} -I${sprng_include}"
231 >  ac_save_LDFLAGS=$LDFLAGS
232 >  LDFLAGS="${LDFLAGS} -L${sprng_libdir} -lsprng"
233 >  AC_CHECK_HEADER(sprng.h, [
234 >    AC_CHECK_LIB(sprng,
235 >                 init_rng,
236 >                    [SPRNG_LIBDIR="${sprng_libdir}"
237 >                     SPRNG_LIB="-lsprng" SPRNG_INC="-I${sprng_include}"
238 >                     HAVE_SPRNG="yes"])])
239 >  CPPFLAGS=$ac_save_CPPFLAGS
240 >  LDFLAGS=$ac_save_LDFLAGS
241 >  AC_LANG_RESTORE()
242 >  
243 >  if test x_$HAVE_SPRNG != x_yes; then
244 >        AC_MSG_ERROR(Can't build with SPRNG)
245 >  fi
246 >  AC_SUBST(SPRNG_LIBDIR)
247 >  AC_SUBST(SPRNG_LIB)
248 >  AC_SUBST(SPRNG_INC)
249 >  AC_SUBST(HAVE_SPRNG)
250 > ])
251 >
252 > dnl
253 > dnl CHECK_MKL
254 > dnl
255 > AC_DEFUN([CHECK_MKL],
256 > [AC_MSG_CHECKING(if MKL is wanted)
257 > AC_ARG_WITH(mkl,
258 >              [  --with-mkl              Do we want MKL [will check /usr/local/intel/mkl61 /opt/intel/mkl61]],
259 > [   AC_MSG_RESULT(yes)
260 >    for dir in $withval /usr/local/intel/mkl61 /opt/intel/mkl61; do
261 >        mkldir="$dir"
262 >        if test -f "$dir/include/mkl.h"; then
263 >            found_mkl="yes";
264 >            break;
265 >        fi
266 >    done
267 >    if test x_$found_mkl != x_yes; then
268 >        AC_MSG_ERROR(Cannot find MKL includes)
269      else
270 <      return(1);
271 <  }], ac_64bit_type="long", ac_64bit_type="<none>", ac_64bit_type=))
272 <  if test "$ac_64bit_type" = "long"
273 <  then
274 <    T1_AA_TYPE64="long"
275 <  else
276 <    T1_AA_TYPE64=
270 >        printf "MKL includes found in $mkldir/include\n";
271 >    fi
272 >
273 >  AC_LANG_SAVE()
274 >  AC_LANG([C])
275 >  ac_save_CPPFLAGS=$CPPFLAGS
276 >  CPPFLAGS="${CPPFLAGS} -I${mkldir}/include"
277 >  ac_save_LDFLAGS=$LDFLAGS
278 >  LDFLAGS="${LDFLAGS} -L${mkldir}/lib/32 -lmkl -lvml -lguide"
279 >  AC_CHECK_HEADER(mkl.h, [
280 >    AC_CHECK_LIB(mkl,
281 >                 vslNewStream,
282 >                    [MKL_LIBDIR="${mkldir}/lib/32",
283 >                     MKL_LIB="-lmkl -lvml -lguide",
284 >                     HAVE_MKL="yes"])
285 >    ], [MKL_INC="-I${mkldir}/include"])
286 >  CPPFLAGS=$ac_save_CPPFLAGS
287 >  LDFLAGS=$ac_save_LDFLAGS
288 >  AC_LANG_RESTORE()
289 >  
290 >  if test x_$HAVE_MKL != x_yes; then
291 >        AC_MSG_ERROR(Can't build with MKL)
292    fi
293 +  AC_SUBST(MKL_LIBDIR)
294 +  AC_SUBST(MKL_LIB)
295 +  AC_SUBST(MKL_INC)
296 +  AC_SUBST(HAVE_MKL)
297 + ],
298 + [
299 +    AC_MSG_RESULT(no)
300   ])
301 + ])
302 + dnl
303  
304 < dnl **** Check for buggy realloc()
305 < AC_DEFUN(ACX_CHECK_REALLOC,
304 >
305 > AC_DEFUN(ACX_CHECK_CC_FLAGS,
306   [
307 < AC_CACHE_CHECK([whether realloc is buggy], ac_cv_c_realloc_bug,
308 <                  AC_TRY_RUN([
309 < #include <stdio.h>
310 < #include <stdlib.h>
311 < int main(void) {
312 <  void *ptr;
313 <  ptr = NULL;
192 <  ptr = realloc(ptr, 1);
193 <  exit(ptr == NULL);
194 < }],
195 <  ac_cv_c_realloc_bug="no",
196 <  ac_cv_c_realloc_bug="yes",
197 <  ac_cv_c_realloc_bug="yes") )
198 < if test "$ac_cv_c_realloc_bug" = "yes"
199 <  then
200 <    :
201 <    $1
202 <  else
203 <    :
204 <    $2
307 > AC_REQUIRE([AC_PROG_CC])
308 > AC_CACHE_CHECK(whether ${CC-cc} accepts $1, ac_$2,
309 > [echo 'void f(){}' > conftest.c
310 > if test -z "`${CC-cc} $1 -c conftest.c 2>&1`"; then
311 >        ac_$2=yes
312 > else
313 >        ac_$2=no
314   fi
315 + rm -f conftest*
316   ])
317 + if test "$ac_$2" = yes; then
318 +        :
319 +        $3
320 + else
321 +        :
322 +        $4
323 + fi
324 + ])
325  
326 + AC_DEFUN(ACX_CHECK_CXX_FLAGS,
327 + [
328 + AC_REQUIRE([AC_PROG_CXX])
329 + AC_CACHE_CHECK(whether ${CXX-c++} accepts $1, ac_$2,
330 + [echo 'void f(){}' > conftest.cpp
331 + if test -z "`${CXX-c++} $1 -c conftest.cpp 2>&1`"; then
332 +        ac_$2=yes
333 + else
334 +        ac_$2=no
335 + fi
336 + rm -f conftest*
337 + ])
338 + if test "$ac_$2" = yes; then
339 +        :
340 +        $3
341 + else
342 +        :
343 +        $4
344 + fi
345 + ])
346  
347 < dnl ICE_CHECK_DECL (FUNCTION, HEADER-FILE...)
348 < dnl -----------------------------------------
347 > dnl -------------------------------------------------------------------------
348 > dnl ACX_CHECK_F90_FLAGS()
349   dnl
350 < dnl If FUNCTION is available, define `HAVE_FUNCTION'.  If it is declared
213 < dnl in one of the headers named in the whitespace-separated list
214 < dnl HEADER_FILE, define `HAVE_FUNCTION_DECL` (in all capitals).
350 > dnl     Check for optimizer flags the Fortran compiler can use.
351   dnl
352 < AC_DEFUN(ICE_CHECK_DECL,
352 > AC_DEFUN(ACX_CHECK_F90_FLAGS,
353   [
354 < changequote(,)dnl
219 < ice_tr=`echo $1 | tr '[a-z]' '[A-Z]'`
220 < changequote([,])dnl
221 < ice_have_tr=HAVE_$ice_tr
222 < ice_have_decl_tr=${ice_have_tr}_DECL
223 < ice_have_$1=no
224 < AC_CHECK_FUNCS($1, ice_have_$1=yes)
225 < if test "${ice_have_$1}" = yes; then
226 < AC_MSG_CHECKING(for $1 declaration in $2)
227 < AC_CACHE_VAL(ice_cv_have_$1_decl,
354 > AC_CACHE_CHECK(whether ${F90-f90} accepts $1, ac_$2,
355   [
356 < ice_cv_have_$1_decl=no
357 < changequote(,)dnl
358 < ice_re_params='[a-zA-Z_][a-zA-Z0-9_]*'
359 < ice_re_word='(^|[^a-zA-Z_0-9_])'
360 < changequote([,])dnl
361 < for header in $2; do
362 < # Check for ordinary declaration
363 < AC_EGREP_HEADER([${ice_re_word}$1 *\(], $header,
364 <        ice_cv_have_$1_decl=yes)
238 < if test "$ice_cv_have_$1_decl" = yes; then
239 <        break
356 > AC_LANG_SAVE
357 > AC_LANG([Fortran 90])
358 > echo 'program main' > conftest.$ac_ext
359 > echo 'end program main' >> conftest.$ac_ext
360 > ac_compile='${F90-f90} -c $1 $F90FLAGS conftest.$ac_ext 1>&AC_FD_CC'
361 > if AC_TRY_EVAL(ac_compile); then
362 >        ac_$2=yes
363 > else
364 >        ac_$2=no
365   fi
366 < # Check for "fixed" declaration like "getpid _PARAMS((int))"
367 < AC_EGREP_HEADER([${ice_re_word}$1 *$ice_re_params\(\(], $header,
368 <        ice_cv_have_$1_decl=yes)
369 < if test "$ice_cv_have_$1_decl" = yes; then
370 <        break
366 > rm -f conftest*
367 > AC_LANG_RESTORE()
368 > ])
369 > if test "$ac_$2" = yes; then
370 >        :
371 >        $3
372 > else
373 >        :
374 >        $4
375   fi
247 done
376   ])
377 < AC_MSG_RESULT($ice_cv_have_$1_decl)
378 < if test "$ice_cv_have_$1_decl" = yes; then
379 < AC_DEFINE_UNQUOTED(${ice_have_decl_tr})
377 >
378 > AC_DEFUN(ACX_PROG_GCC_VERSION,
379 > [
380 > AC_REQUIRE([AC_PROG_CC])
381 > AC_CACHE_CHECK(whether we are using gcc $1.$2 or later, ac_cv_prog_gcc_$1_$2,
382 > [
383 > dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
384 > cat > conftest.c <<EOF
385 > #ifdef __GNUC__ && !defined (__INTEL_COMPILER)
386 > #  if (__GNUC__ > $1) || (__GNUC__ == $1 && __GNUC_MINOR__ >= $2)
387 >     yes;
388 > #  endif
389 > #endif
390 > EOF
391 > if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
392 >  ac_cv_prog_gcc_$1_$2=yes
393 > else
394 >  ac_cv_prog_gcc_$1_$2=no
395   fi
396 + ])
397 + if test "$ac_cv_prog_gcc_$1_$2" = yes; then
398 +        :
399 +        $3
400 + else
401 +        :
402 +        $4
403   fi
404 < ])dnl
404 > ])
405  
406 < dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
407 < dnl
408 < dnl Author:     Mark Wooding
409 < dnl
410 < dnl Synopsis:   mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND])
411 < dnl
412 < dnl Arguments:  FUNC = a function to try to find
413 < dnl             LIBS = a whitespace-separated list of libraries to search
414 < dnl             IF-FOUND = what to do when the function is found
415 < dnl             IF-NOT-FOUND = what to do when the function isn't found
416 < dnl
417 < dnl Use:        Searches for a library which defines FUNC.  It first tries
418 < dnl             without any libraries; then it tries each library specified
419 < dnl             in LIBS in turn.  If it finds a match, it adds the
420 < dnl             appropriate library to `LIBS'.
421 < dnl
422 < dnl             This is particularly handy under DIREIX: if you link with
423 < dnl             `-lnsl' then you get non-NIS-aware versions of getpwnam and
424 < dnl             so on, which is clearly a Bad Thing.
425 < dnl
426 < dnl Modified:   by Evgeny Stambulchik to add (found) libraries to `LIBS'
427 < dnl             *only* if `IF-FOUND' is absent. As well, if no additional
428 < dnl             library is needed for `FUNC', `mdw_cv_lib_$1' sets to "".
406 > AC_DEFUN(ACX_PROG_GXX_VERSION,
407 > [
408 > AC_REQUIRE([AC_PROG_CXX])
409 > AC_CACHE_CHECK(whether we are using g++ $1.$2 or later, ac_cv_prog_gxx_$1_$2,
410 > [
411 > dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
412 > cat > conftest.cpp <<EOF
413 > #ifdef __GNUC__ && !defined (__INTEL_COMPILER)
414 > #  if (__GNUC__ > $1) || (__GNUC__ == $1 && __GNUC_MINOR__ >= $2)
415 >     yes;
416 > #  endif
417 > #endif
418 > EOF
419 > if AC_TRY_COMMAND(${CXX-c++} -E conftest.cpp) | egrep yes >/dev/null 2>&1; then
420 >  ac_cv_prog_gxx_$1_$2=yes
421 > else
422 >  ac_cv_prog_gxx_$1_$2=no
423 > fi
424 > ])
425 > if test "$ac_cv_prog_gxx_$1_$2" = yes; then
426 >        :
427 >        $3
428 > else
429 >        :
430 >        $4
431 > fi
432 > ])
433  
434 < AC_DEFUN(mdw_CHECK_MANYLIBS,
281 < [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1],
282 < [mdw_save_LIBS="$LIBS"
283 < mdw_cv_lib_$1="no"
284 < AC_TRY_LINK(,[$1()], [mdw_cv_lib_$1="none required"])
285 < test "$mdw_cv_lib_$1" = "no" && for i in $2; do
286 < LIBS="-l$i $mdw_save_LIBS"
287 < AC_TRY_LINK(,[$1()],
288 < [mdw_cv_lib_$1="-l$i"
289 < break])
290 < done
291 < LIBS="$mdw_save_LIBS"])
292 < if test "$mdw_cv_lib_$1" != "no"; then
293 <  if test "x$3" != "x"; then
294 <    test "$mdw_cv_lib_$1" = "none required" && mdw_cv_lib_$1=""
295 <    $3
296 <  else
297 <    test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS"
298 <  fi
299 < else :
300 <  $4
301 < fi])
302 <
303 <
304 < dnl ACX_CHECK_MOTIF
305 < dnl --------------
306 < AC_DEFUN(ACX_CHECK_MOTIF,
434 > AC_DEFUN(ACX_PROG_REALLY_GCC,
435   [
436 <  AC_REQUIRE([AC_PATH_XTRA])
437 <  AC_ARG_WITH(motif_library,
438 <  [  --with-motif-library=OBJ     use OBJ as Motif library [-lXm]],
439 <  motif_library="$withval")
440 <  if test "x$motif_library" = "x"
441 <  then
442 <    motif_library=-lXm
443 <  fi
436 > AC_REQUIRE([AC_PROG_CC])
437 > AC_CACHE_CHECK(whether we are *really* using GNU cc, ac_cv_prog_really_gcc,
438 > [
439 > dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
440 > cat > conftest.c <<EOF
441 > #ifdef __GNUC__
442 >  #ifndef __INTEL_COMPILER
443 >     yes;
444 >  #endif
445 > #endif
446 > EOF
447 > if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
448 >  ac_cv_prog_really_gcc=yes
449 > else
450 >  ac_cv_prog_really_gcc=no
451 > fi
452 > ])
453 > if test "$ac_cv_prog_really_gcc" = yes; then
454 >        :
455 >        $1
456 > else
457 >        :
458 >        $2
459 > fi
460 > ])
461  
462 <  ACX_SAVE_STATE
318 <  
319 <  AC_CACHE_CHECK([for a Motif >= $1 compatible API], acx_cv_motif,
320 <    AC_CACHE_VAL(acx_cv_motif_library, acx_cv_motif_library=$motif_library)
321 <    LIBS="$acx_cv_motif_library $GUI_LIBS"
322 <    CFLAGS="$X_CFLAGS $CFLAGS"
323 <    CPPFLAGS="$X_CFLAGS $CPPFLAGS"
324 <    LDFLAGS="$X_LIBS $LDFLAGS"
325 <    AC_TRY_RUN([
326 < #include <Xm/XmAll.h>
327 <      int main(void) {
328 <        int vlibn, vincn;
329 <        vincn = XmVersion;
330 <        XmRegisterConverters();
331 <        vlibn = xmUseVersion;
332 <        if (vincn < [$1]) {
333 <          exit(1);
334 <        }
335 <        if (vincn != vlibn) {
336 <          exit(2);
337 <        }
338 <        exit(0);
339 <      }
340 <      ],
341 <
342 <      acx_cv_motif="yes",
343 <      acx_cv_motif="no",
344 <      acx_cv_motif="no"
345 <    )
346 <  )
347 <  if test "$acx_cv_motif" = "yes"
348 <  then
349 <    AC_DEFINE(HAVE_MOTIF)
350 <    MOTIF_LIB="$acx_cv_motif_library"
351 <    $2
352 <    dnl **** Check whether Motif is actually Lesstif
353 <    ICE_CHECK_LESSTIF
354 <    dnl **** Check whether _XmVersionString[] can be referred to
355 <    ACX_CHECK_XMVERSIONSTRING
356 <  else
357 <    MOTIF_LIB=
358 <    $3
359 <  fi
360 <  
361 <  ACX_RESTORE_STATE
362 < ])dnl
363 <
364 <
365 < dnl ICE_CHECK_LESSTIF
366 < dnl -----------------
367 < dnl
368 < dnl Define `HAVE_LESSTIF' if the Motif library is actually a LessTif library
369 < dnl
370 < AC_DEFUN(ICE_CHECK_LESSTIF,
462 > AC_DEFUN(ACX_PROG_REALLY_GXX,
463   [
464 < AC_MSG_CHECKING(whether the Motif library is actually a LessTif library)
465 < AC_CACHE_VAL(ice_cv_have_lesstif,
466 < AC_EGREP_CPP(yes,
467 < [#include <Xm/Xm.h>
468 < #ifdef LesstifVersion
469 < yes
464 > AC_REQUIRE([AC_PROG_CXX])
465 > AC_CACHE_CHECK(whether we are *really* using GNU c++, ac_cv_prog_really_gxx,
466 > [
467 > dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
468 > cat > conftest.cpp <<EOF
469 > #ifdef __GNUC__
470 >  #ifndef __INTEL_COMPILER
471 >     yes;
472 >  #endif
473   #endif
474 < ], ice_cv_have_lesstif=yes, ice_cv_have_lesstif=no))
475 < AC_MSG_RESULT($ice_cv_have_lesstif)
476 < if test "$ice_cv_have_lesstif" = yes; then
477 < AC_DEFINE(HAVE_LESSTIF)
474 > EOF
475 > if AC_TRY_COMMAND(${CXX-c++} -E conftest.cpp) | egrep yes >/dev/null 2>&1; then
476 >  ac_cv_prog_really_gxx=yes
477 > else
478 >  ac_cv_prog_really_gxx=no
479   fi
480 < ])dnl
480 > ])
481 > if test "$ac_cv_prog_really_gxx" = yes; then
482 >        :
483 >        $1
484 > else
485 >        :
486 >        $2
487 > fi
488 > ])
489  
490  
491 < dnl ACX_CHECK_XMVERSIONSTRING
388 < dnl --------------
389 < AC_DEFUN(ACX_CHECK_XMVERSIONSTRING,
491 > AC_DEFUN(ACX_PROG_CC_MAXOPT,
492   [
493 <  AC_CACHE_CHECK([whether _XmVersionString[] can be referred to],
494 <    acx_cv__xmversionstring,
393 <    AC_TRY_LINK([#include <stdio.h>],
394 <                [extern char _XmVersionString[[]]; printf("%s\n", _XmVersionString);],
395 <                [acx_cv__xmversionstring="yes"],
396 <                [acx_cv__xmversionstring="no"]
397 <    )
398 <  )
399 <  if test "$acx_cv__xmversionstring" = "yes"
400 <  then
401 <    AC_DEFINE(HAVE__XMVERSIONSTRING)
402 <    $1
403 <  else
404 <    :
405 <    $2
406 <  fi
407 < ])dnl
493 > AC_REQUIRE([AC_PROG_CC])
494 > AC_REQUIRE([AC_CANONICAL_HOST])
495  
496 + ACX_PROG_REALLY_GCC
497  
498 < dnl ACX_CHECK_T1LIB
499 < dnl --------------
500 < AC_DEFUN(ACX_CHECK_T1LIB,
501 < [
502 <  AC_CACHE_CHECK([for T1lib >= $1], acx_cv_t1lib,
415 <    ACX_SAVE_STATE
416 <    LIBS="-lt1 -lm $LIBS"
417 <    AC_TRY_RUN([
418 < #include <string.h>
419 < #include <t1lib.h>
420 <      int main(void) {
421 <        char *vlib;
422 <        vlib = T1_GetLibIdent();
423 <        if (strcmp(vlib, "[$1]") < 0) {
424 <          exit(1);
425 <        }
426 <        exit(0);
427 <      }
428 <      ],
498 > # Try to determine "good" native compiler flags if none specified on command
499 > # line
500 > if test "$ac_test_CFLAGS" != "set"; then
501 >  CFLAGS=""
502 >  case "${host_cpu}-${host_os}" in
503  
504 <      acx_cv_t1lib="yes",
505 <      acx_cv_t1lib="no",
506 <      acx_cv_t1lib="no"
507 <    )
508 <    ACX_RESTORE_STATE
509 <  )
436 <  if test "$acx_cv_t1lib" = "yes"
437 <  then
438 <    T1_LIB="-lt1"
439 <    $2
440 <  else
441 <    T1_LIB=
442 <    $3
443 <  fi
444 < ])dnl
504 >  *linux*) if test "$CC" = icc; then
505 >                    CFLAGS="-O"
506 >                fi;;
507 >  sparc-solaris2*) if test "$CC" = cc; then
508 >                    CFLAGS="-native -fast -xO5 -dalign"
509 >                 fi;;
510  
511 < dnl ACX_CHECK_ZLIB
512 < dnl --------------
513 < AC_DEFUN(ACX_CHECK_ZLIB,
514 < [
515 <  AC_ARG_WITH(zlib_library,
516 <  [  --with-zlib-library=OBJ      use OBJ as ZLIB library [-lz]],
517 <  zlib_library="$withval")
518 <  if test "x$zlib_library" = "x"
519 <  then
520 <    zlib_library=-lz
511 >  alpha*-osf*)  if test "$CC" = cc; then
512 >                    CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host -arch host -std1"
513 >                fi;;
514 >
515 >  hppa*-hpux*)  if test "$CC" = cc; then
516 >                    CFLAGS="-Ae +O3 +Oall"
517 >                fi;;
518 >
519 >   rs6000*-aix*)  if test "$CC" = cc -o "$CC" = xlc; then
520 >                    CFLAGS="-O3 -qtune=auto -qansialias -w"
521 >                fi;;
522 >   powerpc*-aix*)
523 >        if test "$CC" = cc -o "$CC" = xlc; then
524 >                CFLAGS="-O3 -qtune=auto -qansialias -w"
525 >                echo "*******************************************************"
526 >                echo "*  You have AIX on an unknown powerpc system.  It is  *"
527 >                echo "*  recommended that you use                           *"
528 >                echo "*                                                     *"
529 >                echo "*    CFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w  *"
530 >                echo "*                                 ^^^                 *"
531 >                echo "*  where xxx is 601, 603, 604, or whatever kind of    *"
532 >                echo "*  PowerPC CPU you have.   For more info, man cc.     *"
533 >                echo "*******************************************************"
534 >        fi;;
535 >   *darwin*)
536 >        if test "$CC" = xlc -o "$CC" = cc; then
537 >                CFLAGS="-qthreaded -O5 -qtune=auto -qarch=auto -qunroll=auto -qaltivec"
538 >        fi;;
539 >  esac
540 >
541 >  # use default flags for gcc on all systems
542 >  if test $ac_cv_prog_really_gcc = yes; then
543 >     CFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
544    fi
545  
546 <  AC_CACHE_CHECK([for zlib >= $1], acx_cv_zlib,
547 <    AC_CACHE_VAL(acx_cv_zlib_library, acx_cv_zlib_library=$zlib_library)
548 <    ACX_SAVE_STATE
549 <    LIBS="$acx_cv_zlib_library $LIBS"
550 <    AC_TRY_RUN([
551 < #include <string.h>
464 < #include <zlib.h>
465 <      int main(void) {
466 <        char *vlib, *vinc;
467 <        vlib = zlibVersion();
468 <        vinc = ZLIB_VERSION;
469 <        if (strcmp(vinc, "[$1]") < 0) {
470 <          exit(1);
471 <        }
472 <        if (strcmp(vinc, vlib) != 0) {
473 <          exit(2);
474 <        }
475 <        exit(0);
476 <      }
477 <      ],
478 <
479 <      acx_cv_zlib="yes",
480 <      acx_cv_zlib="no",
481 <      acx_cv_zlib="no"
482 <    )
483 <    ACX_RESTORE_STATE
484 <  )
485 <  if test "$acx_cv_zlib" = "yes"
486 <  then
487 <    Z_LIB="$acx_cv_zlib_library"
488 <    $2
489 <  else
490 <    Z_LIB=
491 <    $3
546 >  # test for gcc-specific flags:
547 >  if test $ac_cv_prog_really_gcc = yes; then
548 >    # -malign-double for x86 systems
549 >    ACX_CHECK_CC_FLAGS(-malign-double,align_double, CFLAGS="$CFLAGS -malign-double")
550 >    # -fstrict-aliasing for gcc-2.95+
551 >    ACX_CHECK_CC_FLAGS(-fstrict-aliasing,fstrict_aliasing, CFLAGS="$CFLAGS -fstrict-aliasing")
552    fi
493 ])dnl
553  
554 < dnl ACX_CHECK_JPEG
555 < dnl --------------
556 < AC_DEFUN(ACX_CHECK_JPEG,
557 < [
558 <  AC_ARG_WITH(jpeg_library,
559 <  [  --with-jpeg-library=OBJ      use OBJ as JPEG library [-ljpeg]],
560 <  jpeg_library="$withval")
561 <  if test "x$jpeg_library" = "x"
562 <  then
563 <    jpeg_library=-ljpeg
554 >  CPU_FLAGS=""
555 >  if test $ac_cv_prog_really_gcc = yes; then
556 >          dnl try to guess correct CPU flags, at least for linux
557 >          case "${host_cpu}" in
558 >          i586*)  ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium,
559 >                        [CPU_FLAGS=-mcpu=pentium],
560 >                        [ACX_CHECK_CC_FLAGS(-mpentium,pentium,
561 >                                [CPU_FLAGS=-mpentium])])
562 >                  ;;
563 >          i686*)  ACX_CHECK_CC_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro,
564 >                        [CPU_FLAGS=-mcpu=pentiumpro],
565 >                        [ACX_CHECK_CC_FLAGS(-mpentiumpro,pentiumpro,
566 >                                [CPU_FLAGS=-mpentiumpro])])
567 >                  ;;
568 >          powerpc*)
569 >                cputype=`(grep cpu /proc/cpuinfo | head -1 | cut -d: -f2 | sed 's/ //g') 2> /dev/null`
570 >                is60x=`echo $cputype | egrep "^60[0-9]e?$"`
571 >                if test -n "$is60x"; then
572 >                        ACX_CHECK_CC_FLAGS(-mcpu=$cputype,m_cpu_60x,
573 >                                CPU_FLAGS=-mcpu=$cputype)
574 >                elif test "$cputype" = 750; then
575 >                        ACX_PROG_GCC_VERSION(2,95,
576 >                                ACX_CHECK_CC_FLAGS(-mcpu=750,m_cpu_750,
577 >                                        CPU_FLAGS=-mcpu=750))
578 >                fi
579 >                if test -z "$CPU_FLAGS"; then
580 >                        ACX_CHECK_CC_FLAGS(-mcpu=powerpc,m_cpu_powerpc,
581 >                                CPU_FLAGS=-mcpu=powerpc)
582 >                fi
583 >                if test -z "$CPU_FLAGS"; then
584 >                        ACX_CHECK_CC_FLAGS(-mpowerpc,m_powerpc,
585 >                                CPU_FLAGS=-mpowerpc)
586 >                fi
587 >          esac
588    fi
506  
507  AC_CACHE_CHECK([for IJG JPEG software >= $1], acx_cv_jpeg,
508    AC_CACHE_VAL(acx_cv_jpeg_library, acx_cv_jpeg_library=$jpeg_library)
509    ACX_SAVE_STATE
510    LIBS="$acx_cv_jpeg_library $LIBS"
511    AC_TRY_RUN([
512 #include <stdio.h>
513 #include <jpeglib.h>
514      int main(void) {
515        int vinc;
516        struct jpeg_compress_struct cinfo;
517        jpeg_create_compress(&cinfo);
518        vinc = JPEG_LIB_VERSION;
519        if (vinc < [$1]) {
520          exit(1);
521        }
522        exit(0);
523      }
524      ],
589  
590 <      acx_cv_jpeg="yes",
591 <      acx_cv_jpeg="no",
528 <      acx_cv_jpeg="no"
529 <    )
530 <    ACX_RESTORE_STATE
531 <  )
532 <  if test "$acx_cv_jpeg" = "yes"
533 <  then
534 <    JPEG_LIB=$acx_cv_jpeg_library
535 <    $2
536 <  else
537 <    JPEG_LIB=
538 <    $3
590 >  if test -n "$CPU_FLAGS"; then
591 >        CFLAGS="$CFLAGS $CPU_FLAGS"
592    fi
540 ])dnl
593  
594 < dnl ACX_CHECK_PNG
595 < dnl --------------
596 < AC_DEFUN(ACX_CHECK_PNG,
597 < [
598 <  AC_ARG_WITH(png_library,
599 <  [  --with-png-library=OBJ       use OBJ as PNG library [-lpng]],
600 <  png_library="$withval")
601 <  if test "x$png_library" = "x"
602 <  then
551 <    png_library=-lpng
594 >  if test -z "$CFLAGS"; then
595 >        echo ""
596 >        echo "********************************************************"
597 >        echo "* WARNING: Don't know the best CFLAGS for this system  *"
598 >        echo "* Use  make CFLAGS=..., or edit the top level Makefile *"
599 >        echo "* (otherwise, a default of CFLAGS=-O3 will be used)    *"
600 >        echo "********************************************************"
601 >        echo ""
602 >        CFLAGS="-O3"
603    fi
604  
605 <  AC_CACHE_CHECK([for libpng >= $1], acx_cv_png,
606 <    AC_CACHE_VAL(acx_cv_png_library, acx_cv_png_library=$png_library)
607 <    ACX_SAVE_STATE
608 <    LIBS="$acx_cv_png_library $Z_LIB $LIBS"
609 <    AC_TRY_RUN([
610 < #include <string.h>
611 < #include <png.h>
612 <      int main(void) {
613 <        char *vlib, *vinc;
614 <        vlib = png_libpng_ver;
564 <        vinc = PNG_LIBPNG_VER_STRING;
565 <        if (strcmp(vinc, "[$1]") < 0) {
566 <          exit(1);
567 <        }
568 <        if (strcmp(vinc, vlib) != 0) {
569 <          exit(2);
570 <        }
571 <        exit(0);
572 <      }
573 <      ],
605 >  ACX_CHECK_CC_FLAGS(${CFLAGS}, guessed_cflags, , [
606 >        echo ""
607 >        echo "********************************************************"
608 >        echo "* WARNING: The guessed CFLAGS don't seem to work with  *"
609 >        echo "* your compiler.                                       *"
610 >        echo "* Use  make CFLAGS=..., or edit the top level Makefile *"
611 >        echo "********************************************************"
612 >        echo ""
613 >        CFLAGS=""
614 >  ])
615  
616 <      acx_cv_png="yes",
617 <      acx_cv_png="no",
577 <      acx_cv_png="no"
578 <    )
579 <    ACX_RESTORE_STATE
580 <  )
581 <  if test "$acx_cv_png" = "yes"
582 <  then
583 <    PNG_LIB="$acx_cv_png_library"
584 <    $2
585 <  else
586 <    PNG_LIB=
587 <    $3
588 <  fi
589 < ])dnl
616 > fi
617 > ])
618  
619 < dnl ACX_CHECK_TIFF
592 < dnl --------------
593 < AC_DEFUN(ACX_CHECK_TIFF,
619 > AC_DEFUN(ACX_PROG_CXX_MAXOPT,
620   [
621 <  AC_ARG_WITH(tiff_library,
622 <  [  --with-tiff-library=OBJ      use OBJ as TIFF library [-ltiff]],
597 <  tiff_library="$withval")
598 <  if test "x$tiff_library" = "x"
599 <  then
600 <    tiff_library=-ltiff
601 <  fi
621 > AC_REQUIRE([AC_PROG_CXX])
622 > AC_REQUIRE([AC_CANONICAL_HOST])
623  
624 <  AC_CACHE_CHECK([for libtiff >= $1], acx_cv_tiff,
604 <    AC_CACHE_VAL(acx_cv_tiff_library, acx_cv_tiff_library=$tiff_library)
605 <    ACX_SAVE_STATE
606 <    LIBS="$acx_cv_tiff_library $JPEG_LIB $Z_LIB -lm $LIBS"
607 <    AC_TRY_RUN([
608 < #include <tiffio.h>
609 <      int main(void) {
610 <        int vinc;
611 <        (void) TIFFGetVersion();
612 <        vinc = TIFFLIB_VERSION;
613 <        if (vinc < [$1]) {
614 <          exit(1);
615 <        }
616 <        exit(0);
617 <      }
618 <      ],
624 > ACX_PROG_REALLY_GXX
625  
626 <      acx_cv_tiff="yes",
627 <      acx_cv_tiff="no",
628 <      acx_cv_tiff="no"
629 <    )
630 <    ACX_RESTORE_STATE
631 <  )
632 <  if test "$acx_cv_tiff" = "yes"
633 <  then
634 <    TIFF_LIB="$acx_cv_tiff_library"
635 <    $2
636 <  else
637 <    TIFF_LIB=
638 <    $3
626 > # Try to determine "good" native compiler flags if none specified on command
627 > # line
628 > if test "$ac_test_CXXFLAGS" != "set"; then
629 >  CXXFLAGS=""
630 >  case "${host_cpu}-${host_os}" in
631 >
632 >  *linux*) if test "$CXX" = icc -o "$CXX" = icpc; then
633 >                    CXXFLAGS="-O"
634 >                fi;;
635 >  sparc-solaris2*) if test "$CXX" = CC; then
636 >                    CXXFLAGS="-native -fast -xO5 -dalign"
637 >                 fi;;
638 >   rs6000*-aix*)  if test "$CXX" = xlC; then
639 >                    CXXFLAGS="-O3 -qarch=pwrx -qtune=pwrx -qansialias -w"
640 >                fi;;
641 >   powerpc*-aix*)
642 >        if test "$CXX" = xlC; then
643 >                CXXFLAGS="-O3 -qarch=ppc -qansialias -w"
644 >                echo "*******************************************************"
645 >                echo "*  You have AIX on an unknown powerpc system.  It is  *"
646 >                echo "*  recommended that you use                           *"
647 >                echo "*                                                     *"
648 >                echo "*  CXXFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w  *"
649 >                echo "*                                 ^^^                 *"
650 >                echo "*  where xxx is 601, 603, 604, or whatever kind of    *"
651 >                echo "*  PowerPC CPU you have.   For more info, man cc.     *"
652 >                echo "*******************************************************"
653 >        fi;;
654 >   *darwin*)
655 >        if test "$CXX" = xlc++; then
656 >                CXXFLAGS="-qthreaded -O5 -qtune=auto -qarch=auto -qunroll=auto -qaltivec"
657 >        fi;;
658 >  esac
659 >
660 >  # use default flags for gcc on all systems
661 >  if test $ac_cv_prog_really_gxx = yes; then
662 >     CXXFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
663    fi
634 ])dnl
664  
665 < dnl ACX_CHECK_PDFLIB
666 < dnl --------------
667 < AC_DEFUN(ACX_CHECK_PDFLIB,
668 < [
669 <  AC_ARG_WITH(pdf_library,
670 <  [  --with-pdf-library=OBJ       use OBJ as PDFlib library [-lpdf]],
642 <  pdf_library="$withval")
643 <  if test "x$pdf_library" = "x"
644 <  then
645 <    pdf_library=-lpdf
665 >  # test for gcc-specific flags:
666 >  if test $ac_cv_prog_really_gxx = yes; then
667 >    # -malign-double for x86 systems
668 >    ACX_CHECK_CXX_FLAGS(-malign-double,align_double, CXXFLAGS="$CXXFLAGS -malign-double")
669 >    # -fstrict-aliasing for gcc-2.95+
670 >    ACX_CHECK_CXX_FLAGS(-fstrict-aliasing,fstrict_aliasing, CXXFLAGS="$CXXFLAGS -fstrict-aliasing")
671    fi
672  
673 <  AC_CACHE_CHECK([for PDFlib >= $1], acx_cv_pdflib,
674 <    AC_CACHE_VAL(acx_cv_pdf_library, acx_cv_pdf_library=$pdf_library)
675 <    ACX_SAVE_STATE
676 <    LIBS="$acx_cv_pdf_library $TIFF_LIB $JPEG_LIB $PNG_LIB $Z_LIB $LIBS"
677 <    AC_TRY_RUN([
678 < #include <pdflib.h>
679 <      int main(void) {
680 <        char *vinc;
681 <        int vlibn, vincn;
682 <        vlibn = 100*PDF_get_majorversion() + PDF_get_minorversion();
683 <        vincn = 100*PDFLIB_MAJORVERSION + PDFLIB_MINORVERSION;
684 <        vinc = PDFLIB_VERSIONSTRING;
685 <        if (strcmp(vinc, "[$1]") < 0) {
686 <          exit(1);
687 <        }
688 <        if (vincn != vlibn) {
689 <          exit(2);
690 <        }
691 <        exit(0);
692 <      }
693 <      ],
694 <
695 <      acx_cv_pdflib="yes",
696 <      acx_cv_pdflib="no",
697 <      acx_cv_pdflib="no"
698 <    )
699 <    ACX_RESTORE_STATE
700 <  )
701 <  if test "$acx_cv_pdflib" = "yes"
702 <  then
703 <    PDF_LIB="$acx_cv_pdf_library"
704 <    $2
705 <  else
706 <    PDF_LIB=
682 <    $3
673 >  CPU_FLAGS=""
674 >  if test $ac_cv_prog_really_gxx = yes; then
675 >          dnl try to guess correct CPU flags, at least for linux
676 >          case "${host_cpu}" in
677 >          i586*)  ACX_CHECK_CXX_FLAGS(-mcpu=pentium,cpu_pentium,
678 >                        [CPU_FLAGS=-mcpu=pentium],
679 >                        [ACX_CHECK_CXX_FLAGS(-mpentium,pentium,
680 >                                [CPU_FLAGS=-mpentium])])
681 >                  ;;
682 >          i686*)  ACX_CHECK_CXX_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro,
683 >                        [CPU_FLAGS=-mcpu=pentiumpro],
684 >                        [ACX_CHECK_CXX_FLAGS(-mpentiumpro,pentiumpro,
685 >                                [CPU_FLAGS=-mpentiumpro])])
686 >                  ;;
687 >          powerpc*)
688 >                cputype=`(grep cpu /proc/cpuinfo | head -1 | cut -d: -f2 | sed 's/ //g') 2> /dev/null`
689 >                is60x=`echo $cputype | egrep "^60[0-9]e?$"`
690 >                if test -n "$is60x"; then
691 >                        ACX_CHECK_CXX_FLAGS(-mcpu=$cputype,m_cpu_60x,
692 >                                CPU_FLAGS=-mcpu=$cputype)
693 >                elif test "$cputype" = 750; then
694 >                        ACX_PROG_GXX_VERSION(2,95,
695 >                                ACX_CHECK_CXX_FLAGS(-mcpu=750,m_cpu_750,
696 >                                        CPU_FLAGS=-mcpu=750))
697 >                fi
698 >                if test -z "$CPU_FLAGS"; then
699 >                        ACX_CHECK_CXX_FLAGS(-mcpu=powerpc,m_cpu_powerpc,
700 >                                CPU_FLAGS=-mcpu=powerpc)
701 >                fi
702 >                if test -z "$CPU_FLAGS"; then
703 >                        ACX_CHECK_CXX_FLAGS(-mpowerpc,m_powerpc,
704 >                                CPU_FLAGS=-mpowerpc)
705 >                fi
706 >          esac
707    fi
684 ])dnl
708  
709 < dnl ACX_CHECK_NETCDF
710 < dnl --------------
688 < AC_DEFUN(ACX_CHECK_NETCDF,
689 < [
690 <  AC_ARG_WITH(netcdf_libraries,
691 <  [  --with-netcdf-libraries=OBJ  use OBJ as netCDF libraries [-lnetcdf]],
692 <  netcdf_libraries="$withval")
693 <  if test "x$netcdf_libraries" = "x"
694 <  then
695 <    netcdf_libraries=-lnetcdf
709 >  if test -n "$CPU_FLAGS"; then
710 >        CXXFLAGS="$CXXFLAGS $CPU_FLAGS"
711    fi
712  
713 <  AC_CACHE_CHECK([for netCDF API version >= $1], acx_cv_netcdf,
714 <    AC_CACHE_VAL(acx_cv_netcdf_libraries, acx_cv_netcdf_libraries=$netcdf_libraries)
715 <    ACX_SAVE_STATE
716 <    LIBS="$acx_cv_netcdf_libraries $LIBS"
713 >  if test -z "$CXXFLAGS"; then
714 >        echo ""
715 >        echo "**********************************************************"
716 >        echo "* WARNING: Don't know the best CXXFLAGS for this system  *"
717 >        echo "* Use  make CXXFLAGS=..., or edit the top level Makefile *"
718 >        echo "* (otherwise, a default of CXXFLAGS=-O3 will be used)    *"
719 >        echo "**********************************************************"
720 >        echo ""
721 >        CXXFLAGS="-O3"
722 >  fi
723  
724 +  ACX_CHECK_CXX_FLAGS(${CXXFLAGS}, guessed_cxxflags, , [
725 +        echo ""
726 +        echo "**********************************************************"
727 +        echo "* WARNING: The guessed CXXFLAGS don't seem to work with  *"
728 +        echo "* your compiler.                                         *"
729 +        echo "* Use  make CXXFLAGS=..., or edit the top level Makefile *"
730 +        echo "**********************************************************"
731 +        echo ""
732 +        CXXFLAGS=""
733 +  ])
734  
735 <    AC_TRY_RUN([
736 < #include <stdio.h>
706 < #include <netcdf.h>
707 <      int main(void) {
708 <        char *vlib;
709 <        vlib = nc_inq_libvers();
710 <        if (strcmp(vlib, "[$1]") < 0) {
711 <          exit(1);
712 <        }
713 <        exit(0);
714 <      }
715 <      ],
735 > fi
736 > ])
737  
738 <      acx_cv_netcdf="yes",
739 <      acx_cv_netcdf="no",
740 <      acx_cv_netcdf="no"
741 <    )
742 <    ACX_RESTORE_STATE
743 <  )
744 <  if test "$acx_cv_netcdf" = "yes"
745 <  then
746 <    NETCDF_LIBS="$acx_cv_netcdf_libraries"
747 <    $2
748 <  else
749 <    NETCDF_LIBS=
750 <    $3
738 > AC_DEFUN(ACX_PROG_F90_MAXOPT,
739 > [
740 > AC_REQUIRE([AC_PROG_F90])
741 > AC_REQUIRE([AC_CANONICAL_HOST])
742 >
743 > # Try to determine "good" native compiler flags if none specified on command
744 > # line
745 >
746 > if test x"$F90FLAGS" = x ; then
747 >  F90FLAGS=""
748 >  case "${host_cpu}-${host_os}" in
749 >
750 >  *linux*) if test "$F90" = ifc -o "$F90" = ifort; then
751 >                    F90FLAGS="-O"
752 >                fi;;
753 >   rs6000*-aix*)  if test "$F90" = xlf90 -o "$F90" = f90; then
754 >                    F90FLAGS="-O3 -qarch=pwrx -qtune=pwrx -qansialias -w"
755 >                fi;;
756 >   powerpc*-aix*)
757 >        if test "$F90" = f90 -o "$F90" = xlf90; then
758 >                F90FLAGS="-O3 -qarch=ppc -qansialias -w"
759 >                echo "*******************************************************"
760 >                echo "*  You have AIX on an unknown powerpc system.  It is  *"
761 >                echo "*  recommended that you use                           *"
762 >                echo "*                                                     *"
763 >                echo "*  F90FLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w  *"
764 >                echo "*                                 ^^^                 *"
765 >                echo "*  where xxx is 601, 603, 604, or whatever kind of    *"
766 >                echo "*  PowerPC CPU you have.   For more info, man xlf.    *"
767 >                echo "*******************************************************"
768 >        fi;;
769 >   *darwin*)
770 >        if test "$F90" = f90 -o "$F90" = xlf90 -o "$F90" = xlf95; then
771 >                F90FLAGS="-qthreaded -O5 -qtune=auto -qarch=auto -qunroll=auto"
772 >        fi;;
773 >  esac
774 >
775 >  if test -n "$CPU_FLAGS"; then
776 >        F90FLAGS="$F90FLAGS $CPU_FLAGS"
777    fi
731 ])dnl
778  
779 < dnl ACX_CHECK_FFTW
780 < dnl --------------
781 < AC_DEFUN(ACX_CHECK_FFTW,
779 >  if test -z "$F90FLAGS"; then
780 >        echo ""
781 >        echo "**********************************************************"
782 >        echo "* WARNING: Don't know the best F90FLAGS for this system  *"
783 >        echo "* Use  make F90FLAGS=..., or edit the top level Makefile *"
784 >        echo "* (otherwise, a default of F90FLAGS=-O3 will be used)    *"
785 >        echo "**********************************************************"
786 >        echo ""
787 >        F90FLAGS="-O3"
788 >  fi
789 >
790 >  ACX_CHECK_F90_FLAGS(${F90FLAGS}, guessed_f90flags, , [
791 >        echo ""
792 >        echo "**********************************************************"
793 >        echo "* WARNING: The guessed F90FLAGS don't seem to work with  *"
794 >        echo "* your compiler.                                         *"
795 >        echo "* Use  make F90FLAGS=..., or edit the top level Makefile *"
796 >        echo "**********************************************************"
797 >        echo ""
798 >        F90FLAGS=""
799 >  ])
800 >
801 > fi
802 > ])
803 >
804 > AC_DEFUN(ACX_PROG_F90_PREPFLAG,
805   [
806 <  AC_ARG_WITH(fftw_library,
807 <  [  --with-fftw-library=OBJ      use OBJ as FFTW library [-lfftw]],
808 <  fftw_library="$withval")
809 <  if test "x$fftw_library" = "x"
810 <  then
811 <    fftw_library=-lfftw
806 > AC_REQUIRE([AC_PROG_F90])
807 > AC_REQUIRE([AC_CANONICAL_HOST])
808 >
809 > # Try to determine native compiler flags that allow us to use F90 suffix
810 > # for preprocessed f90 source.
811 >
812 > if test "$ac_test_PREPFLAG" != "set"; then
813 >  PREPFLAG=""
814 >  case "${host_cpu}-${host_os}" in
815 >
816 >  *linux*) if test "$F90" = ifc -o "$F90" = ifort; then
817 >                    PREPFLAG="-fpp1 "
818 >                fi;;
819 >  *aix*)  if test "$F90" = xlf90 -o "$F90" = f90; then
820 >                    PREPFLAG="-qsuffix=cpp=F90 "
821 >                fi;;
822 >  *darwin*)
823 >        if test "$F90" = f90 -o "$F90" = xlf90; then
824 >                PREPFLAG="-qsuffix=cpp=F90 "
825 >        fi;;
826 >  esac
827 >
828 >  if test -z "$PREPFLAG"; then
829 >        AC_MSG_WARN("Using empty PREPFLAG")
830 >        PREPFLAG=""
831    fi
832  
833 <  AC_CACHE_CHECK([for FFTW library >= $1], acx_cv_fftw,
834 <    AC_CACHE_VAL(acx_cv_fftw_library, acx_cv_fftw_library=$fftw_library)
835 <    ACX_SAVE_STATE
836 <    LIBS="$acx_cv_fftw_library $LIBS"
837 <    AC_TRY_RUN([
838 < #include <fftw.h>
751 < #include <string.h>
752 <      int main(void) {
753 <        char *vlib = (char *) fftw_version;
754 <        if (strcmp(vlib, "[$1]") < 0) {
755 <          exit(1);
756 <        }
757 <        exit(0);
758 <      }
759 <      ],
833 >  AC_MSG_CHECKING(to make sure F90 preprocessor flag works)
834 >  AC_LANG_SAVE()
835 >  AC_LANG([Fortran 90])
836 >  ac_save_ext=$ac_ext
837 >  ac_ext=F90
838 >  ac_save_F90FLAGS=$F90FLAGS
839  
840 <      acx_cv_fftw="yes",
841 <      acx_cv_fftw="no",
842 <      acx_cv_fftw="no"
843 <    )
840 >  AS_IF([test "$PREPFLAG"], [F90FLAGS="${F90FLAGS} ${PREPFLAG}-DTEST"])
841 >    _AC_COMPILE_IFELSE([
842 >      AC_LANG_PROGRAM([
843 >  integer :: i
844 >  i = 1
845 > ])], [prepflagworks=1], [prepflagworks=0])
846  
847 <    ACX_RESTORE_STATE
848 <  )
849 <  if test "$acx_cv_fftw" = "yes"
850 <  then
851 <    FFTW_LIB="$acx_cv_fftw_library"
852 <    $2
847 >  F90FLAGS=$ac_save_F90FLAGS
848 >  ac_ext=$ac_save_ext
849 >  AC_LANG_RESTORE()
850 >
851 >  if test "$prepflagworks" = 1; then
852 >    AC_MSG_RESULT(yes)
853 >    AC_SUBST(PREPFLAG)
854    else
855 <    FFTW_LIB=
856 <    $3
855 >    AC_MSG_RESULT(no)
856 >    AC_MSG_ERROR([Can't figure out working Fortran90 preprocessor flag])
857    fi
858 < ])dnl
858 > fi
859 > ])
860  
861  
862 < dnl ACX_CHECK_XMHTML
780 < dnl --------------
781 < AC_DEFUN(ACX_CHECK_XMHTML,
862 > AC_DEFUN(ACX_PROG_F90_PREPDEFFLAG,
863   [
864 <  AC_ARG_WITH(xmhtml_library,
865 <  [  --with-xmhtml-library=OBJ    use OBJ as XmHTML library [-lXmHTML]],
866 <  xmhtml_library="$withval")
867 <  if test "x$xmhtml_library" = "x"
868 <  then
869 <    xmhtml_library=-lXmHTML
864 > AC_REQUIRE([AC_PROG_F90])
865 > AC_REQUIRE([AC_CANONICAL_HOST])
866 >
867 > # Try to determine native compiler flags that allow us to use F90 suffix
868 > # for preprocessed f90 source with -D type defines
869 >
870 > if test "$ac_test_PREPDEFFLAG" != "set"; then
871 >  PREPDEFFLAG=""
872 >  case "${host_cpu}-${host_os}" in
873 >
874 >  *linux*) if test "$F90" = ifc -o "$F90" = ifort; then
875 >                    PREPDEFFLAG=" "
876 >                fi;;
877 >  *aix*)  if test "$F90" = xlf90 -o "$F90" = f90; then
878 >                    PREPDEFFLAG="-WF,"
879 >                fi;;
880 >  *darwin*)
881 >        if test "$F90" = f90 -o "$F90" = xlf90; then
882 >                PREPDEFFLAG="-WF,"
883 >        fi;;
884 >  esac
885 >
886 >  if test -z "$PREPDEFFLAG"; then
887 >        AC_MSG_WARN("Using empty PREPDEFFLAG")
888 >        PREPDEFFLAG=" "
889    fi
890  
891 <  AC_CACHE_CHECK([for XmHTML widget >= $1], acx_cv_xmhtml,
892 <    AC_CACHE_VAL(acx_cv_xmhtml_library, acx_cv_xmhtml_library=$xmhtml_library)
893 <    ACX_SAVE_STATE
894 <    LIBS="$acx_cv_xmhtml_library $JPEG_LIB $PNG_LIB $Z_LIB $LIBS"
895 <    AC_TRY_RUN([
896 < #include <XmHTML/XmHTML.h>
797 <      int main(void) {
798 <        int vlib, vinc;
799 <        vlib = XmHTMLGetVersion();
800 <        vinc = XmHTMLVersion;
801 <        if (vinc < [$1]) {
802 <          exit(1);
803 <        }
804 <        if (vinc != vlib) {
805 <          exit(2);
806 <        }
807 <        exit(0);
808 <      }
809 <      ],
891 >  AC_MSG_CHECKING(to make sure F90 preprocessor define flag works)
892 >  AC_LANG_SAVE()
893 >  AC_LANG([Fortran 90])
894 >  ac_save_ext=$ac_ext
895 >  ac_ext=F90
896 >  ac_save_F90FLAGS=$F90FLAGS
897  
898 <      acx_cv_xmhtml="yes",
899 <      acx_cv_xmhtml="no",
900 <      acx_cv_xmhtml="no"
901 <    )
902 <    ACX_RESTORE_STATE
903 <  )
904 <  if test "$acx_cv_xmhtml" = "yes"
905 <  then
906 <    XMHTML_LIB="$acx_cv_xmhtml_library"
907 <    $2
898 >  AS_IF([test "$PREPDEFFLAG"], [F90FLAGS="${F90FLAGS} ${PREPFLAG} ${PREPDEFFLAG}-DTEST"])
899 >    _AC_COMPILE_IFELSE([
900 >      AC_LANG_PROGRAM([
901 >  integer :: i
902 > #ifdef TEST
903 >  i = 1
904 > #else
905 >  choke me
906 > #endif
907 > ])], [prepdefflagworks=1], [prepdefflagworks=0])
908 >
909 >  F90FLAGS=$ac_save_F90FLAGS
910 >  ac_ext=$ac_save_ext
911 >  AC_LANG_RESTORE()
912 >
913 >
914 >  if test "$prepdefflagworks" = 1; then
915 >    AC_MSG_RESULT(yes)
916 >    AC_SUBST(PREPDEFFLAG)
917    else
918 <    XMHTML_LIB=
919 <    $3
918 >    AC_MSG_RESULT(no)
919 >    AC_MSG_ERROR([Can't figure out working Fortran90 preprocessor define flag])
920    fi
921 < ])dnl
921 > fi
922 > ])
923  
924 + dnl check for the required MPI library
925 + AC_DEFUN([ACX_MPI], [
926 +
927 + # Set variables...
928 + MPI_LIB_DIR="$MPI/lib"
929 + MPI_INC_DIR="$MPI/include"
930 + AC_SUBST([MPI_LIB_DIR])
931 + AC_SUBST([MPI_INC_DIR])
932 +
933 + AC_MSG_CHECKING([for mpi.h])
934 + have_mpi_h=0
935 + echo '#include <mpi.h>' > conftest.cc
936 + if test -z "`${CXX} -I${MPI_INC_DIR} -c conftest.cc 2>&1`"; then
937 +        AC_MSG_RESULT(yes)
938 +        have_mpi_h=1
939 + else
940 +        AC_MSG_RESULT(no! Check MPI include paths)
941 +        USE_MPI="no"
942 + fi
943 + rm -f conftest*
944 + if test "$have_mpi_h" = 1; then
945 +    AC_DEFINE(HAVE_MPI_H, 1, [have mpi.h])
946 + fi
947 +
948 + AC_MSG_CHECKING([whether mpif.h is usable])
949 + have_mpif_h=0
950 + rm -f conftest*
951 + cat >conftest.f90 <<EOF
952 + program main
953 +   include 'mpif.h'
954 + end
955 + EOF
956 + if $F90 -I$MPI_INC_DIR -c conftest.f90 > conftest.out 2>&1 ; then
957 +        AC_MSG_RESULT(yes)
958 +        MPI_F90_INC="$MPI_INC"
959 +        have_mpif_h=1
960 + else
961 +        if test -s conftest.out ; then
962 +                cat conftest.out >> config.log
963 +        fi
964 +        AC_MSG_RESULT([no! Check MPI include paths])
965 +        USE_MPI="no"
966 + fi
967 + rm -f conftest*
968 + AC_SUBST(MPI_F90_INC)
969 + if test "$have_mpif_h" = 1; then
970 +    AC_DEFINE(HAVE_MPIF_H, 1, [have mpif.h])
971 + fi
972 +
973 + AC_LANG_PUSH(C)
974 + ac_save_LDFLAGS=$LDFLAGS
975 + LDFLAGS="${LDFLAGS} -L${MPI_LIB_DIR} "
976 +
977 + if test x = x"$MPI_LIB"; then
978 +        AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi"])
979 + fi
980 + if test x = x"$MPI_LIB"; then
981 +        AC_CHECK_LIB(mpich, MPI_Init, [MPI_LIB="-lmpich"])
982 + fi
983 + $as_unset ac_cv_lib_mpi_MPI_Init
984 + if test x = x"$MPI_LIB"; then
985 +        AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi -llam"], [],
986 +                     "-llam")
987 + fi
988 +
989 + $as_unset ac_cv_lib_mpi_MPI_Init
990 + if test x = x"$MPI_LIB"; then
991 + AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi -llam -lpthread"],[
992 +             AC_MSG_ERROR([Didn't find liblam, libmpi, or libmpich; check path for MPI package first...])
993 +             USE_MPI="no"
994 +             ],
995 +             [-llam -lpthread])
996 + fi
997 +
998 + AC_SUBST(MPI_LIB)
999 +
1000 + AC_MSG_CHECKING([for MPI Fortran library])
1001 + MPI_F90_LIB=""
1002 + if test -f "$MPI_LIB_DIR/libfmpich.a" ; then
1003 +        MPI_F90_LIB="-lfmpich"
1004 + elif test -f "$MPI_LIB_DIR/liblamf77mpi.a" ; then
1005 +        MPI_F90_LIB="-llamf77mpi"
1006 + else
1007 +        dnl nothing special found, we'll assume that the C
1008 +        dnl library is all we need
1009 +        MPI_F90_LIB="  "
1010 + fi
1011 + AC_MSG_RESULT([found $MPI_F90_LIB])
1012 + AC_SUBST(MPI_F90_LIB)
1013 + ])dnl ACX_MPI

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines