1 |
# -*- Autoconf -*- |
2 |
# Process this file with autoconf to produce a configure script. |
3 |
|
4 |
AC_PREREQ(2.59) |
5 |
AC_INIT([libescriptreader], [1.0]) |
6 |
AM_INIT_AUTOMAKE |
7 |
AC_CONFIG_SRCDIR([src/esdcreate.cpp]) |
8 |
|
9 |
# Checks for programs. |
10 |
AC_PROG_CXX |
11 |
AC_PROG_CC |
12 |
AM_PROG_LIBTOOL |
13 |
|
14 |
# Checks for header files. |
15 |
AC_HEADER_STDC |
16 |
AC_CHECK_HEADERS([float.h limits.h stdint.h stdlib.h string.h]) |
17 |
|
18 |
# Checks for typedefs, structures, and compiler characteristics. |
19 |
AC_HEADER_STDBOOL |
20 |
AC_C_CONST |
21 |
AC_C_INLINE |
22 |
AC_TYPE_SIZE_T |
23 |
AC_C_VOLATILE |
24 |
|
25 |
# Checks for libraries. |
26 |
AC_CHECK_LIB([m], [sqrt]) |
27 |
|
28 |
# Checks for library functions. |
29 |
AC_FUNC_MALLOC |
30 |
AC_FUNC_REALLOC |
31 |
AC_CHECK_FUNCS([pow sqrt]) |
32 |
|
33 |
CXXFLAGS="-Wall -O2" |
34 |
|
35 |
AC_ARG_ENABLE([esdcreate], |
36 |
AC_HELP_STRING([--disable-esdcreate], |
37 |
[do not build the esdcreate tool]), |
38 |
[ |
39 |
if test "x$enableval" = "xno"; then |
40 |
wants_esdcreate=false |
41 |
else |
42 |
wants_esdcreate=true |
43 |
fi |
44 |
], |
45 |
[wants_esdcreate=true] |
46 |
) |
47 |
|
48 |
AM_CONDITIONAL([BUILD_ESDCREATE], [test "$wants_esdcreate" = true]) |
49 |
|
50 |
AC_ARG_ENABLE([escript2silo], |
51 |
AC_HELP_STRING([--disable-escript2silo], |
52 |
[do not build the escript to Silo converter]), |
53 |
[ |
54 |
if test "x$enableval" = "xno"; then |
55 |
wants_escript2silo=false |
56 |
else |
57 |
wants_escript2silo=true |
58 |
fi |
59 |
], |
60 |
[wants_escript2silo=true] |
61 |
) |
62 |
|
63 |
AC_ARG_WITH([escript-prefix], |
64 |
[AS_HELP_STRING([--with-escript-prefix=PATH], |
65 |
[Prefix of escript installation containing headers])], |
66 |
[ESCRIPTDIR="$withval"]) |
67 |
|
68 |
AC_MSG_CHECKING([for escript include files]) |
69 |
if test "x$ESCRIPTDIR" = "x"; then |
70 |
ESCRIPTDIR="../.." |
71 |
fi |
72 |
|
73 |
if ! test -f "$ESCRIPTDIR/include/finley/ReferenceElements.h"; then |
74 |
AC_MSG_RESULT([no]) |
75 |
AC_MSG_ERROR([ |
76 |
The escript headers could not be found. Please provide the |
77 |
location of your escript installation using --with-escript-prefix |
78 |
]) |
79 |
else |
80 |
ESCRIPT_CFLAGS=" -I$ESCRIPTDIR/include" |
81 |
AC_MSG_RESULT([yes]) |
82 |
fi |
83 |
|
84 |
AC_SUBST([ESCRIPT_CFLAGS]) |
85 |
|
86 |
|
87 |
# Check for NetCDF library and headers |
88 |
|
89 |
AC_ARG_WITH([netcdf-prefix], |
90 |
[AS_HELP_STRING([--with-netcdf-prefix=PATH], |
91 |
[Prefix of NetCDF headers and libraries])], |
92 |
[NETCDFPREFIX="$withval"]) |
93 |
|
94 |
AC_MSG_CHECKING([for NetCDF files]) |
95 |
if ! test "x$NETCDFPREFIX" = "x"; then |
96 |
CPPFLAGS_SAVED="$CPPFLAGS" |
97 |
NETCDF_CFLAGS="-I$NETCDFPREFIX/include" |
98 |
NETCDF_LIBS="-L$NETCDFPREFIX/lib -lnetcdf_c++ -lnetcdf" |
99 |
CPPFLAGS="$CPPFLAGS $NETCDF_CFLAGS" |
100 |
export CPPFLAGS |
101 |
else |
102 |
NETCDF_CFLAGS="" |
103 |
NETCDF_LIBS="-lnetcdf_c++ -lnetcdf" |
104 |
fi |
105 |
AC_LANG_SAVE |
106 |
AC_LANG_CPLUSPLUS |
107 |
AC_TRY_COMPILE( |
108 |
[@%:@include <netcdf.hh>], |
109 |
[NcError ncerr(NcError::verbose_fatal);], |
110 |
[AC_MSG_RESULT([yes])], |
111 |
[AC_MSG_ERROR([ |
112 |
The NetCDF headers could not be found. Please provide the |
113 |
location of your NetCDF installation using --with-netcdf-prefix |
114 |
]) |
115 |
] |
116 |
) |
117 |
AC_LANG_RESTORE |
118 |
if ! test "x$NETCDFPREFIX" = "x"; then |
119 |
CPPFLAGS="$CPPFLAGS_SAVED" |
120 |
fi |
121 |
|
122 |
AC_SUBST([NETCDF_CFLAGS]) |
123 |
AC_SUBST([NETCDF_LIBS]) |
124 |
|
125 |
|
126 |
# Check for Silo library and headers |
127 |
|
128 |
has_silo_lib=false |
129 |
AC_ARG_WITH([silo-prefix], |
130 |
[AS_HELP_STRING([--with-silo-prefix=PATH], |
131 |
[Prefix of Silo headers and libraries])], |
132 |
[SILOPREFIX="$withval"]) |
133 |
|
134 |
AC_MSG_CHECKING([for Silo files]) |
135 |
if test "x$SILOPREFIX" = "x"; then |
136 |
if test -f "/usr/include/silo.h"; then |
137 |
SILOPREFIX="/usr" |
138 |
elif test -f "/usr/local/include/silo.h"; then |
139 |
SILOPREFIX="/usr/local" |
140 |
fi |
141 |
fi |
142 |
|
143 |
if test -f "$SILOPREFIX/include/silo.h"; then |
144 |
SILO_CFLAGS=" -I$SILOPREFIX/include" |
145 |
|
146 |
if test -f "$SILOPREFIX/lib/libsiloh5.a"; then |
147 |
SILO_LIBS="-L$SILOPREFIX/lib -lsiloh5" |
148 |
has_silo_lib=true |
149 |
elif test -f "$SILOPREFIX/lib/libsilo.a"; then |
150 |
SILO_LIBS="-L$SILOPREFIX/lib -lsilo" |
151 |
has_silo_lib=true |
152 |
fi |
153 |
fi |
154 |
AC_SUBST([SILO_CFLAGS]) |
155 |
AC_SUBST([SILO_LIBS]) |
156 |
|
157 |
if test "$has_silo_lib" = "true"; then |
158 |
AC_MSG_RESULT([yes]) |
159 |
AC_DEFINE([HAVE_SILO], [1]) |
160 |
AC_CHECK_LIB([mpi], [MPI_Wait]) |
161 |
AC_CHECK_LIB([z], [deflate]) |
162 |
else |
163 |
AC_MSG_RESULT([no]) |
164 |
AC_MSG_WARN([ |
165 |
The Silo library could not be found. Your escriptreader library will not |
166 |
be able to save data in the Silo format and the escript2silo tool will |
167 |
not be built. If you need this functionality please download the Silo |
168 |
library from http://silo.llnl.gov/ and specify the install location using |
169 |
--with-silo-prefix. |
170 |
]) |
171 |
wants_escript2silo=false |
172 |
fi |
173 |
|
174 |
AM_CONDITIONAL([BUILD_ESCRIPT2SILO], [test "$wants_escript2silo" = true]) |
175 |
|
176 |
AC_CONFIG_FILES([Makefile |
177 |
src/Makefile |
178 |
src/escriptreader/Makefile |
179 |
]) |
180 |
AC_OUTPUT |