configure.ac 11.9 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

AC_PREREQ(2.59)
incardon's avatar
incardon committed
7
AC_INIT(OpenFPM_pdata, 1.0.0, BUG-REPORT-ADDRESS)
incardon's avatar
incardon committed
8
9
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/main.cpp])
Pietro Incardona's avatar
Pietro Incardona committed
10
AC_CONFIG_SUBDIRS([openfpm_data openfpm_devices openfpm_vcluster openfpm_io openfpm_numerics])
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

Pietro Incardona's avatar
Pietro Incardona committed
25
AM_INIT_AUTOMAKE([subdir-objects])
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
m4_ifdef([IMMDX_LIB_PARMETIS],,[m4_include([m4/immdx_lib_parmetis.m4])])
incardon's avatar
incardon committed
33
34
35
36
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])])
Pietro Incardona's avatar
Pietro Incardona committed
37
38
39
40
m4_ifdef([AX_BLAS],,[m4_include([m4/ax_blas.m4])])
m4_ifdef([AX_LAPACK],,[m4_include([m4/ax_lapack.m4])])
m4_ifdef([AX_SUITESPARSE],,[m4_include([m4/ax_suitesparse.m4])])
m4_ifdef([AX_EIGEN],,[m4_include([m4/ax_eigen.m4])])
Pietro Incardona's avatar
Pietro Incardona committed
41
m4_ifdef([AX_LIB_HDF5],,[m4_include([m4/ax_lib_hdf5.m4])])
Pietro Incardona's avatar
Pietro Incardona committed
42
m4_ifdef([AX_LIB_PETSC],,[m4/ax_petsc_lib.m4])
Pietro Incardona's avatar
Pietro Incardona committed
43
m4_ifdef([AX_LIB_HILBERT],,[m4/ax_libhilbert.m4])
incardon's avatar
incardon committed
44

45
case $host_os in
Pietro Incardona's avatar
Pietro Incardona committed
46
   *darwin*|*macosx*)
jenkins's avatar
jenkins committed
47
	CXXFLAGS+=" --std=c++11 "
Pietro Incardona's avatar
Pietro Incardona committed
48
49
	AC_DEFINE([HAVE_OSX],[],[We have OSX])
	;;
50
51
52
53
54
55
56
57
58
   *cygwin*)
        # Do something specific for cygwin
        CXXFLAGS+=" --std=gnu++11 "
        ;;
    *)
        #Default Case
        CXXFLAGS+=" --std=c++11 "
        ;;
esac
incardon's avatar
incardon committed
59
60
61
62

NVCCFLAGS=" "
INCLUDES_PATH=" "

incardon's avatar
incardon committed
63
64
65
# Create a file with the install base folder
echo "$base" > install_dir

Pietro Incardona's avatar
Pietro Incardona committed
66
67
68
69
# Needed for build library
AC_PROG_RANLIB
AM_PROG_AR

incardon's avatar
incardon committed
70
71
72
73
74
75
76
# Checks for programs.
AC_PROG_CXX

# Checks g++ flags

AC_CANONICAL_HOST

incardon's avatar
incardon committed
77
78
79
80
81
82
83
# 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
84
85
# Check target architetture

incardon's avatar
incardon committed
86
#AX_GCC_ARCHFLAG([], [CXXFLAGS="$CXXFLAGS $ax_cv_gcc_archflag"], [])
incardon's avatar
incardon committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

###### 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
109
	CXXFLAGS="$CXXFLAGS -Wall -O3 -g3 -funroll-loops "
incardon's avatar
incardon committed
110
111
112
	NVCCFLAGS+="$NVCCFLAGS -O3 "
fi

incardon's avatar
incardon committed
113
114
115
116
117
118
#########

## Check for Metis

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
119

Pietro Incardona's avatar
Pietro Incardona committed
120
121
#########

incardon's avatar
incardon committed
122
123
124
125
## Check for MPI

ACX_MPI()

Pietro Incardona's avatar
Pietro Incardona committed
126
127
## Check for HDF5

Pietro Incardona's avatar
Pietro Incardona committed
128
AX_LIB_HDF5([parallel])
Pietro Incardona's avatar
Pietro Incardona committed
129
130
131
132
133
134

if test x"$with_hdf5" = x"no"; then
    echo "Cannot detect hdf5, use the --with-hdf5 option if it is not installed in the default location"
    exit 207
fi

Pietro Incardona's avatar
Pietro Incardona committed
135
136
##########

Pietro Incardona's avatar
Pietro Incardona committed
137
138
139
140
141
142
143
## Check for LIBHILBERT

AX_LIB_HILBERT([],[echo "Cannot detect libhilbert, use the --with-libhilbert option if it is not installed in the default location"
                    exit 210])

##########

Pietro Incardona's avatar
Pietro Incardona committed
144
145
146
147
## Check for PETSC

AX_LIB_PETSC()

Pietro Incardona's avatar
Pietro Incardona committed
148
149
## Check for quadmath

incardon's avatar
incardon committed
150
151
152
153
154
155
156
157
158
159

have_quad_lib=no
have_quad_head=no
AC_CHECK_LIB(quadmath, sinq, [have_quad_lib=yes], [])
AC_CHECK_HEADER(quadmath.h,[have_quad_head=yes],[])

if [x"have_quad_math" == x"yes" $&& x"have_quad_math" == x"yes" ]; then
    AC_DEFINE(HAVE_LIBQUADMATH,[],[Have quad math lib])
    LIBQUADMATH=" -lquadmath "
fi
Pietro Incardona's avatar
Pietro Incardona committed
160

incardon's avatar
incardon committed
161
AC_CHECK_LIB(ifcore, for_cpystr, [ LIBIFCORE=-lifcore  ], [ LIBIFCORE= ])
162
163
AC_SUBST(LIBIFCORE)

incardon's avatar
incardon committed
164
165
166
AC_SUBST(OPENMP_CFLAGS)
AC_SUBST(OPENMP_LDFLAGS)

incardon's avatar
incardon committed
167
168
echo "$OPENMP_CFLAGS" > openmp_flags

incardon's avatar
incardon committed
169
########
incardon's avatar
incardon committed
170

incardon's avatar
incardon committed
171
172
173
174
## Enable scan coverty

AC_MSG_CHECKING(whether to build for scan coverty compilation)
AC_ARG_ENABLE(scan-coverty,
incardon's avatar
incardon committed
175
        AC_HELP_STRING(
incardon's avatar
incardon committed
176
177
            [--enable-scan-coverty],
            [enable scan-coverty compilation (def=no)]
incardon's avatar
incardon committed
178
        ),
incardon's avatar
incardon committed
179
        scancoverty="$enableval"
incardon's avatar
incardon committed
180
181
)

incardon's avatar
incardon committed
182
AC_MSG_RESULT($scancoverty)
incardon's avatar
incardon committed
183

incardon's avatar
incardon committed
184
185
if test x"$scancoverty" = x"yes"; then
        AC_DEFINE([COVERTY_SCAN],[],[Compile for coverty scan])
incardon's avatar
incardon committed
186
187
fi

incardon's avatar
incardon committed
188
189
190
191
192
193
194
195
196
197
###### Check for performance test

AC_MSG_CHECKING(whether to build with performance test)
test_per=no
AC_ARG_ENABLE(test-performance,
        AC_HELP_STRING(
            [--enable-test-performance],
            [enable test performance]
        ),
        test_per="$enableval"
incardon's avatar
incardon committed
198
	INCLUDES_PATH+="-I../openfpm_numerics/src "
incardon's avatar
incardon committed
199
200
201
202
203
204
205
206
)



AC_MSG_RESULT($test_per)
if test x"$test_per" = x"yes"; then
        AC_DEFINE([PERFORMANCE_TEST],[],[Test performance mode])
fi
incardon's avatar
incardon committed
207

incardon's avatar
incardon committed
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
###### Check for test coverage

AC_MSG_CHECKING(whether to build with test coverage)
test_cov=no
AC_ARG_ENABLE(test-coverage,
        AC_HELP_STRING(
            [--enable-test-coverage],
            [enable test coverage]
        ),
        test_cov="$enableval"
)



AC_MSG_RESULT($test_cov)
if test x"$test_cov" = x"yes"; then
        AC_DEFINE([TEST_COVERAGE_MODE],[],[Test coverage mode])
        CXXFLAGS="$CXXFLAGS  -fprofile-arcs -ftest-coverage "
fi


incardon's avatar
incardon committed
229
230
231
232
233
234
235
236
###### Checking for compiler flags -fext-numeric-literals

AC_LANG_PUSH([C++])

my_save_cflags="$CXXFLAGS"
CXXFLAGS=-fext-numeric-literals
AC_MSG_CHECKING([whether CXX supports -fext-numeric-literals])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
incardon's avatar
incardon committed
237
238
    [AC_MSG_RESULT([yes])
     AM_CXXFLAGS="-fext-numeric-literals"
incardon's avatar
incardon committed
239
     echo "-fext-numeric-literals" > openfpm_flags
incardon's avatar
incardon committed
240
241
    ],
    [
incardon's avatar
incardon committed
242
     AC_MSG_RESULT([no])
incardon's avatar
incardon committed
243
     echo "" > openfpm_flags
incardon's avatar
incardon committed
244
245
246
247
248
249
250
    ]
)
AC_LANG_POP([C++])
CXXFLAGS="$my_save_cflags"
AC_SUBST([AM_CXXFLAGS])


incardon's avatar
incardon committed
251
252
253
## Check for parMetis

IMMDX_LIB_PARMETIS([],[echo "Cannot detect parmetis, use the --with-parmetis option if it is not installed in the default location"
254
                    exit 208])
incardon's avatar
incardon committed
255

incardon's avatar
incardon committed
256
257
####### include OpenFPM_devices include path

incardon's avatar
incardon committed
258
INCLUDES_PATH+="-I. -Iconfig/ -I../openfpm_io/src -I../openfpm_data/src -I../openfpm_devices/src -I../openfpm_vcluster/src/"
incardon's avatar
incardon committed
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
###### 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
333
334
##### CHECK FOR BOOST ##############

incardon's avatar
incardon committed
335
AX_BOOST_BASE([1.52],[],[echo "boost not found"
incardon's avatar
incardon committed
336
                    exit 202])
incardon's avatar
incardon committed
337
338
339
340
341
AX_BOOST_UNIT_TEST_FRAMEWORK
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_IOSTREAMS

if test x"$ax_cv_boost_unit_test_framework" = x"no"; then
Pietro Incardona's avatar
Pietro Incardona committed
342
  echo "Notify boost unit test framework not usable"
incardon's avatar
incardon committed
343
344
345
346
  exit 202
fi

if test x"$ax_cv_boost_iostreams" = x"no"; then
Pietro Incardona's avatar
Pietro Incardona committed
347
  echo "Notify boost iostream not usable"
incardon's avatar
incardon committed
348
349
350
351
  exit 202
fi

if test x"$ax_cv_boost_programs_options" = x"no"; then
Pietro Incardona's avatar
Pietro Incardona committed
352
  echo "Notify boost program options not usable"
incardon's avatar
incardon committed
353
354
  exit 202
fi
incardon's avatar
incardon committed
355

incardon's avatar
incardon committed
356
357
358
359
360
361
362
363
364
365
### 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
366
367
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
368
369
370

AC_SUBST(BOOST_LDFLAGS)
AC_SUBST(BOOST_CPPFLAGS)
incardon's avatar
incardon committed
371

Pietro Incardona's avatar
Pietro Incardona committed
372
AX_BLAS([],[])
Pietro Incardona's avatar
Pietro Incardona committed
373

Pietro Incardona's avatar
Pietro Incardona committed
374
AX_LAPACK([],[])
Pietro Incardona's avatar
Pietro Incardona committed
375

Pietro Incardona's avatar
Pietro Incardona committed
376
###### Checking for SUITESPARSE
Pietro Incardona's avatar
Pietro Incardona committed
377

Pietro Incardona's avatar
Pietro Incardona committed
378
AX_SUITESPARSE([],[])
Pietro Incardona's avatar
Pietro Incardona committed
379
380
381

###### Checking for EIGEN

Pietro Incardona's avatar
Pietro Incardona committed
382
AX_EIGEN([],[])
incardon's avatar
incardon committed
383

Pietro Incardona's avatar
Pietro Incardona committed
384
385
386
387
388
389
###### RT runtime lib

AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Have clock time])
                                 OPT_LIBS="$OPT_LIBS -lrt"
                                ])

incardon's avatar
incardon committed
390
391
####### Checking for GPU support

incardon's avatar
incardon committed
392
393
AX_CUDA

incardon's avatar
incardon committed
394
395
396
397
398
399
## 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
400
401
402
403
404
	AC_HELP_STRING(
	    [--enable-gpu],
	    [enable gpu support]
	),
  	gpu_support="$enableval"
incardon's avatar
incardon committed
405
  )
incardon's avatar
incardon committed
406

incardon's avatar
incardon committed
407
408
  AC_MSG_RESULT($gpu_support)
  if test x"$gpu_support" = x"yes"; then
incardon's avatar
incardon committed
409
	AC_DEFINE([CUDA_GPU],[],[GPU support])
incardon's avatar
incardon committed
410
411
412
  else
	CUDA_LIBS=""
	CUDA_CFLAGS=""
incardon's avatar
incardon committed
413
414
415
  fi
else
  gpu_support=no
incardon's avatar
incardon committed
416
417
fi

418
419
420
421
if test x$gpu_support = x"no"; then
     CUDA_LIBS=""
     CUDA_CFLAGS=""
fi
incardon's avatar
incardon committed
422
423
424
425
426
427
428

# Set this conditional if cuda is wanted

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

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

incardon's avatar
incardon committed
429
430
431
432
# Define that there is MPI

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

incardon's avatar
incardon committed
433
434
AC_SUBST(NVCCFLAGS)
AC_SUBST(INCLUDES_PATH)
Pietro Incardona's avatar
Pietro Incardona committed
435
AC_SUBST(OPT_LIBS)
incardon's avatar
incardon committed
436
437
438
439
440

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

Pietro Incardona's avatar
Pietro Incardona committed
441
AC_CONFIG_FILES([Makefile src/Makefile images/Makefile ])
incardon's avatar
incardon committed
442
443
444
445
446
447
448
449
450
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
451
452
453
454
455
if [ test x"$memcheck" = x"yes" ]; then
  echo "*    memcheck: yes                *"
else
  echo "*    memcheck: no                 *"
fi
incardon's avatar
incardon committed
456
457
458
459
460
if [ test x"$debuger" = x"yes" ]; then
  echo "*    debug: yes                   *"
else
  echo "*    debug: no                    *"
fi
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
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
476
477
478
479
480
481
482
483
if [ test x"$gpu_support" = x"no" ]; then
  echo "*    gpu: no                      *"
else
  echo "*    gpu: yes                     *"
fi
echo   "*                                 *"
echo   "***********************************"