File: configure.ac

package info (click to toggle)
libfvm 0.15.0-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,472 kB
  • ctags: 1,722
  • sloc: ansic: 38,357; sh: 10,533; makefile: 202
file content (471 lines) | stat: -rw-r--r-- 14,474 bytes parent folder | download
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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# Process this file with autoconf to produce a configure script.

#------------------------------------------------------------------------------
#   This file is part of the "Finite Volume Mesh" library, intended to provide
#   finite volume mesh and associated fields I/O and manipulation services.
#
#   Copyright (C) 2004-2009  EDF
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2.1 of the License, or (at your option) any later version.
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Lesser General Public License for more details.
#
#   You should have received a copy of the GNU Lesser General Public
#   License along with this library; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Initialization
#------------------------------------------------------------------------------

m4_define([fvm_licence_c_comment],
[/*
  This file is part of the "Finite Volume Mesh" library, intended to provide
  finite volume mesh and associated fields I/O and manipulation services.

  Copyright (C) 2004-2009  EDF

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/])

m4_define([fvm_major_version], [0])
m4_define([fvm_minor_version], [15])
m4_define([fvm_release_version], [0])
m4_define([fvm_version_extra], [])
m4_define([fvm_version_string],
          [fvm_major_version.fvm_minor_version.fvm_release_version@&t@fvm_version_extra])

AC_INIT([fvm],[fvm_version_string],[yvan.fournier@edf.fr])
AC_CONFIG_SRCDIR([src/fvm_defs.h])

# Use the config directory for libtool stuff ...
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AC_SUBST(ac_aux_dir)

AC_CANONICAL_TARGET
AC_CONFIG_HEADERS([fvm_config_priv.h:fvm_config_priv.h.in])

AM_INIT_AUTOMAKE

AH_TOP([#ifndef __FVM_CONFIG_PRIV_H__
#define __FVM_CONFIG_PRIV_H__

/*
  This file is part of the "Finite Volume Mesh" library, intended to provide
  finite volume mesh and associated fields I/O and manipulation services.
*/])

AH_BOTTOM([#endif /* __FVM_CONFIG_PRIV_H__ */])

#Define public configuration file

FVM_AC_CONFIG_PUBL_INIT([fvm_config.h])
FVM_AC_CONFIG_PUBL_VERBATIM([fvm_licence_c_comment])

AM_MAINTAINER_MODE

# Version information

FVM_AC_CONFIG_PUBL_DEFINE_STRING(FVM_VERSION, fvm_version_string,
                                 [Complete version number])

FVM_AC_CONFIG_PUBL_DEFINE(FVM_MAJOR_VERSION, fvm_major_version,
                          [Major version number])
FVM_AC_CONFIG_PUBL_DEFINE(FVM_MINOR_VERSION, fvm_minor_version,
                          [Minor version number])
FVM_AC_CONFIG_PUBL_DEFINE(FVM_RELEASE_VERSION, fvm_release_version,
                          [Release version number])

#------------------------------------------------------------------------------
# Checks for programs.
#------------------------------------------------------------------------------

user_CPPFLAGS=$CPPFLAGS
user_CFLAGS=$CFLAGS
user_LDFLAGS=$LDFLAGS

AC_PROG_CC(cc gcc)
AC_PROG_INSTALL
AC_PROG_LN_S

AM_PROG_CC_C_O

# Debug or production compilation mode (debug by default) ?

AC_ARG_ENABLE(debug,
  [  --enable-debug          enable debugging (reduces optimization)],
  [
    case "${enableval}" in
      yes) debug=true ;;
      no)  debug=false ;;
      *)   AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
    esac
  ],
  [ debug=false ]
)
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)

# Optionally deactivate automatic determination of flags on known systems

AC_ARG_ENABLE(auto-flags,
  [  --disable-auto-flags    do not define *FLAGS on known systems],
  [
    case "${enableval}" in
      yes) auto_flags=true ;;
      no)  auto_flags=false ;;
      *)   AC_MSG_ERROR([bad value ${enableval} for --enable-auto-flags]) ;;
    esac
  ],
  [ auto_flags=true ]
)

# Default compiler options (may be modified
# by defining CFLAGS in the environment)
#------------------------------------------

if test "x$auto_flags" = "xtrue" ; then

  # Source associated recommended compiler options

  if test -f "$srcdir/config/fvm_auto_flags.sh" ; then
    AC_MSG_NOTICE([sourcing config/fvm_auto_flags.sh (test for known compilers)])
    . "$srcdir/config/fvm_auto_flags.sh"
  else
    AC_MSG_WARN([config/fvm_auto_flags.sh default configuration file not found])
  fi

  if test "x$user_CPPFLAGS" = "x"; then
    CPPFLAGS="$cppflags_default"
  else
    AC_MSG_NOTICE([default CPPFLAGS overridden by user definition])
  fi

  if test "x$user_CFLAGS" = "x"; then

    CFLAGS="$cflags_default"

    if test "x$debug" = xtrue; then
      CFLAGS="${CFLAGS} $cflags_default_dbg"
    else
      CFLAGS="${CFLAGS} $cflags_default_opt"
    fi

  else

    AC_MSG_NOTICE([default CFLAGS overridden by user definition])

  fi

  if test "x$user_LDFLAGS" = "x"; then

    LDFLAGS="$ldflags_default"

    if test "x$debug" = xtrue; then
      LDFLAGS="${LDFLAGS} $ldflags_default_dbg"
    else
      LDFLAGS="${LDFLAGS} $ldflags_default_opt"
    fi

  else

    AC_MSG_NOTICE([default LDFLAGS overridden by user definition])

  fi

fi

LIBS="${LIBS} -lm"

# Optional additional user flags
#-------------------------------

AC_ARG_VAR(CPP_ADD,  [Additional user C preprocessor flags])
AC_ARG_VAR(CC_ADD,   [Additional user C compiler flags])
AC_ARG_VAR(LD_ADD,   [Additional user linker flags, e.g. -L<libdir>])
AC_ARG_VAR(LIBS_ADD, [Additional user librairies, e.g. -l<lib>])

if test "x$CPP_ADD" != x ; then
  CPPFLAGS="${CPPFLAGS} $CPP_ADD"
fi

if test "x$CC_ADD" != x ; then
  CFLAGS="${CFLAGS} $CC_ADD"
fi

if test "x$LD_ADD" != x ; then
  LDFLAGS="${LDFLAGS} $LD_ADD"
fi

if test "x$LIBS_ADD" != x ; then
  LIBS="${LIBS} $LIBS_ADD"
fi

#------------------------------------------------------------------------------

# We may only turn on processing for libtool now that the basic compiler
# and linker flags are set (to avoid issues with linkers with different
# modes such as 32 and 64 bit which may be modified by compiler or
# linker flags).

# AC_DISABLE_SHARED may not be used inside a test, as it seems to
# take effect whether the result is true or not (maybe due to a bug),
# so we directly use autoconf's enable_shared variable.

if test "x$fvm_disable_shared" = "xyes" ; then
  enable_shared=no
fi

LT_INIT

#------------------------------------------------------------------------------
# Checks for libraries.
#------------------------------------------------------------------------------

# Check for BFT (modifies CPPFLAGS, LDFLAGS, and LIBS)
#-----------------------------------------------------

FVM_AC_TEST_BFT(["1.0.0"])

# syntax with maximum version check: FVM_TEST_BFT(["0.0.0"], ["0.1.0"])

# Check for optionnal HDF support

FVM_AC_TEST_HDF5

# Check for optionnal CGNS support

FVM_AC_TEST_CGNS

# Check for optionnal MED support

FVM_AC_TEST_MED

#------------------------------------------------------------------------------
# Checks for header files.
#------------------------------------------------------------------------------

AC_HEADER_STDC
AC_CHECK_HEADERS([sys/types.h stddef.h])

#------------------------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
#------------------------------------------------------------------------------

AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_HEADER_TIME
AC_HEADER_STDBOOL

AC_CHECK_TYPES([long long, unsigned long long])
AC_CHECK_TYPES([int32_t])
AC_CHECK_TYPES([int64_t])
AC_CHECK_TYPES([uint32_t])
AC_CHECK_TYPES([uint64_t])
AC_CHECK_TYPES([ptrdiff_t])

FVM_AC_CHECK_SIZEOF([void *], [fvm])
FVM_AC_CHECK_SIZEOF([short], [fvm])
FVM_AC_CHECK_SIZEOF([int], [fvm])
FVM_AC_CHECK_SIZEOF([long], [fvm])
FVM_AC_CHECK_SIZEOF([long long], [fvm])
FVM_AC_CHECK_SIZEOF([float], [fvm])
FVM_AC_CHECK_SIZEOF([double], [fvm])

# Use long global numbers ?

FVM_AC_SET_GNUM

#------------------------------------------------------------------------------
# Checks for library functions.
#------------------------------------------------------------------------------

AC_CHECK_FUNCS([mkdir])
AC_CHECK_FUNCS([snprintf])

#------------------------------------------------------------------------------
# Checks for system services.
#------------------------------------------------------------------------------

#---------------------
# optional MPI support (use CC=mpicc with configure if necessary)
#---------------------

MPI_CPPFLAGS=""
MPI_LDFLAGS=""
MPI_LIBS=""

FVM_AC_TEST_MPI

# Whether we used mpicc or $CC, we now know if we have MPI support
FVM_AC_CONFIG_PUBL_SET(FVM_HAVE_MPI, $fvm_have_mpi,
                       [FVM library configured with MPI support ?])
if test "x$fvm_have_mpi" = "xyes" ; then
  FVM_AC_CONFIG_PUBL_SET(FVM_HAVE_MPI_IO, $fvm_have_mpi_io,
                         [FVM library configured with MPI IO support ?])
  FVM_AC_CONFIG_PUBL_SET(FVM_HAVE_MPI_ONE_SIDED, $fvm_have_mpi_one_sided,
                         [FVM library configured with MPI One-sided support ?])
fi

#------------------------------------------------------------------------------
# Internationalization
#------------------------------------------------------------------------------

if test "${prefix}" = "NONE"; then
  localedir="/usr/local/share/locale"
else
  localedir="${prefix}/share/locale"
fi
AC_DEFINE_UNQUOTED(LOCALEDIR, "${localedir}", LOCALEDIR)

# Set of available languages now in po/LINGUAS.

# AM_GNU_GETTEXT

#------------------------------------------------------------------------------
# Compiler options and system characteristics
#------------------------------------------------------------------------------

AC_SUBST(CPPFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)

#------------------------------------------------------------------------------
# Output
#------------------------------------------------------------------------------

# Determine CPPFLAGS, and LDFLAGS required for external code using FVM
#---------------------------------------------------------------------

for flag in [$CPPFLAGS] ; do
  case [$flag] in
    -I* | -isystem*)
    user_cppflags="${user_cppflags} $flag"
    ;;
  esac
done

for flag in [$LDFLAGS] ; do
  case [$flag] in
    -L* | -Wl,-L*)
    user_ldflags="${user_ldflags} $flag"
    ;;
  esac
done

# Output configuration info script
#---------------------------------

FVM_AC_CONFIG_INFO_INIT([fvm-config])

FVM_AC_CONFIG_INFO_EXTRA([
# use debugging code:                         "$debug"
# MPI (Message Passing Interface) support:    "$fvm_have_mpi"
# HDF5 (Hierarchical Data Format) support:    "$have_hdf5"
# CGNS (CFD General Notation System) support: "$have_cgns"
# MED (Model for Exchange of Data) support:   "$have_med"
])

FVM_AC_CONFIG_INFO_CC([${CC}], [${fvm_ac_cc_version}], [${fvm_ac_cc_version_full}])

FVM_AC_CONFIG_INFO_VERSION([fvm_version_string])

FVM_AC_CONFIG_INFO_DIRS([$prefix], [$exec_prefix], [$includedir], [$libdir])

FVM_AC_CONFIG_INFO_FLAGS([$user_cppflags], [], [$user_ldflags], [$LIBS])

FVM_AC_CONFIG_INFO_FLAGS([$CPPFLAGS], [$CFLAGS], [$LDFLAGS], [$LIBS],
                         [build])

FVM_AC_CONFIG_INFO_FLAGS([$BFT_CPPFLAGS], [], [$BFT_LDFLAGS], [$BFT_LIBS],
                         [bft])

FVM_AC_CONFIG_INFO_FLAGS([$MPI_CPPFLAGS], [], [$MPI_LDFLAGS], [$MPI_LIBS],
                         [mpi])

FVM_AC_CONFIG_INFO_FLAGS([$HDF5_CPPFLAGS], [], [$HDF5_LDFLAGS], [$HDF5_LIBS],
                         [hdf5])

FVM_AC_CONFIG_INFO_FLAGS([$CGNS_CPPFLAGS], [], [$CGNS_LDFLAGS], [$CGNS_LIBS],
                         [cgns])

FVM_AC_CONFIG_INFO_FLAGS([$MED_CPPFLAGS], [], [$MED_LDFLAGS], [$MED_LIBS],
                         [med])

FVM_AC_CONFIG_INFO_FINALIZE

#------------------------------------------------------------------------------

# If we use GNU gettext, we need intl/Makefile, po/Makefile, and m4/Makefile.

# AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile
#                  intl/Makefile po/Makefile.in m4/Makefile])

AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile])

#------------------------------------------------------------------------------

FVM_AC_CONFIG_PUBL_FINALIZE

AC_OUTPUT

#------------------------------------------------------------------------------

# Libtool configuration bug workaround (problem encountered with compilers
# which do not recognize "-soname", so that "-Wl,-soname" is needed to pass
# flags to the linker; Manually setting $wl to "-Wl" in libtool corrects
# the problem, and so does this workaround borrowed from
# the HDF5 configure.in, which does it automatically).

if test "x$GCC" != "xyes"; then
  echo 'fixing $wl in libtool'
ed - libtool <<EOF 2> /dev/null
/^wl=""/s//wl="-Wl,"/
w
q
EOF
fi

#------------------------------------------------------------------------------

echo
echo "Configuration options:"
echo " use debugging code: "$debug""
echo " MPI (Message Passing Interface) support: "$fvm_have_mpi""
if (test x$fvm_have_mpi = xyes) ; then
  echo "   MPI I/O support: "$fvm_have_mpi_io""
  echo "   MPI2 one-sided communication support: "$fvm_have_mpi_one_sided""
fi
echo " HDF (Hierarchical Data Format) support: "$have_hdf5""
echo " CGNS (CFD General Notation System) support: "$have_cgns""
echo " MED (Model for Exchange of Data) support: "$have_med""
echo
echo "The package has been configured. Type:"
echo " make"
echo " make install"
echo
echo "To generate and install the FVM package"
echo