configure.ac 18.7 KB
Newer Older
1
#  Process this file with autoconf to produce a configure script.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2
#
3 4 5 6
#  automake 1.16.1
#  autoconf 2.69
#  libtool  2.4.6

Ralf Mueller's avatar
Ralf Mueller committed
7
AC_PREREQ([2.70])
8
LT_PREREQ([2.4.6])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
9

Ralf Mueller's avatar
Ralf Mueller committed
10
AC_INIT([cdi],[1.9.10],[https://mpimet.mpg.de/cdi])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
11

12 13
AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version])

Uwe Schulzweida's avatar
Uwe Schulzweida committed
14 15
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"

Uwe Schulzweida's avatar
Uwe Schulzweida committed
16
CONFIG_ABORT=yes
17 18
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
19 20
dnl forbid acx macro names from remaining unexpanded
m4_pattern_forbid([^ACX_])
21 22 23
AC_CANONICAL_HOST
AC_CANONICAL_BUILD

Uwe Schulzweida's avatar
Uwe Schulzweida committed
24

Sergey Kosukhin's avatar
Sergey Kosukhin committed
25
AM_INIT_AUTOMAKE([1.16.1 foreign serial-tests])
26
AC_CONFIG_HEADERS([src/config.h])
27 28 29
AM_MAINTAINER_MODE([disable])

# Check building environment
Ralf Mueller's avatar
Ralf Mueller committed
30
AC_PROG_CC
31 32 33 34
dnl The check above forgets to delete the following directory
dnl generated by the MacOS linker, which results in multiple
dnl annoying messages from the rm utility:
rm -rf conftest.dSYM
35 36
dnl verify the setup supports POSIX 2001
ACX_PROG_CC_POSIX([2001])
37
AC_C_RESTRICT
38
AC_PROG_FC
39
AS_IF([test -n "$FC" && test "X$FC" != Xno],
40 41 42 43
  [AC_FC_SRCEXT([f90])
   AC_LANG_PUSH([Fortran])
   AC_PROG_FPP
   AC_LANG_POP([Fortran])])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
44
AC_PROG_F77
45 46
AC_PROG_CXX
AC_PROG_INSTALL
47 48 49 50 51 52 53

# Set up libtool.
AC_MSG_NOTICE([setting up libtool])
dnl before switching on libtool, identify compilers that prevent us from
dnl certain build configurations
ACX_LT_PROBLEMS
LT_INIT([pic-only])
54 55
dnl Clean up after Libtool checks:
rm -f a.out
56 57 58
dnl _KPSE_USE_LIBTOOL ensures libtool is also used for configure-time tests,
dnl which deduces dependent libraries automatically
_KPSE_USE_LIBTOOL
59 60 61 62 63 64 65 66 67 68 69 70 71
_KPSE_CHECK_LIBTOOL
AS_IF([test -n "$FC" && test "X$FC" != Xno],
  [AC_LANG_PUSH([Fortran])
   _KPSE_CHECK_LIBTOOL
   AC_LANG_POP([Fortran])])
AS_IF([test -n "$F77" && test "X$F77" != Xno],
  [AC_LANG_PUSH([Fortran 77])
   _KPSE_CHECK_LIBTOOL
   AC_LANG_POP([Fortran 77])])
AS_IF([test -n "$CXX" && test "X$CXX" != Xno],
  [AC_LANG_PUSH([C++])
   _KPSE_CHECK_LIBTOOL
   AC_LANG_POP([C++])])
72

73 74 75
# -----------------------------------------------------------------------
# Check endianess of system
AC_C_BIGENDIAN
76 77
#  ----------------------------------------------------------------------
# Check large file support on 32 bit systems
Uwe Schulzweida's avatar
Uwe Schulzweida committed
78
AC_SYS_LARGEFILE
79 80
#  ----------------------------------------------------------------------
# Checks for library functions.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
81
AC_FUNC_MMAP
82
#  ----------------------------------------------------------------------
83 84
# Checks for structures.
AC_CHECK_MEMBERS([struct stat.st_blksize])
85
#  ----------------------------------------------------------------------
Uwe Schulzweida's avatar
Uwe Schulzweida committed
86
# Checks for header files
87
AC_CHECK_HEADERS([malloc.h unistd.h sys/time.h],,,[AC_INCLUDES_DEFAULT])
88
AX_EXECINFO
89
#  ----------------------------------------------------------------------
Uwe Schulzweida's avatar
Uwe Schulzweida committed
90
# Checks for the availability of functions
91 92
AC_CHECK_FUNCS([mallinfo])
AC_CHECK_FUNCS([getline])
93 94 95
ACX_UUID
LIBS="${LIBS+$LIBS }$UUID_C_LIB"
CPPFLAGS="${CPPFLAGS+$CPPFLAGS }$UUID_C_INCLUDE"
96
#  ----------------------------------------------------------------------
97
# Checks for the availability of ANSI-C99 functions
98 99
AC_CHECK_DECLS([isnan],,,[AC_INCLUDES_DEFAULT
@%:@include <math.h>])
100

101 102 103 104 105
# check for sysconf names
AC_CHECK_DECLS([_SC_LARGE_PAGESIZE, PAGESIZE, PAGE_SIZE, _SC_PAGE_SIZE, dnl
_SC_PAGESIZE, _PC_REC_XFER_ALIGN, POSIX_REC_XFER_ALIGN],,,[AC_INCLUDES_DEFAULT
@%:@include <limits.h>
@%:@include <unistd.h>])
Thomas Jahns's avatar
Thomas Jahns committed
106 107
#
# Check for non-standard builtin
108 109 110 111 112 113 114 115 116 117 118 119 120
AS_FOR([builtin_macro],[builtin],[__builtin_ctz],
  [AS_VAR_PUSHDEF([builtin_cache],[acx_cv_have_decl_]builtin_macro)
   AC_CACHE_CHECK([whether ]builtin_macro[ is declared],
     [builtin_cache],
     [AC_LINK_IFELSE([AC_LANG_PROGRAM(,[  unsigned lbz = builtin_macro][[(56U)]])],
        [AS_VAR_SET([builtin_cache],[yes])],
        [AS_VAR_SET([builtin_cache],[no])])])
   AS_VAR_IF([builtin_cache],[yes],
     [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]),[1])
      break],
     [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]),[0])])])
AH_TEMPLATE([HAVE_DECL___BUILTIN_CTZ],
  [Define to 1 if __builtin_ctz is available, 0 if not])
Thomas Jahns's avatar
Thomas Jahns committed
121

122 123 124 125 126 127 128 129
# Check compiler version
case "$CC" in
  pgcc*)  COMP_VERSION=`$CC -V | head -2 | tail -n 1`;;
  *gcc*)  COMP_VERSION=`$CC --version | head -n 1`;;
  g++*)   COMP_VERSION=`$CC --version | head -n 1`;;
  clang*) COMP_VERSION=`$CC --version | head -n 1`;;
  sxc*)   COMP_VERSION=`$CC -V 2>&1   | tail -n 1`;;
  xlc*)   COMP_VERSION=`$CC -qversion 2>&1   | head -n 1`;;
130 131 132 133 134 135 136 137 138
  *)
     # 'head -n 1' exits after printing the first line, which closes the pipe
     # and kills the compiler's process leaving it no chance to clean any
     # temporary files it might have created (e.g. Intel compiler creates
     # 'a.out' when it is called with additional flags like -I, -L, etc.,
     # which is the case when $CC is an MPI wrapper). Therefore, we have to
     # run the processes one after another:
     COMP_VERSION=`$CC -V 2>&1`
     COMP_VERSION=`echo "$COMP_VERSION" | head -n 1` ;;
139 140 141 142 143
esac

if test -z "$COMP_VERSION" ; then COMP_VERSION="unknown"; fi;
AC_DEFINE_UNQUOTED(COMP_VERSION, ["$COMP_VERSION"], [Compiler version])

144
# Check for system type
145 146
AC_DEFINE_UNQUOTED([SYSTEM_TYPE],["$ac_cv_build"], [System type])
AC_SUBST([SYSTEM_TYPE],["$ac_cv_build"])
147 148 149
# -----------------------------------------------------------------------
# Check for math library and add -lm to LIBS
AC_SEARCH_LIBS(floor, m)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
150
#  ----------------------------------------------------------------------
151
# Add basic configure options
152
ACX_CDI_OPTIONS
153
AM_CONDITIONAL([ENABLE_NETCDF],[test x$ENABLE_NETCDF = xyes])
154
AC_CHECK_FUNCS([grib_get_length])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
155
#  ----------------------------------------------------------------------
156
# Compile with MPI support
157 158
AC_ARG_ENABLE([mpi],
  AS_HELP_STRING([--enable-mpi],
159
    [Compile with MPI compiler @<:@default=no@:>@]),,
160
    [enable_mpi=no])
161 162 163 164 165 166 167 168 169 170 171 172 173 174
AS_VAR_IF([enable_mpi], [yes],
  [ACX_C_PACKAGE([MPI],[mpi.h],,,
     [AC_MSG_FAILURE([Required header mpi.h not found or not compilable.])
      enable_MPI=no],
     [MPI_Waitall],[mpi mpich],,,
     [AC_MSG_FAILURE([Cannot link C MPI programs.])
      enable_MPI=no])
   AS_IF([test -n "$FC" && test "X$FC" != "Xno"],
     [ACX_FORTRAN_PACKAGE([MPI], [mpif.h],,,
        [AC_MSG_FAILURE([Required include mpif.h not found or not compilable.])
         enable_MPI=no],[mpi_waitall],
        [mpi mpi_f90 mpi_f77 mpich],[[-lmpi_f77 -lmpi],[-lmpi]],,
        [AC_MSG_FAILURE([Cannot link Fortran MPI programs.])
         enable_MPI=no],[])])])
175 176
AS_IF([test x"${enable_mpi}" = x"yes"],
      [USE_MPI=yes])
177
HAVE_PARALLEL_NC4=0
178
enable_ppm=no
179
AS_IF([test x"$USE_MPI" = xyes],
180
  [AC_DEFINE([USE_MPI],[1],[parallel I/O requested and available])
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
   AC_PATH_PROGS([MPI_LAUNCH],[mpirun mpiexec],[true])
   AS_IF([test x"$cross_compiling" = xno],
     [AC_MSG_CHECKING([if $MPI_LAUNCH works])
      saved_CFLAGS=$CFLAGS
      saved_LIBS=$LIBS
      CFLAGS="$CFLAGS $MPI_C_INCLUDE"
      LIBS="$LIBS $MPI_C_LIB"
      AC_LINK_IFELSE([AC_LANG_SOURCE([
@%:@include <stdio.h>
@%:@include <stdlib.h>

@%:@include <mpi.h>

@%:@define xmpi(ret)           \\
  do {                      \\
    if (ret != MPI_SUCCESS) \\
      exit(EXIT_FAILURE);   \\
  } while (0)

int
main(int argc, char **argv)
{
  xmpi(MPI_Init(&argc, &argv));
  char *numarg = argv@<:@1@:>@;
  int cmdnum = atoi(numarg);
  int procnum = 1;
  xmpi(MPI_Allreduce(MPI_IN_PLACE, &procnum, 1, MPI_INT, MPI_SUM,
                     MPI_COMM_WORLD));
  xmpi(MPI_Finalize());
  return (procnum == cmdnum)?EXIT_SUCCESS:EXIT_FAILURE;
}
])],
         [AS_IF([$MPI_LAUNCH -n 4 ./conftest$EXEEXT 4],
            [AC_MSG_RESULT([yes])],
            [AC_MSG_RESULT([no])
             AC_MSG_FAILURE([mpirun doesn't work])])],
         [AC_MSG_FAILURE([Cannot compile simple MPI program])])
      CFLAGS=$saved_CFLAGS
      LIBS=$saved_LIBS
     ])
   AS_IF([test "x$MPI_LAUNCH" = xtrue],
     [AC_MSG_WARN([MPI launch command unavailable])])

224 225 226
   PKG_CHECK_MODULES([YAXT],[yaxt],
     [AC_DEFINE([HAVE_YAXT],,[yaxt library is available])],
     [AC_MSG_FAILURE([Required yaxt library unavailable.])])
227 228 229 230 231 232
   AS_IF([test x"$ENABLE_NC4" = xyes],
     [AC_CHECK_HEADERS([netcdf_par.h],
        [AC_CHECK_DECL([MPI_Bcast],
           [HAVE_PARALLEL_NC4=1],
           [AC_MSG_WARN([The supplied netCDF library does not support MPI parallel invocations])],
           [AC_INCLUDES_DEFAULT
233
@%:@include <netcdf.h>
234 235 236
@%:@include <netcdf_par.h>])],
           [AC_MSG_WARN([The supplied netCDF library does not support MPI parallel invocations])],
           [AC_INCLUDES_DEFAULT
237 238 239
@%:@ifdef HAVE_NETCDF_H
@%:@include <netcdf.h>
@%:@endif])
240 241
      dnl parallel netCDF support still requires ScalES-PPM and YAXT to
      dnl re-arrange the data when running with more than one collector
242 243 244 245 246 247
      PKG_CHECK_MODULES([PPM_CORE],[scales-ppm-core],
        [enable_ppm=yes
         AC_DEFINE([HAVE_PPM_CORE],,
           [ScalES PPM C core library is available])
        ],
        [enable_ppm=no])
248 249
      dnl if not both scales-ppm and yaxt are available, netcdf can only be
      dnl used in serial mode
250
      AS_IF([test x$enable_ppm != xyes],
251 252 253
        [HAVE_PARALLEL_NC4=0])
     ])
  ],
254 255
  [MPI_LAUNCH="`pwd`/util/serialrun"
   AC_SUBST([MPI_LAUNCH])])
256 257 258 259
AS_IF([test $HAVE_PARALLEL_NC4 -gt 0],
  [AC_DEFINE([HAVE_PARALLEL_NC4],[1],
             [netCDF library does support MPI parallel invocations])])
AC_SUBST([HAVE_PARALLEL_NC4])
260
AM_CONDITIONAL([USE_MPI],[test x"$USE_MPI" = xyes])
261
AM_CONDITIONAL([USE_PPM_CORE],[test $enable_ppm = yes])
262
AM_CONDITIONAL([HAVE_PARALLEL_NC4],[test $HAVE_PARALLEL_NC4 -gt 0])
263
AC_SUBST([USE_MPI])
264
AC_SUBST([ENABLE_MPI],[`test x"$enable_mpi" = xyes && echo true || echo false`])
265 266 267 268 269 270 271
AC_SUBST([LIBRT])
AM_COND_IF([USE_MPI],
  [LIBRT=
   LIBS_save=$LIBS
   AC_SEARCH_LIBS([aio_suspend], [rt],
     [test "$ac_res" = "none required" || LIBRT=$ac_res])
   LIBS=$LIBS_save])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
272 273
#  ----------------------------------------------------------------------
#  Create the Fortran Interface via iso_c_binding module (Fortran 2003 Standard)
274
#
Thomas Jahns's avatar
Thomas Jahns committed
275 276 277 278 279
AC_ARG_ENABLE([iso-c-interface],
              [AS_HELP_STRING([--enable-iso-c-interface],
                 [Create Fortran Interface via iso_c_bindings facility of F2003 [default=no].])],
              [enable_isoc=${enableval}],[enable_isoc=no])
AS_IF([test x"$enable_isoc" = xyes],
280 281 282 283
  [AS_IF([test -z "$FC" || test "X$FC" = "Xno"],
     [AC_MSG_FAILURE([Fortran compiler not found or disabled: either disable dnl
Fortran 2003 interface (--disable-iso-c-interface) or set FC accordingly])])
   ACX_FC_CHECK_STRPTR_CONVERT([],
284 285 286
     [AC_MSG_FAILURE([the Fortran compiler cannot handle complex CHARACTER dnl
interoperability: disable Fortran 2003 interface (--disable-iso-c-interface)])])],
  [enable_isoc=no])
287
AM_CONDITIONAL([CREATE_ISOC],[test "x$enable_isoc" = 'xyes'])
Thomas Jahns's avatar
Thomas Jahns committed
288 289
AC_SUBST([ENABLE_F2003_ISOC],[$enable_isoc])
AM_SUBST_NOTMAKE([ENABLE_F2003_ISOC])
290 291 292 293 294 295 296 297 298 299
# in case the Fortran interface uses the more modern F90-style interface,
# the FCFLAGS for users of the library have to include a switch to use the
# .mod file
CDI_F90_INTERFACE_FCFLAGS=''
AS_IF([test "x${enable_isoc}" = "xyes"],
  [AC_LANG_PUSH([Fortran])
   ACX_SL_FC_CHECK_MOD_PATH_FLAG
   AC_LANG_POP([Fortran])
   CDI_F90_INTERFACE_FCFLAGS="${FC_MOD_FLAG}${includedir}"])
AC_SUBST([CDI_F90_INTERFACE_FCFLAGS])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
300
#  Check the module extension of the fortran compiler
301
AS_IF([test -n "$FC" && test "X$FC" != "Xno"],
302 303
  [ACX_SL_FC_MOD_SUFFIX(,[FCMODEXT=mod])])
AM_CONDITIONAL([FORTRAN_MOD_UC],[test "x$FCMODCASE" = "xuc"])
304
# -----------------------------------------------------------------------
305 306
# Check for SWIG - Generator for script-language bindings
AC_ARG_ENABLE(swig,
307 308 309 310
              [AS_HELP_STRING([--enable-swig],[use swig to create extra bindings [default=no] (EXPERIMENTAL)])],
              [AC_CHECK_PROG(SWIG,swig,swig)],
              [enable_swig=no])
AM_CONDITIONAL(ENABLE_SWIG,[test "x$SWIG" != "x"])
311 312
#  ----------------------------------------------------------------------
#  Create the Ruby Interface via swig
313 314
#
AC_ARG_ENABLE([ruby],
315
  [AS_HELP_STRING([--enable-ruby],[ruby language bindings [default=no] (EXPERIMENTAL)])],
316 317
  [AC_CHECK_PROG([RUBY],[ruby],[ruby])
   RUBY_INCLUDES="$($RUBY $srcdir/config/interface.rb)"
318 319
   save_CPPFLAGS=$CPPFLAGS
   CPPFLAGS="$CPPFLAGS $RUBY_INCLUDES"
320
   AC_CHECK_HEADER([ruby.h],,[enable_ruby=no], [AC_INCLUDES_DEFAULT])
321 322 323
   CPPFLAGS=$save_CPPFLAGS
   AS_IF([test "x$RUBY" != "x"],
         [AS_IF([test "x$SWIG" = "x"],
324
                [AC_MSG_ERROR([Ruby bindings: Please enable SWIG with '--enable-swig'!])])],
325 326 327 328 329 330 331
                [AS_IF([test `$SWIG -help 2>&1 | $GREP -c '\-ruby *- Generate'` = 0],
                       [AC_MSG_NOTICE([No (swig does not support -ruby option)])
                        enable_ruby=no
                       ])])],
  [enable_ruby=no])
AM_CONDITIONAL(ENABLE_RUBY,[test "x$enable_ruby" != "xno"])
AS_IF([test "x$enable_ruby" != "xno"],[AC_SUBST([ENABLE_RUBY],[true])],[AC_SUBST([ENABLE_RUBY],[false])])
332 333 334 335
# Ruby is also used for the Fortran 2003 ISO C generator in maintainer mode.
# Report properly if it's missing:
AS_VAR_IF([RUBY], [], [AS_UNSET([RUBY])])
AM_MISSING_PROG([RUBY], [ruby])
336
#  ----------------------------------------------------------------------
337
#  Create the Python Interface via swig
338
AC_ARG_ENABLE(python,
339
  [AS_HELP_STRING([--enable-python],[python language bindings [default=no] (EXPERIMENTAL)])],
340
  [AC_CHECK_PROG(PYTHON,python,python)
Thomas Jahns's avatar
Thomas Jahns committed
341 342
   enable_python=no
   for PYTHON_INCLUDES in \
343 344
     "-I`$PYTHON -c 'from distutils import sysconfig;print(sysconfig.get_python_inc())'`" \
     "-I`$PYTHON -c 'from distutils import sysconfig;print(sysconfig.get_python_lib(1,1))' | $SED 's/lib/include/'`"
Thomas Jahns's avatar
Thomas Jahns committed
345 346 347 348
   do
     save_CPPFLAGS=$CPPFLAGS
     CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
     AC_CHECK_HEADER([Python.h],[enable_python=yes
349
       break],,[AC_INCLUDES_DEFAULT])
Thomas Jahns's avatar
Thomas Jahns committed
350 351 352
     CPPFLAGS=$save_CPPFLAGS
   done
   AS_IF([test "x$enable_python" != "xno"],
353
         [AS_IF([test "x$SWIG" = "x"],
354
                [AC_MSG_ERROR([Python bindings: Please enable SWIG with '--enable-swig'!])],
Thomas Jahns's avatar
Thomas Jahns committed
355
                [PYTHON=])],
356 357 358 359 360 361 362 363 364
                [AS_IF([test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0],
                       [AC_MSG_NOTICE([No (swig does not support -python option)])
                        enable_python=no
                       ])])],
  [enable_python=no])
AM_CONDITIONAL(ENABLE_PYTHON, [test "x$enable_python" != "xno"])
AS_IF([test "x$enable_python" != "xno"],[AC_SUBST([ENABLE_PYTHON],[true])],[AC_SUBST([ENABLE_PYTHON],[false])])
#  ----------------------------------------------------------------------
AM_CONDITIONAL(CREATE_INTERFACES, [test  "x$enable_ruby" = "xyes" -o "x$enable_python" = "xyes"])
365 366 367 368 369 370 371
#  ----------------------------------------------------------------------
#  Create the CDI Fortran77 Interface via cfortran.h
AC_ARG_ENABLE([cf-interface],
              [AS_HELP_STRING([--disable-cf-interface],
                              [Omit building of cfortran Interface])],
              [enable_cfinterface=${enableval}],[enable_cfinterface=yes])
AS_IF([test "x${enable_cfinterface}" = "xyes"], [
Thomas Jahns's avatar
Thomas Jahns committed
372 373 374 375 376 377 378 379
dnl ######################################################################
dnl Test whether cfortran.h works correctly
dnl ######################################################################
ACX_FIND_CFORTRAN_DEF
ACX_XLF_QEXTNAME_ADD_APPENDUS
AS_IF([test -n "$FC" -a X"$FC" != Xno -o -n "$F77" -a X"$F77" != Xno],
  [ACX_CHECK_CFORTRAN([$srcdir/src],
    [AC_DEFINE([HAVE_CF_INTERFACE],[1],
380 381 382 383 384 385 386 387 388 389 390
       [Defined to 1 if C / Fortran interface cfortran.h works])],
    [AS_CASE([x"$acx_cv_cfortran_works"],
       [x"error"],
       [AC_MSG_NOTICE([Linking/Running with C EXTERNAL built with cfortran.h does not work!])],
       [x"compiling with cfortran.h failed"],
       [AC_MSG_NOTICE([Compilation with cfortran.h is not working!])],
       [x"error compiling Fortran subroutine"],
       [AC_MSG_NOTICE([compilation of simple Fortran source failed!])],
       [AC_MSG_NOTICE([Unexpected error when linking C and Fortran via cfortran.h!])])
     AC_MSG_NOTICE([Disabling cfortran.h bindings generation])
     acx_cv_cfortran_works=no])])
391
])
Thomas Jahns's avatar
Thomas Jahns committed
392
AM_CONDITIONAL([USE_FC],[test -n "$FC" -a X"$FC" != Xno -a x"$acx_cv_cfortran_works" = xyes])dnl
393 394 395
dnl
AC_SUBST([CPPFLAGS])dnl
dnl
396 397 398 399 400
m4_foreach([build_flag_var],[[BUILD_CFLAGS],[BUILD_FCFLAGS],[BUILD_LDFLAGS],[BUILD_LIBS],[BUILD_MPI_C_LIB],[BUILD_MPI_FC_LIB],[BUILD_C_INCLUDE],[BUILD_FC_INCLUDE]],
  [AC_ARG_VAR(build_flag_var,
     [append to ]m4_bpatsubst(build_flag_var, [BUILD_], [])[ during build but not in configure phase])dnl
AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_flag_var, [BUILD_], [])[="$]m4_bpatsubst(build_flag_var, [BUILD_], [])[$]{build_flag_var+ $build_flag_var[}"])dnl
AM_SUBST_NOTMAKE(build_flag_var)])dnl
401

402 403 404 405 406 407 408 409
m4_foreach([build_tool_var],[[BUILD_CC],[BUILD_CXX],[BUILD_FC],[BUILD_F77]],
  [AC_ARG_VAR(build_tool_var,
     [replace ]m4_bpatsubst(build_tool_var, [BUILD_], [])[ with expansion of $]build_tool_var[ during build but not in configure phase])dnl
AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_tool_var, [BUILD_], [])[="$]{build_tool_var-$[]m4_bpatsubst(build_tool_var, [BUILD_], [])}["])dnl
AM_SUBST_NOTMAKE(build_tool_var)])dnl
dnl
dnl
dnl
410 411 412 413
# Checks for compiler
COMPILER="$CC $CFLAGS"
AC_DEFINE_UNQUOTED(COMPILER, ["$COMPILER"], [Compiler])

414 415 416 417 418 419
AC_CONFIG_FILES([tests/test_cksum_grib \
                 tests/test_cksum_nc \
                 tests/test_cksum_nc2 \
                 tests/test_cksum_nc4 \
                 tests/test_cksum_extra \
                 tests/test_cksum_service \
420
                 tests/test_cksum_ieg \
421
                 tests/test_chunk_cksum \
Thomas Jahns's avatar
Thomas Jahns committed
422
                 tests/test_f2003 \
423
                 tests/pio_write_run \
Thomas Jahns's avatar
Thomas Jahns committed
424
                 tests/pio_write_deco2d_run \
Thomas Jahns's avatar
Thomas Jahns committed
425
                 tests/pio_cksum_mpinonb \
426
                 tests/pio_cksum_mpi_fw_ordered \
427
                 tests/pio_cksum_mpi_fw_at_all \
428
                 tests/pio_cksum_mpi_fw_at_reblock \
Thomas Jahns's avatar
Thomas Jahns committed
429 430 431
                 tests/pio_cksum_fpguard \
                 tests/pio_cksum_asynch \
                 tests/pio_cksum_writer \
432
                 tests/pio_cksum_cdf \
Thomas Jahns's avatar
Thomas Jahns committed
433 434
                 tests/test_byteswap_run \
                 tests/test_resource_copy_run \
435
                 tests/test_resource_copy_mpi_run \
436
                 tests/test_cdf_transformation \
437
                 tests/test_cdf_const \
Thomas Jahns's avatar
Thomas Jahns committed
438
                 tests/test_table_run \
439
                 tables/gen_tableheaderfile \
440
                 util/serialrun],[chmod a+x "$ac_file"])
441

Ralf Mueller's avatar
Ralf Mueller committed
442
AC_CONFIG_FILES([Makefile src/Makefile interfaces/Makefile app/Makefile \
443
	tests/Makefile examples/Makefile cdi.settings \
444 445
	examples/pio/Makefile src/pkgconfig/cdi.pc src/pkgconfig/cdipio.pc \
        src/pkgconfig/cdi_f2003.pc])
Ralf Mueller's avatar
Ralf Mueller committed
446
AC_OUTPUT
Uwe Schulzweida's avatar
Uwe Schulzweida committed
447

448 449 450
#  ----------------------------------------------------------------------
#  Show configuration
AC_MSG_NOTICE([CDI is configured with the following options:])
451
./config.status cdi.settings
452
cat cdi.settings
453

454 455
AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
      [AC_MSG_NOTICE([
456

457 458
  Warning: The C compiler does not accept ANSI C99 source code!
])])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
459 460 461 462 463 464
AC_MSG_NOTICE([

  Configuration completed.

    You can now say 'make' to compile the CDI package and 'make install' to install it afterwards.
])