configure.ac 8.17 KB
Newer Older
incardon's avatar
incardon committed
1
2
3
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

incardon's avatar
incardon committed
4
## Take all the options with the exception of --enable-install-req
incardon's avatar
incardon committed
5
6
7
8
9

AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/main.cpp])
incardon's avatar
incardon committed
10
AC_CONFIG_SUBDIRS([openfpm_data openfpm_devices openfpm_vcluster openfpm_io])
incardon's avatar
incardon committed
11
12
13
14
15
16
17
18
19
20

#### Adding --with-pdata option and openfpm_pdata to prefix folder

if test "$prefix" = "NONE"; then
    prefix=/usr/local
fi
base=$prefix
prefix="$prefix/openfpm_pdata"
echo "Installation dir is: $prefix"

incardon's avatar
incardon committed
21
ac_configure_args="$ac_configure_args --with-pdata=../../src"
incardon's avatar
incardon committed
22

incardon's avatar
incardon committed
23
########################
incardon's avatar
incardon committed
24

incardon's avatar
incardon committed
25
AM_INIT_AUTOMAKE
incardon's avatar
incardon committed
26
AC_CONFIG_HEADER([src/config/config.h])
incardon's avatar
incardon committed
27
28
29
30
m4_ifdef([ACX_PTHREAD],,[m4_include([m4/acx_pthread.m4])])
m4_ifdef([ACX_MPI],,[m4_include([m4/acx_mpi.m4])])
m4_ifdef([AX_OPENMP],,[m4_include([m4/ax_openmp.m4])])
m4_ifdef([AX_CUDA],,[m4_include([m4/ax_cuda.m4])])
incardon's avatar
incardon committed
31
m4_ifdef([IMMDX_LIB_METIS],,[m4_include([m4/immdx_lib_metis.m4])])
incardon's avatar
incardon committed
32
33
34
35
m4_ifdef([AX_BOOST_BASE],,[m4_include([m4/ax_boost_base.m4])])
m4_ifdef([AX_BOOST_IOSTREAMS],,[m4_include([m4/ax_boost_iostreams.m4])])
m4_ifdef([AX_BOOST_PROGRAM_OPTIONS],,[m4_include([m4/ax_boost_program_options.m4])])
m4_ifdef([AX_BOOST_UNIT_TEST_FRAMEWORK],,[m4_include([m4/ax_boost_unit_test_framework.m4])])
incardon's avatar
incardon committed
36

incardon's avatar
incardon committed
37
CXXFLAGS+=" --std=c++11 "
incardon's avatar
incardon committed
38
39
40
NVCCFLAGS=" "
INCLUDES_PATH=" "

incardon's avatar
incardon committed
41
42
43
# Create a file with the install base folder
echo "$base" > install_dir

incardon's avatar
incardon committed
44
45
46
47
48
49
50
# Checks for programs.
AC_PROG_CXX

# Checks g++ flags

AC_CANONICAL_HOST

incardon's avatar
incardon committed
51
52
53
54
55
56
57
# Check that the compiler support mpi

AC_LANG_PUSH([C++])
AC_CHECK_HEADER(mpi.h,[],[echo "mpi.h not found"
                          exit 200])
AC_LANG_POP([C++])

incardon's avatar
incardon committed
58
59
# Check target architetture

incardon's avatar
incardon committed
60
#AX_GCC_ARCHFLAG([], [CXXFLAGS="$CXXFLAGS $ax_cv_gcc_archflag"], [])
incardon's avatar
incardon committed
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

###### Check for debug compilation

AC_MSG_CHECKING(whether to build with debug information)
debuger=no
AC_ARG_ENABLE(debug,
	AC_HELP_STRING(
	    [--enable-debug],
	    [enable debug data generation (def=no)]
	),
  	debuger="$enableval"
)



AC_MSG_RESULT($debuger)
if test x"$debuger" = x"yes"; then
	AC_DEFINE([DEBUG_MODE],[],[Debug])
	AC_DEFINE([DEBUG],[],[Debug])
	CXXFLAGS="$CXXFLAGS -g3  -Wall -O0 "
	NVCCFLAGS+="$NVCCFLAGS -g -O0 "
else
incardon's avatar
incardon committed
83
	CXXFLAGS="$CXXFLAGS -Wall -O3 -g3 -funroll-loops "
incardon's avatar
incardon committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
	NVCCFLAGS+="$NVCCFLAGS -O3 "
fi

## Check for memcheck

AC_MSG_CHECKING(whether to build with memcheck capabilities)
AC_ARG_ENABLE(memcheck,
        AC_HELP_STRING(
            [--enable-memcheck],
            [enable memory check (def=no)]
        ),
        memcheck="$enableval"
)

AC_MSG_RESULT($memcheck)

if test x"$memcheck" = x"yes"; then
        AC_DEFINE([MEMLEAK_CHECK],[],[Memory check, corruption and leak])
fi

#########

incardon's avatar
incardon committed
106
107
## Check for Metis

incardon's avatar
incardon committed
108
109
IMMDX_LIB_METIS([],[echo "Cannot detect metis, use the --with-metis option if it is not installed in the default location"
                    exit 201])
incardon's avatar
incardon committed
110

incardon's avatar
incardon committed
111
112
####### include OpenFPM_devices include path

113
INCLUDES_PATH+="-I. -Isrc/config/ -I../openfpm_io/src -I../openfpm_data/src -I../openfpm_devices/src -I../openfpm_vcluster/src/"
incardon's avatar
incardon committed
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
###### Check for se-class1

AC_MSG_CHECKING(whether to build with security enhancement class1)
se_class1=no
AC_ARG_ENABLE(se-class1,
        AC_HELP_STRING(
            [--enable-se-class1],
            [enable security enhancement class1]
        ),
        se_class1="$enableval"
)



AC_MSG_RESULT($se_class1)
if test x"$se_class1" = x"yes"; then
        AC_DEFINE([SE_CLASS1],[],[Security enhancement class 1])
fi


###### Check for se-class 2

AC_MSG_CHECKING(whether to build with security enhancement class 2)
se_class2=no
AC_ARG_ENABLE(se-class2,
        AC_HELP_STRING(
            [--enable-se-class2],
            [enable security enhancement class 2]
        ),
        se_class2="$enableval"
)


AC_MSG_RESULT($se_class2)
if test x"$se_class2" = x"yes"; then
        AC_DEFINE([SE_CLASS2],[],[Security enhancement class 2])
fi

###### Check for se-class 3

AC_MSG_CHECKING(whether to build with security enhancement class 3)
se_class3=no
AC_ARG_ENABLE(se-class3,
        AC_HELP_STRING(
            [--enable-se-class3],
            [enable security enhancement class 3]
        ),
        se_class3="$enableval"
)



AC_MSG_RESULT($se_class3)
if test x"$se_class3" = x"yes"; then
        AC_DEFINE([SE_CLASS3],[],[Security enhancement class 3])
fi

###### Check for action on error

action_on_e=continue
AC_ARG_WITH([action-on-error],
             AS_HELP_STRING([--with-action-on-error=stop,throw,continue],
             [specify the action to do in case of error]),
             [action_on_e="$withval"],
             [action_on_e=continue])

if test x"$action_on_e" = x"stop"; then
           AC_DEFINE([STOP_ON_ERROR],[],[If an error occur stop the program])
fi
if test x"$action_on_e" = x"throw"; then
           AC_DEFINE([THROW_ON_ERROR],[],[when an error accur continue but avoid unsafe operation])
fi

incardon's avatar
incardon committed
188
189
##### CHECK FOR BOOST ##############

incardon's avatar
incardon committed
190
AX_BOOST_BASE([1.52],[],[echo "boost not found"
incardon's avatar
incardon committed
191
                    exit 202])
incardon's avatar
incardon committed
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
AX_BOOST_UNIT_TEST_FRAMEWORK
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_IOSTREAMS

if test x"$ax_cv_boost_unit_test_framework" = x"no"; then
  echo "Notify boost not usable"
  exit 202
fi

if test x"$ax_cv_boost_iostreams" = x"no"; then
  echo "Notify boost not usable"
  exit 202
fi

if test x"$ax_cv_boost_programs_options" = x"no"; then
  echo "Notify boost not usable"
  exit 202
fi
incardon's avatar
incardon committed
210

incardon's avatar
incardon committed
211
212
213
214
215
216
217
218
219
220
### Unfortunately a lot of linux distros install a pretty old MPI in the system wide folder,
### override such MPI with the installed one is extremely difficult and tricky, because we want
### to include "some" system library but exclude mpi. One possibility is to give specifically
### the wanted libmpi.so directly to the linker. But this is not possible because this lib is
### given by mpic++ in the form -L/path/to/mpi -lmpi, the other is completely eliminate every
### -L with a system default library
###

# eliminate any /usr/lib and and /usr/include from $BOOST_LIB and $BOOST_INCLUDE

incardon's avatar
incardon committed
221
222
BOOST_LDFLAGS=$(echo "$BOOST_LDFLAGS" | sed -e 's/ -L\/usr\/lib64[ \b]//g' | sed -e 's/ -L\/usr\/lib[ \b]//g')
BOOST_CPPFLAGS=$(echo "$BOOST_CPPFLAGS" | sed -e 's/-I\/usr\/include[ \b]//g')
incardon's avatar
incardon committed
223
224
225
226

AC_SUBST(BOOST_LDFLAGS)
AC_SUBST(BOOST_CPPFLAGS)

incardon's avatar
incardon committed
227
228
####### Checking for GPU support

incardon's avatar
incardon committed
229
230
AX_CUDA

incardon's avatar
incardon committed
231
232
233
234
235
236
## detect for NVCC

if test x"$NVCC_EXIST" = x"yes"; then
  AC_MSG_CHECKING(whether to build with GPU support)
  gpu_support=yes
  AC_ARG_ENABLE(gpu,
incardon's avatar
incardon committed
237
238
239
240
241
	AC_HELP_STRING(
	    [--enable-gpu],
	    [enable gpu support]
	),
  	gpu_support="$enableval"
incardon's avatar
incardon committed
242
  )
incardon's avatar
incardon committed
243

incardon's avatar
incardon committed
244
245
  AC_MSG_RESULT($gpu_support)
  if test x"$gpu_support" = x"yes"; then
incardon's avatar
incardon committed
246
	AC_DEFINE([GPU],[],[GPU support])
incardon's avatar
incardon committed
247
248
249
  else
	CUDA_LIBS=""
	CUDA_CFLAGS=""
incardon's avatar
incardon committed
250
251
252
  fi
else
  gpu_support=no
incardon's avatar
incardon committed
253
254
fi

255
256
257
258
if test x$gpu_support = x"no"; then
     CUDA_LIBS=""
     CUDA_CFLAGS=""
fi
incardon's avatar
incardon committed
259
260
261
262
263
264
265

# Set this conditional if cuda is wanted

AM_CONDITIONAL(BUILDCUDA, test ! x$NVCC = x"no")

###########################

incardon's avatar
incardon committed
266
267
268
269
# Define that there is MPI

AC_DEFINE([HAVE_MPI],[],[MPI Enabled])

incardon's avatar
incardon committed
270
271
272
273
274
275
276
AC_SUBST(NVCCFLAGS)
AC_SUBST(INCLUDES_PATH)

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

277
AC_CONFIG_FILES([Makefile src/Makefile vtk/Makefile ])
incardon's avatar
incardon committed
278
279
280
281
282
283
284
285
286
AC_OUTPUT
echo ""
echo   "***********************************"
echo   "*                                 *"
if [ test x"$profiler" = x"yes" ]; then
  echo "*    profiler: yes                *"
else
  echo "*    profiler: no                 *"
fi
incardon's avatar
incardon committed
287
288
289
290
291
if [ test x"$memcheck" = x"yes" ]; then
  echo "*    memcheck: yes                *"
else
  echo "*    memcheck: no                 *"
fi
incardon's avatar
incardon committed
292
293
294
295
296
if [ test x"$debuger" = x"yes" ]; then
  echo "*    debug: yes                   *"
else
  echo "*    debug: no                    *"
fi
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
if [ test x"$se_class1" = x"yes" ]; then
  echo "*    se-class1: yes               *"
else
  echo "*    se-class1: no                *"
fi
if [ test x"$se_class2" = x"yes" ]; then
  echo "*    se-class2: yes               *"
else
  echo "*    se-class2: no                *"
fi
if [ test x"$se_class3" = x"yes" ]; then
  echo "*    se-class3: yes               *"
else
  echo "*    se-class3: no                *"
fi
incardon's avatar
incardon committed
312
313
314
315
316
317
318
319
if [ test x"$gpu_support" = x"no" ]; then
  echo "*    gpu: no                      *"
else
  echo "*    gpu: yes                     *"
fi
echo   "*                                 *"
echo   "***********************************"