1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(source_f/readfile.f)
4 AC_PREFIX_DEFAULT(${HOME})
6 dnl Check for prfix directory and create it if necessary
7 test "x$prefix" = xNONE && prefix=$ac_default_prefix
9 AC_MSG_CHECKING([whether $prefix is a directory and writeable])
11 if test -d $prefix && echo "" > $prefix/test_conf_write \
12 && rm -f $prefix/test_conf_write; then
17 *** $prefix must be a writeable directory for installation
18 *** either you provide that or give another one, say mydir, by calling
19 *** $ ./configure --prefix=mydir
23 dnl Checks for programs.
25 for ccc in "$CC" cc gcc acc "cc -Aa"; do
26 if test -z "$ccc"; then
30 AC_MSG_CHECKING([whether ($CC $CFLAGS $LDFLAGS) works])
31 ac_cpp='$CPP $CPPFLAGS'
32 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
33 ac_link='$CC -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
34 echo '#include "confdefs.h"' > conftest.c
35 echo 'main(int argc,char **argv){return(0);}' >> conftest.c
36 if { (eval $ac_link) 2>&5; } && test -s conftest; then
47 if test -z "$CC"; then
49 *** No valid ANSI C compiler found
50 *** You will not be able to use some of the routines
51 *** If you do have a C compiler called by, say, mycc -ANSI, do:
52 *** $ setenv CC "mycc -ANSI"
57 if test -n "$CC" && test -z "$CFLAGS"; then
58 echo 'void f(){}' > conftest.c
59 for cflags in -O3 -O2 -O +O3 +O -xO3; do
60 AC_MSG_CHECKING([whether $CC accepts $cflags])
61 if test -z "`$CC $cflags -c conftest.c 2>&1`"; then
69 if test -z "$CFLAGS"; then
71 *** no valid optimisation flags for $CC found
77 if test -n "$CC"; then
80 dnl Checks for header files.
82 AC_CHECK_HEADERS(limits.h malloc.h)
84 dnl Checks for typedefs, structures, and compiler characteristics.
86 if test $ac_cv_c_const = no; then
92 dnl Checks for library functions.
98 for fff in "$FC" f77 g77 "f77 +U77" "f77 -q -f -B108 -lU77"; do
99 if test -z "$fff"; then
103 AC_MSG_CHECKING([whether ($FC $FFLAGS $LDFLAGS) works])
104 cat > conftest.f << EOF
107 write(*,'(2hxx,a)') argv
110 (eval $FC $FFLAGS $LDFLAGS conftest.f -o conftest) 1>&5 2>&5
111 if test -n "`(eval ./conftest TEST | grep xxTEST) 2>&5`"; then
112 rm -f conftest.f conftest
116 rm -f conftest.f conftest
122 if test -z "$FC"; then
124 *** No usable Fortran compiler found
125 *** You will not be able to use some of the routines
126 *** If you do have a working Fortran compiler called, say, myf77 -trick, do:
127 *** $ setenv FC "myf77 -trick"
132 if test -z "$CC" && test -z "$FC"; then
134 *** with neither working C nor Fortran compilers there wouldn't be any
135 *** programs left you could compile
139 if test -n "$FC" && test -z "$FFLAGS"; then
140 echo ' end' > conftest.f
141 for fflags in -O +O; do
142 AC_MSG_CHECKING([whether $FC accepts $fflags])
143 cat > conftest.f << EOF
144 write(*,'(6hxxTEST)')
147 (eval $FC $fflags $LDFLAGS conftest.f -o conftest) 1>&5 2>&5
148 if test -n "`(eval ./conftest | grep xxTEST) 2>&5`"; then
149 rm -f conftest.f conftest
154 rm -f conftest.f conftest
158 if test -z "$FFLAGS"; then
160 *** no valid optimisation flags for $FC found
169 if test -n "$FC"; then
171 for iu in 0 1 2 3 4 6 7 8 9; do
172 AC_MSG_CHECKING([whether Fortran unit $iu is stderr])
173 rm -Rf ./config_test_dir
174 mkdir ./config_test_dir
176 echo " write($iu,'(1ht)')" > test.f
177 echo " end" >> test.f
178 (eval $FC $FFLAGS test.f -o test.out) 1>&5 2>&5
179 if test -z "`./test.out 2>&1 1>/dev/null`"; then
181 rm -Rf ./config_test_dir
185 rm -Rf ./config_test_dir
191 if test -z $ERRUNIT; then
194 *** Couldn't determine Fortran stderr unit, assuming unit 0, fingers crossed
200 AC_CHECK_PROG(AR,ar,ar,ar)
202 AC_MSG_CHECKING([whether ${AR} accepts ${ARFLAGS}])
203 if test -n "$CC"; then
204 echo 'void f(){}' > libtest.c
207 echo ' end' > libtest.f
210 ${AR} ${ARFLAGS} libtest.a libtest.o 1>&5 2>&5
211 if test -s libtest.a; then
215 AC_MSG_RESULT([no, using ${ARFLAGS} instead])
224 AC_CHECK_PROGS(GP,gnuplot)
225 if test -n "$GP"; then
226 AC_MSG_CHECKING(if gnuplot can read from a pipe)
227 cat > conftest.gnu <<EOF
230 plot '< (echo "1 1"; echo "2 2")'
232 if $GP conftest.gnu 2>&5 1>&5; then
235 :-) you may try to run $GP on the following files
236 after you installed everything:])
237 find examples -name "*.gnu" -print | sed "s%\./% %"
242 :-( you may not be able to run $GP on the examples
243 docs_f/docs/*.gnu without changes])
247 AC_OUTPUT(Makefile source_f/Makefile source_f/slatec/Makefile source_f/randomize/Makefile source_c/Makefile source_c/routines/Makefile)