dnl------------------------------------------------------------------ dnl Copyright (C) GFD Dennou Club, 2005. All rights reserved. dnl------------------------------------------------------------------ dnl dnl= Template file to create configure script for dcpam dnl dnl * Developers: Yasuhiro Morikawa dnl * Version: $Id: configure.in,v 1.4 2005/06/22 10:37:51 morikawa Exp $ dnl * Tag Name: $Name: dcpam2-20050623-4 $ dnl * Change History: dnl dnl== Overview dnl dnl This file is template file to create "configure" script by dnl autoconf 2.13. Some functions are defined in "aclocal.m4" dnl (for example, DC_ARG_WITH). dnl ############################################################ #== StartUp # AC_CHECK_CANONICAL_HOST AC_INIT(src/run/dycore.f90) AC_PREFIX_DEFAULT(/usr/local/dcpam2) ############################################################ #== Set prefix # if test X"$prefix" != X"NONE" ; then ac_cv_prefix=`echo $prefix | sed 's/\/\+$//'` fi AC_CACHE_CHECK([prefix], ac_cv_prefix, [ ac_cv_prefix=$ac_default_prefix ]) prefix=`echo $ac_cv_prefix | sed 's/\/\+$//'` ############################################################ #== Check fortran Compiler and Module type # DC_ARG_WITH(fc, [Fortran compiler (override "\$FC")], ac_cv_FC, [ AC_MSG_RESULT((no)) ]) #AC_CACHE_CHECK([ from cache], ac_cv_FC, [ # AC_MSG_RESULT((no)) #]) if test X"$ac_cv_FC" != X"" ; then FC=$ac_cv_FC fi sh ./chkfort.sh || exit 1 . chkfort.cfg AC_SUBST(FC) ac_cv_FC=$FC AC_SUBST(MOD) AC_SUBST(F90MODTYPE) : ${IFCCEM:=:} AC_SUBST(IFCCEM) if test X"$MOD" = X".f90" ; then CLEAN_MODS= else CLEAN_MODS="*$MOD" fi AC_SUBST(CLEAN_MODS) ############################################################ #== Set DCPAMDIR DC_SET_DCPAMDIR dnl ############################################################ dnl #== CharSet dnl # dnl dnl AC_CHECK_PROG(SJISTOEUC, nkf, nkf -xe) dnl AC_CHECK_PROG(SJISTOEUC, iconv, iconv -f SHIFT_JIS -t EUC-JP) dnl AC_CHECK_PROG(EUCTOSJIS, nkf, nkf -xs) dnl AC_CHECK_PROG(EUCTOSJIS, iconv, iconv -f EUC-JP -t SHIFT_JIS) dnl dnl AC_ARG_WITH(charset, [charset: of source and resource (shift_jis or euc-jp)], [ dnl ac_cv_sys_charset=$withval dnl ], [ dnl AC_CACHE_CHECK([charset for source/resource], ac_cv_sys_charset, [ dnl case $SYSTYPE in dnl *BSD*|Linux*|SunOS-4.*) dnl ac_cv_sys_charset=euc-jp dnl ;; dnl *) dnl ac_cv_sys_charset=shift_jis dnl ;; dnl esac dnl ]) dnl ]) dnl CHARSET=$ac_cv_sys_charset dnl AC_SUBST(CHARSET) ############################################################ #== Library Check #=== ispack # DC_ARG_WITH(ispack, [ispack library filename], ac_cv_lib_ispack, [ AC_MSG_ERROR(specify ispack library filename (like libisp.a) with --with-ispack=) ]) DC_SET_LIBDIR_LIBNAME($ac_cv_lib_ispack, ispack_libdir, ispack_libname) #=== Netcdf # DC_ARG_WITH(netcdf, [netcdf library filename], ac_cv_lib_netcdf, [ AC_MSG_ERROR(specify netcdf library filename (like libnetcdf.a) with --with-netcdf=) ]) DC_SET_LIBDIR_LIBNAME($ac_cv_lib_netcdf, netcdf_libdir, netcdf_libname) try2=`dirname $netcdf_libdir`/include if test -f "$try2/netcdf.h"; then netcdf_incdir=$try2 else AC_MSG_ERROR(netcdf include file not found) fi #=== gt4f90io # DC_ARG_WITH(gt4f90io, [gt4f90io library filename], ac_cv_lib_gt4f90io, AC_MSG_ERROR(specify gt4f90io library filename (like libgt4f90io.a) with --with-gt4f90io=) ) DC_SET_LIBDIR_LIBNAME($ac_cv_lib_gt4f90io, gt4f90io_libdir, gt4f90io_libname) DC_SET_MODDIR($ac_cv_lib_gt4f90io, gt4f90io_moddir) #=== spml # DC_ARG_WITH(spml, [spmodel library filename], ac_cv_lib_spml, AC_MSG_ERROR(specify spmodel library filename (like libspml.a) with --with-spml=) ) DC_SET_LIBDIR_LIBNAME($ac_cv_lib_spml, spml_libdir, spml_libname) DC_SET_MODDIR($ac_cv_lib_spml, spml_moddir) ############################################################ #== Check Cache about FFLAGS # DC_ARG_WITH(fflags, [flags for Fortran compiler], ac_cv_fflags, [ ac_cv_fflags="" ]) ############################################################ #== Setting LDFLAGS, LDLIBS, FFLAGS # SYSLDFLAGS="-L$spml_libdir -L$gt4f90io_libdir -L$netcdf_libdir -L$ispack_libdir" SYSLDLIBS="-l$spml_libname -l$gt4f90io_libname -l$netcdf_libname -l$ispack_libname" SYSFFLAGS="$ac_cv_fflags -I$spml_moddir -I$gt4f90io_moddir" ############################################################ #== --with-docdir=docidir # ac_cv_dest_doc='${prefix}/doc' DC_ARG_WITH(docdir, [document installation directory [${ac_default_prefix}/doc]], ac_cv_dest_doc, [ AC_MSG_ERROR(specify docdir with --with-docdir=DIR) ]) case $ac_cv_dest_doc in "/"*) docdir=${ac_cv_dest_doc} ;; '${prefix}/doc') docdir=${ac_cv_dest_doc} ;; no) docdir='${prefix}/doc' ;; *) echo -n 'reconfigure with --with-docdir=DIR, ' echo 'but DIR must be ABSOLUTE path name.' AC_MSG_ERROR(unrecognized docdir type) ;; esac AC_SUBST(docdir) ############################################################ #== --with-dcpam_lib_name=ARG # default_dcpam_lib_name=dcpam2 ac_cv_dcpam_lib_name=${default_dcpam_lib_name} DC_ARG_WITH(dcpam_lib_name, [Library Name [dcpam]], ac_cv_dcpam_lib_name, [AC_MSG_ERROR(specify Library Name --with-dcpam_lib_name=ARG)] ) case $ac_cv_dcpam_lib_name in *'/'*) dcpam_lib_name=`basename ${ac_cv_dcpam_lib_name}` ;; *) if test "${ac_cv_dcpam_lib_name}" = "" ; then dcpam_lib_name=${default_dcpam_lib_name} else dcpam_lib_name=${ac_cv_dcpam_lib_name} fi ;; esac echo "set libname \"${dcpam_lib_name}\"" AC_SUBST(dcpam_lib_name) ############################################################ #== --with-dcpam_suffix=ARG # default_dcpam_suffix=no DC_ARG_WITH(dcpam_suffix, [Set suffix to installdir, library name, and executable files], ac_cv_dcpam_suffix, [ac_cv_dcpam_suffix=""] ) case $ac_cv_dcpam_suffix in *'/'*) dcpam_suffix=`basename ${ac_cv_dcpam_suffix}` ;; *) if test "${ac_cv_dcpam_suffix}" = "" ; then dcpam_suffix=${default_dcpam_suffix} else dcpam_suffix=${ac_cv_dcpam_suffix} fi ;; esac if test "${dcpam_suffix}" = "no" ; then dcpam_dst_suffix="" dcpam_lib_suffix="" dcpam_bin_suffix="" else dcpam_dst_suffix=-$dcpam_suffix dcpam_lib_suffix=-$dcpam_suffix dcpam_bin_suffix=.$dcpam_suffix fi echo "set dcpam_dst_suffix=\"${dcpam_dst_suffix}\"", \ "set dcpam_lib_suffix=\"${dcpam_lib_suffix}\"", \ "set dcpam_bin_suffix=\"${dcpam_bin_suffix}\"" AC_SUBST(dcpam_dst_suffix) AC_SUBST(dcpam_lib_suffix) AC_SUBST(dcpam_bin_suffix) ############################################################ #== --with-lang_conform_check # DC_ARG_WITH(lang_conform_check, [language standard conformance checking [no]], ac_cv_lang_conform_check, [ac_cv_lang_conform_check=no] ) case $ac_cv_lang_conform_check in f95) case `uname -s` in Linux) if test X"$F90MODTYPE" = X"fqs.mod"; then SYSFFLAGS="$SYSFFLAGS -v95d,95o,95s" echo "set compile and link flags \"-v95d,95o,95s\"" elif test X"$F90MODTYPE" = X"std.mod" && test X"$FC" = X"g95" ; then SYSFFLAGS="$SYSFFLAGS -std=f95" echo "set compile and link flags \"-std=f95\"" elif test X"$F90MODTYPE" = X"std.mod" && test X"$FC" = X"ifort" ; then SYSFFLAGS="$SYSFFLAGS -stand 95 -e95" echo "set compile and link flags \"-stand 95 -e95\"" else AC_MSG_ERROR(I do not know language standard conformance checking options of your compiler) fi ;; *) AC_MSG_ERROR(I do not know language standard conformance checking options of your system) ;; esac ;; no) ;; *) echo -n 'reconfigure with --with-lang_conform_check={f95,no}' echo ' or --without-lang_conform_check' AC_MSG_ERROR(unknown lang_conform_check type) ;; esac ############################################################ #== --enable-diagmsg # DC_ARG_ENABLE(diagmsg, [Output diagnostic messages about the source program [disable]], ac_cv_diagmsg, [ac_cv_diagmsg=no] ) case $ac_cv_diagmsg in yes) case `uname -s` in Linux) if test X"$F90MODTYPE" = X"fqs.mod"; then case "$SYSFFLAGS" in *"-E cg"*) ;; *) SYSFFLAGS="$SYSFFLAGS -E cg";; esac echo "set compile and link flags \"-E cg\"" elif test X"$F90MODTYPE" = X"std.mod" && test X"$FC" = X"g95" ; then case "$SYSFFLAGS" in *"-Wall"*) ;; *) SYSFFLAGS="$SYSFFLAGS -Wall";; esac echo "set compile and link flags \"-Wall\"" elif test X"$F90MODTYPE" = X"std.mod" && test X"$FC" = X"ifort" ; then case "$SYSFFLAGS" in *"-warn all"*) ;; *) SYSFFLAGS="$SYSFFLAGS -warn all";; esac echo "set compile and link flags \"-warn all\"" else AC_MSG_ERROR(I do not know outputs diagnostic messages options of your compiler) fi ;; *) AC_MSG_ERROR(I do not know outputs diagnostic messages options of your system) ;; esac ;; no) ;; *) echo 'reconfigure with --enable-diagmsg or --disable-diagmsg' AC_MSG_ERROR(unknown diagmsg type) ;; esac ############################################################ #== --enable-debug # DC_ARG_ENABLE(debug, [Check Fortran source programs [disable]], ac_cv_debug, [ac_cv_debug=no] ) case $ac_cv_debug in yes) case `uname -s` in Linux) if test X"$F90MODTYPE" = X"fqs.mod"; then case "$SYSFFLAGS" in *"-E cg"*) ;; *) SYSFFLAGS="$SYSFFLAGS -E cg";; esac SYSFFLAGS="$SYSFFLAGS -g -H aesux" echo "set compile and link flags \"-E cg -g -H aesux\"" elif test X"$F90MODTYPE" = X"std.mod" && test X"$FC" = X"g95" ; then case "$SYSFFLAGS" in *"-Wall"*) ;; *) SYSFFLAGS="$SYSFFLAGS -Wall";; esac echo "set compile and link flags \"-Wall\"" elif test X"$F90MODTYPE" = X"std.mod" && test X"$FC" = X"ifort" ; then case "$SYSFFLAGS" in *"-warn all"*) ;; *) SYSFFLAGS="$SYSFFLAGS -warn all";; esac case "$SYSFFLAGS" in *"-traceback"*) ;; *) SYSFFLAGS="$SYSFFLAGS -warn all -traceback";; esac echo "set compile and link flags \"-warn all -traceback\"" else AC_MSG_ERROR(I do not know debug options of your compiler) fi ;; *) AC_MSG_ERROR(I do not know debug options of your system) ;; esac ;; no) ;; *) echo 'reconfigure with --enable-debug or --disable-debug' AC_MSG_ERROR(unknown debug type) ;; esac ############################################################ #== Care of some special Environments # case `uname -s` in Linux) if test X"$F90MODTYPE" = X"intel.d"; then case "$SYSLDLIBS$SYSLDFLAGS$SYSFFLAGS" in *-Vaxlib*) ;; *) SYSLDLIBS="$SYSLDLIBS -Vaxlib";; esac fi if test X"$F90MODTYPE" = X"fqs.mod"; then case "$SYSFFLAGS" in *-Am*) ;; *) SYSFFLAGS="$SYSFFLAGS -Am";; esac fi ;; esac AC_SUBST(SYSLDLIBS) AC_SUBST(SYSLDFLAGS) AC_SUBST(SYSFFLAGS) ############################################################ #== system dependent runtime selection (not checked) # #DC_ARG_WITH(getarg, [getarg runtime procedure], ac_cv_fortran_getarg, # ac_cv_fortran_getarg=common #) #SYSDEPARG=$ac_cv_fortran_getarg #case $SYSDEPARG in #common) echo 'sysdepargget() calls GETARG' ;; #*) echo 'reconfigure with --with-getarg={common}' # AC_MSG_ERROR(unknown getarg type) ;; #esac #AC_SUBST(SYSDEPARG) #DC_ARG_WITH(abort, [abort runtime procedure [abort]], ac_cv_fortran_abort, # ac_cv_fortran_abort=abort #) #SYSDEPABORT=$ac_cv_fortran_abort #case $SYSDEPABORT in #abort) echo 'sysdepabort() calls ABORT';; #errtra-setrcd) echo 'sysdepabort() calls ERRTRA/SETRCD/EXIT (intended for Lahey/Fujitsu Fortran)';; #exit) echo 'sysdepabort() calls EXIT (intended for Intel Fortran)';; #setrcd) echo 'sysdepabort() calls SETRCD/EXIT (intended for FQS Fortran)';; #stop) echo 'sysdepabort() executes STOP';; #*) echo 'reconfigure with --with-abort={abort,errtra-setrcd,exit,setrcd,stop}' # AC_MSG_ERROR(unknown abort type) ;; #esac #AC_SUBST(SYSDEPABORT) ############################################################ #== Some system commands #=== make # DC_ARG_WITH(make-cmd, ["make" command], ac_cv_make, [ ac_cv_make=make ]) if test X"${ac_cv_make}" != X"" ; then if which $ac_cv_make > /dev/null 2>&1 ; then MAKE=$ac_cv_make else AC_MSG_ERROR(make command \"$ac_cv_make\" is not found. Specify existing make command with --with-make-cmd=) fi else AC_MSG_ERROR(specify make command with --with-make-cmd=) fi AC_SUBST(MAKE) #=== ar # DC_ARG_WITH(ar-cmd, ["ar" command], ac_cv_ar, [ ac_cv_ar=ar ]) if test X"${ac_cv_ar}" != X"" ; then if which $ac_cv_ar > /dev/null 2>&1 ; then AR=$ac_cv_ar else AC_MSG_ERROR(ar command \"$ac_cv_ar\" is not found. Specify existing ar command with --with-ar-cmd=) fi else AC_MSG_ERROR(specify ar command with --with-ar-cmd=) fi AC_SUBST(AR) ############################################################ #== output # AC_OUTPUT(Config.mk:Config.mk.in) # ${MAKE:-make} ${CHARSET}