7d871d97fbd0692b8f0a976f366cc17b5fcd95b9
[alexxy/gromacs.git] / aclocal.m4
1 # aclocal.m4 generated automatically by aclocal 1.4f
2
3 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14  
15 # ACX_CHECK_FFTW()
16 # ----------------
17 # This macro checks for fftw header files and libraries,
18 # including the possible prefixing with s or d to determine precision.
19 # Arg 1 is the fftw header/library name to check for, without 
20 # prefix or anything else (e.g. rfftw_mpi for real MPI transforms)
21 # Arg 2 is the value of $enable_float, i.e. yes/no for precision=4/8.
22 AC_DEFUN(ACX_CHECK_FFTW,
23 [
24 if test -z "$ac_fftw_firstname"; then
25
26 if test "$2" = "no"; then
27   prec="double"
28   realsize=8
29   fftwcheckprefix=d
30 else
31   prec="single"
32   realsize=4
33   fftwcheckprefix=s
34 fi
35
36 usedprefix=""
37 ok="no"
38 # check header doesn't work, since we must use mpicc to get includes, not just /lib/cpp
39 AC_MSG_CHECKING([for $1.h])
40 AC_TRY_COMPILE([#include <$1.h>],,
41 [
42 fftwname=$1 
43 AC_MSG_RESULT(yes)
44 ],
45 AC_MSG_RESULT(no))
46
47
48 if test -n "$fftwname"; then
49 # we cannot run the code since an MPI program might not be allowed on a login node of a supercomputer
50 AC_TRY_COMPILE([#include <$fftwname.h>],
51 [int _array_ [1 - 2 * !((sizeof(fftw_real)) == $realsize)]; ],
52 ok="yes",ok="no")
53 fi
54
55 fftwname=$1
56
57 if test "$ok" != "yes"; then
58   xfftwname=${fftwcheckprefix}${fftwname}
59   AC_MSG_CHECKING([for $xfftwname.h])
60   AC_TRY_COMPILE([#include <$xfftwname.h>],,AC_MSG_RESULT(yes),
61 [
62 AC_MSG_RESULT(no)
63 AC_MSG_ERROR([Cannot find any $prec precision $fftwname.h or $xfftwname.h]
64 [Do you have $prec precision FFTW installed? If you are using packages,]
65 [note that you also need fftw-devel to compile GROMACS. You can find the ]
66 [software at www.fftw.org, and detailed instructions at www.gromacs.org.]
67 [If you compiled FFTW yourself:                                        ]
68 [Note that the default FFTW setup is double precision. Change the FFTW]
69 [configuration to single with --enable-float. If you want MPI support,]
70 [use --enable-mpi. It is a good idea to install both single & double.] 
71 [If your sysadm doesn't want to install it you can do it to a location]
72 [in your home directory and provide the correct paths in the CPPFLAGS]
73 [and LDFLAGS environment variables before running configure.]
74 [That is also necessary to do if your compiler doesn't search]
75 [/usr/local/include and /usr/local/lib by default.]
76 [You can find information at www.gromacs.org, or in the INSTALL file.])
77 ])
78 AC_TRY_COMPILE([#include <$xfftwname.h>],[int _array_ [1 - 2 * !((sizeof(fftw_real)) == $realsize)];],
79 [
80 fftwname=$xfftwname 
81 usedprefix=$fftwcheckprefix
82 ],
83 [
84 AC_MSG_ERROR([Cannot find any $prec precision $fftwname.h or $xfftwname.h]
85 [Do you have $prec precision FFTW installed? If you are using packages,]
86 [note that you also need fftw-devel to compile GROMACS. You can find the ]
87 [software at www.fftw.org, and detailed instructions at www.gromacs.org.]
88 [If you compiled FFTW yourself:                                       ]
89 [Note that the default FFTW setup is double precision. Change the FFTW]
90 [configuration to single with --enable-float. If you want MPI support,]
91 [use --enable-mpi. It is a good idea to install both single & double.] 
92 [If your sysadm doesn't want to install it you can do it to a location]
93 [in your home directory and provide the correct paths in the CPPFLAGS]
94 [and LDFLAGS environment variables before running configure.]
95 [That is also necessary to do if your compiler doesn't search]
96 [/usr/local/include and /usr/local/lib by default.]
97 [You can find information at www.gromacs.org, or in the INSTALL file.])])
98 fi
99
100 AC_CHECK_LIB($fftwname,main,,AC_MSG_ERROR([Can't find a library to match the $fftwname header]))
101 ac_fftw_savedprefix=$usedprefix
102 ac_fftw_firstname=$fftwname
103
104 else
105
106 fftwname=${ac_fftw_savedprefix}$1
107 AC_MSG_CHECKING([for $fftwname.h])
108 AC_TRY_COMPILE(
109 [#include <$fftwname.h>],,AC_MSG_RESULT(yes)
110 AC_CHECK_LIB($fftwname,main,,AC_MSG_ERROR([Can't find a library to match the $fftwname header])),
111 [
112 AC_MSG_RESULT(no)
113 AC_MSG_ERROR([Cant find $fftwname.h header. Make sure all your fftw prefixes match - we already use $ac_fftw_firstname.h])
114 ])
115
116 fi
117
118 ])
119
120
121
122 dnl macro from the fftw distribution (http://www.fftw.org)
123 dnl like AC_SUBST, but replace XXX_variable_XXX instead of @variable@
124 dnl This macro protects VARIABLE from being diverted twice
125 dnl if this macro is called twice for it.
126 dnl AC_SUBST(VARIABLE)
127 define(ACX_SUBST_XXX,
128 [ifdef([ACX_SUBST_XXX_$1], ,
129 [define([ACX_SUBST_XXX_$1], )dnl
130 AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl
131 s=XXX_$1_XXX=[$]$1=g
132 AC_DIVERT_POP()dnl
133 ])])
134
135
136 # ACX_F77_NAME_MANGLING
137 # ---------------------
138 # This is a macro adopted from the fftw distribution (http://www.fftw.org)
139 # to determine how we should call fortran functions from C.
140 AC_DEFUN(ACX_F77_NAME_MANGLING,
141 [
142 AC_REQUIRE([AC_PROG_CC])
143 AC_REQUIRE([AC_PROG_F77])
144 AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
145 AC_MSG_CHECKING(fortran name mangling)
146 cat > mangle-func.f <<EOF
147       subroutine foobar()
148       return
149       end
150       subroutine foo_bar()
151       return
152       end
153 EOF
154 ac_try='$F77 -c $FFLAGS mangle-func.f 1>&AC_FD_CC'
155 if AC_TRY_EVAL(ac_try); then
156   ac_try=""
157 else
158   echo "configure: failed program was:" >&AC_FD_CC
159   cat mangle-func.f >&AC_FD_CC
160   rm -f mangle-func*
161   AC_MSG_ERROR(failed to compile fortran test program)
162 fi
163
164 ac_f77_mangle_type=unknown
165 AC_LANG_SAVE
166 AC_LANG_C
167 ac_save_LIBS="$LIBS"
168 LIBS="mangle-func.o $FLIBS $LIBS"
169 AC_TRY_LINK(,foobar();,
170      ac_f77_mangle_type=lowercase,
171      AC_TRY_LINK(,foobar_();,
172           ac_f77_mangle_type=lowercase-underscore,
173           AC_TRY_LINK(,FOOBAR();,
174                ac_f77_mangle_type=uppercase,
175                AC_TRY_LINK(,FOOBAR_();,
176                     ac_f77_mangle_type=uppercase-underscore))))
177 LIBS="$ac_save_LIBS"
178 AC_LANG_RESTORE
179 AC_MSG_RESULT($ac_f77_mangle_type)
180
181 mangle_try=unknown
182 case $ac_f77_mangle_type in
183         lowercase)
184                 AC_DEFINE(F77_NAME_LOWERCASE,,[call f77 with lowercase, no underscore])
185                 mangle_try=foo_bar_
186                 ;;
187         lowercase-underscore)
188                 AC_DEFINE(F77_NAME_LOWERCASE_UNDERSCORE,,[call f77 with lowercase and underscore])
189                 mangle_try=foo_bar__
190                 ;;
191         uppercase)
192                 AC_DEFINE(F77_NAME_UPPERCASE,,[call f77 with uppercase, no underscore])
193                 mangle_try=FOO_BAR_
194                 ;;
195         uppercase-underscore)
196                 AC_DEFINE(F77_NAME_UPPERCASE_UNDERSCORE,,[call f77 with uppercase and underscore])
197                 mangle_try=FOO_BAR__
198                 ;;
199 esac
200
201 AC_MSG_CHECKING(whether f77 functions with underscore get an extra underscore)
202
203 AC_LANG_SAVE
204 AC_LANG_C
205 ac_save_LIBS="$LIBS"
206 LIBS="mangle-func.o $FLIBS $LIBS"
207 AC_TRY_LINK(,$mangle_try();,
208             [ac_f77_mangle_underscore=yes;
209              AC_DEFINE(F77_NAME_EXTRA_UNDERSCORE,,[Append extra underscore to already underscored names])],
210             [ac_f77_mangle_underscore=no])
211 LIBS="$ac_save_LIBS"
212 AC_LANG_RESTORE
213 rm -f mangle-func*
214 AC_MSG_RESULT($ac_f77_mangle_underscore)
215 ])
216
217
218
219
220
221 dnl
222 dnl
223 dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables
224 dnl     to easily use them in a Makefile.
225 dnl
226 dnl Adapted from a macro by Andreas Zeller.
227 dnl
228 dnl The variables provided are :
229 dnl     link_motif              (e.g. -L/usr/lesstif/lib -lXm -lXt)
230 dnl     include_motif           (e.g. -I/usr/lesstif/lib)
231 dnl     motif_libraries         (e.g. /usr/lesstif/lib)
232 dnl     motif_includes          (e.g. /usr/lesstif/include)
233 dnl
234 dnl The link_motif and include_motif variables should be fit to put on
235 dnl your application's link line in your Makefile.
236 dnl
237 AC_DEFUN(AC_FIND_MOTIF,
238 [
239 AC_REQUIRE([AC_PATH_XTRA])
240
241 motif_includes=
242 motif_libraries=
243
244 dnl AC_ARG_WITH(motif,
245 dnl [  --without-motif         do not use Motif widgets])
246 dnl Treat --without-motif like
247 dnl --without-motif-includes --without-motif-libraries.
248
249 if test "$no_x" = "yes"
250 then
251   motif_includes=none
252   motif_libraries=none
253 fi
254
255 AC_ARG_WITH(motif-includes,
256 [  --with-motif-includes=DIR     Motif include files are in DIR],
257 motif_includes="$withval")
258
259 AC_ARG_WITH(motif-libraries,
260 [  --with-motif-libraries=DIR    Motif libraries are in DIR],
261 motif_libraries="$withval")
262
263 AC_MSG_CHECKING(for Motif)
264
265
266 #
267 #
268 # Search the include files.
269 #
270 if test "$motif_includes" = ""; then
271 AC_CACHE_VAL(ac_cv_motif_includes,
272 [
273 ac_motif_save_LIBS="$LIBS"
274 ac_motif_save_INCLUDES="$INCLUDES"
275 ac_motif_save_CPPFLAGS="$CPPFLAGS"
276 ac_motif_save_LDFLAGS="$LDFLAGS"
277 #
278 LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
279 INCLUDES="$X_CFLAGS $INCLUDES"
280 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
281 LDFLAGS="$X_LIBS $LDFLAGS"
282 #
283 ac_cv_motif_includes="none"
284 AC_TRY_COMPILE([#include <Xm/Xm.h>],[int a;],
285 [
286 # Xm/Xm.h is in the standard search path.
287 ac_cv_motif_includes=
288 ],
289 [
290 # Xm/Xm.h is not in the standard search path.
291 # Locate it and put its directory in `motif_includes'
292 #
293 # /usr/include/Motif* are used on HP-UX (Motif).
294 # /usr/include/X11* are used on HP-UX (X and Athena).
295 # /usr/dt is used on Solaris (Motif).
296 # /usr/openwin is used on Solaris (X and Athena).
297 # Other directories are just guesses.
298 for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
299            /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \
300            /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \
301            /usr/dt/include /usr/openwin/include \
302            /usr/dt/*/include /opt/*/include /usr/include/Motif* \
303            "${prefix}"/*/include /usr/*/include /usr/local/*/include \
304            "${prefix}"/include/* /usr/include/* /usr/local/include/*; do
305 if test -f "$dir/Xm/Xm.h"; then
306 ac_cv_motif_includes="$dir"
307 break
308 fi
309 done
310 ])
311 #
312 LIBS="$ac_motif_save_LIBS"
313 INCLUDES="$ac_motif_save_INCLUDES"
314 CPPFLAGS="$ac_motif_save_CPPFLAGS"
315 LDFLAGS="$ac_motif_save_LDFLAGS"
316 ])
317 motif_includes="$ac_cv_motif_includes"
318 fi
319 #
320 #
321 # Now for the libraries.
322 #
323 if test "$motif_libraries" = ""; then
324 AC_CACHE_VAL(ac_cv_motif_libraries,
325 [
326 ac_motif_save_LIBS="$LIBS"
327 ac_motif_save_INCLUDES="$INCLUDES"
328 ac_motif_save_CPPFLAGS="$CPPFLAGS"
329 ac_motif_save_LDFLAGS="$LDFLAGS"
330 #
331 LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
332 INCLUDES="$X_CFLAGS $INCLUDES"
333 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
334 LDFLAGS="$X_LIBS $LDFLAGS"
335 #
336 ac_cv_motif_libraries="none"
337 AC_TRY_LINK([#include <Xm/Xm.h>],[XtToolkitInitialize();],
338 [
339 # libXm.a is in the standard search path.
340 ac_cv_motif_libraries=
341 ],
342 [
343 # libXm.a is not in the standard search path.
344 # Locate it and put its directory in `motif_libraries'
345 #
346 # /usr/lib/Motif* are used on HP-UX (Motif).
347 # /usr/lib/X11* are used on HP-UX (X and Athena).
348 # /usr/dt is used on Solaris (Motif).
349 # /usr/lesstif is used on Linux (Lesstif).
350 # /usr/openwin is used on Solaris (X and Athena).
351 # Other directories are just guesses.
352 for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
353            /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \
354            /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \
355            /usr/dt/lib /usr/openwin/lib \
356            /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \
357            /usr/lesstif*/lib /usr/lib/Lesstif* \
358            "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
359            "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
360 if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then
361 ac_cv_motif_libraries="$dir"
362 break
363 fi
364 done
365 ])
366 #
367 LIBS="$ac_motif_save_LIBS"
368 INCLUDES="$ac_motif_save_INCLUDES"
369 CPPFLAGS="$ac_motif_save_CPPFLAGS"
370 LDFLAGS="$ac_motif_save_LDFLAGS"
371 ])
372 #
373 motif_libraries="$ac_cv_motif_libraries"
374 fi
375 #
376 # Provide an easier way to link
377 #
378 if test "$motif_includes" = "none" -o "$motif_libraries" = "none"; then
379         with_motif="no"
380 else
381         with_motif="yes"
382 fi
383
384 if test "$with_motif" != "no"; then
385         if test "$motif_libraries" = ""; then
386                 link_motif="-lXm -lXt"
387                 MOTIF_LIBS="-lXm -lXt"
388         else
389                 link_motif="-L$motif_libraries -lXm -lXt"
390                 MOTIF_LIBS="-L$motif_libraries -lXm -lXt"
391         fi
392         if test "$motif_includes" != ""; then
393                 include_motif="-I$motif_includes"
394                 MOTIF_INCLUDES="-I$motif_includes"
395         fi
396         LIBS="$LIBS $MOTIF_LIBS"
397         INCLUDES="$INCLUDES $MOTIF_INCLUDES"
398         AC_DEFINE(HAVE_MOTIF,,[Use motif/lesstif libraries])
399 else
400         with_motif="no"
401 fi
402 #
403 #
404 #
405 #
406 motif_libraries_result="$motif_libraries"
407 motif_includes_result="$motif_includes"
408 test "$motif_libraries_result" = "" && motif_libraries_result="in default path"
409 test "$motif_includes_result" = "" && motif_includes_result="in default path"
410 test "$motif_libraries_result" = "none" && motif_libraries_result="(none)"
411 test "$motif_includes_result" = "none" && motif_includes_result="(none)"
412 AC_MSG_RESULT(
413   [libraries $motif_libraries_result, headers $motif_includes_result])
414 ])dnl
415
416
417 dnl macro modified from the fftw distribution (www.fftw.org)
418 AC_DEFUN(ACX_CHECK_CC_FLAGS,
419 [
420 AC_REQUIRE([AC_PROG_CC])
421 AC_CACHE_CHECK(whether $CC accepts $1, ac_$2,
422 [echo 'void f(){}' > conftest.c
423 if test -z "`$CC $1 -c conftest.c 2>&1`"; then
424         ac_$2=yes
425 else
426         ac_$2=no
427 fi
428 rm -f conftest*
429 ])
430 if test "$ac_$2" = yes; then
431         :
432         $3
433 else
434         :
435         $4
436 fi
437 ])
438
439 dnl macro modified from the fftw distribution (www.fftw.org)
440 AC_DEFUN(ACX_CHECK_F77_FLAGS,
441 [
442 AC_REQUIRE([AC_PROG_F77])
443 AC_CACHE_CHECK(whether $F77 accepts $1, ac_$2,
444 [cat > conftest.f << EOF
445       subroutine f
446       return 
447       end
448 EOF
449 if test -z "`$F77 $1 -c conftest.f `"; then
450         ac_$2=yes
451 else
452         ac_$2=no
453 fi
454 rm -f conftest*
455 ])
456 if test "$ac_$2" = yes; then
457         :
458         $3
459 else
460         :
461         $4
462 fi
463 ])
464
465
466 # ACX_DETECT_GMXCPU
467 # ---------------------------
468 # Macro to extend the exact CPU for some hosts
469 AC_DEFUN(ACX_DETECT_GMXCPU,
470 [
471 AC_REQUIRE([AC_CANONICAL_HOST])
472
473 #
474 # Determine the exact cpu type on some common systems where it is 
475 # not visible from the host triplet.
476 # (on e.g. intel and dec/tru64 the host type is enough)
477
478 case "${host_cpu}-${host_os}" in
479
480 rs6000*-aix*)
481   # we need to fool the combination of m4, sh and awk - thus the seemingly unnecessary n
482   IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ n=1; print $n }'`
483   if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER4 >/dev/null 2>&1; then
484     gmxcpu=power4
485   elif /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER3 >/dev/null 2>&1; then
486     gmxcpu=power3
487   elif /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER2 >/dev/null 2>&1; then
488     gmxcpu=power2
489   else
490     gmxcpu=""
491   fi
492   ;;
493
494 powerpc*-aix*)
495   if /usr/sbin/lscfg -vp | grep PowerPC | grep 604 >/dev/null 2>&1; then
496     gmxcpu=ppc604
497   elif /usr/sbin/lscfg -vp | grep PowerPC | grep 603 >/dev/null 2>&1; then
498     gmxcpu=ppc603
499   elif /usr/sbin/lscfg -vp | grep PowerPC | grep rs64a >/dev/null 2>&1; then
500     gmxcpu=rs64a
501   elif /usr/sbin/lscfg -vp | grep PowerPC | grep rs64b >/dev/null 2>&1; then
502     gmxcpu=rs64b
503   elif /usr/sbin/lscfg -vp | grep PowerPC | grep rs64c >/dev/null 2>&1; then
504     gmxcpu=rs64c
505   else
506     gmxcpu=""
507   fi
508   ;;
509
510 mips*-irix*)
511   if /sbin/hinv | grep CPU | grep R12000 >/dev/null 2>&1; then
512     gmxcpu=r12000
513   elif /sbin/hinv | grep CPU | grep R10000 >/dev/null 2>&1; then
514     gmxcpu=r10000
515   elif /sbin/hinv | grep CPU | grep R8000 >/dev/null 2>&1; then
516     gmxcpu=r8000
517   elif /sbin/hinv | grep CPU | grep R5000 >/dev/null 2>&1; then
518     gmxcpu=r5000
519   else
520     gmxcpu=""
521   fi
522   ;;
523
524 sparc*-solaris*)
525   if /usr/sbin/prtconf | grep UltraSPARC-III >/dev/null 2>&1; then
526     gmxcpu=ultrasparc3
527   elif /usr/sbin/prtconf | grep UltraSPARC-IIi >/dev/null 2>&1; then
528     gmxcpu=ultrasparc2i
529   elif /usr/sbin/prtconf | grep UltraSPARC-II >/dev/null 2>&1; then
530     gmxcpu=ultrasparc2
531   elif /usr/sbin/prtconf | grep UltraSPARC >/dev/null 2>&1; then
532     gmxcpu=ultrasparc
533   else
534     gmxcpu=""
535   fi
536   ;;
537 *)
538   gmxcpu=""
539   ;;
540
541 esac
542 ])
543
544
545
546 # Macro modified from the fftw distribution (www.fftw.org)
547 # to determine optimization flags.
548 # Note that we have modified config.guess and config.sub
549 # to provide extended information on the detailed type of CPU.
550 # In general we assume you have recent versions of the compilers
551 # that support the highest optimization we know of. If not, you 
552 # can always override these flags, but it's better to upgrade :-)
553 AC_DEFUN(ACX_COMPILER_MAXOPT,
554 [
555 AC_REQUIRE([AC_PROG_CC])
556 AC_REQUIRE([AC_PROG_F77])
557 AC_REQUIRE([AC_CANONICAL_HOST])
558
559 # Try to determine "good" native compiler flags if none specified on command
560 # line. To avoid repeating the entire procedure for fortran flags, we first
561 # determine our suggested choices for both C and fortran, and then possibly
562 # override them with user choices.
563
564 cc_vendor="unknown"
565
566 case "${host_cpu}-${host_os}" in
567
568   *-solaris2*) 
569     case "${gmxcpu}" in
570       ultrasparc3*)
571         xCFLAGS="-fast -xO5 -xtarget=ultra3 -fsimple=2 -fnonstd -dalign"
572         xFFLAGS=$xCFLAGS
573         ;;
574       ultrasparc2i*)
575         xCFLAGS="-fast -xO5 -xtarget=ultra2i -fsimple=2 -fnonstd -dalign"
576         xFFLAGS=$xCFLAGS
577         ;;
578       ultrasparc2*)
579         xCFLAGS="-fast -xO5 -xtarget=ultra2 -fsimple=2 -fnonstd -dalign"
580         xFFLAGS=$xCFLAGS
581         ;;
582       ultrasparc*)
583         xCFLAGS="-fast -xO5 -xtarget=ultra -fsimple=2 -fnonstd -dalign"
584         xFFLAGS=$xCFLAGS
585         ;;
586       *)
587         xCFLAGS="-native -fast -xO5 -fsimple=2 -fnonstd -dalign"
588         xFFLAGS=$xCFLAGS
589         ;;
590     esac
591     ;;
592
593   *-hpux*)  
594     xCFLAGS="-Ae +O3 +Oall"
595     xFFLAGS=$xCFLAGS
596     # If you haven't noticed, we don't like hp very much...
597     # but perhaps that will change if they make something nice out of ia64.
598     ;;
599
600   rs6000*-aix*)
601     # dont use inter-procedure analysis for the innerloops - they take
602     # forever to compile with it, and it doesnt help at all.
603     case "${gmxcpu}" in
604       power4*)
605         xCFLAGS="-O3 -qarch=pwr4 -qtune=pwr4 -qlanglvl=ansi -qmaxmem=16384"
606         xFFLAGS="-O3 -Q -qarch=pwr4 -qtune=pwr4 -qmaxmem=16384 -qhot -qnoipa"
607         ;;
608       power3*)
609         xCFLAGS="-O3 -qarch=pwr3 -qtune=pwr3 -qlanglvl=ansi -qmaxmem=16384"
610         xFFLAGS="-O3 -Q -qarch=pwr3 -qtune=pwr3 -qmaxmem=16384 -qhot -qnoipa"
611         ;;
612       power2*)
613         xCFLAGS="-O3 -qarch=pwr2 -qtune=pwr2 -qlanglvl=ansi -qmaxmem=16384"
614         xFFLAGS="-O3 -Q -qarch=pwr2 -qtune=pwr2 -qmaxmem=16384 -qhot -qnoipa"
615         ;;
616       power)
617         xCFLAGS="-O3 -qarch=pwr -qtune=pwr -qlanglvl=ansi -qmaxmem=16384"
618         xFFLAGS="-O3 -Q -qarch=pwr -qtune=pwr -qmaxmem=16384 -qhot -qnoipa"
619         ;;
620       *)
621         # I don't think people are using anything older than power2, so we tune for
622         # pwr, but dont set the arch since it is nice to have common binaries 
623         # that run also on powerpc.
624         xCFLAGS="-O3 -qlanglvl=ansi -qtune=pwr -qmaxmem=16384"
625         xFFLAGS="-O3 -Q -qtune=pwr -qmaxmem=16384 -qhot"
626         ;;
627     esac
628     ;;
629
630   powerpc*-aix*)
631     case "${gmxcpu}" in
632       ppc604)
633         xCFLAGS="-O3 -qarch=604 -qtune=604 -qlanglvl=ansi -qmaxmem=16384"
634         xFFLAGS="-O3 -Q -qarch=604 -qtune=604 -qmaxmem=16384 -qhot"
635         ;;
636       ppc603)
637         xCFLAGS="-O3 -qarch=603 -qtune=603 -qlanglvl=ansi -qmaxmem=16384"
638         xFFLAGS="-O3 -Q -qarch=603 -qtune=603 -qmaxmem=16384 -qhot"
639         ;;
640       rs64a)
641         xCFLAGS="-O3 -qarch=rs64a -qtune=rs64a -qlanglvl=ansi -qmaxmem=16384"
642         xFFLAGS="-O3 -Q -qarch=rs64a -qtune=rs64a -qmaxmem=16384 -qhot"
643         ;;
644       rs64b)
645         xCFLAGS="-O3 -qarch=rs64b -qtune=rs64b -qlanglvl=ansi -qmaxmem=16384"
646         xFFLAGS="-O3 -Q -qarch=rs64b -qtune=rs64b -qmaxmem=16384 -qhot"
647         ;;
648       rs64c)
649         xCFLAGS="-O3 -qarch=rs64c -qtune=rs64c -qlanglvl=ansi -qmaxmem=16384"
650         xFFLAGS="-O3 -Q -qarch=rs64c -qtune=rs64c -qmaxmem=16384 -qhot"
651         ;;
652       *)
653         xCFLAGS="-O3 -qlanglvl=ansi -qmaxmem=16384"
654         xFFLAGS="-O3 -Q -qmaxmem=16384 -qhot"
655         ;;
656     esac
657     ;;
658
659   mips*-irix*)
660     xCFLAGS="-O3 -OPT:IEEE_arithmetic=3 -OPT:rsqrt=ON -SWP:loop_overhead -INLINE:=ON -LNO:opt=1 -LNO:ou_further=3 -OPT:Olimit=0:roundoff=3:alias=typed -woff 1174 -D__INLINE_INTRINSICS"
661     xFFLAGS="-O3 -OPT:IEEE_arithmetic=3 -OPT:rsqrt=ON -SWP:loop_overhead -INLINE:=ON -LNO:opt=1 -LNO:ou_further=3 -OPT:Olimit=0:roundoff=3:alias=typed -OPT:cray_ivdep=TRUE"
662     
663     if $CC -version | grep "Version 7.1" > /dev/null 2>&1; then
664       xCFLAGS="$xCFLAGS -GCM:aggressive_speculation -GCM:array_speculation" 
665       xFFLAGS="$xFFLAGS -GCM:aggressive_speculation -GCM:array_speculation" 
666     fi
667
668     if $CC -version | grep "Version 7.3" > /dev/null 2>&1; then
669       xCFLAGS="$xCFLAGS -SWP:heur=fdms,nhms,fdnms" 
670       xFFLAGS="$xFFLAGS -SWP:heur=fdms,nhms,fdnms" 
671     fi
672     LDFLAGS="$LDFLAGS -woff 84"
673
674     case "${gmxcpu}" in
675       r12000*)
676         xCFLAGS="-n32 -r12000 -mips4 $xCFLAGS"
677         xFFLAGS="-n32 -r12000 -mips4 $xFFLAGS"
678         xLDFLAGS="-n32 -r12000 -mips4"
679         ;;
680       r10000*)
681         xCFLAGS="-n32 -r10000 -mips4 $xCFLAGS"
682         xFFLAGS="-n32 -r10000 -mips4 $xFFLAGS"
683         xLDFLAGS="-n32 -r10000 -mips4"
684         ;;
685       r8000*)
686         xCFLAGS="-n32 -r8000 -mips4 $xCFLAGS"
687         xFFLAGS="-n32 -r8000 -mips4 $xFFLAGS"
688         xLDFLAGS="-n32 -r8000 -mips4"
689         ;;
690       r5000*)
691         xCFLAGS="-n32 -r5000 -mips4 $xCFLAGS"
692         xFFLAGS="-n32 -r5000 -mips4 $xFFLAGS"
693         xLDFLAGS="-n32 -r5000 -mips4"
694         ;;
695       *)                
696         xCFLAGS="-n32 $xCFLAGS"
697         xFFLAGS="-n32 $xFFLAGS"
698         xLDFLAGS="-n32"
699         ;;
700     esac
701     ;;
702
703   alpha*-osf*) 
704      # NB: -arch implies -tune according to the cc manual.
705      # We dont use -ifo since it conflicts with dependency
706      # generation on old versions of the compiler.
707     case "${host_cpu}" in
708       alphaev*)
709         # extract the processor from cpu type (e.g. alphaev56 -> ev56)
710         evtype=`echo ${host_cpu} | sed 's/alpha//'`
711         xCFLAGS="-std1 -fast -O4 -no_ifo -arch $evtype -unroll 2 -fp_reorder"
712         xFFLAGS="$xCFLAGS -assume noaccuracy_sensitive"
713         xLDFLAGS="-O4"
714         ;;
715       *)
716         xCFLAGS="-std1 -fast -O4 -no_ifo -arch host -unroll 2 -fp_reorder"
717         xFFLAGS="$xCFLAGS -assume noaccuracy_sensitive"
718         xLDFLAGS="-O4"
719         ;;
720     esac
721     ;;
722
723   alpha*-linux*)
724     case "${host_cpu}" in
725       alphaev*)
726         # extract the processor from cpu type (e.g. alphaev56 -> ev56)
727         evtype=`echo ${host_cpu} | sed 's/alpha//'`
728         tmpCFLAGS="-std1 -fast -O4 -no_ifo -arch $evtype -unroll 2 -fp_reorder"
729         tmpFFLAGS="$tmpCFLAGS -assume noaccuracy_sensitive"
730         tmpLDFLAGS="-O4"
731         ;;
732       *)
733         tmpCFLAGS="-std1 -fast -O4 -no_ifo -arch host -unroll 2 -fp_reorder"
734         tmpFFLAGS="$tmpCFLAGS -assume noaccuracy_sensitive"
735         tmpLDFLAGS="-O4"
736         ;;
737     esac
738     if $CC -V 2>  /dev/null | grep Compaq > /dev/null 2>&1; then
739       xCFLAGS="$tmpCFLAGS"
740       cc_vendor="Compaq"
741     fi
742     if test "$enable_fortran" = "yes"; then
743       if $F77 -V 2>  /dev/null | grep Compaq > /dev/null 2>&1; then
744         xFFLAGS="$tmpFFLAGS"
745       fi
746     fi
747     ;;
748
749   *-*)
750     # most of these systems (e.g. linux, FreeBSD) use gcc which is treated
751     # further down, but we can at least check if the Portland compilers are used:
752     if $CC -V 2>  /dev/null | grep Portland > /dev/null 2>&1; then
753       case "${host_cpu}" in
754         i586)
755           pgiopt="-tp p5" 
756           ;;
757         i686)
758           pgiopt="-tp p6" 
759           ;;
760       esac
761       xCFLAGS="$pgiopt -fast -pc 32"
762     fi
763     if test "$enable_fortran" = "yes"; then
764       if $F77 -V 2>  /dev/null | grep Portland > /dev/null 2>&1; then
765         xFFLAGS="$xCFLAGS"
766       fi        
767     fi
768     ;;
769 esac    
770 # Phew, end of all those operating systems and processors!                      
771
772 # use default flags for gcc/g77 on all systems
773 if test $ac_cv_prog_gcc = yes; then
774   xCFLAGS="-O6 -fomit-frame-pointer -finline-functions -funroll-all-loops -Wall -Wno-unused"
775   # -malign-double for x86 systems
776   ACX_CHECK_CC_FLAGS(-malign-double,align_double,xCFLAGS="$xCFLAGS -malign-double")
777 fi
778   
779 if test $enable_fortran = yes; then
780   if test $ac_cv_prog_g77 = yes; then
781     xFFLAGS="-O3 -ffast-math -fomit-frame-pointer -finline-functions -funroll-all-loops -Wall -Wno-unused"
782     # -malign-double for f77 on x86 systems - haven't checked that this works yet.
783     #ACX_CHECK_F77_FLAGS(-malign-double,align_double,xFFLAGS="$xFFLAGS -malign-double")
784   fi
785 fi
786
787 CPU_FLAGS=""
788
789 if test "$GCC" = "yes"; then
790   ASFLAGS="$ASFLAGS -x assembler-with-cpp"
791   # try to guess correct CPU flags, at least for linux
792   case "${host_cpu}" in
793     # i586/i686 cpu flags don't improve speed, thus no need to use them.
794     # don't check f77 separately - we assume f77 and gcc are similar
795           
796     powerpc*)
797       cputype=`(grep cpu /proc/cpuinfo | head -1 | cut -d: -f2 | sed 's/ //g') 2> /dev/null`
798       is60x=`echo $cputype | egrep "^60[0-9]e?$"`
799       if test -n "$is60x"; then
800         ACX_CHECK_CC_FLAGS(-mcpu=$cputype,m_cpu_60x,CPU_FLAGS=-mcpu=$cputype)
801       elif test "$cputype" = 750; then
802         ACX_CHECK_CC_FLAGS(-mcpu=750,m_cpu_750,CPU_FLAGS=-mcpu=750)
803       fi
804       if test -z "$CPU_FLAGS"; then
805         ACX_CHECK_CC_FLAGS(-mcpu=powerpc,m_cpu_powerpc,CPU_FLAGS=-mcpu=powerpc)
806       fi
807       if test -z "$CPU_FLAGS"; then
808         ACX_CHECK_CC_FLAGS(-mpowerpc,m_powerpc,CPU_FLAGS=-mpowerpc)
809       fi
810    esac
811 else
812   AM_CONDITIONAL(GNU_CC,false)
813 fi
814
815 if test -n "$CPU_FLAGS"; then
816   xCFLAGS="$xCFLAGS $CPU_FLAGS"
817   xFFLAGS="$xFFLAGS $CPU_FLAGS"
818 fi
819
820 # Now check if the user provided anything special for C or fortran...
821 # Not nice to have checked everything then, but otherwise we would have
822 # to use entirely separate checks for C and fortran flags, doubling the code.
823 if test "$ac_test_CFLAGS" != "set"; then
824   CFLAGS="$xCFLAGS"
825   # Use the extra link optimization flags on e.g. irix only when
826   # we are using our own C compiler flags
827   LDFLAGS="$LDFLAGS $xLDFLAGS"
828   
829   if test -z "$CFLAGS"; then
830     echo "*******************************************************************"
831     echo "* WARNING: No special optimization settings found for the C       *"
832     echo "* compiler. Use  make CFLAGS=..., or edit the top level Makefile. *"
833     echo "* Reverting to the default setting CFLAGS=-O3. (mail us about it!)*"
834     echo "*******************************************************************"
835     CFLAGS="-O3"
836   fi
837   ACX_CHECK_CC_FLAGS(${CFLAGS}, guessed_cflags, , [
838     echo "*******************************************************************"
839     echo "* Sorry, these optimization settings don't seem to work for       *"
840     echo "* your C compiler. Use make CFLAGS=..., or edit the top Makefile. *"
841     echo "*******************************************************************"
842     CFLAGS=""
843   ])
844 else
845   echo "******************************************"
846   echo "* Using CFLAGS from environment variable *"
847   echo "******************************************"
848 fi
849
850 if test "$enable_fortran" = "yes"; then 
851   if test "$ac_test_FFLAGS" != "set"; then
852     FFLAGS="$xFFLAGS"
853     if test -z "$FFLAGS"; then
854       echo "*******************************************************************"
855       echo "* WARNING: No special optimization settings found for the fortran *"
856       echo "* compiler. Use  make FFLAGS=..., or edit the top level Makefile. *"
857       echo "* Reverting to the default setting FFLAGS=-O3. (mail us about it!)*"
858       echo "*******************************************************************"
859       FFLAGS="-O3"
860     fi
861     ACX_CHECK_F77_FLAGS(${FFLAGS}, guessed_fflags, , [
862       echo "*******************************************************************"
863       echo "* Sorry, these optimization settings don't seem to work for       *"
864       echo "* your f77 compiler. Use make FFLAGS=.., or edit the top Makefile.*"
865       echo "*******************************************************************"
866       FFLAGS=""
867     ])
868   else
869     echo "******************************************"
870     echo "* Using FFLAGS from environment variable *"
871     echo "******************************************"
872   fi
873 fi
874   
875 ])
876
877
878
879
880
881
882
883 # serial 46 AC_PROG_LIBTOOL
884 AC_DEFUN([AC_PROG_LIBTOOL],
885 [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
886 dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
887 dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
888   AC_PROVIDE_IFELSE([AC_PROG_CXX],
889     [AC_LIBTOOL_CXX],
890     [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
891 ])])
892   AC_PROVIDE_IFELSE([AC_PROG_F77],
893     [AC_LIBTOOL_F77],
894     [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
895 ])])
896
897 dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
898 dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
899 dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
900   AC_PROVIDE_IFELSE([AC_PROG_GCJ],
901     [AC_LIBTOOL_GCJ],
902     [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
903         [AC_LIBTOOL_GCJ],
904         [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
905           [AC_LIBTOOL_GCJ],
906         [ifdef([AC_PROG_GCJ],
907                [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
908 ])])
909          ifdef([A][M_PROG_GCJ],
910                [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
911 ])])
912          ifdef([LT_AC_PROG_GCJ],
913                [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
914 ])])])])])])
915
916 AC_DEFUN([_AC_PROG_LIBTOOL],
917 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
918 AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
919 AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
920
921 # Save cache, so that ltconfig can load it
922 AC_CACHE_SAVE
923
924 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
925 AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
926 MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
927 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
928 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
929 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
930 deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
931 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
932 $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
933 || AC_MSG_ERROR([libtool configure failed])
934
935 # Reload cache, that may have been modified by ltconfig
936 AC_CACHE_LOAD
937
938 # This can be used to rebuild libtool when needed
939 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
940
941 # Always use our own libtool.
942 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
943 AC_SUBST(LIBTOOL)dnl
944
945 # Redirect the config.log output again, so that the ltconfig log is not
946 # clobbered by the next message.
947 exec 5>>./config.log
948 ])
949
950 AC_DEFUN([AC_LIBTOOL_SETUP],
951 [AC_PREREQ(2.13)dnl
952 AC_REQUIRE([AC_ENABLE_SHARED])dnl
953 AC_REQUIRE([AC_ENABLE_STATIC])dnl
954 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
955 AC_REQUIRE([AC_CANONICAL_HOST])dnl
956 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
957 AC_REQUIRE([AC_PROG_CC])dnl
958 AC_REQUIRE([AC_PROG_LD])dnl
959 AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
960 AC_REQUIRE([AC_PROG_NM])dnl
961 AC_REQUIRE([AC_PROG_LN_S])dnl
962 AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
963 # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
964 AC_REQUIRE([AC_OBJEXT])dnl
965 AC_REQUIRE([AC_EXEEXT])dnl
966 dnl
967
968 # Only perform the check for file, if the check method requires it
969 case $deplibs_check_method in
970 file_magic*)
971   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
972     AC_PATH_MAGIC
973   fi
974   ;;
975 esac
976
977 AC_CHECK_TOOL(RANLIB, ranlib, :)
978 AC_CHECK_TOOL(STRIP, strip, :)
979
980 # Check for any special flags to pass to ltconfig.
981 libtool_flags="--cache-file=$cache_file"
982 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
983 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
984 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
985 test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
986 test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
987 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
988 [libtool_flags="$libtool_flags --enable-dlopen"])
989 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
990 [libtool_flags="$libtool_flags --enable-win32-dll"])
991 AC_ARG_ENABLE(libtool-lock,
992   [  --disable-libtool-lock        avoid locking (might break parallel builds)])
993 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
994 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
995
996 AC_ARG_WITH(pic,
997   [  --with-pic                    try to use only PIC/non-PIC [default=both]],
998      pic_mode="$withval", pic_mode=default)
999 test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
1000 test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
1001
1002 # Some flags need to be propagated to the compiler or linker for good
1003 # libtool support.
1004 case $host in
1005 *-*-irix6*)
1006   # Find out which ABI we are using.
1007   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
1008   if AC_TRY_EVAL(ac_compile); then
1009     case `/usr/bin/file conftest.$ac_objext` in
1010     *32-bit*)
1011       LD="${LD-ld} -32"
1012       ;;
1013     *N32*)
1014       LD="${LD-ld} -n32"
1015       ;;
1016     *64-bit*)
1017       LD="${LD-ld} -64"
1018       ;;
1019     esac
1020   fi
1021   rm -rf conftest*
1022   ;;
1023
1024 *-*-sco3.2v5*)
1025   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1026   SAVE_CFLAGS="$CFLAGS"
1027   CFLAGS="$CFLAGS -belf"
1028   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
1029     [AC_LANG_SAVE
1030      AC_LANG_C
1031      AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
1032      AC_LANG_RESTORE])
1033   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
1034     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1035     CFLAGS="$SAVE_CFLAGS"
1036   fi
1037   ;;
1038
1039 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1040 [*-*-cygwin* | *-*-mingw* | *-*-pw32*)
1041   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
1042   AC_CHECK_TOOL(AS, as, false)
1043   AC_CHECK_TOOL(OBJDUMP, objdump, false)
1044
1045   # recent cygwin and mingw systems supply a stub DllMain which the user
1046   # can override, but on older systems we have to supply one
1047   AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
1048     [AC_TRY_LINK([],
1049       [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
1050       DllMain (0, 0, 0);],
1051       [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
1052
1053   case $host/$CC in
1054   *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
1055     # old mingw systems require "-dll" to link a DLL, while more recent ones
1056     # require "-mdll"
1057     SAVE_CFLAGS="$CFLAGS"
1058     CFLAGS="$CFLAGS -mdll"
1059     AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
1060       [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
1061     CFLAGS="$SAVE_CFLAGS" ;;
1062   *-*-cygwin* | *-*-pw32*)
1063     # cygwin systems need to pass --dll to the linker, and not link
1064     # crt.o which will require a WinMain@16 definition.
1065     lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
1066   esac
1067   ;;
1068   ])
1069 esac
1070 ])
1071
1072 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
1073 AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
1074
1075 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
1076 AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
1077
1078 # AC_ENABLE_SHARED - implement the --enable-shared flag
1079 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
1080 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1081 #   `yes'.
1082 AC_DEFUN([AC_ENABLE_SHARED],
1083 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
1084 AC_ARG_ENABLE(shared,
1085 changequote(<<, >>)dnl
1086 <<  --enable-shared[=PKGS]        build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
1087 changequote([, ])dnl
1088 [p=${PACKAGE-default}
1089 case $enableval in
1090 yes) enable_shared=yes ;;
1091 no) enable_shared=no ;;
1092 *)
1093   enable_shared=no
1094   # Look at the argument we got.  We use all the common list separators.
1095   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1096   for pkg in $enableval; do
1097     if test "X$pkg" = "X$p"; then
1098       enable_shared=yes
1099     fi
1100   done
1101   IFS="$ac_save_ifs"
1102   ;;
1103 esac],
1104 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
1105 ])
1106
1107 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
1108 AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1109 AC_ENABLE_SHARED(no)])
1110
1111 # AC_ENABLE_STATIC - implement the --enable-static flag
1112 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
1113 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1114 #   `yes'.
1115 AC_DEFUN([AC_ENABLE_STATIC],
1116 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
1117 AC_ARG_ENABLE(static,
1118 changequote(<<, >>)dnl
1119 <<  --enable-static[=PKGS]        build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
1120 changequote([, ])dnl
1121 [p=${PACKAGE-default}
1122 case $enableval in
1123 yes) enable_static=yes ;;
1124 no) enable_static=no ;;
1125 *)
1126   enable_static=no
1127   # Look at the argument we got.  We use all the common list separators.
1128   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1129   for pkg in $enableval; do
1130     if test "X$pkg" = "X$p"; then
1131       enable_static=yes
1132     fi
1133   done
1134   IFS="$ac_save_ifs"
1135   ;;
1136 esac],
1137 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
1138 ])
1139
1140 # AC_DISABLE_STATIC - set the default static flag to --disable-static
1141 AC_DEFUN([AC_DISABLE_STATIC],
1142 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1143 AC_ENABLE_STATIC(no)])
1144
1145
1146 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
1147 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
1148 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1149 #   `yes'.
1150 AC_DEFUN([AC_ENABLE_FAST_INSTALL],
1151 [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
1152 AC_ARG_ENABLE(fast-install,
1153 changequote(<<, >>)dnl
1154 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
1155 changequote([, ])dnl
1156 [p=${PACKAGE-default}
1157 case $enableval in
1158 yes) enable_fast_install=yes ;;
1159 no) enable_fast_install=no ;;
1160 *)
1161   enable_fast_install=no
1162   # Look at the argument we got.  We use all the common list separators.
1163   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1164   for pkg in $enableval; do
1165     if test "X$pkg" = "X$p"; then
1166       enable_fast_install=yes
1167     fi
1168   done
1169   IFS="$ac_save_ifs"
1170   ;;
1171 esac],
1172 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
1173 ])
1174
1175 # AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
1176 AC_DEFUN([AC_DISABLE_FAST_INSTALL],
1177 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1178 AC_ENABLE_FAST_INSTALL(no)])
1179
1180 # AC_LIBTOOL_PICMODE - implement the --with-pic flag
1181 # Usage: AC_LIBTOOL_PICMODE[(MODE)]
1182 #   Where MODE is either `yes' or `no'.  If omitted, it defaults to
1183 #   `both'.
1184 AC_DEFUN([AC_LIBTOOL_PICMODE],
1185 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1186 pic_mode=ifelse($#,1,$1,default)])
1187
1188
1189 # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
1190 AC_DEFUN([AC_PATH_TOOL_PREFIX],
1191 [AC_MSG_CHECKING([for $1])
1192 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
1193 [case $MAGIC_CMD in
1194   /*)
1195   lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
1196   ;;
1197   ?:/*)
1198   lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
1199   ;;
1200   *)
1201   ac_save_MAGIC_CMD="$MAGIC_CMD"
1202   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
1203 dnl $ac_dummy forces splitting on constant user-supplied paths.
1204 dnl POSIX.2 word splitting is done only on the output of word expansions,
1205 dnl not every word.  This closes a longstanding sh security hole.
1206   ac_dummy="ifelse([$2], , $PATH, [$2])"
1207   for ac_dir in $ac_dummy; do
1208     test -z "$ac_dir" && ac_dir=.
1209     if test -f $ac_dir/$1; then
1210       lt_cv_path_MAGIC_CMD="$ac_dir/$1"
1211       if test -n "$file_magic_test_file"; then
1212         case $deplibs_check_method in
1213         "file_magic "*)
1214           file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
1215           MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
1216           if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
1217             egrep "$file_magic_regex" > /dev/null; then
1218             :
1219           else
1220             cat <<EOF 1>&2
1221
1222 *** Warning: the command libtool uses to detect shared libraries,
1223 *** $file_magic_cmd, produces output that libtool cannot recognize.
1224 *** The result is that libtool may fail to recognize shared libraries
1225 *** as such.  This will affect the creation of libtool libraries that
1226 *** depend on shared libraries, but programs linked with such libtool
1227 *** libraries will work regardless of this problem.  Nevertheless, you
1228 *** may want to report the problem to your system manager and/or to
1229 *** bug-libtool@gnu.org
1230
1231 EOF
1232           fi ;;
1233         esac
1234       fi
1235       break
1236     fi
1237   done
1238   IFS="$ac_save_ifs"
1239   MAGIC_CMD="$ac_save_MAGIC_CMD"
1240   ;;
1241 esac])
1242 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
1243 if test -n "$MAGIC_CMD"; then
1244   AC_MSG_RESULT($MAGIC_CMD)
1245 else
1246   AC_MSG_RESULT(no)
1247 fi
1248 ])
1249
1250
1251 # AC_PATH_MAGIC - find a file program which can recognise a shared library
1252 AC_DEFUN([AC_PATH_MAGIC],
1253 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
1254 AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
1255 if test -z "$lt_cv_path_MAGIC_CMD"; then
1256   if test -n "$ac_tool_prefix"; then
1257     AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
1258   else
1259     MAGIC_CMD=:
1260   fi
1261 fi
1262 ])
1263
1264
1265 # AC_PROG_LD - find the path to the GNU or non-GNU linker
1266 AC_DEFUN([AC_PROG_LD],
1267 [AC_ARG_WITH(gnu-ld,
1268 [  --with-gnu-ld                 assume the C compiler uses GNU ld [default=no]],
1269 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1270 AC_REQUIRE([AC_PROG_CC])dnl
1271 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1272 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1273 ac_prog=ld
1274 if test "$GCC" = yes; then
1275   # Check if gcc -print-prog-name=ld gives a path.
1276   AC_MSG_CHECKING([for ld used by GCC])
1277   case $host in
1278   *-*-mingw*)
1279     # gcc leaves a trailing carriage return which upsets mingw
1280     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1281   *)
1282     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1283   esac
1284   case $ac_prog in
1285     # Accept absolute paths.
1286     [[\\/]* | [A-Za-z]:[\\/]*)]
1287       re_direlt=['/[^/][^/]*/\.\./']
1288       # Canonicalize the path of ld
1289       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1290       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1291         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1292       done
1293       test -z "$LD" && LD="$ac_prog"
1294       ;;
1295   "")
1296     # If it fails, then pretend we aren't using GCC.
1297     ac_prog=ld
1298     ;;
1299   *)
1300     # If it is relative, then search for the first ld in PATH.
1301     with_gnu_ld=unknown
1302     ;;
1303   esac
1304 elif test "$with_gnu_ld" = yes; then
1305   AC_MSG_CHECKING([for GNU ld])
1306 else
1307   AC_MSG_CHECKING([for non-GNU ld])
1308 fi
1309 AC_CACHE_VAL(lt_cv_path_LD,
1310 [if test -z "$LD"; then
1311   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1312   for ac_dir in $PATH; do
1313     test -z "$ac_dir" && ac_dir=.
1314     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1315       lt_cv_path_LD="$ac_dir/$ac_prog"
1316       # Check to see if the program is GNU ld.  I'd rather use --version,
1317       # but apparently some GNU ld's only accept -v.
1318       # Break only if it was the GNU/non-GNU ld that we prefer.
1319       if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1320         test "$with_gnu_ld" != no && break
1321       else
1322         test "$with_gnu_ld" != yes && break
1323       fi
1324     fi
1325   done
1326   IFS="$ac_save_ifs"
1327 else
1328   lt_cv_path_LD="$LD" # Let the user override the test with a path.
1329 fi])
1330 LD="$lt_cv_path_LD"
1331 if test -n "$LD"; then
1332   AC_MSG_RESULT($LD)
1333 else
1334   AC_MSG_RESULT(no)
1335 fi
1336 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1337 AC_PROG_LD_GNU
1338 ])
1339
1340 AC_DEFUN([AC_PROG_LD_GNU],
1341 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
1342 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1343 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1344   lt_cv_prog_gnu_ld=yes
1345 else
1346   lt_cv_prog_gnu_ld=no
1347 fi])
1348 with_gnu_ld=$lt_cv_prog_gnu_ld
1349 ])
1350
1351 # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
1352 #   -- PORTME Some linkers may need a different reload flag.
1353 AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
1354 [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
1355 [lt_cv_ld_reload_flag='-r'])
1356 reload_flag=$lt_cv_ld_reload_flag
1357 test -n "$reload_flag" && reload_flag=" $reload_flag"
1358 ])
1359
1360 # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
1361 #  -- PORTME fill in with the dynamic library characteristics
1362 AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
1363 [AC_CACHE_CHECK([how to recognise dependant libraries],
1364 lt_cv_deplibs_check_method,
1365 [lt_cv_file_magic_cmd='$MAGIC_CMD'
1366 lt_cv_file_magic_test_file=
1367 lt_cv_deplibs_check_method='unknown'
1368 # Need to set the preceding variable on all platforms that support
1369 # interlibrary dependencies.
1370 # 'none' -- dependencies not supported.
1371 # `unknown' -- same as none, but documents that we really don't know.
1372 # 'pass_all' -- all dependencies passed with no checks.
1373 # 'test_compile' -- check by making test program.
1374 # 'file_magic [regex]' -- check by looking for files in library path
1375 # which responds to the $file_magic_cmd with a given egrep regex.
1376 # If you have `file' or equivalent on your system and you're not sure
1377 # whether `pass_all' will *always* work, you probably want this one.
1378
1379 case $host_os in
1380 aix*)
1381   lt_cv_deplibs_check_method=pass_all
1382   ;;
1383
1384 beos*)
1385   lt_cv_deplibs_check_method=pass_all
1386   ;;
1387
1388 bsdi4*)
1389   lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
1390   lt_cv_file_magic_cmd='/usr/bin/file -L'
1391   lt_cv_file_magic_test_file=/shlib/libc.so
1392   ;;
1393
1394 cygwin* | mingw* |pw32*)
1395   lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
1396   lt_cv_file_magic_cmd='$OBJDUMP -f'
1397   ;;
1398
1399 darwin* | rhapsody*)
1400   lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
1401   lt_cv_file_magic_cmd='/usr/bin/file -L'
1402   case "$host_os" in
1403   rhapsody* | darwin1.[012])
1404     lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
1405     ;;
1406   *) # Darwin 1.3 on
1407     lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
1408     ;;
1409   esac
1410   ;;
1411
1412 freebsd* )
1413   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
1414     case $host_cpu in
1415     i*86 )
1416       # Not sure whether the presence of OpenBSD here was a mistake.
1417       # Let's accept both of them until this is cleared up.
1418       lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
1419       lt_cv_file_magic_cmd=/usr/bin/file
1420       lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
1421       ;;
1422     esac
1423   else
1424     lt_cv_deplibs_check_method=pass_all
1425   fi
1426   ;;
1427
1428 gnu*)
1429   lt_cv_deplibs_check_method=pass_all
1430   ;;
1431
1432 hpux10.20*|hpux11*)
1433   lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
1434   lt_cv_file_magic_cmd=/usr/bin/file
1435   lt_cv_file_magic_test_file=/usr/lib/libc.sl
1436   ;;
1437
1438 irix5* | irix6*)
1439   case $host_os in
1440   irix5*)
1441     # this will be overridden with pass_all, but let us keep it just in case
1442     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
1443     ;;
1444   *)
1445     case $LD in
1446     *-32|*"-32 ") libmagic=32-bit;;
1447     *-n32|*"-n32 ") libmagic=N32;;
1448     *-64|*"-64 ") libmagic=64-bit;;
1449     *) libmagic=never-match;;
1450     esac
1451     # this will be overridden with pass_all, but let us keep it just in case
1452     lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
1453     ;;
1454   esac
1455   lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
1456   lt_cv_deplibs_check_method=pass_all
1457   ;;
1458
1459 # This must be Linux ELF.
1460 linux-gnu*)
1461   case $host_cpu in
1462   alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
1463     lt_cv_deplibs_check_method=pass_all ;;
1464   *)
1465     # glibc up to 2.1.1 does not perform some relocations on ARM
1466     lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;;
1467   esac
1468   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
1469   ;;
1470
1471 netbsd*)
1472   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
1473     [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
1474   else
1475     [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$']
1476   fi
1477   ;;
1478
1479 newsos6)
1480   [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
1481   lt_cv_file_magic_cmd=/usr/bin/file
1482   lt_cv_file_magic_test_file=/usr/lib/libnls.so
1483   ;;
1484
1485 osf3* | osf4* | osf5*)
1486   # this will be overridden with pass_all, but let us keep it just in case
1487   lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
1488   lt_cv_file_magic_test_file=/shlib/libc.so
1489   lt_cv_deplibs_check_method=pass_all
1490   ;;
1491
1492 sco3.2v5*)
1493   lt_cv_deplibs_check_method=pass_all
1494   ;;
1495
1496 solaris*)
1497   lt_cv_deplibs_check_method=pass_all
1498   lt_cv_file_magic_test_file=/lib/libc.so
1499   ;;
1500
1501 [sysv5uw[78]* | sysv4*uw2*)]
1502   lt_cv_deplibs_check_method=pass_all
1503   ;;
1504
1505 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
1506   case $host_vendor in
1507   ncr)
1508     lt_cv_deplibs_check_method=pass_all
1509     ;;
1510   motorola)
1511     lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
1512     lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
1513     ;;
1514   esac
1515   ;;
1516 esac
1517 ])
1518 file_magic_cmd=$lt_cv_file_magic_cmd
1519 deplibs_check_method=$lt_cv_deplibs_check_method
1520 ])
1521
1522
1523 # AC_PROG_NM - find the path to a BSD-compatible name lister
1524 AC_DEFUN([AC_PROG_NM],
1525 [AC_MSG_CHECKING([for BSD-compatible nm])
1526 AC_CACHE_VAL(lt_cv_path_NM,
1527 [if test -n "$NM"; then
1528   # Let the user override the test.
1529   lt_cv_path_NM="$NM"
1530 else
1531   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1532   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
1533     test -z "$ac_dir" && ac_dir=.
1534     tmp_nm=$ac_dir/${ac_tool_prefix}nm
1535     if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
1536       # Check to see if the nm accepts a BSD-compat flag.
1537       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
1538       #   nm: unknown option "B" ignored
1539       # Tru64's nm complains that /dev/null is an invalid object file
1540       if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
1541         lt_cv_path_NM="$tmp_nm -B"
1542         break
1543       elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1544         lt_cv_path_NM="$tmp_nm -p"
1545         break
1546       else
1547         lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
1548         continue # so that we can try to find one that supports BSD flags
1549       fi
1550     fi
1551   done
1552   IFS="$ac_save_ifs"
1553   test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
1554 fi])
1555 NM="$lt_cv_path_NM"
1556 AC_MSG_RESULT([$NM])
1557 ])
1558
1559 # AC_CHECK_LIBM - check for math library
1560 AC_DEFUN([AC_CHECK_LIBM],
1561 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1562 LIBM=
1563 case $host in
1564 *-*-beos* | *-*-cygwin* | *-*-pw32*)
1565   # These system don't have libm
1566   ;;
1567 *-ncr-sysv4.3*)
1568   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
1569   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1570   ;;
1571 *)
1572   AC_CHECK_LIB(m, main, LIBM="-lm")
1573   ;;
1574 esac
1575 ])
1576
1577 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1578 # the libltdl convenience library and INCLTDL to the include flags for
1579 # the libltdl header and adds --enable-ltdl-convenience to the
1580 # configure arguments.  Note that LIBLTDL and INCLTDL are not
1581 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
1582 # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
1583 # with '${top_builddir}/' and INCLTDL will be prefixed with
1584 # '${top_srcdir}/' (note the single quotes!).  If your package is not
1585 # flat and you're not using automake, define top_builddir and
1586 # top_srcdir appropriately in the Makefiles.
1587 AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
1588 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1589   case $enable_ltdl_convenience in
1590   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1591   "") enable_ltdl_convenience=yes
1592       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1593   esac
1594   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
1595   INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1596 ])
1597
1598 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1599 # the libltdl installable library and INCLTDL to the include flags for
1600 # the libltdl header and adds --enable-ltdl-install to the configure
1601 # arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
1602 # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
1603 # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
1604 # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
1605 # with '${top_srcdir}/' (note the single quotes!).  If your package is
1606 # not flat and you're not using automake, define top_builddir and
1607 # top_srcdir appropriately in the Makefiles.
1608 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1609 AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
1610 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1611   AC_CHECK_LIB(ltdl, main,
1612   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
1613   [if test x"$enable_ltdl_install" = xno; then
1614      AC_MSG_WARN([libltdl not installed, but installation disabled])
1615    else
1616      enable_ltdl_install=yes
1617    fi
1618   ])
1619   if test x"$enable_ltdl_install" = x"yes"; then
1620     ac_configure_args="$ac_configure_args --enable-ltdl-install"
1621     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
1622     INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1623   else
1624     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1625     LIBLTDL="-lltdl"
1626     INCLTDL=
1627   fi
1628 ])
1629
1630 # If this macro is not defined by Autoconf, define it here.
1631 ifdef([AC_PROVIDE_IFELSE],
1632       [],
1633       [define([AC_PROVIDE_IFELSE],
1634               [ifdef([AC_PROVIDE_$1],
1635                      [$2], [$3])])])
1636
1637 # AC_LIBTOOL_F77 - enable support for fortran libraries
1638 AC_DEFUN([AC_LIBTOOL_F77], [AC_REQUIRE([_AC_LIBTOOL_F77])])
1639
1640 AC_DEFUN([_AC_LIBTOOL_F77],
1641 [
1642 if test "$ac_cv_prog_f77_works" = "yes"; then
1643 AC_REQUIRE([AC_PROG_F77])
1644 LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-f77.sh"
1645 lt_save_CC="$CC"
1646 lt_save_CFLAGS="$CFLAGS"
1647 dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
1648 dnl is set to the fortran compiler.
1649 AR="$AR" LTCC="$CC" CC="$F77" F77="$F77" CFLAGS="$FFLAGS" CPPFLAGS="" \
1650 MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
1651 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
1652 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
1653 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
1654 deplibs_check_method="$deplibs_check_method" \
1655 file_magic_cmd="$file_magic_cmd" \
1656 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
1657 --build="$build" --add-tag=F77 $ac_aux_dir/ltcf-f77.sh $host \
1658 || AC_MSG_ERROR([libtool tag configuration failed])
1659 CC="$lt_save_CC"
1660 CFLAGS="$lt_save_CFLAGS"
1661
1662 # Redirect the config.log output again, so that the ltconfig log is not
1663 # clobbered by the next message.
1664 exec 5>>./config.log
1665 fi
1666 ])
1667
1668 # AC_LIBTOOL_CXX - enable support for C++ libraries
1669 AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
1670
1671 AC_DEFUN([_AC_LIBTOOL_CXX],
1672 [AC_REQUIRE([AC_PROG_CXX])
1673 AC_REQUIRE([AC_PROG_CXXCPP])
1674 LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
1675 lt_save_CC="$CC"
1676 lt_save_CFLAGS="$CFLAGS"
1677 dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
1678 dnl is set to the C++ compiler.
1679 AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
1680 MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
1681 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
1682 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
1683 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
1684 deplibs_check_method="$deplibs_check_method" \
1685 file_magic_cmd="$file_magic_cmd" \
1686 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
1687 --build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
1688 || AC_MSG_ERROR([libtool tag configuration failed])
1689 CC="$lt_save_CC"
1690 CFLAGS="$lt_save_CFLAGS"
1691
1692 # Redirect the config.log output again, so that the ltconfig log is not
1693 # clobbered by the next message.
1694 exec 5>>./config.log
1695 ])
1696
1697 # AC_LIBTOOL_GCJ - enable support for GCJ libraries
1698 AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
1699
1700 AC_DEFUN([_AC_LIBTOOL_GCJ],
1701 [AC_REQUIRE([AC_PROG_LIBTOOL])
1702 AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
1703   [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
1704     [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
1705       [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
1706          [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
1707            [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
1708 LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
1709 lt_save_CC="$CC"
1710 lt_save_CFLAGS="$CFLAGS"
1711 dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
1712 dnl is set to the C++ compiler.
1713 AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
1714 MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
1715 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
1716 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
1717 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
1718 deplibs_check_method="$deplibs_check_method" \
1719 file_magic_cmd="$file_magic_cmd" \
1720 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
1721 --build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
1722 || AC_MSG_ERROR([libtool tag configuration failed])
1723 CC="$lt_save_CC"
1724 CFLAGS="$lt_save_CFLAGS"
1725
1726 # Redirect the config.log output again, so that the ltconfig log is not
1727 # clobbered by the next message.
1728 exec 5>>./config.log
1729 ])
1730
1731 dnl old names
1732 AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
1733 AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
1734 AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
1735 AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
1736 AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
1737 AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
1738 AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
1739
1740 dnl This is just to silence aclocal about the macro not being used
1741 ifelse([AC_DISABLE_FAST_INSTALL])dnl
1742 ifelse([AC_DISABLE_SHARED])dnl
1743
1744 AC_DEFUN([LT_AC_PROG_GCJ],
1745 [AC_CHECK_TOOL(GCJ, gcj, no)
1746   test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
1747   AC_SUBST(GCJFLAGS)
1748 ])
1749
1750 # serial 3
1751
1752 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
1753 # -------------------------------------
1754 # Define a conditional.
1755 #
1756 # FIXME: Once using 2.50, use this:
1757 # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl
1758 AC_DEFUN([AM_CONDITIONAL],
1759 [ifelse([$1], [TRUE],
1760         [errprint(__file__:__line__: [$0: invalid condition: $1
1761 ])dnl
1762 m4exit(1)])dnl
1763 ifelse([$1], [FALSE],
1764        [errprint(__file__:__line__: [$0: invalid condition: $1
1765 ])dnl
1766 m4exit(1)])dnl
1767 AC_SUBST([$1_TRUE])
1768 AC_SUBST([$1_FALSE])
1769 if $2; then
1770   $1_TRUE=
1771   $1_FALSE='#'
1772 else
1773   $1_TRUE='#'
1774   $1_FALSE=
1775 fi])
1776
1777 # Do all the work for Automake.  This macro actually does too much --
1778 # some checks are only needed if your package does certain things.
1779 # But this isn't really a big deal.
1780
1781 # serial 5
1782
1783 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1784 # written in clear, in which case automake, when reading aclocal.m4,
1785 # will think it sees a *use*, and therefore will trigger all it's
1786 # C support machinery.  Also note that it means that autoscan, seeing
1787 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1788
1789
1790 # We require 2.13 because we rely on SHELL being computed by configure.
1791 AC_PREREQ([2.13])
1792
1793 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
1794 # -----------------------------------------------------------
1795 # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
1796 # The purpose of this macro is to provide the user with a means to
1797 # check macros which are provided without letting her know how the
1798 # information is coded.
1799 # If this macro is not defined by Autoconf, define it here.
1800 ifdef([AC_PROVIDE_IFELSE],
1801       [],
1802       [define([AC_PROVIDE_IFELSE],
1803               [ifdef([AC_PROVIDE_$1],
1804                      [$2], [$3])])])
1805
1806
1807 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
1808 # ----------------------------------------------
1809 AC_DEFUN([AM_INIT_AUTOMAKE],
1810 [AC_REQUIRE([AC_PROG_INSTALL])dnl
1811 # test to see if srcdir already configured
1812 if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
1813    test -f $srcdir/config.status; then
1814   AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
1815 fi
1816
1817 # Define the identity of the package.
1818 PACKAGE=$1
1819 AC_SUBST(PACKAGE)dnl
1820 VERSION=$2
1821 AC_SUBST(VERSION)dnl
1822 ifelse([$3],,
1823 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1824 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
1825
1826 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
1827 # the ones we care about.
1828 ifdef([m4_pattern_allow],
1829       [m4_pattern_allow([^AM_(C|CPP|CXX|OBJC|F|R|GCJ)FLAGS])])dnl
1830
1831 # Some tools Automake needs.
1832 AC_REQUIRE([AM_SANITY_CHECK])dnl
1833 AC_REQUIRE([AC_ARG_PROGRAM])dnl
1834 AM_MISSING_PROG(ACLOCAL, aclocal)
1835 AM_MISSING_PROG(AUTOCONF, autoconf)
1836 AM_MISSING_PROG(AUTOMAKE, automake)
1837 AM_MISSING_PROG(AUTOHEADER, autoheader)
1838 AM_MISSING_PROG(MAKEINFO, makeinfo)
1839 AM_MISSING_PROG(AMTAR, tar)
1840 AM_MISSING_INSTALL_SH
1841 AM_PROG_INSTALL_STRIP
1842 # We need awk for the "check" target.  The system "awk" is bad on
1843 # some platforms.
1844 AC_REQUIRE([AC_PROG_AWK])dnl
1845 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1846 AC_REQUIRE([AM_DEP_TRACK])dnl
1847 AC_REQUIRE([AM_SET_DEPDIR])dnl
1848 AC_PROVIDE_IFELSE([AC_PROG_][CC],
1849                   [AM_DEPENDENCIES(CC)],
1850                   [define([AC_PROG_][CC],
1851                           defn([AC_PROG_][CC])[AM_DEPENDENCIES(CC)])])dnl
1852 AC_PROVIDE_IFELSE([AC_PROG_][CXX],
1853                   [AM_DEPENDENCIES(CXX)],
1854                   [define([AC_PROG_][CXX],
1855                           defn([AC_PROG_][CXX])[AM_DEPENDENCIES(CXX)])])dnl
1856 ])
1857
1858 #
1859 # Check to make sure that the build environment is sane.
1860 #
1861
1862 # serial 3
1863
1864 # AM_SANITY_CHECK
1865 # ---------------
1866 AC_DEFUN([AM_SANITY_CHECK],
1867 [AC_MSG_CHECKING([whether build environment is sane])
1868 # Just in case
1869 sleep 1
1870 echo timestamp > conftest.file
1871 # Do `set' in a subshell so we don't clobber the current shell's
1872 # arguments.  Must try -L first in case configure is actually a
1873 # symlink; some systems play weird games with the mod time of symlinks
1874 # (eg FreeBSD returns the mod time of the symlink's containing
1875 # directory).
1876 if (
1877    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
1878    if test "$[*]" = "X"; then
1879       # -L didn't work.
1880       set X `ls -t $srcdir/configure conftest.file`
1881    fi
1882    rm -f conftest.file
1883    if test "$[*]" != "X $srcdir/configure conftest.file" \
1884       && test "$[*]" != "X conftest.file $srcdir/configure"; then
1885
1886       # If neither matched, then we have a broken ls.  This can happen
1887       # if, for instance, CONFIG_SHELL is bash and it inherits a
1888       # broken ls alias from the environment.  This has actually
1889       # happened.  Such a system could not be considered "sane".
1890       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1891 alias in your environment])
1892    fi
1893
1894    test "$[2]" = conftest.file
1895    )
1896 then
1897    # Ok.
1898    :
1899 else
1900    AC_MSG_ERROR([newly created file is older than distributed files!
1901 Check your system clock])
1902 fi
1903 AC_MSG_RESULT(yes)])
1904
1905
1906 # serial 2
1907
1908 # AM_MISSING_PROG(NAME, PROGRAM)
1909 # ------------------------------
1910 AC_DEFUN([AM_MISSING_PROG],
1911 [AC_REQUIRE([AM_MISSING_HAS_RUN])
1912 $1=${$1-"${am_missing_run}$2"}
1913 AC_SUBST($1)])
1914
1915
1916 # AM_MISSING_INSTALL_SH
1917 # ---------------------
1918 # Like AM_MISSING_PROG, but only looks for install-sh.
1919 AC_DEFUN([AM_MISSING_INSTALL_SH],
1920 [AC_REQUIRE([AM_MISSING_HAS_RUN])
1921 if test -z "$install_sh"; then
1922    for install_sh in "$ac_aux_dir/install-sh" \
1923                      "$ac_aux_dir/install.sh" \
1924                      "${am_missing_run}${ac_auxdir}/install-sh";
1925    do
1926      test -f "$install_sh" && break
1927    done
1928    # FIXME: an evil hack: we remove the SHELL invocation from
1929    # install_sh because automake adds it back in.  Sigh.
1930    install_sh=`echo $install_sh | sed -e 's/\${SHELL}//'`
1931 fi
1932 AC_SUBST(install_sh)])
1933
1934
1935 # AM_MISSING_HAS_RUN
1936 # ------------------
1937 # Define MISSING if not defined so far and test if it supports --run.
1938 # If it does, set am_missing_run to use it, otherwise, to nothing.
1939 AC_DEFUN([AM_MISSING_HAS_RUN],
1940 [test x"${MISSING+set}" = xset ||
1941   MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
1942 # Use eval to expand $SHELL
1943 if eval "$MISSING --run true"; then
1944   am_missing_run="$MISSING --run "
1945 else
1946   am_missing_run=
1947   am_backtick='`'
1948   AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
1949 fi
1950 ])
1951
1952 # AM_AUX_DIR_EXPAND
1953
1954 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
1955 # $ac_aux_dir to ${srcdir}/foo.  In other projects, it is set to `.'.
1956 # Of course, Automake must honor this variable whenever it call a tool
1957 # from the auxiliary directory.  The problem is that $srcdir (hence
1958 # $ac_aux_dir) can be either an absolute path or a path relative to
1959 # $top_srcdir or absolute, this depends on how configure is run.  This
1960 # is pretty anoying since it makes $ac_aux_dir quite unusable in
1961 # subdirectories: on the top source directory, any form will work
1962 # fine, but in subdirectories relative pat needs to be adapted.
1963 # - calling $top_srcidr/$ac_aux_dir/missing would success if $srcdir is
1964 #   relative, but fail if $srcdir is absolute
1965 # - conversly, calling $ax_aux_dir/missing would fail if $srcdir is
1966 #   absolute, and success on relative paths.
1967 #
1968 # Consequently, we define and use $am_aux_dir, the "always absolute"
1969 # version of $ac_aux_dir.
1970
1971 AC_DEFUN([AM_AUX_DIR_EXPAND], [
1972 # expand $ac_aux_dir to an absolute path
1973 am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
1974 ])
1975
1976 # One issue with vendor `install' (even GNU) is that you can't
1977 # specify the program used to strip binaries.  This is especially
1978 # annoying in cross-compiling environments, where the build's strip
1979 # is unlikely to handle the host's binaries.
1980 # Fortunately install-sh will honor a STRIPPROG variable, so we
1981 # always use install-sh in `make install-strip', and initialize
1982 # STRIPPROG with the value of the STRIP variable (set by the user).
1983 AC_DEFUN([AM_PROG_INSTALL_STRIP],
1984 [AC_REQUIRE([AM_MISSING_INSTALL_SH])dnl
1985 _am_dirpart="`echo $install_sh | sed -e 's,//*[[^/]]*$,,'`"
1986 INSTALL_STRIP_PROGRAM="\${SHELL} \`CDPATH=: && cd $_am_dirpart && pwd\`/install-sh -c -s"
1987 AC_SUBST([INSTALL_STRIP_PROGRAM])])
1988
1989 # serial 3
1990
1991 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1992 # written in clear, in which case automake, when reading aclocal.m4,
1993 # will think it sees a *use*, and therefore will trigger all it's
1994 # C support machinery.  Also note that it means that autoscan, seeing
1995 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1996
1997 # AM_DEPENDENCIES(NAME)
1998 # ---------------------
1999 # See how the compiler implements dependency checking.
2000 # NAME is "CC", "CXX" or "OBJC".
2001 # We try a few techniques and use that to set a single cache variable.
2002 AC_DEFUN([AM_DEPENDENCIES],
2003 [AC_REQUIRE([AM_SET_DEPDIR])dnl
2004 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2005 am_compiler_list=
2006 ifelse([$1], CC,
2007        [AC_REQUIRE([AC_PROG_][CC])dnl
2008 AC_REQUIRE([AC_PROG_][CPP])
2009 depcc="$CC"
2010 depcpp="$CPP"],
2011        [$1], CXX, [AC_REQUIRE([AC_PROG_][CXX])dnl
2012 AC_REQUIRE([AC_PROG_][CXXCPP])
2013 depcc="$CXX"
2014 depcpp="$CXXCPP"],
2015        [$1], OBJC, [am_compiler_list='gcc3 gcc'
2016 depcc="$OBJC"
2017 depcpp=""],
2018        [$1], GCJ,  [am_compiler_list='gcc3 gcc'
2019 depcc="$GCJ"
2020 depcpp=""],
2021        [AC_REQUIRE([AC_PROG_][$1])dnl
2022 depcc="$$1"
2023 depcpp=""])
2024
2025 AC_REQUIRE([AM_MAKE_INCLUDE])
2026 AC_REQUIRE([AM_DEP_TRACK])
2027
2028 AC_CACHE_CHECK([dependency style of $depcc],
2029                [am_cv_$1_dependencies_compiler_type],
2030 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2031   # We make a subdir and do the tests there.  Otherwise we can end up
2032   # making bogus files that we don't know about and never remove.  For
2033   # instance it was reported that on HP-UX the gcc test will end up
2034   # making a dummy file named `D' -- because `-MD' means `put the output
2035   # in D'.
2036   mkdir confdir
2037   # Copy depcomp to subdir because otherwise we won't find it if we're
2038   # using a relative directory.
2039   cp "$am_depcomp" confdir
2040   cd confdir
2041
2042   am_cv_$1_dependencies_compiler_type=none
2043   if test "$am_compiler_list" = ""; then
2044      am_compiler_list="`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`"
2045   fi
2046   for depmode in $am_compiler_list; do
2047     # We need to recreate these files for each test, as the compiler may
2048     # overwrite some of them when testing with obscure command lines.
2049     # This happens at least with the AIX C compiler.
2050     echo '#include "conftest.h"' > conftest.c
2051     echo 'int i;' > conftest.h
2052
2053     case "$depmode" in
2054     nosideeffect)
2055       # after this tag, mechanisms are not by side-effect, so they'll
2056       # only be used when explicitly requested
2057       if test "x$enable_dependency_tracking" = xyes; then
2058         continue
2059       else
2060         break
2061       fi
2062       ;;
2063     none) break ;;
2064     esac
2065     # We check with `-c' and `-o' for the sake of the "dashmstdout"
2066     # mode.  It turns out that the SunPro C++ compiler does not properly
2067     # handle `-M -o', and we need to detect this.
2068     if depmode="$depmode" \
2069        source=conftest.c object=conftest.o \
2070        depfile=conftest.Po tmpdepfile=conftest.TPo \
2071        $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
2072        grep conftest.h conftest.Po > /dev/null 2>&1; then
2073       am_cv_$1_dependencies_compiler_type="$depmode"
2074       break
2075     fi
2076   done
2077
2078   cd ..
2079   rm -rf confdir
2080 else
2081   am_cv_$1_dependencies_compiler_type=none
2082 fi
2083 ])
2084 $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
2085 AC_SUBST([$1DEPMODE])
2086 ])
2087
2088
2089 # AM_SET_DEPDIR
2090 # -------------
2091 # Choose a directory name for dependency files.
2092 # This macro is AC_REQUIREd in AM_DEPENDENCIES
2093 AC_DEFUN([AM_SET_DEPDIR],
2094 [if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
2095   DEPDIR=.deps
2096   # We redirect because .deps might already exist and be populated.
2097   # In this situation we don't want to see an error.
2098   rmdir .deps > /dev/null 2>&1
2099 else
2100   DEPDIR=_deps
2101 fi
2102 AC_SUBST(DEPDIR)
2103 ])
2104
2105
2106 # AM_DEP_TRACK
2107 # ------------
2108 AC_DEFUN([AM_DEP_TRACK],
2109 [AC_ARG_ENABLE(dependency-tracking,
2110 [  --disable-dependency-tracking Speeds up one-time builds
2111   --enable-dependency-tracking  Do not reject slow dependency extractors])
2112 if test "x$enable_dependency_tracking" != xno; then
2113   am_depcomp="$ac_aux_dir/depcomp"
2114   AMDEPBACKSLASH='\'
2115 fi
2116 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2117 pushdef([subst], defn([AC_SUBST]))
2118 subst(AMDEPBACKSLASH)
2119 popdef([subst])
2120 ])
2121
2122 # Generate code to set up dependency tracking.
2123 # This macro should only be invoked once -- use via AC_REQUIRE.
2124 # Usage:
2125 # AM_OUTPUT_DEPENDENCY_COMMANDS
2126
2127 #
2128 # This code is only required when automatic dependency tracking
2129 # is enabled.  FIXME.  This creates each `.P' file that we will
2130 # need in order to bootstrap the dependency handling code.
2131 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
2132 AC_OUTPUT_COMMANDS([
2133 test x"$AMDEP_TRUE" != x"" ||
2134 for mf in $CONFIG_FILES; do
2135   case "$mf" in
2136   Makefile) dirpart=.;;
2137   */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
2138   *) continue;;
2139   esac
2140   grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
2141   # Extract the definition of DEP_FILES from the Makefile without
2142   # running `make'.
2143   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
2144   test -z "$DEPDIR" && continue
2145   # When using ansi2knr, U may be empty or an underscore; expand it
2146   U=`sed -n -e '/^U = / s///p' < "$mf"`
2147   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
2148   # We invoke sed twice because it is the simplest approach to
2149   # changing $(DEPDIR) to its actual value in the expansion.
2150   for file in `sed -n -e '
2151     /^DEP_FILES = .*\\\\$/ {
2152       s/^DEP_FILES = //
2153       :loop
2154         s/\\\\$//
2155         p
2156         n
2157         /\\\\$/ b loop
2158       p
2159     }
2160     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
2161        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
2162     # Make sure the directory exists.
2163     test -f "$dirpart/$file" && continue
2164     fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
2165     $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
2166     # echo "creating $dirpart/$file"
2167     echo '# dummy' > "$dirpart/$file"
2168   done
2169 done
2170 ], [AMDEP_TRUE="$AMDEP_TRUE"
2171 ac_aux_dir="$ac_aux_dir"])])
2172
2173 # AM_MAKE_INCLUDE()
2174 # -----------------
2175 # Check to see how make treats includes.
2176 AC_DEFUN([AM_MAKE_INCLUDE],
2177 [am_make=${MAKE-make}
2178 cat > confinc << 'END'
2179 doit:
2180         @echo done
2181 END
2182 # If we don't find an include directive, just comment out the code.
2183 AC_MSG_CHECKING([for style of include used by $am_make])
2184 _am_include='#'
2185 _am_quote=
2186 _am_result=none
2187 # First try GNU make style include.
2188 echo "include confinc" > confmf
2189 # We grep out `Entering directory' and `Leaving directory'
2190 # messages which can occur if `w' ends up in MAKEFLAGS.
2191 # In particular we don't look at `^make:' because GNU make might
2192 # be invoked under some other name (usually "gmake"), in which
2193 # case it prints its new name instead of `make'.
2194 if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
2195    _am_include=include
2196    _am_quote=
2197    _am_result=GNU
2198 fi
2199 # Now try BSD make style include.
2200 if test "$_am_include" = "#"; then
2201    echo '.include "confinc"' > confmf
2202    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
2203       _am_include=.include
2204       _am_quote='"'
2205       _am_result=BSD
2206    fi
2207 fi
2208 AC_SUBST(_am_include)
2209 AC_SUBST(_am_quote)
2210 AC_MSG_RESULT($_am_result)
2211 rm -f confinc confmf
2212 ])
2213
2214 # Like AC_CONFIG_HEADER, but automatically create stamp file.
2215
2216 # serial 3
2217
2218 # When config.status generates a header, we must update the stamp-h file.
2219 # This file resides in the same directory as the config header
2220 # that is generated.  We must strip everything past the first ":",
2221 # and everything past the last "/".
2222
2223 AC_PREREQ([2.12])
2224
2225 AC_DEFUN([AM_CONFIG_HEADER],
2226 [AC_CONFIG_HEADER([$1])
2227   AC_OUTPUT_COMMANDS(
2228    ifelse(patsubst([$1], [[^ ]], []),
2229           [],
2230           [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
2231            patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
2232   [am_indx=1
2233   for am_file in $1; do
2234     case " $CONFIG_HEADERS " in
2235     *" $am_file "*)
2236       echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
2237       ;;
2238     esac
2239     am_indx=\`expr \$am_indx + 1\`
2240   done])
2241 ])
2242
2243
2244 # serial 1
2245
2246 AC_DEFUN([AM_WITH_DMALLOC],
2247 [AC_MSG_CHECKING([if malloc debugging is wanted])
2248 AC_ARG_WITH(dmalloc,
2249 [  --with-dmalloc          use dmalloc, as in
2250                           http://www.dmalloc.com/dmalloc.tar.gz],
2251 [if test "$withval" = yes; then
2252   AC_MSG_RESULT(yes)
2253   AC_DEFINE(WITH_DMALLOC,1,
2254             [Define if using the dmalloc debugging malloc package])
2255   LIBS="$LIBS -ldmalloc"
2256   LDFLAGS="$LDFLAGS -g"
2257 else
2258   AC_MSG_RESULT(no)
2259 fi], [AC_MSG_RESULT(no)])
2260 ])
2261