Adding DisEMBL dependency Tisean executable
[jabaws.git] / binaries / src / disembl / Tisean_3.0.1 / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(source_f/readfile.f)
3
4 AC_PREFIX_DEFAULT(${HOME})
5
6 dnl Check for prfix directory and create it if necessary
7 test "x$prefix" = xNONE && prefix=$ac_default_prefix
8
9 AC_MSG_CHECKING([whether $prefix is a directory and writeable])
10 mkdir -p $prefix 2>&5
11 if test -d $prefix && echo "" > $prefix/test_conf_write \
12    && rm -f $prefix/test_conf_write; then
13    AC_MSG_RESULT(yes)
14 else
15    AC_MSG_RESULT(no)
16    AC_MSG_WARN([
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
20 ])
21 fi
22
23 dnl Checks for programs.
24
25 for ccc in "$CC" cc gcc acc "cc -Aa"; do
26    if test -z "$ccc"; then 
27       continue
28    fi
29    CC=$ccc
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
37          rm -fr conftest*
38          AC_MSG_RESULT(yes)
39          break
40    else
41          rm -fr conftest*
42          AC_MSG_RESULT(no)
43          CC=
44    fi
45 done
46
47 if test -z "$CC"; then
48    AC_MSG_WARN([
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"
53 *** and rerun
54 ])
55 fi
56
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
62          AC_MSG_RESULT(yes)
63          CFLAGS=$cflags
64          break
65       else
66          AC_MSG_RESULT(no)
67       fi
68    done
69    if test -z "$CFLAGS"; then
70       AC_MSG_WARN([
71 *** no valid optimisation flags for $CC found
72 ])
73    fi
74    rm -f conftest*
75 fi
76
77 if test -n "$CC"; then
78    AC_CHECK_LIB(m, main)
79
80 dnl Checks for header files.
81    AC_HEADER_STDC
82    AC_CHECK_HEADERS(limits.h malloc.h)
83
84 dnl Checks for typedefs, structures, and compiler characteristics.
85    AC_C_CONST
86    if test $ac_cv_c_const = no; then
87       CC="$CC -Dconst="
88    fi
89
90    AC_TYPE_SIZE_T
91
92 dnl Checks for library functions.
93    AC_FUNC_MEMCMP
94 fi
95
96 AC_SUBST(CC)
97
98 for fff in "$FC" f77 g77 "f77 +U77" "f77 -q -f -B108 -lU77"; do
99    if test -z "$fff"; then 
100       continue
101    fi
102    FC=$fff
103    AC_MSG_CHECKING([whether ($FC $FFLAGS $LDFLAGS) works])
104    cat > conftest.f << EOF
105       character*20 argv
106       call getarg(1,argv)
107       write(*,'(2hxx,a)') argv
108       end
109 EOF
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
113       AC_MSG_RESULT(yes)
114       break
115    else
116       rm -f conftest.f conftest
117       AC_MSG_RESULT(no)
118       FC=
119    fi
120 done
121
122 if test -z "$FC"; then
123       AC_MSG_WARN([
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"
128 *** and rerun
129 ])
130 fi
131
132 if test -z "$CC" && test -z "$FC"; then
133    AC_MSG_ERROR([
134 *** with neither working C nor Fortran compilers there wouldn't be any
135 *** programs left you could compile
136 ])
137 fi
138
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)')
145       end
146 EOF
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
150          AC_MSG_RESULT(yes)
151          FFLAGS=$fflags
152          break
153       else
154          rm -f conftest.f conftest
155          AC_MSG_RESULT(no)
156       fi
157    done
158    if test -z "$FFLAGS"; then
159       AC_MSG_WARN([
160 *** no valid optimisation flags for $FC found
161 ])
162    fi
163    rm -f conftest*
164 fi
165
166 AC_SUBST(FC)
167 AC_SUBST(FFLAGS)
168
169 if test -n "$FC"; then
170    ERRUNIT=""
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
175       cd ./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
180          cd ..
181          rm -Rf ./config_test_dir
182          AC_MSG_RESULT(no)
183       else
184          cd ..
185          rm -Rf ./config_test_dir
186          AC_MSG_RESULT(yes)
187          ERRUNIT=$iu
188          break
189       fi
190    done
191    if test -z $ERRUNIT; then
192       ERRUNIT=0
193       AC_MSG_WARN([
194 *** Couldn't determine Fortran stderr unit, assuming unit 0, fingers crossed
195 ])
196    fi
197    AC_SUBST(ERRUNIT)
198 fi
199
200 AC_CHECK_PROG(AR,ar,ar,ar)
201 ARFLAGS=r
202 AC_MSG_CHECKING([whether ${AR} accepts ${ARFLAGS}])
203 if test -n "$CC"; then
204    echo 'void f(){}' > libtest.c
205    ${CC} -c libtest.c
206 else
207    echo '      end' > libtest.f
208    ${FC} -c libtest.f
209 fi
210 ${AR} ${ARFLAGS} libtest.a libtest.o 1>&5 2>&5
211 if test -s libtest.a; then
212   AC_MSG_RESULT(yes)
213 else
214   ARFLAGS=-r
215   AC_MSG_RESULT([no, using ${ARFLAGS} instead])
216 fi
217 rm -f libtest.*
218 AC_SUBST(ARFLAGS)
219
220 AC_PROG_INSTALL
221 AC_PROG_MAKE_SET
222 AC_PROG_RANLIB
223
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
228 set out "/dev/null"
229 set term dumb
230 plot '< (echo "1 1"; echo "2 2")'
231 EOF
232    if $GP conftest.gnu 2>&5 1>&5; then
233       rm -f conftest.gnu
234       AC_MSG_RESULT([yes
235 :-)   you may try to run $GP on the following files
236       after you installed everything:])
237    find examples -name "*.gnu" -print | sed "s%\./%         %"
238       echo ""
239    else
240       rm -f conftest.gnu
241       AC_MSG_RESULT([no 
242 :-(   you may not be able to run $GP on the examples
243       docs_f/docs/*.gnu without changes])
244    fi
245 fi
246
247 AC_OUTPUT(Makefile source_f/Makefile source_f/slatec/Makefile source_f/randomize/Makefile source_c/Makefile source_c/routines/Makefile)