configure.ac 4.25 KB
Newer Older
incardon's avatar
incardon committed
1 2 3 4 5 6 7 8 9
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.


AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/main.cpp])
AM_INIT_AUTOMAKE
incardon's avatar
incardon committed
10
AC_CONFIG_HEADER([src/config/config.h])
incardon's avatar
incardon committed
11
m4_ifdef([ACX_PTHREAD],,[m4_include([m4/acx_pthread.m4])])
incardon's avatar
incardon committed
12
m4_ifdef([AX_BOOST],,[m4_include([m4/ax_boost.m4])])
incardon's avatar
incardon committed
13 14 15 16
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
17
CXXFLAGS+=" --std=c++11 -march=native -mtune=native -Wno-unused-local-typedefs -Wextra -Wno-unused-parameter "
incardon's avatar
incardon committed
18
NVCCFLAGS=" "
incardon's avatar
incardon committed
19
INCLUDES_PATH=" "
incardon's avatar
incardon committed
20

21 22 23 24 25
# Add openfpm_vcluster to prefix forlder (if prefix end if openfpm_pdata remove that path)
if [ echo "$prefix" | grep -qE "/openfpm_pdata$" ]; then
  prefix=$(echo "$prefix" | sed 's/\(.*\)\/openfpm_pdata$/\1/g')
fi

incardon's avatar
incardon committed
26 27 28 29 30 31
prefix="$prefix/openfpm_vcluster"
echo "Installation dir is: $prefix"

AC_PROG_RANLIB
AM_PROG_AR

incardon's avatar
incardon committed
32 33 34 35 36 37 38
# Checks for programs.
AC_PROG_CXX

# Checks g++ flags

AC_CANONICAL_HOST

incardon's avatar
incardon committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
###### Check for verbose

AC_MSG_CHECKING(whether to build with verbose print)
verbose=no
AC_ARG_ENABLE(verbose,
	AC_HELP_STRING(
	    [--enable-verbose],
	    [enable verbose print (def=no)]
	),
  	verbose="$enableval"
)



AC_MSG_RESULT($verbose)
if test x"$verbose" = x"yes"; then
	AC_DEFINE([VERBOSE_TEST],[],[Verbose test])
fi

incardon's avatar
incardon committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
###### 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
79
	CXXFLAGS="$CXXFLAGS -Wall -O3 -g3 -funroll-loops "
incardon's avatar
incardon committed
80 81 82
	NVCCFLAGS+="$NVCCFLAGS -O3 "
fi

83
####### include openfpm_devices include path
incardon's avatar
incardon committed
84

85
INCLUDES_PATH+=" -I/usr/local/include -I. -Iconfig -I../../openfpm_devices/src -I../../openfpm_data/src"
incardon's avatar
incardon committed
86 87

###### Check for memleak check compilation
incardon's avatar
incardon committed
88

incardon's avatar
incardon committed
89 90 91
AC_MSG_CHECKING(whether to build with memory check)
mem_check=no
AC_ARG_ENABLE(memcheck,
incardon's avatar
incardon committed
92
	AC_HELP_STRING(
incardon's avatar
incardon committed
93 94
	    [--enable-memcheck],
	    [enable memory checking (def=no)]
incardon's avatar
incardon committed
95
	),
incardon's avatar
incardon committed
96
  	mem_check="$enableval"
incardon's avatar
incardon committed
97 98 99
)


incardon's avatar
incardon committed
100 101 102 103 104
AC_MSG_RESULT($mem_check)
if test x"$mem_check" = x"yes"; then
	AC_DEFINE([MEMLEAK_CHECK],[],[Memory check])
fi

105 106 107 108 109 110 111
####################################

DEFAULT_LIB=""
# At least for glibc, clock_gettime is in librt.  But don't pull that
# in if it still doesn't give us the function we want.
AC_CHECK_LIB(rt, clock_gettime,[DEFAULT_LIB+=" -lrt "],[],[])

incardon's avatar
incardon committed
112 113
##### CHECK FOR BOOST ##############

incardon's avatar
incardon committed
114
AX_BOOST([1.52],[],[])
incardon's avatar
incardon committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136

####### Checking for GPU support

AX_CUDA

if test x"$NVCC_EXIST" = x"yes"; then
  AC_MSG_CHECKING(whether to build with GPU support)
  gpu_support=yes
  AC_ARG_ENABLE(gpu,
        AC_HELP_STRING(
            [--enable-gpu],
            [enable gpu support]
        ),
        gpu_support="$enableval"
  )

  AC_MSG_RESULT($gpu_support)
  if test x"$gpu_support" = x"yes"; then
        AC_DEFINE([CUDA_GPU],[],[CUDA GPU support])
  fi
else
  gpu_support=no
incardon's avatar
incardon committed
137 138 139 140 141
fi


# Set this conditional if cuda is wanted

incardon's avatar
incardon committed
142 143 144 145 146
#

AM_CONDITIONAL(BUILDCUDA, test x$gpu_support = x"yes")

##########################
incardon's avatar
incardon committed
147 148

AC_SUBST(NVCCFLAGS)
incardon's avatar
incardon committed
149
AC_SUBST(INCLUDES_PATH)
150
AC_SUBST(DEFAULT_LIB)
incardon's avatar
incardon committed
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_CONFIG_FILES([Makefile src/Makefile])
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
166 167 168 169 170
if [ test x"$memcheck" = x"yes" ]; then
  echo "*    memcheck: yes                *"
else
  echo "*    memcheck: no                 *"
fi
incardon's avatar
incardon committed
171 172 173 174 175 176 177 178 179 180 181 182 183
if [ test x"$debuger" = x"yes" ]; then
  echo "*    debug: yes                   *"
else
  echo "*    debug: no                    *"
fi
if [ test x"$gpu_support" = x"no" ]; then
  echo "*    gpu: no                      *"
else
  echo "*    gpu: yes                     *"
fi
echo   "*                                 *"
echo   "***********************************"