1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
#!/bin/sh
# $Id: configure,v 1.2 2010-02-28 21:49:21 dhmunro Exp $
# configure script for mpy
curdate=`date`
cursystem=`uname -a`
fatality=0
if test -x "../relocate/bin/yorick"; then
yorick_exe="../relocate/bin/yorick"
else
yorick_exe="yorick"
fi
mpicc_exe="mpicc"
mpifc_exe=""
mpi_cflags=""
mpi_ldflags=""
debug="no"
for opt do
case "$opt" in
--debug) debug="yes"
;;
--yorick=*) yorick_exe=`echo $opt | sed -e s/--yorick=//`
;;
--mpicc=*) mpicc_exe=`echo $opt | sed -e s/--mpicc=//`
;;
--mpifc=*) mpifc_exe=`echo $opt | sed -e s/--mpifc=//`
;;
--cflags=*) mpi_cflags=`echo $opt | sed -e s/--cflags=//`
;;
--ldflags=*) mpi_ldflags=`echo $opt | sed -e s/--ldflags=//`
;;
*) cat <<EOF
Usage: ./configure [options]
Options are one or more of:
--yorick=/path/to/yorick
set path to yorick executable (if not on your PATH)
--mpicc=/path/to/mpicc
set path to mpicc executable (if not on your PATH or not called mpicc)
--cflags='cflags'
any CFLAGS needed to compile with with mpicc
--ldflags='ldflags'
any LDFLAGS needed to load with with mpicc
EOF
exit 1
;;
esac
done
if test "$mpicc" = mpicc; then
mpicc_dflt="yes"
else
mpicc_dflt="no"
fi
rm -f cfg.* ycode.* yinit.* ywrap.*
rm -f core a.out *.o *.a *.so *.sl *.dylib *.dll *~ '#'*
rm -f mpy Makempy paths.i cfg*
mpicc_dir=""
mpicc_name=`echo $mpicc_exe | sed -e 's/[ \t].*//'`
case "$mpicc_name" in
*/*)
if test -x "$mpicc_name" -a ! -d "$mpicc_name"; then
mpicc_dir=`dirname "$mpicc_name"`
fi
;;
*)
save_IFS=$IFS
IFS=:
for d in `echo "$PATH" | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./'`
do
if test -x "$d/$mpicc_name" -a ! -d "$d/$mpicc_name"; then
mpicc_dir="$d"
mpicc_exe="$d/$mpicc_exe"
break;
fi
done
IFS=$save_IFS
;;
esac
found="no"
case "$yorick_exe" in
*/*)
if test -x "$yorick_exe" -a ! -d "$yorick_exe"; then
Y_BINDIR=`dirname "$yorick_exe"`
found="yes"
fi
;;
*)
save_IFS=$IFS
IFS=:
for d in `echo "$PATH" | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./'`
do
if test -x "$d/$yorick_exe" -a ! -d "$d/$yorick_exe"; then
Y_BINDIR="$d"
yorick_exe="$d/$yorick_exe"
found="yes"
break;
fi
done
IFS=$save_IFS
;;
esac
if test $found = no; then
echo --yorick=$yorick_exe not found
echo rerun ./configure with --yorick option or ./configure --help
exit 1
fi
"$yorick_exe" -batch make.i
Y_HOME=`grep '^Y_MAKEDIR=' ./Makefile | sed -e 's/^Y_MAKEDIR=//'`
# try to handle escaped blanks in Y_MAKEDIR
Y_HOME=`echo $Y_HOME | sed -e 's/\\\\ / /g'`
CC=`grep '^CC=' "${Y_HOME}/Make.cfg" | sed -e 's/^CC=//'`
CFLAGS=`grep '^Y_CFLAGS=' "${Y_HOME}/Make.cfg" | sed -e 's/^Y_CFLAGS=//'`
LDFLAGS=`grep '^Y_LDFLAGS=' "${Y_HOME}/Make.cfg" | sed -e 's/^Y_LDFLAGS=//'`
echo Using ${Y_HOME}/Make.cfg
echo " CFLAGS=$CFLAGS"
echo " LDFLAGS=$LDFLAGS"
if test $mpicc_dflt = yes; then
if test -n "$mpi_cflags"; then
mpi_cflags="$CFLAGS"
fi
if test -n "$mpi_cflags"; then
mpi_ldflags="$LDFLAGS"
fi
fi
if test -z "$mpicc_dir"; then
echo --mpicc=$mpicc_exe not found
echo rerun ./configure with --mpicc option or ./configure --help
exit 1
else
echo Using --mpicc=$mpicc_exe
echo " MPI_CFLAGS=$mpi_cflags"
echo " MPI_LDFLAGS=$mpi_ldflags"
fi
cat >Makempy <<EOF
# Makempy configure results for mpy
# generated by mpy configure script on $curdate
# $cursystem
CC=$mpicc_exe
FC=$mpifc_exe
MPI_CFLAGS=$mpi_cflags
MPI_LDFLAGS=$mpi_ldflags
EOF
exit 0
|