-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
140 lines (116 loc) · 3.39 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
AC_INIT([SUNphi],[1.0],[[email protected]])
AX_GET_CONFIGURE_PARS($*)
AC_CONFIG_SRCDIR([include])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([1.14 no-define foreign subdir-objects])
AM_CONFIG_HEADER(include/config.hpp)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_PROG_RANLIB
# Enable C and C++
AC_PROG_CC
AC_PROG_CXX
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX(17,noext,mandatory)
# Activate all warnings
AX_CXXFLAGS_WARN_ALL
# Check all x86 features supported
AX_CHECK_X86_FEATURES
# Silent automake
AM_SILENT_RULES([yes])
# Search for pthread
AX_SUBPACKAGE(threads,pthread.h,pthread,pthread_getconcurrency,THREADS,autouse)
# Search automatically MPI for c++
AC_LANG_PUSH([C++])
LX_FIND_MPI
AC_LANG_POP([C++])
AC_MSG_RESULT([with C++ MPI preprocessor options... $MPI_CXXFLAGS])
AC_MSG_RESULT([with C++ MPI link options... $MPI_CXXLDFLAGS])
AC_MSG_RESULT([with C++ MPI libs... $MPI_CXXLIBS])
# Debug or not
AX_SIMPLE_ENABLE([debug],[no],[Enable debug mode (strip all optimization, add -O0 -g)])
if test "$enable_debug" == "yes"
then
changequote({,})
remove_flags='s|-O[0-9s]*||g;s|-g[0-9]*||g'
CFLAGS=`echo "$CFLAGS"|sed -e $remove_flags`
CPPFLAGS=`echo "$CPPFLAGS"|sed -e $remove_flags`
CXXFLAGS=`echo "$CXXFLAGS"|sed -e $remove_flags`
CPPFLAGS="$CPPFLAGS -g -O0"
changequote([,])
AC_DEFINE([DEBUG_MODE],1,[Enable debug mode])
fi
# Check if we enable MPI
AX_SIMPLE_ENABLE([MPI],[$have_CXX_mpi],[Enable MPI])
if test "$enable_MPI" == "yes"
then
# Check if we have MPI
if test "$have_CXX_mpi" == "yes"
then
CPPFLAGS="$MPI_CXXFLAGS $CPPFLAGS"
LIBS="$MPI_CXXLIBS $LIBS"
LDFLAGS="$MPI_CXXLDFLAGS $LDFLAGS"
AC_DEFINE([USE_MPI],1,[Enable MPI])
else
AC_MSG_ERROR(["Unable to find MPI"])
fi
fi
# Enable SIMD Mersenne-twister
AX_SIMPLE_ENABLE([SIMD-Mersenne-twister],[$support_sse2],[Enable SSE2 for Mersenne twister])
if test "$enable_SIMD_Mersenne_twister" == "yes"
then
if test "$enable_sse2" == "no"
then
AC_MSG_ERROR(["Cannot enable SIMD Mersenne-twister, SSE2 not enabled"])
fi
AC_DEFINE([USE_SIMD_MERSENNE_TWISTER],1,[Enable SIMD Mersenne twister])
fi
# Search for dwarf
if test "$enable_debug" == "yes"
then
default_dwarf=autouse
else
default_dwarf=
fi
AX_SUBPACKAGE(dwarf,libdwarf/dwarf.h,dwarf,dwarf_child,DWARF,$default_dwarf)
# yaml-cpp library
AX_SUBPACKAGE(yaml,yaml-cpp/yaml.h,yaml-cpp,YAML::Emitter,YAML,mandatory)
# Check if we enable assembler code generation
AX_SIMPLE_ENABLE([asm-code],[no],[Enable assembler code generation])
if test "$enable_asm_code" == "yes"
then
CXX="$(readlink -f $srcdir)/config/createAsm.sh $CXX"
fi
# Configure doxygen
DX_INIT_DOXYGEN($PACKAGE_NAME,[config/Doxyfile],[docs])
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_MAN_FEATURE(ON)
DX_HTML_FEATURE(ON)
AC_SUBST([DOXYGEN_OUTPUT_DIR],[docs])
# Result of conf to screen
AC_MSG_RESULT([
--------------------------------------------------
Configuration summary for $PACKAGE_NAME ($VERSION)
--------------------------------------------------
CC : $CC
CPPFLAGS : $CPPFLAGS
CXXFLAGS : $CXXFLAGS
CXX : $CXX
---
LDFLAGS : $LDFLAGS
LIBS : $LIBS
---
Installation prefix : $prefix
$LIBRARY_RESULT
$SUMMARY_RESULT
--------------------------------------------------
Configuration OK
--------------------------------------------------
])
# Configure output
AC_CONFIG_FILES(Makefile
bin/Makefile
lib/Makefile
config/Doxyfile)
AC_OUTPUT