-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure.in
474 lines (429 loc) · 10.8 KB
/
configure.in
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
dnl Process this file with autoconf to produce a configure script.
dnl $Id$ $Name$
AC_PREREQ(2.59)
AC_INIT(showeq, 5.13.10.51)
AC_CONFIG_SRCDIR(src/main.cpp)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(1.11 dist-bzip2)
AM_MAINTAINER_MODE
dnl doxygen macros
dnl DX_HTML_FEATURE(ON)
dnl DX_CHM_FEATURE(OFF)
dnl DX_CHI_FEATURE(OFF)
dnl DX_MAN_FEATURE(OFF)
dnl DX_RTF_FEATURE(OFF)
dnl DX_XML_FEATURE(OFF)
dnl DX_PDF_FEATURE(OFF)
dnl DX_PS_FEATURE(OFF)
dnl DX_INIT_DOXYGEN(ShowEQ, doxygen.cfg, dox)
dnl Use CCd/CXXd rather than CC/CXX otherwise it cache's the value
dnl and prevents the alternate search from working. Would be better
dnl if there was someway to invalidate the cache entry. ??
AC_CHECK_PROGS(CCd,$CC gcc cc gcc3 gcc-3.0)
AC_CHECK_PROGS(CXXd,$CXX $CCC g++ c++ gcc CC cxx cc++ gcc g++3 g++-3.0)
CC=$CCd
CXX=$CXXd
AC_ARG_ENABLE(old-compiler,
[ --enable-old-compiler Compile with an older compiler],
[ AC_MSG_CHECKING(whether to build with an older compiler)
case "${enableval}" in
yes) AC_MSG_RESULT(yes);
ac_cv_showeq_old_compiler=yes
;;
*) AC_MSG_RESULT(no)
ac_cv_showeq_old_compiler=no
;;
esac] )
AC_DEFUN([CHECK_COMPILER],[
ac_save_cxxflags="$CXXFLAGS"
if [[ "$ac_cv_showeq_old_compiler" == "yes" ]]; then
CXXFLAGS="$CXXFLAGS -DOLDCOMPILER"
fi
AC_TRY_LINK(
[
#include <stdio.h>
],
[
#ifdef __GNUC__
#if ((!defined(OLDCOMPILER) && (__GNUC__ < 3)) || \
((__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 96))))
#ifdef __GNUC_PATCHLEVEL__
printf("Unsupported GCC Version: %d.%d.%d\n",
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#else
printf("Unsuported GCC Version: %d.%d\n", __GNUC__, __GNUC_MINOR__);
#endif
#error "Unsupported Compiler Version"
#else
#ifdef __GNUC_PATCHLEVEL__
printf("GCC Version: %d.%d.%d\n",
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#else
printf("GCC Version: %d.%d\n", __GNUC__, __GNUC_MINOR__);
#endif
#endif
#else
printf("Non-GNU Compiler\n");
#warning "Unknown Compiler may or may not work!"
#endif
],
[
AC_MSG_RESULT(yes)
HAVE_GCC="YES";
],
[
AC_MSG_RESULT(no);
HAVE_GCC="NO";
]
)
CXXFLAGS="$ac_save_cxxflags"
]
)
AC_MSG_CHECKING(for supported compiler version)
AC_LANG_CPLUSPLUS
CHECK_COMPILER
if test "$HAVE_GCC" = "NO"; then
unset CC
unset CXX
AC_CHECK_PROGS(CC,gcc-3.0 gcc3)
AC_CHECK_PROGS(CXX,g++-3.0 g++3)
AC_MSG_CHECKING(alternate compiler for supported compiler version)
CHECK_COMPILER
fi
if test "$HAVE_GCC" = "NO"; then
AC_MSG_ERROR([You need at least GCC G++ 3.0 or greater to compile ShowEQ])
fi
AC_LANG_C
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
dnl Checks for typedefs, structures, and compiler characteristics.
dnl AC_C_CONST will fail if c++ is switched on using AC_LANG_CPLUSPLUS
dnl before this test is run.
AC_C_CONST
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING(for supported libc version)
AC_TRY_LINK(
[
#include <stdio.h>
],
[
#ifdef __GLIBC__
#if __GLIBC_MINOR__ < 2
printf("Unsuported GLIBC Version: %d.%d\n", __GLIBC__, __GLIBC_MINOR__);
#error "Unsupported Compiler Version"
#else
printf("GLIBC Version: %d.%d\n", __GLIBC__, __GLIBC_MINOR__);
#endif
#else
printf("Non-GNU LibC\n");
#warning "Unknown LibC may or may not work!"
#endif
],
[
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
AC_MSG_ERROR([You need at least glibc-2.2 or greater to compile ShowEQ])
]
)
AC_PATH_QT_MOC
AC_PATH_QT_UIC
AC_PATH_QT
dnl The below needs to be re-defined since the Qt defines from KDE destroy it
AC_LANG_CPLUSPLUS
dnl Check taken from SINS 0.5
AC_DEFUN([SHOWEQ_CHECK_THREADING],[
AC_LANG_CPLUSPLUS
USE_THREADS=""
LIBGETOPT=""
LIBPTHREAD=""
LIBPCAP_EXTRA=""
case $target_os in
solaris*)
USE_THREADS="-D_THREAD_SAFE"
LIBPTHREAD="-pthread"
LIBPCAP_EXTRA="-lresolv"
echo "setting Solaris pthread compilation options"
;;
freebsd*)
USE_THREADS="-D_THREAD_SAFE"
LIBPTHREAD="-pthread"
LIBGETOPT="-L/usr/local/lib/ -lgnugetopt"
echo "setting FreeBSD pthread compilation options"
;;
aix*)
USE_THREADS="-D_THREAD_SAFE"
LIBPTHREAD="$LIBPTHREAD -lc_r"
echo "setting AIX pthread compilation options"
;;
linux*)
AC_CHECK_LIB( pthread,
pthread_create,
USE_THREADS="-D_REENTRANT"
LIBPTHREAD="-lpthread"
echo "setting Linux pthread compilation options",
AC_MSG_ERROR( cannot find pthread_create in libpthread )
)
;;
*)
;;
esac
AC_SUBST(USE_THREADS)
AC_SUBST(LIBPTHREAD)
AC_SUBST(LIBGETOPT)
])
dnl Checks for libraries.
dnl check for the threading library
SHOWEQ_CHECK_THREADING
AC_CHECK_LIB(pcap, pcap_open_live,
,
AC_MSG_ERROR(cannot find pcap_open_live in libpcap. Read the INSTALL file.))
AC_CHECK_LIB(gd, gdImageCreate,
havegd=true,
havegd=false)
AM_CONDITIONAL(HAVE_GD, test x$havegd=xtrue)
AC_CHECK_LIB(gd, gdImagePng,
AC_DEFINE(HAVE_GD_IMAGEPNG, 1, Define if libgd supports PNG))
AC_CHECK_LIB(z, inflate,
,
AC_MSG_ERROR(cannot find compresion library functions. Make sure libz is installed) )
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(deque,,AC_MSG_ERROR(cannot find deque, normally part of a c++ development package))
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_ARG_ENABLE(cgi,
[ --enable-cgi=DIR Compile CGIs and install in specified DIR],
[ AC_MSG_CHECKING(whether to build CGIs)
case "${enableval}" in
no) AC_MSG_RESULT(No) ;;
yes) for dir in /var/www/cgi-bin /home/httpd/cgi-bin; do
if test -d ${dir} ; then
enableval=${dir}
fi
done
if test -d ${enableval} ; then
cgi=true
CGIDIR=${enableval}
AC_MSG_RESULT(${enableval})
else
AC_MSG_RESULT(No path found)
cgi=false
fi
;;
*) AC_MSG_RESULT(${enableval})
cgi=true
CGIDIR=${enableval}
;;
esac ], [cgi=false])
AC_SUBST(CGIDIR)
AM_CONDITIONAL(CGI, test x$cgi = xtrue)
CGI_ICON_DIR=/eq-icons/
CGI_ICONS=false
AC_ARG_ENABLE(cgi-icons,
[ --enable-cgi-icons=DIR Directory on your server where your icons will
be stored (/eq-icons/ for http://<SERVER>/eq-icons/).],[ AC_MSG_CHECKING(whether to enable build CGIs with icon support)
case "${enableval}" in
no) CGI_ICON_DIR=/eq-icons/
AC_MSG_RESULT(no)
CGI_ICONS=false
;;
yes) CGI_ICON_DIR=/eq-icons/
AC_MSG_RESULT(${CGI_ICON_DIR})
CGI_ICONS=true
;;
*) CGI_ICON_DIR=${enableval}
AC_MSG_RESULT(${CGI_ICON_DIR})
CGI_ICONS=true
;;
esac ], [CGI_ICONS=false])
AC_SUBST(CGI_ICONS)
AC_SUBST(CGI_ICON_DIR)
AC_MSG_CHECKING(whether to enable debugging code and flags)
AC_ARG_ENABLE(debug,
[ --disable-debug turn off debugging code and flags ],
[ case "${enableval}" in
yes)
AC_MSG_RESULT(yes)
DEBUG="1"
USE_DEBUG_C="-Wall -g -ggdb -DDEBUG"
USE_DEBUG_CXX="-Wall -g -ggdb -DDEBUG"
ac_cv_showeq_debug="${enableval}"
;;
no)
AC_MSG_RESULT(no)
DEBUG=
USE_DEBUG_C="-Wall -UDEBUG"
USE_DEBUG_CXX="-Wall -UDEBUG"
ac_cv_showeq_debug="${enableval}"
;;
esac
],
[ AC_MSG_RESULT(yes)
USE_DEBUG_C="-Wall -g -ggdb -DDEBUG"
USE_DEBUG_CXX="-Wall -g -ggdb -DDEBUG"
ac_cv_sins_debug=yes
]
)
AC_SUBST(DEBUG)
AC_MSG_CHECKING(whether to build with optimization enabled)
AC_ARG_ENABLE(
optimization,
[ --disable-optimization turn off compiler optimizations ],
[ case "${enableval}" in
yes)
AC_MSG_RESULT(yes)
USE_OPT_C="-O2"
USE_OPT_CXX="-O2"
ac_cv_showeq_optimization=yes
;;
no)
AC_MSG_RESULT(no)
USE_OPT_C=
USE_OPT_CXX=
ac_cv_showeq_optimization=no
;;
6)
AC_MSG_RESULT(level 6)
USE_OPT_C="-O6"
USE_OPT_CXX="-O6"
ac_cv_showeq_optimization="${enableval}"
;;
3)
AC_MSG_RESULT(level 3)
USE_OPT_C="-O3"
USE_OPT_CXX="-O3"
ac_cv_showeq_optimization="${enableval}"
;;
2)
AC_MSG_RESULT(level 2)
USE_OPT_C="-O2"
USE_OPT_CXX="-O2"
ac_cv_showeq_optimization="${enableval}"
;;
1)
AC_MSG_RESULT(level 1)
USE_OPT_C="-O1"
USE_OPT_CXX="-O1"
ac_cv_showeq_optimization="${enableval}"
;;
esac
],
[ AC_MSG_RESULT(yes)
USE_OPT_C="-02"
USE_OPT_CXX="-O2"
ac_cv_sins_optimization=yes
]
)
AC_MSG_CHECKING(whether to build with code inlined)
AC_ARG_ENABLE(inlines,
[ --disable-inlines Disable code inlining],
[ case "${enableval}" in
no) AC_MSG_RESULT(no)
USE_INLINE_C="-fno-inline-functions"
USE_INLINE_CXX="-fno-inline-functions"
ac_cv_showeq_inlines=no
;;
*) AC_MSG_RESULT(yes);
USE_INLINE_C="-finline-functions"
USE_INLINE_CXX="-finline-functions"
ac_cv_showeq_inlines=yes
;;
esac],
[ AC_MSG_RESULT(yes);
USE_INLINE_C="-finline-functions"
USE_INLINE_CXX="-finline-functions"
ac_cv_showeq_inlines=yes
]
)
MEMORY_LIBS=
AC_ARG_ENABLE(mpr,
[ --enable-mpr Compile with mpr],
[ AC_MSG_CHECKING(whether to build with mpr)
case "${enableval}" in
yes) AC_MSG_RESULT(yes);
MEMORY_LIBS="-lmpr"
ac_cv_showeq_mpr=yes
;;
*) AC_MSG_RESULT(no)
ac_cv_showeq_mpr=no
;;
esac] )
AC_ARG_ENABLE(mpatrol,
[ --enable-mpatrol Compile with mpatrol],
[ AC_MSG_CHECKING(whether to build with mpatrol)
case "${enableval}" in
yes) AC_MSG_RESULT(yes);
MEMORY_LIBS="-lmpatrol -lbfd -liberty"
ac_cv_showeq_mpatrol=yes
;;
*) AC_MSG_RESULT(no)
ac_cv_showeq_mpatrol=no
;;
esac] )
AC_SUBST(MEMORY_LIBS)
AC_MSG_CHECKING(whether to build with profiling)
AC_ARG_ENABLE(profiling,
[ --enable-profiling Compile with profiling data for gprof],
[ case "${enableval}" in
yes) AC_MSG_RESULT(yes);
USE_PROFILE_C="-pg"
USE_PROFILE_CXX="-pg"
PROFILE_LIBS="-pg"
ac_cv_showeq_profiling=yes
;;
no) AC_MSG_RESULT(no)
USE_PROFILE_C=
USE_PROFILE_CXX=
PROFILE_LIBS=
ac_cv_showeq_profiling=no
;;
esac],
[ AC_MSG_RESULT(no)
USE_PROFILE_C=
USE_PROFILE_CXX=
PROFILE_LIBS=
ac_cv_showeq_profiling=no
]
)
AC_SUBST(PROFILE_LIBS)
AC_MSG_CHECKING(whether to build for use with the test server)
AC_ARG_WITH(test-server,
[ --with-test-server Compile for use with the test server ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(TEST_SERVER, 1, Define if compiling for test server)
test_server=true ],
[ AC_MSG_RESULT(no)
test_server=false ]
)
AM_CONDITIONAL(TEST_SERVER, test x$test_server = xtrue)
AC_CHECK_RPATH
CFLAGS="$USE_THREADS $USE_OPT_C $USE_DEBUG_C $USE_INLINE_C $USE_PROFILE_C $CFLAGS"
CXXFLAGS="$USE_THREADS $USE_OPT_CXX $USE_DEBUG_CXX $USE_INLINE_CXX $USE_PROFILE_CXX -DQT_THREAD_SUPPORT=1 -DDISPLAY_ICONS=${CGI_ICONS} -DICON_DIR=\\\"${CGI_ICON_DIR}\\\" $CXXFLAGS"
AC_DEFUN([SUCCESS],[
echo "Success!"
case $target_os in
solaris*)
echo "<insert build instructions here>"
;;
freebsd*)
echo "Please run:"
echo " gmake"
;;
linux*)
echo "Please run:"
echo " make"
;;
esac
])
AC_OUTPUT([Makefile src/Makefile conf/Makefile])
SUCCESS