forked from valabau/itp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
224 lines (186 loc) · 7.1 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(Casmacat Server Library, 0.1, [email protected])
AC_CONFIG_SRCDIR([src/include/casmacat/compat.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADER([src/include/casmacat/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
dnl Initialize automake
AM_INIT_AUTOMAKE(casmacat, 0.1)
dnl Initialize Libtool
LT_INIT([dlopen])
LTDL_INIT
# The lt_dladvise_init symbol was added with libtool-2.2
if test "x$with_included_ltdl" != "xyes"; then
save_CPPFLAGS="$CPPFLAGS"
save_LDFLAGS="$LDFLAGS"
CFLAGS="$CPPFLAGS $LTDLINCL"
LDFLAGS="$LDFLAGS $LIBLTDL"
AC_CHECK_LIB([ltdl], [lt_dladvise_init],
[],
[AC_MSG_ERROR([installed libltdl is too old])])
LDFLAGS="$save_LDFLAGS"
CPPFLAGS="$save_CPPFLAGS"
fi
# Checks for programs.
#AC_DISABLE_STATIC
dnl Check if Libtool is present
dnl Libtool is used for building share libraries
AC_PROG_LIBTOOL
AC_PROG_CXX
AC_LANG(C++)
AC_PROG_INSTALL
AC_PROG_MAKE_SET
#YACC=bison
#AC_PROG_YACC
#AM_PROG_LEX
# boost
#XXX: disable unit testing since it does not work in many installations
# AX_BOOST_BASE(1.41)
# AX_BOOST_UNIT_TEST_FRAMEWORK
# AM_CONDITIONAL([MAKE_TEST], [test x"$BOOST_UNIT_TEST_FRAMEWORK_LIB" != x])
# check for Python
AM_PATH_PYTHON
AX_PYTHON_DEVEL([>= 2.5])
AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test x"$PYTHON_EXTRA_LIBS" != x])
if [ test "x$PYTHON_EXTRA_LIBS" != x ]; then
AC_DEFINE([HAVE_PYTHON], [1], [Whether Python devel is available])
# Swig python bindings
AX_PKG_SWIG(1.3.40, [], [ AC_MSG_WARN([SWIG is required to build python bindings]) ])
AX_SWIG_ENABLE_CXX
AX_SWIG_PYTHON
AM_CONDITIONAL([HAVE_SWIG], [test "x$SWIG" != x])
AM_CONDITIONAL([HAVE_BOOST_PYTHON], test "x$boost_python_cpplib_avail_cv_" = xtrue)
# right now boost.python does not allow to convert non-const arguments so use SWIG instead
# AX_BOOST_PYTHON
#
# if [ test x$BOOST_PYTHON_LIB != x ]; then
# AC_CACHE_CHECK(
# [if boost_python is available],
# [boost_python_cpplib_avail_cv_],
# [boost_python_save_libs=$LIBS
# LIBS="-lboost_python$BOOST_SUFFIX -lpython$PYTHON_VERSION $LIBS"
# AC_LANG_PUSH(C++)
# AC_LINK_IFELSE(
# [AC_LANG_PROGRAM(
# [[#include <boost/python.hpp>
# using namespace boost::python;
# class foo {};
# BOOST_PYTHON_MODULE(samp) {
# class_< foo > ("foo") ;
# }]],
# [[return 0]])],
# [boost_python_cpplib_avail_cv_=true],
# [boost_python_cpplib_avail_cv_=false])
# AC_LANG_POP
# LIBS=$boost_python_save_libs])
#
# if [ test x$boost_python_cpplib_avail_cv_ = xtrue ]; then
# AC_DEFINE([HAVE_BOOST_PYTHON], [1], [Whether Boost.Python is available])
# LIBS="-lboost_python$BOOST_SUFFIX -lpython$PYTHON_VERSION $LIBS"
# fi
# AM_CONDITIONAL([HAVE_BOOST_PYTHON], test x$boost_python_cpplib_avail_cv_ = xtrue)
# fi
fi
# check perl support
# https://bitbucket.org/jjacky/rxvt-unicode-jjk/src/a815fc4b8585/configure.ac
support_perl=yes
HAVE_PERL=
if test x$support_perl = xyes; then
AC_PATH_PROG(PERL, perl5)
AC_PATH_PROG(PERL, perl)
AC_MSG_CHECKING(for $PERL suitability)
if $PERL -MExtUtils::Embed >/dev/null 2>/dev/null; then
save_CXXFLAGS="$CXXFLAGS"
save_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS `$PERL -MExtUtils::Embed -e ccopts`"
LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
]], [[
PerlInterpreter *perl = perl_alloc ();
]])],[rxvt_perl_link=yes],[rxvt_perl_link=no])
CXXFLAGS="$save_CXXFLAGS"
LIBS="$save_LIBS"
if test x$rxvt_perl_link = xyes; then
AC_MSG_RESULT(ok)
AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter)
HAVE_PERL=YES
PERL_O=rxvtperl.o
PERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts`"
PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`"
PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`"
else
AC_MSG_WARN([no, unable to link. Probably the libperl-dev package is missing])
fi
else
AC_MSG_WARN([no working perl found, or perl not version >= 5.8])
fi
fi
AC_SUBST(PERLLIB)
AC_SUBST(PERLFLAGS)
AC_SUBST(PERLPRIVLIBEXP)
AC_SUBST(PERL)
AC_SUBST(HAVE_PERL)
AC_SUBST(PERL_O)
AM_CONDITIONAL([HAVE_PERL], [test x$rxvt_perl_link = xyes])
# doxygen
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
DX_INIT_DOXYGEN(casmacat, doxygen.cfg, doc)
if test -z "$DOXYGEN";
then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
fi
AC_SUBST(HAVE_DOXYGEN)
# optional configure options
AC_ARG_WITH(debug, AC_HELP_STRING(--with-debug, \
[enable debug]), \
[ DEBUG=true \
CXXFLAGS="-g3 -O0"])
AC_ARG_WITH(gprof, AC_HELP_STRING(--with-gprof, \
[enable profiler]), \
[ PROFILE=true \
CPPFLAGS="-DDEBUG=1" \
CXXFLAGS+=" -pg"])
AC_ARG_WITH([thot], [AC_HELP_STRING([--with-thot], \
[enable thot plugins])], \
[THOT_DIR="$with_thot"], [THOT_DIR=""])
AC_MSG_WARN([thot include dir $with_thot])
AM_CONDITIONAL([HAVE_THOT], [test x"$with_thot" != x])
AC_SUBST([THOT_DIR])
# Checks for libraries.
AM_PROG_LIBTOOL
dnl this allows us specify individual liking flags for each target
AM_PROG_CC_C_O
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([string])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
#COMPILANCE_CXXFLAGS="${CPPCXXFLAGS} -D_POSIX_C_SOURCE=200809L"
AX_CHECK_COMPILE_FLAG([-pedantic], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -pedantic"])
#AX_CHECK_COMPILE_FLAG([-fpermissive], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -fpermissive"])
AX_CHECK_COMPILE_FLAG([-Wall], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Wall"])
AX_CHECK_COMPILE_FLAG([-Wextra], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Wextra"])
AX_CHECK_COMPILE_FLAG([-Wshadow], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Wshadow"])
# enable this on profiling since it will show which inlines where not made
#AX_CHECK_COMPILE_FLAG([-Winline], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Winline"])
AX_CHECK_COMPILE_FLAG([-Wunused], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Wunused"])
AX_CHECK_COMPILE_FLAG([-Wunused-variable], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Wunused-variable"])
AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Wunused-parameter"])
AX_CHECK_COMPILE_FLAG([-Wunused-function], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -Wunused-function"])
AS_IF(test x"$DEBUG" = x"true" -o "$PROFILE" = x"true" , [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -DDEBUG -DLT_DEBUG_LOADERS"], [WARNING_CXXFLAGS="${WARNING_CXXFLAGS} -DNDEBUG"])
#AS_IF(test x"$DEBUG" = x"true", [OPTIMIZATION_CXXFLAGS="${OPTIMIZATION_CXXFLAGS} -DDEBUG -g3 -O0"], [OPTIMIZATION_CXXFLAGS="${OPTIMIZATION_CXXFLAGS} -O2 -ffast-math"])
AC_SUBST([WARNING_CXXFLAGS], ["${WARNING_CXXFLAGS}"])
AC_SUBST([COMPILANCE_CXXFLAGS])
AC_SUBST([OPTIMIZATION_CXXFLAGS])
AC_CONFIG_FILES(Makefile
src/bin/Makefile
src/lib/Makefile
src/include/casmacat/Makefile
docs/Makefile
docs/doxygen.cfg)
AC_OUTPUT