195 |
echo " a system-default makedepend was not found." |
echo " a system-default makedepend was not found." |
196 |
|
|
197 |
# Try to build the cyrus implementation |
# Try to build the cyrus implementation |
198 |
rm -f ./genmake_cy_md |
build_cyrus_makedepend |
|
( |
|
|
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
|
|
&& ./configure > /dev/null 2>&1 \ |
|
|
&& make > /dev/null 2>&1 |
|
|
if test -x ./makedepend.exe ; then |
|
|
$LN ./makedepend.exe ./makedepend |
|
|
fi |
|
|
./makedepend ifparser.c > /dev/null 2>&1 \ |
|
|
&& echo "true" |
|
|
) > ./genmake_cy_md |
|
|
grep true ./genmake_cy_md > /dev/null 2>&1 |
|
199 |
RETVAL=$? |
RETVAL=$? |
200 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" != x0 ; then |
|
MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend' |
|
|
else |
|
201 |
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
202 |
fi |
fi |
203 |
rm -f ./genmake_cy_md |
rm -f ./genmake_cy_md |
204 |
fi |
fi |
205 |
|
else |
206 |
|
# echo "MAKEDEPEND=${MAKEDEPEND}" |
207 |
|
echo "${MAKEDEPEND}" | grep -i cyrus > /dev/null 2>&1 |
208 |
|
RETVAL=$? |
209 |
|
if test x"$RETVAL" = x0 ; then |
210 |
|
build_cyrus_makedepend |
211 |
|
fi |
212 |
fi |
fi |
213 |
} |
} |
214 |
|
|
215 |
|
|
216 |
|
build_cyrus_makedepend() { |
217 |
|
rm -f ./genmake_cy_md |
218 |
|
( |
219 |
|
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
220 |
|
&& ./configure > /dev/null 2>&1 \ |
221 |
|
&& make > /dev/null 2>&1 |
222 |
|
if test -x ./makedepend.exe ; then |
223 |
|
$LN ./makedepend.exe ./makedepend |
224 |
|
fi |
225 |
|
./makedepend ifparser.c > /dev/null 2>&1 \ |
226 |
|
&& echo "true" |
227 |
|
) > ./genmake_cy_md |
228 |
|
grep true ./genmake_cy_md > /dev/null 2>&1 |
229 |
|
RETVAL=$? |
230 |
|
rm -f ./genmake_cy_md |
231 |
|
if test "x$RETVAL" = x0 ; then |
232 |
|
MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend' |
233 |
|
return 0 |
234 |
|
else |
235 |
|
echo "WARNING: unable to build cyrus-imapd-makedepend" |
236 |
|
return 1 |
237 |
|
fi |
238 |
|
} |
239 |
|
|
240 |
# Guess possible config options for this host |
# Guess possible config options for this host |
241 |
find_possible_configs() { |
find_possible_configs() { |
242 |
|
|
269 |
|
|
270 |
look_for_makedepend |
look_for_makedepend |
271 |
|
|
272 |
# look for possible fortran compilers |
#================================================================ |
273 |
|
# look for possible C compilers |
274 |
|
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc" |
275 |
|
p_CC= |
276 |
|
for c in $tmp ; do |
277 |
|
rm -f ./genmake_hello.c ./genmake_hello |
278 |
|
cat >> genmake_hello.c << EOF |
279 |
|
#include <stdio.h> |
280 |
|
int main(int argc, char **argv) { |
281 |
|
printf("Hello!\n"); |
282 |
|
return 0; |
283 |
|
} |
284 |
|
EOF |
285 |
|
$c -o genmake_hello genmake_hello.c > /dev/null 2>&1 |
286 |
|
RETVAL=$? |
287 |
|
if test "x${RETVAL}" = x0 ; then |
288 |
|
p_CC="$p_CC $c" |
289 |
|
fi |
290 |
|
done |
291 |
|
rm -f ./genmake_hello.c ./genmake_hello |
292 |
|
if test "x${p_CC}" = x ; then |
293 |
|
cat 1>&2 <<EOF |
294 |
|
|
295 |
|
Error: No C compilers were found in your path. Please specify one using: |
296 |
|
|
297 |
|
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
298 |
|
2) the CC or MITGCM_CC environment variables. |
299 |
|
|
300 |
|
EOF |
301 |
|
exit 1 |
302 |
|
else |
303 |
|
echo " The possible C compilers found in your path are:" |
304 |
|
echo " "$p_CC |
305 |
|
if test "x$CC" = x ; then |
306 |
|
CC=`echo $p_CC | $AWK '{print $1}'` |
307 |
|
echo " Setting C compiler to: "$CC |
308 |
|
fi |
309 |
|
fi |
310 |
|
|
311 |
|
#================================================================ |
312 |
|
# look for possible FORTRAN compilers |
313 |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
314 |
p_FC= |
p_FC= |
315 |
for c in $tmp ; do |
for c in $tmp ; do |
335 |
|
|
336 |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
337 |
2) a command-line option (eg. "-fc NAME"), or |
2) a command-line option (eg. "-fc NAME"), or |
338 |
3) the MITGCM_FC environment variable. |
3) the FC or MITGCM_FC environment variables. |
339 |
|
|
340 |
EOF |
EOF |
341 |
exit 1 |
exit 1 |
506 |
will search for a working compiler by trying a list of |
will search for a working compiler by trying a list of |
507 |
"usual suspects" such as g77, f77, etc. |
"usual suspects" such as g77, f77, etc. |
508 |
|
|
509 |
|
-cc NAME | --cc NAME | -cc=NAME | --cc=NAME |
510 |
|
Use "NAME" as the C compiler. By default, genmake |
511 |
|
will search for a working compiler by trying a list of |
512 |
|
"usual suspects" such as gcc, c89, cc, etc. |
513 |
|
|
514 |
-[no]ieee | --[no]ieee |
-[no]ieee | --[no]ieee |
515 |
Do or don't use IEEE numerics. Note that this option |
Do or don't use IEEE numerics. Note that this option |
516 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
569 |
EOF |
EOF |
570 |
return 1 |
return 1 |
571 |
fi |
fi |
572 |
c_tcall=`nm genmake_test.o | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
c_tcall=`nm genmake_test.o 2>/dev/null | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
573 |
RETVAL=$? |
RETVAL=$? |
574 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
575 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
599 |
EOF |
EOF |
600 |
return 1 |
return 1 |
601 |
fi |
fi |
602 |
f_tcall=`nm genmake_tcomp.o | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
f_tcall=`nm genmake_tcomp.o 2>/dev/null | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
603 |
RETVAL=$? |
RETVAL=$? |
604 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
605 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
676 |
|
|
677 |
|
|
678 |
check_netcdf_libs() { |
check_netcdf_libs() { |
679 |
|
echo "" > genmake_tnc.log |
680 |
cat <<EOF > genmake_tnc.for |
cat <<EOF > genmake_tnc.for |
681 |
program fgennc |
program fgennc |
682 |
#include "netcdf.inc" |
#include "netcdf.inc" |
690 |
end |
end |
691 |
EOF |
EOF |
692 |
#echo "$CPP $DEFINES $INCLUDES" |
#echo "$CPP $DEFINES $INCLUDES" |
693 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f \ |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
694 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
695 |
RET_COMPILE=$? |
RET_COMPILE=$? |
696 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
699 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
700 |
else |
else |
701 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
702 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f \ |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
703 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
704 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
705 |
RET_COMPILE=$? |
RET_COMPILE=$? |
729 |
S64= |
S64= |
730 |
KPP= |
KPP= |
731 |
FC= |
FC= |
732 |
|
CC= |
733 |
CPP= |
CPP= |
734 |
LINK= |
LINK= |
735 |
DEFINES= |
DEFINES= |
737 |
ENABLE= |
ENABLE= |
738 |
DISABLE= |
DISABLE= |
739 |
MAKEFILE= |
MAKEFILE= |
740 |
MAKEDEPEND= |
#MAKEDEPEND= |
741 |
PDEPEND= |
PDEPEND= |
742 |
DUMPSTATE=t |
DUMPSTATE=t |
743 |
PDEFAULT= |
PDEFAULT= |
960 |
# ac_prev=cpp ;; |
# ac_prev=cpp ;; |
961 |
# -cpp=* | --cpp=*) |
# -cpp=* | --cpp=*) |
962 |
# CPP=$ac_optarg ;; |
# CPP=$ac_optarg ;; |
963 |
|
|
964 |
|
-cc | --cc) |
965 |
|
ac_prev=CC ;; |
966 |
|
-cc=* | --cc=*) |
967 |
|
CC=$ac_optarg ;; |
968 |
|
|
969 |
-fortran | --fortran | -fc | --fc) |
-fortran | --fortran | -fc | --fc) |
970 |
ac_prev=FC ;; |
ac_prev=FC ;; |
971 |
-fc=* | --fc=*) |
-fc=* | --fc=*) |
1121 |
fi |
fi |
1122 |
fi |
fi |
1123 |
|
|
1124 |
# Check that FC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
# Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
1125 |
# either set defaults or complain and abort! |
# either set defaults or complain and abort! |
1126 |
if test ! "x$BASH" = x ; then |
if test ! "x$BASH" = x ; then |
1127 |
# add a trailing space so that it works within the Makefile syntax (see below) |
# add a trailing space so that it works within the Makefile syntax (see below) |
1137 |
EOF |
EOF |
1138 |
exit 1 |
exit 1 |
1139 |
fi |
fi |
1140 |
|
if test "x$CC" = x ; then |
1141 |
|
cat <<EOF 1>&2 |
1142 |
|
|
1143 |
|
Error: no C compiler: please specify using one of the following: |
1144 |
|
1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
1145 |
|
2) the "-cc=XXX" command-line option |
1146 |
|
3) the "./genmake_local" file |
1147 |
|
EOF |
1148 |
|
exit 1 |
1149 |
|
fi |
1150 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1151 |
LINK=$FC |
LINK=$FC |
1152 |
fi |
fi |
1850 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
# Special preprocessor (KAP on DECs, FPP on Crays) |
1851 |
KPP = ${KPP} |
KPP = ${KPP} |
1852 |
# Fortran compiler |
# Fortran compiler |
1853 |
FC = ${FC} |
FC = ${FC} in |
1854 |
# Fortran compiler |
# Fortran compiler |
1855 |
F90C = ${F90C} |
F90C = ${F90C} |
1856 |
|
# C compiler |
1857 |
|
CC = ${CC} |
1858 |
# Link editor |
# Link editor |
1859 |
LINK = ${LINK} ${LDADD} |
LINK = ${LINK} ${LDADD} |
1860 |
|
|