forked from HomerReid/scuff-em
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
335 lines (285 loc) · 10.9 KB
/
configure.ac
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
AC_INIT(scuff-em, [m4_esyscmd_s([git describe --always --dirty])], homer@homerreid.com)
AC_CONFIG_SRCDIR([README])
# Shared-library version. This has a technical
# meaning related to binary compatibility and is NOT
# the same as the human version number. See http://tinyurl.com/yegqrlz
SHARED_VERSION_INFO="0:0:0" # CURRENT:REVISION:AGE
AM_INIT_AUTOMAKE
LT_INIT
AM_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE
AC_SUBST(SHARED_VERSION_INFO)
AC_DISABLE_SHARED dnl shared libs by default cause too much trouble
AC_PROG_CXX
AC_PROG_F77
AC_F77_WRAPPERS
AC_PROG_INSTALL
# 20160830 these are no longer necessary because I
# modified the build process for libs/libMatProp/cmatheval;
# the files generated by lex/yacc are now stored in the
# repository, so lex/yacc are not needed to build SCUFF-EM
#AC_PROG_YACC
#AM_PROG_LEX
AC_LANG([C++])
##################################################
# compiler flags
##################################################
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile for debugging])], enable_debug=$enableval, enable_debug=no)
if test "x$enable_debug" = xyes; then
CXXFLAGS=-g
FFLAGS=-g
fi
# TODO: set optimization flags? Does it matter, or is the default -g -O2 okay?
# add gcc warnings in debug or maintainer mode
if test "x$enable_debug" = xyes || test "$USE_MAINTAINER_MODE" = yes; then
if test "$ac_test_CFLAGS" != "set"; then
if test $ac_cv_prog_gcc = yes; then
CXXFLAGS="$CXXFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wno-long-long -Wshadow -Wwrite-strings -Wredundant-decls -pedantic"
fi
fi
fi
##################################################
# threading library
##################################################
AC_ARG_WITH(openmp, [AC_HELP_STRING([--without-openmp],[do not use OpenMP directives for parallelism])], with_openmp=$withval, with_openmp=yesdefault)
AC_ARG_WITH(pthreads, [AC_HELP_STRING([--with-pthreads],[use POSIX threads for parallelism])], with_pthreads=$withval, with_pthreads=no)
need_pthreads=no
if test "x$with_pthreads" = xyes; then
AC_DEFINE([USE_PTHREAD], [1], [Define to use pthread threading.])
if test "x$with_openmp" = xyes; then
AC_MSG_ERROR([--with-openmp and --with-pthreads are incompatible])
fi
with_openmp=no
need_pthreads=yes
fi
if test "x$with_openmp" = xyesdefault; then with_openmp=yes; fi
if test "x$with_openmp" = xyes; then
AC_DEFINE([USE_OPENMP], [1], [Define to use OpenMP threading.])
AX_OPENMP([], [AC_MSG_ERROR([Could not find OpenMP flag; configure with --without-openmp and/or --with-pthreads])])
CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
need_pthreads=yes # for pthread_rwlock
fi
if test $need_pthreads = yes; then
AX_PTHREAD([], [AC_MSG_ERROR([Could not find pthreads library.])])
LIBS="$PTHREAD_LIBS $LIBS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
fi
##################################################
# checks for hdf5
##################################################
AC_ARG_WITH(hdf5,
[AC_HELP_STRING([--without-hdf5],[build without HDF5 support])],
with_hdf5=$withval,
with_hdf5=yes)
#
# if they DIDN'T say --without-hdf5, process hdf5-related configure options
# and look for hdf5 headers and libraries
#
if test "x$with_hdf5" != xno
then
AC_ARG_WITH(hdf5-includedir,
[AC_HELP_STRING([--with-hdf5-includedir=<dir>], [look for HDF5 header files in <dir>])],
with_hdf5_includedir=$withval,
with_hdf5_includedir=yes)
AC_ARG_WITH(hdf5-libdir,
[AC_HELP_STRING([--with-hdf5-libdir=<dir>],
[look for HDF5 library in <dir>])],
with_hdf5_libdir=$withval,
with_hdf5_libdir=yes)
if test "x$with_hdf5_includedir" != xno; then
if test -d "$with_hdf5_includedir"; then
CPPFLAGS="$CPPFLAGS -I$with_hdf5_includedir"
fi
if test -d "$with_hdf5_libdir"; then
CPPFLAGS="$CPPFLAGS -L$with_hdf5_libdir"
LDFLAGS="$LDFLAGS -L$with_hdf5_libdir"
fi
have_hdf5=no
AC_CHECK_HEADER([hdf5.h],
[AC_CHECK_LIB( [hdf5], [H5Fcreate],
[LIBS="-lhdf5 $LIBS";
AC_CHECK_LIB([hdf5_hl],
[H5LTmake_dataset_double],
[LIBS="-lhdf5_hl $LIBS"; have_hdf5=yes])])],
[AC_CHECK_HEADER([H5pubconf.h],
[AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include <H5pubconf.h>
#ifdef H5_HAVE_PARALLEL
# include <mpi.h>
#endif], [])], [], [AC_MSG_WARN([HDF5 compiled with parallel support requires MPI compiler, e.g. configure with CXX=mpic++])])])])
if test $have_hdf5 = yes; then
AC_DEFINE([HAVE_HDF5],[1],[define if we have HDF5])
LIBS="$LIBS -lhdf5_hl -lhdf5"
else
AC_MSG_ERROR([couldn't find HDF5; configure --without-hdf5])
fi
else
have_hdf5=no
fi
fi
if test "x$with_hdf5" == xno
then
AC_MSG_WARN([building without HDF5 support])
fi
##################################################
# checks for blas/lapack
##################################################
ACX_BLAS([], [AC_MSG_ERROR([BLAS was not found!])])
ACX_LAPACK([], [AC_MSG_ERROR([LAPACK was not found!])])
LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
##################################################
# checks for readline
# (which is used by some test programs)
##################################################
AC_CHECK_LIB(readline, readline)
AC_LANG_PUSH([C++])
AC_CHECK_LIB(DCUTRI, DCUTRI)
AC_LANG_POP
##################################################
# checks for backtrace functionality, used to
# output useful debugging info to log files in
# the event of code crashes
##################################################
AC_CHECK_HEADERS([execinfo.h])
AC_CHECK_FUNCS([backtrace])
##################################################
# check for GSL
##################################################
AC_CHECK_LIB([m],[cos])
AC_CHECK_LIB([gslcblas],[cblas_dgemm])
AC_CHECK_LIB([gsl],[gsl_sf_legendre_array_n])
##############################################################################
# check for libGDSII
##############################################################################
AC_CHECK_HEADER(libGDSII.h, [have_gdsii=maybe], [have_gdsii=no])
if test $have_gdsii = maybe; then
AC_CHECK_LIB(GDSII, libGDSIIExists)
fi
##################################################
# Checks for miscellaneous math functions
AC_CHECK_FUNCS([isnan isinf erf erfc copysign])
##################################################
# Python SWIG wrappers
##################################################
AC_ARG_WITH(python,
[AC_HELP_STRING([--without-python], [don't compile Python interface])],
with_python=$withval,with_python=yes)
if test "$enable_shared" = no; then
AC_MSG_WARN([Python interface requires --enable-shared; disabling])
have_python=no
else
if test "x$with_python" = xno; then
have_python=no
else
AM_PATH_PYTHON([],[have_python=yes],[have_python=no])
if test $have_python = yes; then
AC_MSG_CHECKING([for Python include directory])
pinc=`echo "import distutils.sysconfig; print (distutils.sysconfig.get_python_inc())" | $PYTHON - 2>/dev/null`
AC_MSG_RESULT([${pinc:-unknown}])
test -n "$pinc" && PYTHON_INCLUDES="-I$pinc"
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
AC_CHECK_HEADER([Python.h], [], [AC_MSG_WARN([disabling Python wrappers])
have_python=no])
if test $have_python = yes; then
AC_MSG_CHECKING([for Numpy include directory])
pinc=`echo "import numpy; print (numpy.get_include())" | $PYTHON - 2>/dev/null`
AC_MSG_RESULT([${pinc:-unknown}])
test -n "$pinc" && PYTHON_INCLUDES="$PYTHON_INCLUDES -I$pinc"
CPPFLAGS="$save_CPPFLAGS $PYTHON_INCLUDES"
AC_CHECK_HEADER([numpy/arrayobject.h],[],[
AC_MSG_WARN([disabling Python wrappers])
have_python=no],[#include <Python.h>])
fi
CPPFLAGS=$save_CPPFLAGS
fi
fi # with_python
fi # if enable_shared
AC_SUBST(PYTHON_INCLUDES)
AM_CONDITIONAL(WITH_PYTHON, test x"$have_python" = "xyes")
##################################################
# checks for tr1 headers vs. c++11
##################################################
AC_LANG_PUSH(C++)
AC_CHECK_HEADER(tr1/unordered_map,[AC_DEFINE([HAVE_TR1],[1],["Have tr1 headers"])],[])
AX_CXX_COMPILE_STDCXX([11], [], [optional])
AC_LANG_POP
##############################################################################
# set SCUFFLIBS to save libraries and flags required to link -lscuff
SCUFFLIBS="$LDFLAGS $LIBS"
AC_SUBST(SCUFFLIBS)
##################################################
##################################################
##################################################
AC_CONFIG_FILES([
Makefile
m4/Makefile
scuff-em-pkgconfig
libs/Makefile
libs/libIncField/Makefile
libs/libSpherical/Makefile
libs/libMDInterp/Makefile
libs/libMatProp/Makefile
libs/libMatProp/cmatheval/Makefile
libs/libSGJC/Makefile
libs/libSubstrate/Makefile
libs/libSubstrate/tests/Makefile
libs/libTriInt/Makefile
libs/libhmat/Makefile
libs/libhrutil/Makefile
libs/libscuff/Makefile
libs/libStaticSolver/Makefile
libs/libscuffSolver/Makefile
libs/libscuffSolver/tests/Makefile
libs/python/Makefile
applications/Makefile
applications/scuff-analyze/Makefile
applications/scuff-caspol/Makefile
applications/scuff-cas3D/Makefile
applications/scuff-ldos/Makefile
applications/scuff-neq/Makefile
applications/scuff-plotEpsMu/Makefile
applications/scuff-rf/Makefile
applications/scuff-scatter/Makefile
applications/scuff-spectrum/Makefile
applications/scuff-static/Makefile
applications/scuff-tmatrix/Makefile
applications/scuff-transmission/Makefile
examples/Makefile
examples/DiffractionPatterns/Makefile
examples/CorrugatedDisc/Makefile
examples/CubeTorus/Makefile
examples/GetTMatrix/Makefile
examples/HalfSpaceLDOS/Makefile
examples/HalfSpaceLDOS/mshFiles/Makefile
examples/HalfSpaceLDOS/scuffgeoFiles/Makefile
examples/ImplicitSubstrate/Makefile
examples/MicrostripDevices/Makefile
examples/NanorodResonantModes/Makefile
examples/PaulTrap/Makefile
examples/PlateWithHole/Makefile
examples/PerforatedThinFilm/Makefile
examples/PlatonicSolids/Makefile
examples/pythonCapacitance/Makefile
examples/SolidSphere/Makefile
examples/SphericalShell/Makefile
examples/SiliconBeams/Makefile
examples/SiO2Spheres/Makefile
examples/StriplineCapacitor/Makefile
examples/TwoBodyCapacitors/Makefile
examples/TwoDimensionalCylinders/Makefile
examples/ThinFilm/Makefile
examples/WireAntenna/Makefile
examples/YagiUdaAntennas/Makefile
tests/Makefile
tests/Mie/Makefile
tests/Fresnel/Makefile
])
AC_OUTPUT
##################################################
##################################################
##################################################
AC_MSG_NOTICE([**])
AC_MSG_NOTICE([** The configure process was successful.])
AC_MSG_NOTICE([** Now type 'make' to compile and sudo 'make install'.])
AC_MSG_NOTICE([**])