summaryrefslogtreecommitdiff
path: root/server/configure.in
blob: 63e2e249da7c283268e07bc4d1a4e6d988512b4f (plain)
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# Filename: configure.in

AC_INIT(src/pracrod.cc)

VERSION="2.2.0"
AM_INIT_AUTOMAKE( pracrod, $VERSION )

dnl ======================
dnl Compile with debug options
dnl ======================
AC_ARG_WITH(debug,
	[  --with-debug            build with debug support (default=no)],
	[],
	[with_debug=no])
if test x$with_debug == xyes; then
    AC_MSG_WARN([*** Building with debug support!])
    AC_DEFINE_UNQUOTED(WITH_DEBUG, , [The project is configured to use debug output])
    CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector -Wall -Werror -g -O0"
fi

dnl ======================
dnl Check for inotify (old and new)
dnl ======================
inotify_support=no
AC_CHECK_HEADERS([sys/inotify.h],
[
  AC_CHECK_FUNCS(inotify_init1, inotify_support=yes
)
])
if test "$inotify_support" = "no"
then
  AC_MSG_ERROR([*** Inotify not found (needs at least 2.6.21 kernel)!])
fi
#AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])

dnl ======================
dnl Init pkg-config
dnl ======================
PKG_PROG_PKG_CONFIG(0.23)

dnl ======================
dnl Compile with praxisd support
dnl ======================
AC_ARG_WITH(praxisd,
	[  --with-praxisd          build with praxisd support (default=yes)],
	[],
	[with_praxisd=yes])
if test x$with_praxisd == xno; then
    AC_MSG_WARN([*** Building without praxisd support!])
else
    AC_DEFINE_UNQUOTED(WITH_PRAXISD, , [The project is configured to use praxisd])
    dnl ======================
    dnl Check for cURL library
    dnl ======================
    PKG_CHECK_MODULES(CURL, libcurl >= 7.9.5)
fi

dnl ======================
dnl Compile with artefact support
dnl ======================
AC_ARG_WITH(artefact,
	[  --with-artefact         build with artefact support (default=yes)],
	[],
	[with_artefact=yes])
if test x$with_artefact == xyes; then
    PKG_CHECK_MODULES(ATF, libartefact >= 0.0.2)
else
    AC_MSG_WARN([*** Building without artefact support!])
    AC_DEFINE_UNQUOTED(WITHOUT_ARTEFACT, , [The project is configured not to use artefact])
fi 

dnl ======================
dnl Compile without uploadserver support
dnl ======================
AC_ARG_WITH(uploadserver,
	[  --with-uploadserver     build with uploadserver support (default=yes)],
	[],
	[with_uploadserver=yes])
if test x$with_uploadserver == xno; then
    AC_MSG_WARN([*** Building without uploadserver support!])
    AC_DEFINE_UNQUOTED(WITHOUT_UPLOADSERVER, , [The project is configured not to use the upload server])
fi 

dnl ======================
dnl Compile without db support
dnl ======================
AC_ARG_WITH(db,
	[  --with-db               build with db support (default=yes)],
	[],
	[with_db=yes])
if test x$with_db == xno; then
    AC_MSG_WARN([*** Building without db support!])
    AC_DEFINE_UNQUOTED(WITHOUT_DB, , [The project is configured not to use the db])
else
    dnl ======================
    dnl Check for libpqxx
    dnl ======================
    PKG_CHECK_MODULES(PQXX, libpqxx >= 2.6.8)
fi 

dnl ======================
dnl Compile with ssl support?
dnl ======================
AC_ARG_WITH(ssl,
	[  --with-ssl              build with ssl support, requires microhttpd to be build with ssl support (default=yes)],
	[],
	[with_ssl=yes])
if test x$with_ssl == xno; then
    AC_MSG_WARN([*** Building without ssl support!])
    AC_DEFINE_UNQUOTED(WITHOUT_SSL, , [The project is configured not to use ssl])
else
    AC_MSG_WARN([*** Building with ssl support!])
    dnl ======================
    dnl TODO: Check for ssl support in microhttpd
    dnl ======================
fi 

AC_PROG_CXX

AC_PROG_LIBTOOL
AM_PROG_LIBTOOL

AM_CONFIG_HEADER(config.h)
AC_STDC_HEADERS

dnl ======================
dnl Create the ETC var i config.h
dnl ======================
if echo "$prefix" | grep "NONE" > /dev/null
then
	MYPREFIX="/usr/local"
else
	MYPREFIX="${prefix}"
fi
AC_SUBST(MYPREFIX)
AC_DEFINE_UNQUOTED(ETC, "$MYPREFIX/etc", [The path to the config files])

dnl ======================
dnl Use efence in linking and includes
dnl ======================
AC_ARG_ENABLE(efence,
	[  --enable-efence         enable efence - for debugging only (no)],
	[], [ enable_efence=no])             
if test "x$enable_efence" = xno; then
	enable_efence=no
else
	LD_EFENCE="-lefence"
	AC_SUBST(LD_EFENCE)
	AC_DEFINE_UNQUOTED(USE_EFENCE, , [Use the efence includes])
fi

dnl ======================
dnl Use duma in linking and includes
dnl ======================
AC_ARG_ENABLE(duma,
	[  --enable-duma           enable duma - for debugging only (no)],
	[], [ enable_duma=no])             
if test "x$enable_duma" = xno; then
	enable_duma=no
else
	LD_EFENCE="-lduma"
	AC_SUBST(LD_DUMA)
	AC_DEFINE_UNQUOTED(USE_DUMA, , [Use the duma includes])
fi

dnl ======================
dnl Check for lua
dnl ======================
PKG_CHECK_MODULES(LUA, lua >= 5.1)

dnl ======================
dnl Create the XML var i config.h
dnl ======================
AC_DEFINE_UNQUOTED(XML, "$MYPREFIX/share/xml", [The path to the xml files])

dnl ======================
dnl Check for getopt
dnl ======================
AC_HAVE_HEADERS(getopt.h)

dnl ======================
dnl Check for libconfig++
dnl ======================
PKG_CHECK_MODULES(CONFIG, libconfig++ >= 1.0.1)

dnl ======================
dnl Check for libmicrohttpd
dnl ======================
PKG_CHECK_MODULES(HTTPD, libmicrohttpd >= 0.4.4)

dnl ======================
dnl Compile with openssl
dnl ======================
PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.7)

dnl ======================
dnl Check for eXpat library
dnl ======================
tmp_CXXFLAGS="$CXXFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_LIBS="$LIBS"
CXXFLAGS=""
CPPFLAGS=""
CFLAGS=""
LDFLAGS=""
LIBS=""
AC_CHECK_HEADER(expat.h, , AC_MSG_ERROR([*** eXpat header file not found!]))
AC_CHECK_LIB(expat, XML_ParserCreate, , AC_MSG_ERROR([*** eXpat library not found!]))
EXPAT_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
EXPAT_LIBS="$LDFLAGS $LIBS"
CXXFLAGS="$tmp_CXXFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
AC_SUBST(EXPAT_CFLAGS)
AC_SUBST(EXPAT_LIBS)

dnl ======================
dnl Check for the pthread library
dnl ======================
tmp_CXXFLAGS="$CXXFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_LIBS="$LIBS"
CXXFLAGS=""
CPPFLAGS=""
CFLAGS=""
LDFLAGS=""
LIBS=""
AC_CHECK_HEADER(pthread.h, , AC_MSG_ERROR([*** pthread header file not found!]))
AC_CHECK_LIB(pthread,  pthread_mutex_init, , AC_MSG_ERROR([*** pthread library not found!]))
PTHREAD_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
PTHREAD_LIBS="$LDFLAGS $LIBS"
CXXFLAGS="$tmp_CXXFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)

AC_OUTPUT(
	Makefile
	src/Makefile
	gentoo/init.d/Makefile
	gentoo/init.d/pracrod
	gentoo/logrotate.d/Makefile
	etc/Makefile
	man/Makefile
	tools/Makefile
	xml/templates/Makefile
	xml/macros/Makefile
	xml/courses/Makefile
	xml/Makefile)