9
9
dnl - PACKAGE_VERSION, the version ;
10
10
dnl - PACKAGE_STRING, the name + the version ;
11
11
dnl - PACKAGE_BUGREPORT, the mail.
12
AC_INIT([ETSF - IO library], [1.0.3], [damien.caliste@cea.fr], [etsf_io])
12
AC_INIT([ETSF - IO library], [1.0.4], [https://bugs.launchpad.net/etsf-io], [etsf_io])
14
14
dnl All temporary building files are put in this directory.
15
15
dnl his must be called before AM_INIT_AUTOMAKE
16
AC_CONFIG_AUX_DIR(config)
16
AC_CONFIG_AUX_DIR([config])
17
17
AC_CONFIG_MACRO_DIR([config/m4])
19
19
dnl Init something, don't know exactly what...
20
AM_INIT_AUTOMAKE(1.10)
22
22
dnl Defining fortran language for tests.
26
26
dnl Set th default prefix to /opt (see the discussion
27
27
dnl on the nanoquanta mailing list of october 2006).
28
AC_PREFIX_DEFAULT(/opt)
28
AC_PREFIX_DEFAULT([/opt])
30
30
dnl If FC environement variable is not already set, it
31
31
dnl looks for a modern Fortran compiler, prefering newest
52
52
AC_MSG_RESULT([$capitalize_module_ext])
54
dnl We custom the module naming scheme depending on the compiler
54
dnl We customize the module naming scheme depending on the compiler
55
55
dnl and the platform.
57
57
AM_CONDITIONAL(CAPITALIZE, test "$capitalize_module" = "yes")
58
58
AC_SUBST(MODULE_EXT, $capitalize_module_ext)
60
dnl Set the FCFLAGS and FFLAGS variable
61
if test -z "$FFLAGS" ; then
62
AC_SUBST(FFLAGS, "-O2")
64
if test -z "$FCFLAGS" ; then
65
AC_SUBST(FCFLAGS, "-O2")
68
60
dnl Look for ranlib and canonicalize it with the $host variable
69
61
AC_CHECK_TOOL(RANLIB, ranlib, :)
70
if test "$ranlib" = ":" ; then
62
if test "$RANLIB" = ":" ; then
71
63
AC_MSG_ERROR(["No 'ranlib' program found."])
73
65
dnl Look for ar and canonicalize it with the $host variable
74
66
AC_CHECK_TOOL(AR, ar, :)
75
if test "$ar" = ":" ; then
67
if test "$AR" = ":" ; then
76
68
AC_MSG_ERROR(["No 'ar' program found."])
79
dnl Get the NetCDF module
80
AC_ARG_WITH(netcdf-module-path, AS_HELP_STRING([--with-netcdf-module-path], [Give the path of the NetCDF Fortran90 module (default = /usr/include).]),
81
ac_netcdf_mod=$withval, ac_netcdf_mod=/usr/include)
82
AC_CHECK_FILE(${ac_netcdf_mod}/netcdf.mod, withnetcdf=yes, withnetcdf=no)
83
if test "$withnetcdf" = "no" ; then
84
AC_CHECK_FILE(${ac_netcdf_mod}/NETCDF.mod, withnetcdf=yes, withnetcdf=no)
85
if test "$withnetcdf" = "no" ; then
86
AC_CHECK_FILE(${ac_netcdf_mod}/NETCDF.MOD, withnetcdf=yes, withnetcdf=no)
72
AC_ARG_WITH([netcdf-incs],
73
AS_HELP_STRING([--with-netcdf-incs],
74
[Include flags for the NetCDF Fortran90 modules (default = /usr/include).]),
75
[ac_netcdf_incs="$withval"],
76
[ac_netcdf_incs="-I/usr/include"])
77
AC_ARG_WITH([netcdf-libs],
78
AS_HELP_STRING([--with-netcdf-libs],
79
[NetCDF link flags.]),
80
[ac_netcdf_libs="$withval"],
82
AC_ARG_WITH([netcdf-prefix],
83
AS_HELP_STRING([--with-netcdf-prefix],
84
[Prefix directory where to look for NetCDF components.]),
85
[ac_netcdf_prefix="$withval"],
86
[ac_netcdf_prefix=""])
88
dnl Look for NetCDF parameters
89
if test "$ac_netcdf_prefix" != ""; then
90
AC_MSG_CHECKING([for nc-config (will override configure options)])
91
nc_config_bin="$ac_netcdf_prefix/bin/nc-config"
92
if test -x "$nc_config_bin"; then
94
ac_netcdf_incs="-I`$nc_config_bin --includedir`"
95
ac_netcdf_libs=`$nc_config_bin --flibs`
96
ac_netcdf_fcflags=`$nc_config_bin --fflags`
89
if test "$withnetcdf" = "no" ; then
90
echo "Action: install NetCDF and set its path with --with-netcdf-module-path."
91
AC_MSG_ERROR(["No 'NetCDF' module found."])
93
AC_SUBST(NETCDF_CFLAGS, "$ac_netcdf_mod")
95
dnl Get the NetCDF library
96
ac_netcdf_dir=/usr/lib
97
AC_ARG_WITH(netcdf-ldflags, AS_HELP_STRING([--with-netcdf-ldflags], [Give the flags required to link with the NetCDF library (default is -L/usr/lib).]),
98
ac_netcdf_dir=$withval, ac_netcdf_dir=)
99
if test -n "$ac_netcdf_dir" ; then
100
LDFLAGS="$LDFLAGS $ac_netcdf_dir"
102
AC_MSG_CHECKING([for netcdf library])
104
FCFLAGS="$FCFLAGS -I$ac_netcdf_mod"
106
LIBS="$LIBS_SVG -lnetcdf"
101
AC_MSG_CHECKING([for NetCDF includes])
102
AC_MSG_RESULT([$ac_netcdf_incs])
103
AC_MSG_CHECKING([for NetCDF libraries])
104
AC_MSG_RESULT([$ac_netcdf_libs])
105
AC_MSG_CHECKING([for NetCDF Fortran flags])
106
AC_MSG_RESULT([$ac_netcdf_fcflags])
107
AC_SUBST(NETCDF_INCLUDES, $ac_netcdf_incs)
109
dnl Set the FCFLAGS and FFLAGS variables
110
if test -z "$FCFLAGS" ; then
111
AC_SUBST(FCFLAGS, "$ac_netcdf_fcflags")
113
if test -z "$FFLAGS" ; then
114
AC_SUBST(FFLAGS, "$ac_netcdf_fcflags")
117
dnl Check whether NetCDF is working
118
AC_MSG_CHECKING([for NetCDF])
119
FCFLAGS_SVG="$FCFLAGS"
121
FCFLAGS="$FCFLAGS $ac_netcdf_incs"
122
LIBS="$ac_netcdf_libs $LIBS"
110
126
integer :: s, ncid
111
127
s = nf90_open(path = "", mode = NF90_NOWRITE, ncid = ncid)
113
], withnetcdf="-lnetcdf", withnetcdf=no)
114
if test "$withnetcdf" = "no" ; then
115
LIBS="$LIBS_SVG -lnetcdff -lnetcdf"
120
s = nf90_open(path = "", mode = NF90_NOWRITE, ncid = ncid)
122
], withnetcdf="-lnetcdff -lnetcdf", withnetcdf=no)
129
], withnetcdf="yes", withnetcdf="no")
124
130
AC_MSG_RESULT([$withnetcdf])
125
131
if test "$withnetcdf" = "no" ; then
126
echo "LDFLAGS was '$LDFLAGS'"
127
echo "Action: install NetCDF and set the library link path with --with-netcdf-ldflags."
132
echo "Action: install NetCDF and set its parameters through --with-netcdf-incs and --with-netcdf-libs."
128
133
AC_MSG_ERROR(["No 'NetCDF' library found."])
131
LIBS="$LIBS_SVG"$withnetcdf
133
136
dnl Test if only the library must be built
134
137
ac_build_tutorials="no"