forked from denora/denora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
862 lines (761 loc) · 25.2 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
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
dnl autoconf.in for Stats.
dnl
dnl Denora (c) 2004-2013 Denora Team
dnl Contact us at [email protected]
dnl This program is free but copyrighted software; see the file COPYING for
dnl details.
dnl Based heavily on the Anope configure.in script.
AC_INIT(denora, 1.5.0, [email protected])
dnl Sneaky way to get an id into the configure script.
AC_COPYRIGHT([])
if test $# = 0; then
echo "You might want to run ./Config or provide some parameters to this script."
echo "./configure --help for information about this script"
exit 0
fi
touch install-sh
m4_include([m4/ext_have_lib.m4])
m4_include([m4/mysql.m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CONFIG_HEADER(include/sysconf.h)
AC_PREFIX_DEFAULT(~/stats)
AC_PROG_CC([gcc clang cc])
CFLAGS=-g
if test "$ac_cv_prog_gcc" = "yes"; then
# CFLAGS="$CFLAGS -funsigned-char"
AC_CACHE_CHECK(if gcc has a working -pipe, ac_cv_pipe, [
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -pipe"
AC_TRY_COMPILE(,, ac_cv_pipe="yes", ac_cv_pipe="no")
CFLAGS="$save_cflags"
])
if test "$ac_cv_pipe" = "yes"; then
CFLAGS="-pipe $CFLAGS"
fi
fi
if test "$host_cpu" = "x86_64"; then
CFLAGS="$CFLAGS -fPIC"
fi
if test "$CC" == "gcc"; then
DENORA_CFLAGS_GCC_TRY_FLAGS(-ggdb, denora_cv_ggdb)
DENORA_CPU_GCC_TRY_FLAGS(-O3, ac_cv_denora_O3)
if test "$ac_cv_denora_O3" = "yes"; then
echo "Setting optimization level to -O3"
else
DENORA_CPU_GCC_TRY_FLAGS(-O2, ac_cv_denora_O2)
if test "$ac_cv_denora_O2" = "yes"; then
echo "Setting optimization level to -O2"
else
DENORA_CPU_GCC_TRY_FLAGS(-O1, ac_cv_denora_O1)
fi
if test "$ac_cv_denora_O1" = "yes"; then
echo "Setting optimization level to -O1"
else
DENORA_CPU_GCC_TRY_FLAGS(-O0, ac_cv_denora_O0)
fi
if test "$ac_cv_denora_O0" = "yes"; then
echo "Setting optimization level to -O0"
else
echo "No compiler optimization"
fi
fi
fi
if test "$CC" == "gcc"; then
AC_C_VAR_PRETTY_FUNC
if test "$ac_cv_c_var_prettyfunc" = "no"; then
AC_C_VAR_FUNCTION
if test "$ac_cv_c_var_function" = "no"; then
AC_C_VAR_FUNC
if test "$ac_cv_c_var_func" = "no"; then
echo "Compiler does not have a define macro to get functions names"
fi
fi
fi
fi
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(CP,cp)
AC_PATH_PROG(TOUCH,touch)
AC_PATH_PROG(PERL,perl)
AC_PATH_PROG(INSTALL,install)
AC_CHECK_LIB(nsl,inet_ntoa,DENORALIBS="$DENORALIBS-lnsl ")
AC_CHECK_LIB(socket, socket,DENORALIBS="$DENORALIBS-lsocket ")
AC_CHECK_LIB(resolv, res_query,DENORALIBS="$DENORALIBS-lresolv ")
AC_CHECK_LIB(bsd, revoke,DENORALIBS="$DENORALIBS-lbsd ")
AC_CHECK_LIB(z, inflateEnd,DENORALIBS="$DENORALIBS-lz ")
AC_CHECK_HEADER(sys/types.h,AC_DEFINE(HAS_SYS_TYPES_H,1,"Has sys/types.h"))
DENORA_CHECK_TYPE_SIZES
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H,1,""))
AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H,1,""))
AC_CHECK_HEADER(stdint.h,AC_DEFINE(HAVE_STDINT_H,1,""))
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H,1,""))
AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H,1,""))
AC_CHECK_HEADER(execinfo.h,AC_DEFINE(HAVE_BACKTRACE,1,""))
AC_CHECK_HEADER(unistd.h,AC_DEFINE(HAVE_UNISTD_H,1,""))
AC_CHECK_HEADER(zlib.h,AC_DEFINE(HAVE_LIBZ,1,""))
AC_CHECK_HEADER(netinet/in.h,AC_DEFINE(HAVE_NETINETIN,1,""))
AC_CHECK_HEADER(netdb.h,AC_DEFINE(HAVE_NETDBH,1,""))
AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H,1,""))
AC_CHECK_HEADER(signal.h,AC_DEFINE(HAVE_SIGNAL_H,1,""))
AC_CHECK_HEADER(poll.h,AC_DEFINE(HAVE_POLL_H,1,""))
AC_CHECK_HEADER(regex.h,AC_DEFINE(HAVE_REGEX_H,1,""))
AC_CHECK_HEADER(mcheck.h,AC_DEFINE(HAVE_MCHECK,1,""))
AC_C_INLINE
CHECK_SSL
AC_ARG_ENABLE(crypt,
[ --enable-crypt Enable Admin encrypted passwords],
[ac_cv_crypt="$enableval"],
[ac_cv_crypt="no"])
if test "$ac_cv_crypt" = "yes"; then
AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H,1,""))
AC_CHECK_LIB(crypt, crypt,[
DENORALIBS="$DENORALIBS-lcrypt "
AC_DEFINE(HAVE_CRYPT,1,"")
])
DIS_ENCRYPT="Crypted Passwords: Yes"
else
DIS_ENCRYPT="Crypted Passwords: No"
fi
DIS_MYSQL="MySQL: No"
AC_ARG_WITH(mysql,
[ --without-mysql Do not compile with MySQL],
[ac_cv_mysql="no"],
[ac_cv_mysql="$enableval"])
if test "$ac_cv_mysql" = "yes"; then
MYSQL_CLIENT
if test -z "$MYSQL_CLIENT_LIBS" ; then
DIS_MYSQL="MySQL: No"
else
DENORALIBS="$DENORALIBS $MYSQL_CLIENT_LIBS"
AC_DEFINE_UNQUOTED(USE_MYSQL,1,"Use Mysql")
CFLAGS="$CFLAGS $MYSQL_CLIENT_CFLAGS"
DIS_MYSQL="MySQL: Yes"
fi
else
DIS_MYSQL="MySQL: No"
fi
DIS_MYSQLBT="Mysql backtrace debug: No"
AC_ARG_ENABLE(mysqlbt,
[ --enable-mysqlbt Enable backtrace of mysql queries],
[ac_cv_mysqlbt="$enableval"],
[ac_cv_mysqlbt="no"])
if test "$ac_cv_mysqlbt" = "yes"; then
AC_DEFINE_UNQUOTED(USE_MYSQL_BT,1,"Backtrace mysql queries")
DIS_MYSQLBT="Mysql backtrace debug: Yes"
fi
DIS_THREADING="Threading: No"
AC_ARG_ENABLE(threading,
[ --enable-threading Enable support for the threading library],
[ac_cv_pthread="$enableval"],
[ac_cv_pthread="no"])
if test "$ac_cv_pthread" = "yes"; then
ACX_PTHREAD([
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
DENORALIBS="$DENORALIBS$PTHREAD_LIBS "
AC_DEFINE_UNQUOTED(USE_THREADS,1,"Use threads")
DIS_THREADING="Threading: Yes"
])
else
DIS_THREADING="Threading: No"
fi
TYPE_SOCKLEN_T
dnl ----------------------------------------------------------
dnl
dnl IPv4/IPv6 related checks
dnl
AC_CHECK_FUNCS(freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_ntop inet_pton)
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[ struct sockaddr_storage s; ],
[ ac_cv_have_struct_sockaddr_storage="yes" ],
[ ac_cv_have_struct_sockaddr_storage="no" ]
)
])
if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1], [System supports sockaddr_storage])
fi
AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
AC_TRY_COMPILE(
[
#include <unistd.h>
#include <netinet/in.h>
],
[ struct sockaddr_in6 s; s.sin6_family = 0; ],
[ ac_cv_have_struct_sockaddr_in6="yes" ],
[ ac_cv_have_struct_sockaddr_in6="no" ]
)
])
if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1], [System supports sockaddr_in6])
fi
AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
AC_TRY_COMPILE(
[
#include <unistd.h>
#include <netinet/in.h>
],
[ struct in6_addr s; s.s6_addr[0] = 0; ],
[ ac_cv_have_struct_in6_addr="yes" ],
[ ac_cv_have_struct_in6_addr="no" ]
)
])
if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1], [System supports struct in6_addr])
fi
AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],
[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
[ ac_cv_have_struct_addrinfo="yes" ],
[ ac_cv_have_struct_addrinfo="no" ]
)
])
if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1], [System supports struct addrinfo])
fi
AC_CACHE_CHECK([for getaddrinfo() rfc2553bis compatibility], ac_cv_have_getaddrinfo_bis, [
AC_TRY_RUN(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int main()
{
struct addrinfo s, *r;
memset(&s, 0, sizeof(s));
s.ai_family = AF_UNSPEC;
s.ai_socktype = SOCK_STREAM;
s.ai_flags = AI_ALL|AI_V4MAPPED|AI_ADDRCONFIG|AI_PASSIVE;
if (getaddrinfo(NULL, "0", &s, &r))
return 1; /* bad */
return 0; /* good */
}
],
[ ac_cv_have_getaddrinfo_bis="yes" ],
[ ac_cv_have_getaddrinfo_bis="no" ],
[ ac_cv_have_getaddrinfo_bis="no" ]
)
])
if test "x$ac_cv_have_getaddrinfo_bis" = "xyes" ; then
AC_DEFINE([RFC2553BIS], [1], [System supports RFC2553BIS])
fi
AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
ac_cv_have_ss_family_in_struct_ss, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[ struct sockaddr_storage s; s.ss_family = 1; ],
[ ac_cv_have_ss_family_in_struct_ss="yes" ],
[ ac_cv_have_ss_family_in_struct_ss="no" ],
)
])
if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [System supports s.ss_family])
fi
AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
ac_cv_have___ss_family_in_struct_ss, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[ struct sockaddr_storage s; s.__ss_family = 1; ],
[ ac_cv_have___ss_family_in_struct_ss="yes" ],
[ ac_cv_have___ss_family_in_struct_ss="no" ]
)
])
if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1], [System supports s.__ss_family])
fi
DIS_MODULES="Modules Support: Yes"
dnl module checking based on Unreal's module checking code
AC_DEFUN([AC_ENABLE_DYN],
[
AC_CHECK_FUNC(dlopen,, AC_CHECK_LIB(dl,dlopen,[
DENORALIBS="$DENORALIBS -ldl"
AC_DEFINE(USE_MODULES,1,"Modules are available")
USE_MODULES="yes"
DIS_MODULES="Modules Support: Yes"
],
[
AC_MSG_WARN(Dynamic linking is not enabled because dlopen was not found)
AC_DEFINE(STATIC_LINKING,"NO_MODULES","modules not available")
DIS_MODULES="Modules Support: No"
]))
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -export-dynamic"
AC_CACHE_CHECK(if we need the -export-dynamic flag, ac_cv_export_dynamic, [
AC_TRY_LINK(, [int i];, ac_cv_export_dynamic=yes, ac_cv_export_dynamic=no)])
if test "$ac_cv_export_dynamic" = "no"; then
CFLAGS=$hold_cflags
fi
AC_CACHE_CHECK(Check if CLANG/CC compiler remove export-dynamic,ac_cv_darwin,[
if test "$CC" == "cc"; then
CFLAGS=$hold_cflags
fi
if test "$CC" == "clang"; then
CFLAGS=$hold_cflags
fi
])
AC_CACHE_CHECK(for compiler option to produce PIC,ac_cv_pic,[
if test "$ac_cv_prog_gcc" = "yes"; then
ac_cv_pic="-fPIC -DPIC -shared"
case `uname -s` in
Darwin*[)]
ac_cv_pic=""
;;
HP-UX*[)]
ac_cv_pic="-fPIC"
;;
CYGWIN*[)]
ac_cv_pic="-DPIC --shared"
;;
esac
else
case `uname -s` in
SunOS*[)]
ac_cv_pic="-KPIC -DPIC -G"
;;
esac
fi
])
if test "$CC" == "clang"; then
ac_cv_pic="-fPIC -DPIC"
fi
AC_CACHE_CHECK([for RTLD_LOCAL], ac_cv_have_rtld_local, [
AC_TRY_COMPILE(
[
#include <dlfcn.h>
],
[ int main(void) { return RTLD_LOCAL; } ],
[ ac_cv_have_rtld_local="yes" ],
[ ac_cv_have_rtld_local="no" ]
)
])
if test "x$ac_cv_have_rtld_local" = "xyes" ; then
AC_DEFINE([HAS_RTLD_LOCAL], [], [System supports RTLD_LOCAL])
fi
if test "$ac_cv_prog_gcc" = "yes"; then
case `uname -s` in
Darwin*[)]
SHARED="-bundle -flat_namespace -undefined suppress"
AC_SUBST(SHARED)
;;
CYGWIN*[)]
SHARED="--shared"
AC_SUBST(SHARED)
;;
*[)]
SHARED="-shared"
AC_SUBST(SHARED)
;;
esac
fi
AC_CACHE_CHECK(if your system prepends an underscore on symbols,ac_cv_underscore,[
cat >uscore.c << __EOF__
int main() {
return 0;
}
__EOF__
$CC -o uscore $CFLAGS uscore.c 1>&5
if test -z "`strings -a uscore |grep '^_main$'`"; then
ac_cv_underscore=no
else
ac_cv_underscore=yes
fi
rm -f uscore uscore.c
])
if test "$ac_cv_underscore" = "yes"; then
AC_DEFINE(DL_PREFIX,"_","Underscore needed for dlopen")
else
AC_DEFINE(DL_PREFIX,"","No prefix needed for dlopen")
fi
MODULEFLAGS=$ac_cv_pic
AC_SUBST(MODULEFLAGS)
AC_DEFINE(USE_MODULES,1,"Modules available")
])
AC_ENABLE_DYN
AC_CHECK_FUNCS(strerror,AC_DEFINE(HAVE_STRERROR,1))
AC_CHECK_FUNCS(sys_errlist,AC_DEFINE(HAVE_SYS_ERRLIST,1))
AC_CHECK_FUNCS(stricmp,AC_DEFINE(HAVE_STRICMP,1))
AC_CHECK_FUNCS(strnicmp,AC_DEFINE(HAVE_STRNICMP,1))
AC_CHECK_FUNCS(strcasecmp,AC_DEFINE(HAVE_STRCASECMP,1))
AC_CHECK_FUNCS(strspn,AC_DEFINE(HAVE_STRSPN,1))
AC_CHECK_FUNCS(strlcat,AC_DEFINE(HAVE_STRLCAT,1))
AC_CHECK_FUNCS(strlcpy,AC_DEFINE(HAVE_STRLCPY,1))
AC_CHECK_FUNCS(strsignal,AC_DEFINE(HAVE_STRSIGNAL,1))
AC_CHECK_FUNCS(gettimeofday,AC_DEFINE(HAVE_GETTIMEOFDAY,1))
AC_CHECK_FUNCS(setgrent,AC_DEFINE(HAVE_SETGRENT,1))
AC_CHECK_FUNCS(umask,AC_DEFINE(HAVE_UMASK,1))
AC_CHECK_FUNCS(fork,AC_DEFINE(HAVE_FORK,1))
AC_CHECK_FUNCS(gethostbyname,AC_DEFINE(HAVE_GETHOSTBYNAME,1))
AC_CHECK_FUNCS(gethostbyname_r,AC_DEFINE(HAVE_GETHOSTBYNAME_R,1))
AC_CHECK_FUNCS(ntohl,AC_DEFINE(HAVE_NTOHL,1))
AC_CHECK_FUNCS(inet_aton,AC_DEFINE([HAVE_INETATON], [1], [System supports inet_aton]))
AC_CHECK_FUNCS(setrlimit,AC_DEFINE([HAVE_GETSETRLIMIT], [1], [System supports set/get/rlimit]))
AC_CHECK_FUNCS(getrlimit,AC_DEFINE([HAVE_GETSETRLIMIT], [1], [System supports set/get/rlimit]))
AC_CHECK_FUNCS(memcpy, AC_DEFINE(HAVE_MEMCPY,1))
AC_CHECK_FUNCS(setpgid, AC_DEFINE([HAVE_SETPGID],[1][Check cause minix lacks this]))
AC_ARG_WITH(rungroup,
[ --with-rungroup=group Specify the rungroup for Denora], [
AC_DEFINE_UNQUOTED(RUNGROUP,"$withval","Run group")
RUNGROUP=$withval
])
AC_SUBST(RUNGROUP)
dnl AC_DEFINE_UNQUOTED(MYOSNAME,"`uname -a`","uname")
AC_ARG_WITH(permissions,
[ --with-permissions=permissions Specify the default permissions for Denora],
AC_DEFINE_UNQUOTED(DEFUMASK,$withval,"Default umask permissions"), AC_DEFINE(DEFUMASK, 007,"Default umask Permissions"))
AC_ARG_WITH(bindir,
[ --with-bindir=bindir Specify the default binary dir for Denora], [
AC_DEFINE_UNQUOTED(STATS_BIN,"${withval}/stats","Binary Dir")
BINDEST=$withval
DATDEST=$withval
MODULE_PATH=${withval}/modules/
])
AC_SUBST(BINDEST)
AC_ARG_WITH(datadir,
[ --with-datadir=datadir Specify the location of the stats data folder],
[
AC_DEFINE_UNQUOTED(STATS_DIR,"$withval","stats bin dir")
AC_DEFINE_UNQUOTED(MODULE_PATH,"${withval}/modules/","Module dir")
DATDEST=$withval
MODULE_PATH=${withval}/modules/
])
AC_SUBST(DATDEST)
AC_SUBST(MODULE_PATH)
AC_DEFINE_UNQUOTED(STATS_BUILD,"$build","stats build")
AC_DEFINE_UNQUOTED(STATS_OS,"$build_os","stats os")
AC_DEFINE_UNQUOTED(STATS_CPU,"$build_cpu","stats cpu")
if test "$CC" == "gcc"; then
case `uname -s` in
CYGWIN*[)]
RDYNAMNIC=""
AC_SUBST(RDYNAMNIC)
;;
SUN*[)]
RDYNAMNIC=""
AC_SUBST(RDYNAMNIC)
;;
Darwin*[)]
RDYNAMNIC=""
AC_SUBST(RDYNAMNIC)
;;
*[)]
RDYNAMNIC=" -rdynamic"
AC_SUBST(RDYNAMNIC)
;;
esac
fi
dnl Does this platform require array notation to assign to a va_list?
dnl If cross-compiling, we assume va_list is "normal". If this breaks
dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
dnl also just to be sure.
AC_MSG_CHECKING(whether va_list assignments need array notation)
AC_CACHE_VAL(ac_cv_valistisarray,
[AC_TRY_RUN([#include <stdlib.h>
#include <stdarg.h>
void foo(int i, ...) {
va_list ap1, ap2;
va_start(ap1, i);
ap2 = ap1;
if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); }
va_end(ap1); va_end(ap2);
}
int main()
{ foo(0, 123); return(0); }],
[ac_cv_valistisarray=false],
[ac_cv_valistisarray=true],
[ac_cv_valistisarray=false])])
if test "$ac_cv_valistisarray" = true ; then
AC_DEFINE([HAVE_VA_LIST_AS_ARRAY], 1, "System has VA_LIST as an array")
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_CACHE_CHECK(what type of signals you have, ac_cv_sigtype, [
AC_TRY_RUN([
#include <signal.h>
int main() {
sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L);
}
], ac_cv_sigtype=POSIX, [
AC_TRY_RUN([
#include <signal.h>
int calls = 0;
void handler()
{
if (calls)
return;
calls++;
kill(getpid(), SIGTERM);
sleep(1);
}
int main() {
signal(SIGTERM, handler);
kill(getpid(), SIGTERM);
exit(0);
}
], ac_cv_sigtype=BSD,ac_cv_sigtype=SYSV)])])
if test "$ac_cv_sigtype" = "POSIX"; then
AC_DEFINE([POSIX_SIGNALS], [], [Setting to POSIX style signals])
elif test "$ac_cv_sigtype" = "BSD"; then
AC_DEFINE([BSD_RELIABLE_SIGNALS], [], [Setting to BSD style signals])
else
AC_DEFINE([SYSV_UNRELIABLE_SIGNALS], [], [Setting to SYSV style signals])
fi
if test "$CC" == "gcc"; then
echo "Checking best optimization compiler flags"
echo "Host CPU : $host_cpu"
case $host in
hppa*-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mpa-risc-1-1], denora_cv_cpu)
;;
m68*-*-*)
case $host in
m68020-*-*) DENORA_CPU_GCC_TRY_FLAGS([-m68020], denora_cv_cpu) ;;
m68030-*-*) DENORA_CPU_GCC_TRY_FLAGS([-m68030], denora_cv_cpu) ;;
m68040-*-*) DENORA_CPU_GCC_TRY_FLAGS([-m68040], denora_cv_cpu) ;;
m68060-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-m68060], denora_cv_cpu)
DENORA_CPU_GCC_TRY_FLAGS([-m68000], denora_cv_cpu)
;;
m68360-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-m68000], denora_cv_cpu)
;;
*) DENORA_CPU_GCC_TRY_FLAGS([-m68000], denora_cv_cpu) ;;
esac
;;
m88110*-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-m88110], denora_cv_cpu)
;;
powerpc*-*-*)
case $host_cpu in
powerpc603)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=603], denora_cv_mtune)
;;
powerpc603e)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=603e], denora_cv_mtune)
;;
powerpc604)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=604], denora_cv_cpu)
;;
powerpc740)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=740], denora_cv_mtune)
;;
powerpc7400)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=7400], denora_cv_mtune)
;;
powerpc7450)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=7450], denora_cv_mtune)
;;
powerpc750)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=750], denora_cv_mtune)
;;
esac
;;
# POWER
[power-*-* | power[12]-*-* | power2sc-*-*])
DENORA_CPU_GCC_TRY_FLAGS([-mpower], denora_cv_power)
;;
*sparc*-*-*)
gcc_cflags_cpu=
case $host in
sparcv8*-*-* | supersparc*-*-* | microsparc*-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mv8], denora_cv_mv8)
;;
sparcv9*-*-* | ultrasparc*-*-* | sparc64-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mv8], denora_cv_mv8)
;;
esac
;;
X86_PATTERN | x86_64-*-*)
case $host in
i386*-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=i386], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=i386], denora_cv_march)
;;
i586*-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=i586], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=i586], denora_cv_march)
;;
pentium-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=pentium], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=i586], denora_cv_march)
;;
pentiummmx-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=pentiummmx], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
;;
pentiumpro-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=pentiumpro], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=i686], denora_cv_march)
;;
i686*-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=i686], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=i686], denora_cv_march)
;;
pentium3-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=i686], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=i686], denora_cv_march)
;;
pentium2-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=pentium2], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=i686], denora_cv_march)
;;
k6-3-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=k6-3], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=k6-3], denora_cv_march)
;;
k6-2-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=k6-2], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=k6-2], denora_cv_march)
;;
k6-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=k6], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=k6], denora_cv_march)
;;
athlon-4-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=athlon-4], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=athlon-4], denora_cv_march)
;;
athlon-xp-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=athlon-xp], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=athlon-xp], denora_cv_march)
;;
athlon-mp-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=athlon-mp], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=athlon-mp], denora_cv_march)
;;
athlon-tbird-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=athlon-tbird], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=athlon-tbird], denora_cv_march)
;;
k7-* | athlon-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=athlon], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=athlon], denora_cv_march)
;;
pentium4-*-* | i786-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=pentium4], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=pentium4], denora_cv_march)
;;
viac32-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=c3-2], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=c3-2], denora_cv_march)
;;
viac3*-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=c3], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m32], denora_cv_m32)
DENORA_CPU_GCC_TRY_FLAGS([-march=c3], denora_cv_march)
;;
x86_64-*-*)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=k8], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=athlon64], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-mtune=athlon-fx], denora_cv_mtune)
DENORA_CPU_GCC_TRY_FLAGS([-m64], denora_cv_m64)
DENORA_CPU_GCC_TRY_FLAGS([-march=k8], denora_cv_march)
DENORA_CPU_GCC_TRY_FLAGS([-march=athlon64], denora_cv_march)
DENORA_CPU_GCC_TRY_FLAGS([-march=athlon-fx], denora_cv_march)
;;
esac
;;
none-*-*)
;;
esac
fi
if test "$CC" == "gcc"; then
echo "Checking compiler flags for make strict"
DENORA_GCC_TRY_FLAGS([-Wextra], denora_cv_gcc_w_extra)
DENORA_GCC_TRY_FLAGS([-Wall], denora_cv_gcc_w_all)
DENORA_GCC_TRY_FLAGS([-pedantic], denora_cv_gcc_pedantic)
DENORA_GCC_TRY_FLAGS([-Wshadow], denora_cv_gcc_wshadow)
DENORA_GCC_TRY_FLAGS([-Wmissing-declarations], denora_cv_gcc_missing_dec)
DENORA_GCC_TRY_FLAGS([-Wpointer-arith], denora_cv_gcc_pointer_arith)
DENORA_GCC_TRY_FLAGS([-Wcast-align], denora_cv_gcc_cast_align)
dnl DENORA_GCC_TRY_FLAGS([-Wcast-qual], denora_cv_gcc_cast_qual)
DENORA_GCC_TRY_FLAGS([-Wfloat-equal], denora_cv_gcc_float_equal)
DENORA_GCC_TRY_FLAGS([-Wstrict-prototypes], denora_cv_gcc_strict_prototypes)
DENORA_GCC_TRY_FLAGS([-Wmissing-prototypes], denora_cv_gcc_missing_prototype)
DENORA_GCC_TRY_FLAGS([-Wredundant-decls], denora_cv_gcc_redundant_decls)
DENORA_GCC_TRY_FLAGS([-Wunused-variable], denora_cv_gcc_unused_vars)
DENORA_GCC_TRY_FLAGS([-Wunused-parameter], denora_cv_gcc_unused_params)
DENORA_GCC_TRY_FLAGS([-Wuninitialized], denora_cv_gcc_uninit)
DENORA_GCC_TRY_FLAGS([-Wparentheses], denora_cv_gcc_parenthese)
DENORA_GCC_TRY_FLAGS([-Wno-long-long], denora_cv_gcc_no_long_long)
DENORA_GCC_TRY_FLAGS([-Wunused-macros], denora_cv_gcc_unused_macro)
DENORA_GCC_TRY_FLAGS([-Wwrite-strings], denora_cv_gcc_write_strings)
DENORA_GCC_TRY_FLAGS([-Wimplicit], denora_cv_gcc_implicit)
DENORA_GCC_TRY_FLAGS([-Wnested-externs], denora_cv_gcc_nested)
DENORA_GCC_TRY_FLAGS([-Wno-unused], denora_cv_gcc_no_unused)
DENORA_GCC_TRY_FLAGS([-Wundef], denora_cv_gcc_undef)
DENORA_GCC_TRY_FLAGS([-Wpacked], denora_cv_gcc_packed)
DENORA_GCC_TRY_FLAGS([-Wbad-function-cast], denora_cv_gcc_bad_func_cast)
DENORA_GCC_TRY_FLAGS([-Wunused-function], denora_cv_gcc_unused_func)
DENORA_GCC_TRY_FLAGS([-Wunused-label], denora_cv_gcc_unused_label)
DENORA_GCC_TRY_FLAGS([-Wunused-value], denora_cv_gcc_unused_value)
DENORA_GCC_TRY_FLAGS([-Wfloat-equal], denora_cv_gcc_float_equal)
DENORA_GCC_TRY_FLAGS([-Wchar-subscripts], denora_cv_gcc_char_sub)
DENORA_GCC_TRY_FLAGS([-Wswitch], denora_cv_gcc_switch)
DENORA_GCC_TRY_FLAGS([-Wmissing-braces], denora_cv_gcc_missing_braces)
DENORA_GCC_TRY_FLAGS([-Wsequence-point], denora_cv_gcc_sequence_point)
DENORA_GCC_TRY_FLAGS([-Wunknown-pragmas], denora_cv_gcc_unknown_pragmas)
DENORA_GCC_TRY_FLAGS([-Wdeclaration-after-statement], denora_cv_gcc_declaration_after_statement)
DENORA_GCC_TRY_FLAGS([-Wsign-compare], denora_cv_gcc_sign_compare)
DENORA_GCC_TRY_FLAGS([-fstack-protector], denora_cv_gcc_fstack_protector)
DENORA_GCC_TRY_FLAGS([-Winvalid-source-encoding], denora_cv_invalid_encode)
if test "$denora_cv_gcc_fstack_protector" = "yes"; then
STRICT="$STRICT --param=ssp-buffer-size=4 "
fi
DENORA_GCC_TRY_FLAGS([-Wp,-D_FORTIFY_SOURCE=2], denora_cv_gcc_fortify_source)
fi
AC_SUBST(DENORALIBS)
AC_SUBST(CFLAGS)
AC_SUBST(OPCFLAGS)
AC_SUBST(STRICT)
AC_SUBST(LDFLAGS)
AC_CONFIG_FILES( \
Makefile \
src/bin/denorarc \
src/bin/geoipupd \
)
AC_OUTPUT
cat <<EOT
$DIS_MODULES
$DIS_MYSQL
$DIS_MYSQLBT
$DIS_ENCRYPT
$DIS_THREADING
All done! Above you can see if Modules Support and MySQL Support will be compiled or not.
If you intended to compile MySQL support and you see "NO", then your system is probably
missing the mysql client development libraries. Please consult your distribution package
manager and install the required package, then try running ./Config again.
Now run "make" (or possibly "gmake") to compile Denora.
See the INSTALL, README and FAQ files if you have any problems.
EOT