-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.ac
230 lines (209 loc) · 6.77 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([ChaNGa], [3.2], [[email protected]])
AC_DEFINE_UNQUOTED([NBODY_PACKAGE_VERSION], [$PACKAGE_VERSION])
AC_CONFIG_SRCDIR([Reductions.h])
AC_CONFIG_HEADER([config.h $srcdir/../utility/structures/config.h])
AC_ARG_VAR([CHARMC], "Charm compiler")
# Checks for programs.
AC_PATH_PROG([CHARMC], [charmc], [no], [$CHARM_DIR/bin:$PATH:../charm/bin:../../charm/bin])
if test "$CHARMC" = "no" ; then
AC_MSG_WARN([Cannnot locate charmc])
AC_MSG_WARN([Try setting your CHARM_DIR environment variable to point at the charm source directory])
exit
fi
CHARM_PATH=${CHARMC%/bin/charmc}
CONV_CONFIG=${CHARM_PATH}/tmp/conv-config.sh
CHARMINC=${CHARM_PATH}/include
AC_SUBST([CHARM_PATH])
. ${CONV_CONFIG}
CXX=${CMK_SEQ_CXX}
CC=${CMK_SEQ_CC}
LD=${CMK_SEQ_LD}
LDXX=${CMK_SEQ_LDXX}
AC_SUBST([AR], [${CMK_AR}])
CPPFLAGS="$CPPFLAGS -I.."
AC_CHECK_FILE(../libs, [LDFLAGS="$LDFLAGS -L../libs"])
AC_PROG_CXX($CHARMC)
# AC_PROG_CC($CHARMC)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/bittypes.h endian.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h sys/param.h unistd.h values.h])
AC_CHECK_HEADER(netinet/in.h,,[MISSING_NETINET=yes])
if test "${MISSING_NETINET}" = "yes" ; then
CPPFLAGS="$CPPFLAGS -I/usr/include"
fi
AC_CHECK_HEADERS([rpc/types.h])
AC_CHECK_HEADER([rpc/xdr.h],,[MISSING_XDR=yes],
[#ifdef HAVE_RPC_TYPES_H
#include <rpc/types.h>
#endif
])
AC_SEARCH_LIBS([xdr_float], [xdr],,[MISSING_XDR=yes])
if test "${MISSING_XDR}" = "yes" ; then
echo "XDR missing, attempting to use xdr with package"
if test -d ../xdr ; then
ln -s $PWD/../xdr ../rpc
else
echo "Try downloading the xdr package and place it in the parent directory."
echo "And do a make in ../xdr"
exit
fi
CPPFLAGS="$CPPFLAGS -I.."
LDFLAGS="$LDFLAGS -L../xdr"
fi
# Use single-precision for gravity calculations
AC_ARG_ENABLE([float],
[AS_HELP_STRING([--enable-float], [use single-precision for gravity calculations])],
[float=$enableval], [float=no])
if test "$float" = "yes" ; then
echo "float selected"
FLAG_FLOAT="-DCOSMO_FLOAT"
else
FLAG_FLOAT=""
fi
AC_SUBST([FLAG_FLOAT])
# SSE2 vector optimization for gravity
AC_ARG_ENABLE([sse2],
[AS_HELP_STRING([--enable-sse2], [enable sse2 gravity vectorization])],
[sse2=$enableval], [sse2=no])
if test "$sse2" = "yes" ; then
echo "SSE2 selected"
FLAG_SSE="-DCMK_USE_SSE2"
else
FLAG_SSE=""
fi
AC_SUBST([FLAG_SSE])
# AVX vector optimization for gravity
AC_ARG_ENABLE([avx],
[AS_HELP_STRING([--enable-avx], [enable avx gravity vectorization])],
[avx=$enableval], [avx=no])
if test "$avx" = "yes" ; then
echo "AVX selected"
FLAG_AVX="-DCMK_USE_AVX"
else
FLAG_AVX=""
fi
AC_SUBST([FLAG_AVX])
# physical softening in comoving coordinates:
AC_ARG_ENABLE([changesoft],
[AS_HELP_STRING([--enable-changesoft], [enable physical softening])],
[changesoft=$enableval], [changesoft=yes])
if test "$changesoft" = "yes" ; then
echo "CHANGESOFT selected"
FLAG_CHANGESOFT="-DCHANGESOFT"
else
FLAG_CHANGESOFT=""
fi
AC_SUBST([FLAG_CHANGESOFT])
# 128 bit keys:
AC_ARG_ENABLE([bigkeys],
[AS_HELP_STRING([--enable-bigkeys], [enable 128 bit hash keys])],
[bigkeys=$enableval], [bigkeys=no])
if test "$bigkeys" = "yes" ; then
echo "BIGKEYS selected"
FLAG_BIGKEYS="-DBIGKEYS"
else
FLAG_BIGKEYS=""
fi
AC_SUBST([FLAG_BIGKEYS])
# Wendland C4 Kernel:
AC_ARG_ENABLE([wendland],
[AS_HELP_STRING([--enable-wendland], [enable Wendland C4 Kernel])],
[wendland=$enableval], [wendland=no])
if test "$wendland" = "yes" ; then
echo "WENDLAND selected"
FLAG_KERNEL="-DWENDLAND"
else
FLAG_KERNEL=""
fi
AC_SUBST([FLAG_KERNEL])
# Cooling:
AC_ARG_ENABLE([cooling],
[AS_HELP_STRING([--enable-cooling], [enable gas cooling (planet,cosmo)])],
[cooling=$enableval], [cooling=no])
OBJECTS_COOLING=""
if test "$cooling" = "no" ; then
echo "Adiabatic SPH only selected"
FLAG_COOLING="-DCOOLING_NONE"
elif test "$cooling" = "planet" ; then
echo "Planet cooling selected"
FLAG_COOLING="-DCOOLING_PLANET"
OBJECTS_COOLING="cooling_planet.o stiff.o"
elif test "$cooling" = "cosmo" ; then
echo "Cosmo cooling selected"
FLAG_COOLING="-DCOOLING_COSMO"
OBJECTS_COOLING="cooling_cosmo.o stiff.o"
elif test "$cooling" = "grackle" ; then
echo "Grackle cooling selected"
FLAG_COOLING="-DCOOLING_GRACKLE"
OBJECTS_COOLING="cooling_grackle.o"
ac_cv_libhdf5="yes"
AC_CHECK_LIB([hdf5], [H5Fcreate], [], [ac_cv_libhdf5=no])
if test $ac_cv_libhdf5 = "no" ; then
AC_MSG_WARN([HDF5 library needed for Grackle, but not found]);
AC_MSG_WARN([Try setting LDFLAGS environment with -L<hd5libdir>]);
exit
fi
ac_cv_libgrackle="yes"
AC_CHECK_HEADER(grackle.h, [], [],
[[
#define CONFIG_BFLOAT_8
]])
if test "$ac_cv_header_grackle_h" == no
then
AC_MSG_WARN([grackle header needed for Grackle, but not found])
AC_MSG_WARN([Try setting CPPFLAGS environment with -I <grackledir>])
exit
fi
AC_CHECK_LIB([grackle], [initialize_chemistry_data], [], [ac_cv_libgrackle=no], [-lhdf5])
if test $ac_cv_libgrackle = "no" ; then
AC_MSG_WARN([grackle library needed for Grackle, but not found]);
AC_MSG_WARN([Try setting LDFLAGS environment with -L<gracklelibdir>]);
AC_MSG_WARN([Also remember to set LD_LIBRARY_PATH when running, if grackle and hdf5 are dynamic libraries]);
exit
fi
else
echo "Unknown cooling selected, using Adiabatic"
FLAG_COOLING="-DCOOLING_NONE"
cooling="no"
fi
AC_ARG_ENABLE([hexadecapole],
[AS_HELP_STRING([--disable-hexadecapole], [disable use of hexadecapole expansions])],
# Note that "$enableval" being "yes" means ENABLE hexadecapole -- the
# help string, as one would expect, only affects how we document
# the option.
[case "$enableval" in
yes | no ) hexadecapole="$enableval";;
*) AC_MSG_ERROR("$enableval: invalid argument to `--disable-hexadecapole'") ;;
esac],
[hexadecapole="yes"])
HEXADECAPOLE=""
if test "$hexadecapole" = "yes"; then
HEXADECAPOLE="-DHEXADECAPOLE"
else
HEXADECAPOLE=""
fi
AC_SUBST([FLAG_COOLING])
AC_SUBST([OBJECTS_COOLING])
AC_SUBST([HEXADECAPOLE])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_CHECK_TYPES([u_int64_t, u_quad_t, int64_t, quad_t, quad])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([floor memset pow sqrt strchr])
AC_CHECK_LIB([xdr], [xdr_hyper])
AC_CHECK_FUNCS([xdr_hyper])
####################### CUDA #######################
m4_include([cuda.ac])
##################### END CUDA #####################
AC_CONFIG_FILES([Makefile
$srcdir/../utility/structures/Makefile
])
AC_OUTPUT