File: configure.ac

package info (click to toggle)
etsf-io 1.0.3-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 5,472 kB
  • ctags: 1,159
  • sloc: f90: 26,620; sh: 466; makefile: 439; ansic: 12
file content (194 lines) | stat: -rw-r--r-- 6,144 bytes parent folder | download | duplicates (2)
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)

dnl Init basic data for package
dnl define following variables :
dnl  - PACKAGE_NAME, the name ;
dnl  - PACKAGE_TARNAME, the name used for the tarball ;
dnl  - PACKAGE_VERSION, the version ;
dnl  - PACKAGE_STRING, the name + the version ;
dnl  - PACKAGE_BUGREPORT, the mail.
AC_INIT([ETSF - IO library], [1.0.3], [damien.caliste@cea.fr], [etsf_io])

dnl All temporary building files are put in this directory.
dnl his must be called before AM_INIT_AUTOMAKE
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([config/m4])

dnl Init something, don't know exactly what...
AM_INIT_AUTOMAKE

dnl Defining fortran language for tests.
AC_LANG(Fortran)
AC_FC_SRCEXT(f90)

dnl Set th default prefix to /opt (see the discussion
dnl on the nanoquanta mailing list of october 2006).
AC_PREFIX_DEFAULT(/opt)

dnl If FC environement variable is not already set, it
dnl looks for a modern Fortran compiler, prefering newest
dnl fortran available (e. g. Fortran95). Then FC variable
dnl is set.
AC_PROG_FC()
dnl Imported script from ABINIT to defined which compiler is under usage.
dnl It will define fc_type and fc_version that are required when installing.
ABI_PROG_FC()

dnl Set if the module name are capitalized or not with the FC compiler.
AC_MSG_CHECKING([for module extension for compiler '$fc_type'])
case "$fc_type" in
  "pathscale")
     capitalize_module=yes
     capitalize_module_ext="mod" ;;
  "open64")
     capitalize_module=yes
     capitalize_module_ext="mod" ;;
  *)
     capitalize_module=no
     capitalize_module_ext="mod" ;;
esac
AC_MSG_RESULT([$capitalize_module_ext])

dnl We custom the module naming scheme depending on the compiler
dnl and the platform.
dnl Not done yet
AM_CONDITIONAL(CAPITALIZE, test "$capitalize_module" = "yes")
AC_SUBST(MODULE_EXT, $capitalize_module_ext)

dnl Set the FCFLAGS and FFLAGS variable
if test -z "$FFLAGS" ; then
  AC_SUBST(FFLAGS, "-O2")
fi
if test -z "$FCFLAGS" ; then
  AC_SUBST(FCFLAGS, "-O2")
fi

dnl Look for ranlib and canonicalize it with the $host variable
AC_CHECK_TOOL(RANLIB, ranlib, :)
if test "$ranlib" = ":" ; then
  AC_MSG_ERROR(["No 'ranlib' program found."])
fi
dnl Look for ar and canonicalize it with the $host variable
AC_CHECK_TOOL(AR, ar, :)
if test "$ar" = ":" ; then
  AC_MSG_ERROR(["No 'ar' program found."])
fi

dnl Get the NetCDF module
AC_ARG_WITH(netcdf-module-path, AS_HELP_STRING([--with-netcdf-module-path], [Give the path of the NetCDF Fortran90 module (default = /usr/include).]),
            ac_netcdf_mod=$withval, ac_netcdf_mod=/usr/include)
AC_CHECK_FILE(${ac_netcdf_mod}/netcdf.mod, withnetcdf=yes, withnetcdf=no)
if test "$withnetcdf" = "no" ; then
  AC_CHECK_FILE(${ac_netcdf_mod}/NETCDF.mod, withnetcdf=yes, withnetcdf=no)
  if test "$withnetcdf" = "no" ; then
    AC_CHECK_FILE(${ac_netcdf_mod}/NETCDF.MOD, withnetcdf=yes, withnetcdf=no)
  fi
fi
if test "$withnetcdf" = "no" ; then
  echo "Action: install NetCDF and set its path with --with-netcdf-module-path."
  AC_MSG_ERROR(["No 'NetCDF' module found."])
fi
AC_SUBST(NETCDF_CFLAGS, "$ac_netcdf_mod")

dnl Get the NetCDF library
ac_netcdf_dir=/usr/lib
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).]),
            ac_netcdf_dir=$withval, ac_netcdf_dir=)
if test -n "$ac_netcdf_dir" ; then
  LDFLAGS="$LDFLAGS $ac_netcdf_dir"
fi
AC_MSG_CHECKING([for netcdf library])
FCFLAGS_SVG=$FCFLAGS
FCFLAGS="$FCFLAGS -I$ac_netcdf_mod"
LIBS_SVG=$LIBS
LIBS="$LIBS_SVG -lnetcdf"
AC_LINK_IFELSE([
program main
  use netcdf
  integer :: s, ncid
  s = nf90_open(path = "", mode = NF90_NOWRITE, ncid = ncid)
end program main
], withnetcdf="-lnetcdf", withnetcdf=no)
if test "$withnetcdf" = "no" ; then
  LIBS="$LIBS_SVG -lnetcdff -lnetcdf"
  AC_LINK_IFELSE([
program main
  use netcdf
  integer :: s, ncid
  s = nf90_open(path = "", mode = NF90_NOWRITE, ncid = ncid)
end program main
], withnetcdf="-lnetcdff -lnetcdf", withnetcdf=no)
fi
AC_MSG_RESULT([$withnetcdf])
if test "$withnetcdf" = "no" ; then
  echo "LDFLAGS was '$LDFLAGS'"
  echo "Action: install NetCDF and set the library link path with --with-netcdf-ldflags."
  AC_MSG_ERROR(["No 'NetCDF' library found."])
fi
FCFLAGS=$FCFLAGS_SVG
LIBS="$LIBS_SVG"$withnetcdf

dnl Test if only the library must be built
ac_build_tutorials="no"
AC_ARG_ENABLE(build-tutorials,
              AS_HELP_STRING([--enable-build-tutorials],
                             [Create the tutorial binaries (disable by default).]),
              ac_build_tutorials=$enableval, ac_build_tutorials="no")
AM_CONDITIONAL(BUILD_TUTORIALS, test "$ac_build_tutorials" = "yes")

dnl default installation directories
AC_ARG_WITH(moduledir,
            AS_HELP_STRING([--with-moduledir],
                           [installation directory for module files [[INCLUDEDIR/FC_TYPE]]]),
              ac_moduledir=$withval, ac_moduledir="no")
if test x"$ac_moduledir" != x"no" ; then
  moduledir=$ac_moduledir
else
  moduledir=${includedir}/${fc_type}
fi
AC_SUBST(moduledir)

dnl Append $FCFLAGS_SRCEXT to $FCFLAGS since the former is not
dnl added automatically in the Makefile.in.
FCFLAGS="$FCFLAGS $FCFLAGS_f90"

lowleveldocdir=$docdir"/low_level"
AC_SUBST(lowleveldocdir)
groupleveldocdir=$docdir"/group_level"
AC_SUBST(groupleveldocdir)
utilsdocdir=$docdir"/utils"
AC_SUBST(utilsdocdir)
tutorialsdocdir=$docdir"/tutorials"
AC_SUBST(tutorialsdocdir)

dnl Give the name of file.in to transform to file
AC_CONFIG_FILES([
Makefile
src/low_level/Makefile
src/group_level/Makefile
src/tutorials/Makefile
src/utils/Makefile
tests/low_level/Makefile
tests/group_level/Makefile
tests/utils/Makefile
doc/www/Makefile
doc/www/low_level/Makefile
doc/www/group_level/Makefile
doc/www/utils/Makefile
doc/www/tutorials/Makefile
])
AC_OUTPUT

echo "
Basics:
  Prefix:                 $prefix
  Fortran90 compiler:     $FC
  Fortran90 flags:        $FCFLAGS
  Linker flags:           $LDFLAGS
  Linked libraries:       $LIBS
  Installed module dir:   $moduledir
  Installed lib dir:      $libdir
  Installed doc dir:      $docdir
"