forked from CMA-ES/libcmaes
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
183 lines (162 loc) · 5.67 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
# configure for libcmaes
# author
AC_INIT(libcmaes,0.9.5)
AC_MSG_NOTICE([libcmaes $PACKAGE_VERSION])
AC_CONFIG_SRCDIR(Makefile.am)
AM_INIT_AUTOMAKE([subdir-objects])
AM_CONFIG_HEADER([libcmaes_config.h])
AC_CONFIG_FILES(libcmaes.pc)
#ac_default_prefix=`pwd`
#bindir=$ac_default_prefix/bin/$host
#libdir=$ac_default_prefix/lib/$host
AC_PROG_INSTALL
AC_CANONICAL_HOST
AC_PROG_CC(clang++ g++ c++) # force c++ compiler on C files, otherwise BBOB lib doesn't link properly
AC_PROG_CXX(clang++ g++ c++)
AM_CONDITIONAL(HAVE_CLANG, test x"$CXX" = xclang++)
AC_PROG_INSTALL
AC_PROG_LIBTOOL
m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
AX_CXX_COMPILE_STDCXX_11()
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([for eigen3])
AC_ARG_WITH(eigen3-include,
AC_HELP_STRING([--with-eigen3-include=DIR], [Path to the eigen3 header files]),
[eig_incs=$withval],
[eig_incs=/usr/include/eigen3])
AC_CHECK_FILE($eig_incs/Eigen,,
[AC_CHECK_FILE(/usr/local/include/eigen3,[eig_incs=/usr/local/include/eigen3])])
eig_ac_save_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$eig_incs"
lib_eig_avail=no
AC_CHECK_HEADER(Eigen/Dense,
lib_eig_avail=yes,)
CPPFLAGS=$eig_ac_save_cppflags
if test x"$lib_eig_avail" = xyes; then
AC_SUBST([EIGEN3_INC], [$eig_incs])
else
AC_MSG_ERROR([Cannot find Eigen3])
fi
AM_CONDITIONAL(HAVE_EIGEN3, test x"$lib_eig_avail" = xyes)
# Check if there is google-gflags library installed.
AC_ARG_WITH(gflags, AS_HELP_STRING[--with-gflags=GFLAGS_DIR],
GFLAGS_CFLAGS="-I${with_gflags}/include"
GFLAGS_LIBS="-L${with_gflags}/lib -lgflags"
CFLAGS="$CFLAGS $GFLAGS_CFLAGS"
LIBS="$LIBS $GFLAGS_LIBS"
)
AC_CHECK_LIB(gflags, main, ac_cv_have_libgflags=1, ac_cv_have_libgflags=0)
if test x"$ac_cv_have_libgflags" = x"1"; then
AC_DEFINE(HAVE_LIB_GFLAGS, 1, [define if you have google gflags library])
if test x"$GFLAGS_LIBS" = x""; then
GFLAGS_LIBS="-lgflags"
fi
else
GFLAGS_CFLAGS=
GFLAGS_LIBS=
fi
AC_SUBST(GFLAGS_LIBS)
AC_SUBST(GFLAGS_CFLAGS)
AM_CONDITIONAL(HAVE_GFLAGS, test x"$ac_cv_have_libgflags" = x"1")
# Check if there is google-glog library installed.
AC_ARG_ENABLE(gglog,
AC_HELP_STRING([--enable-gglog],[Enable google glog (default is NO)]),
[case "${enableval}" in
yes) gglog=true ;;
no) gglog=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for --enable-gglog) ;;
esac],[gglog=false])
if test x"$gglog" = x"true"; then
AC_DEFINE(HAVE_GLOG,1,[google glog requested])
fi
AC_ARG_WITH(glog, AS_HELP_STRING[--with-glog=GLOG_DIR],
GLOG_CFLAGS="-I${with_glog}/include"
GLOG_LIBS="-L${with_glog}/lib -lglog"
CFLAGS="$CFLAGS $GLOG_CFLAGS"
LIBS="$LIBS $GLOG_LIBS"
)
AC_CHECK_LIB(glog, main, ac_cv_have_libglog=1, ac_cv_have_libglog=0)
if test x"$ac_cv_have_libglog" = x"1"; then
AC_DEFINE(HAVE_LIB_GLOG, 1, [define if you have google glog library])
if test x"$GLOG_LIBS" = x""; then
GLOG_LIBS="-lglog"
fi
else
GLOG_CFLAGS=
GLOG_LIBS=
fi
AC_SUBST(GLOG_LIBS)
# Check for gtest.
AC_CHECK_HEADER([gtest/gtest.h], gtest_header_avail=yes,)
AM_CONDITIONAL(HAVE_GTEST, test x"$gtest_header_avail" = xyes)
# Whether to compile with BBOB
AC_ARG_ENABLE(bbob,
AC_HELP_STRING([--enable-bbob],[Enable support for BBOB'2013 benchmark (default is NO)]),
[case "${enableval}" in
yes) bbob=true ;;
no) bbob=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for --enable-bbob) ;;
esac],[bbob=false])
AM_CONDITIONAL(HAVE_BBOB, test x$bbob = xtrue)
# Whether to compile with python wrapper support
AC_ARG_ENABLE(python,
AC_HELP_STRING([--enable-python],[Enable support for python wrapper (default is NO)]),
[case "${enableval}" in
yes) python=true ;;
no) python=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for --enable-python) ;;
esac],[python=false])
AM_CONDITIONAL(HAVE_PYTHON, test x$python = xtrue)
if test x"$python" = x"true"; then
# AC_DEFINE(HAVE_PYTHON, 1, [python boost])
AX_BOOST_PYTHON()
if test "$BOOST_PYTHON_LIB" == ""; then
AC_MSG_ERROR(boost python required for building the python wrapper,1)
fi
fi
# Check for numpy
if test x"$python" = x"true"; then
AC_MSG_CHECKING([for Numpy include directory])
CPPFLAGS=$PYTHON_CPPFLAGS $CPPFLAGS
NUMPY_INCLUDE_DIR=`echo "import numpy; print numpy.get_include()" | $PYTHON - 2>/dev/null`
AC_SUBST(NUMPY_INCLUDE_DIR)
AC_CHECK_HEADER([${NUMPY_INCLUDE_DIR}/numpy/arrayobject.h],
[NUMPY_HEADER=yes],
[AC_MSG_ERROR([Numpy extension header not found])],
[#include "Python.h"])
AC_SUBST(NUMPY_HEADER)
fi
# Whether to only compile the library, without exe (e.g. tests and examples).
AC_ARG_ENABLE(onlylib,
AC_HELP_STRING([--enable-onlylib],[Compile the library alone without tests and examples (default is NO)]),
[case "${enableval}" in
yes) onlylib=true ;;
no) onlylib=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for --enable-onlylib) ;;
esac],[onlylib=false])
AM_CONDITIONAL(HAVE_ONLYLIB, test x$onlylib = xtrue)
# Whether to compile support for surrogates
AC_ARG_ENABLE(surrog,
AC_HELP_STRING([--enable-surrog],[Compile the library with support for surrogates (default is YES)]),
[case "${enableval}" in
yes) surrog=true ;;
no) surrog=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for --enable-surrog) ;;
esac],[surrog=true])
AM_CONDITIONAL(HAVE_SURROG, test x$surrog = xtrue)
if test x"$surrog" = x"true"; then
AC_DEFINE(HAVE_SURROG, 1, [surrog])
fi
# Whether debug mode
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable debug mode (default is NO)]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad_value ${enableval} for --enable-debug) ;;
esac],[debug=false])
if test x"$debug" = x"true"; then
AC_DEFINE(HAVE_DEBUG, 1, [debug])
fi
#AM_CONDITIONAL(HAVE_DEBUG, test x$debug = xtrue)
AC_OUTPUT(Makefile src/Makefile tests/Makefile examples/Makefile python/Makefile)