This repository has been archived by the owner on Sep 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
configure.ac.in
1686 lines (1415 loc) · 37.9 KB
/
configure.ac.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
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AC_INIT([resin],@RESIN_VERSION@)
AC_CONFIG_AUX_DIR(automake)
#AC_CONFIG_MACRO_DIR([m4])
dnl Get os info
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
AC_PREFIX_DEFAULT(/usr/local/share)
FULL_VERSION="Resin $PACKAGE_VERSION -- `date`"
AC_SUBST(FULL_VERSION)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_LD
AC_PROG_EGREP
dnl Checks for poll.h
#AC_CHECK_HEADER(sys/poll.h, [ CFLAGS="$CFLAGS -DPOLL"; poll=1 ])
AC_CHECK_HEADER(sys/poll.h, [ poll=1 ])
dnl Checks for epoll.h
AC_CHECK_HEADER(sys/epoll.h, [ CFLAGS="$CFLAGS -DEPOLL"; epoll=1 ])
#
# Resin home
#
resin_version="resin-$PACKAGE_VERSION"
if test "$prefix" == "NONE"; then
usr_share="$ac_default_prefix"
resin_home="$ac_default_prefix/$resin_version"
else
resin_home="$prefix"
fi
build_dir="${abs_builddir}"
if test -z "${build_dir}"; then
build_dir=`pwd`
fi
AC_SUBST(resin_home)
AC_SUBST(resin_version)
AC_SUBST(usr_share)
AC_SUBST(build_dir)
AC_SUBST(initd_dir)
#
# --with-resin-root
#
AC_ARG_WITH(resin-root,
[AS_HELP_STRING([--with-resin-root=DIR],
[resin data directory])],
[resin_root=${withval}])
if test -z "$resin_root"; then
if test "$prefix" == "NONE"; then
resin_root="/var/resin"
else
resin_root="$prefix"
fi
fi
AC_SUBST(resin_root)
#
# --with-resin-conf
#
AC_SUBST(resin_conf)
AC_ARG_WITH(resin-conf,
[AS_HELP_STRING([--with-resin-conf=DIR],
[resin configuration directory])],
[resin_conf=${withval}])
if test -z "$resin_conf"; then
if test "$prefix" == "NONE"; then
resin_conf="/etc/resin"
else
resin_conf="$prefix/conf"
fi
fi
#
# --with-resin-log
#
AC_SUBST(resin_log)
AC_ARG_WITH(resin-log,
[AS_HELP_STRING([--with-resin-log=DIR],
[resin log directory])],
[resin_log=${withval}])
if test -z "$resin_log"; then
if test "$prefix" == "NONE"; then
resin_log="/var/log/resin"
else
resin_log="$prefix/log"
fi
fi
#
# --with-resin-init.d
#
if test -d "/etc/init.d/rc.d"; then
resin_init_d="/etc/init.d/rc.d/resin"
initd_dir="/etc/init.d/rc.d"
elif test -d "/etc/init.d"; then
resin_init_d="/etc/init.d/resin"
initd_dir="/etc/init.d"
elif test -d "/etc/rc.d"; then
resin_init_d="/etc/rc.d"
initd_dir="/etc/"
fi
AC_ARG_WITH(resin-init-d,
[AS_HELP_STRING([--with-resin-init-d=PATH],
[resin startup (init.d) script path])],
[
case "${withval}" in
no)
resin_init_d=
initd_dir=
;;
*)
resin_init_d=${withval}
initd_dir=`dirname $resin_init_d`
;;
esac
])
AC_SUBST(resin_init_d)
AC_SUBST(initd_dir)
resin_pro="."
resin_os="../resin_os"
is_dev=""
if test -r "modules/c/src/resin/mmap_file.c"; then
resin_pro="."
elif test -r "../pro/modules/c/src/resin/mmap_file.c"; then
resin_pro="../pro"
resin_os="../../../../../resin/modules/c/src/resin_os"
is_dev="true"
fi
AC_SUBST(resin_os)
AC_SUBST(resin_pro)
#
# --with-java-home
#
AC_ARG_WITH(java-home,
[AS_HELP_STRING([--with-java-home=DIR],
[java home])],
[JAVA_HOME=${withval}])
if test -n "$JAVA_HOME"; then
JAVA_EXE="$JAVA_HOME/bin/java"
elif test -x "/usr/libexec/java_home"; then
JAVA_HOME=`/usr/libexec/java_home`
else
java=`which java 2>/dev/null`
if test -x "$java"; then
while test -h "$java"
do
head=`dirname $java`
tail=`/bin/ls -l $java | awk '{ print $NF; }'`
if test -f "$tail"; then
java=$tail
else
java=$head/$tail
fi
done
JAVA_BIN=`dirname $java`
# we're in $JAVA_HOME/jre
if test -f "$JAVA_BIN/include/jni.h"; then
JAVA_HOME="$JAVA_BIN"
elif test -f "$JAVA_BIN/../include/jni.h"; then
JAVA_HOME="$JAVA_BIN/.."
elif test -f "$JAVA_BIN/../../include/jni.h"; then
JAVA_HOME="$JAVA_BIN/../.."
elif test -f "/System/Library/Frameworks/JavaVM.framework"; then
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework"
elif test -d "/etc/alternatives/java_sdk"; then
JAVA_HOME="/etc/alternatives/java_sdk"
elif test -f "$JAVA_BIN/lib/rt.jar"; then
JAVA_HOME=`cd $JAVA_BIN/..; pwd`
elif test -f "/usr/lib/jvm/java-6-openjdk/include/jni.h"; then
JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
elif test -f "/usr/lib/jvm/java-6-sun/include/jni.h"; then
JAVA_HOME="/usr/lib/jvm/java-6-sun"
elif test -f "/usr/lib/jvm/java-openjdk/include/jni.h"; then
JAVA_HOME="/usr/lib/jvm/java-openjdk"
elif test -f "/usr/lib/jvm/java/include/jni.h"; then
JAVA_HOME="/usr/lib/jvm/java"
elif test -d "/usr/java"; then
JAVA_HOME=/usr/java
else
JAVA_HOME="$JAVA_BIN"
fi
elif test -d "/usr/java"; then
JAVA_HOME=/usr/java
elif test -f "/System/Library/Frameworks/JavaVM.framework"; then
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework"
fi
fi
echo $ac_n "checking for JAVA_HOME... $JAVA_HOME"
if test ! -d "$JAVA_HOME"; then
AC_MSG_ERROR([Can't find valid JAVA_HOME ${JAVA_HOME}])
fi
AC_SUBST(JAVA_HOME)
if test -z "$JAVA_EXE"; then
java=`which java 2>/dev/null`
if test -x "$java"; then
JAVA_EXE="$java"
fi
fi
if test -z "$JAVA_EXE"; then
JAVA_EXE="$JAVA_HOME/bin/java"
fi
AC_SUBST(JAVA_EXE)
JAVA_ARGS=
$JAVA_EXE -d64 -version 1>/dev/null 2>/dev/null
if test $? = "0"; then
JAVA_ARGS="-d64"
fi
AC_SUBST(JAVA_ARGS)
#
# libtool stuff
#
AC_PROG_LIBTOOL
if test -z "${LTFLAGS}"; then
LTFLAGS="--silent"
fi
LIBTOOL_SCRIPT="`pwd`/libtool"
LIBTOOL="${LIBTOOL_SCRIPT} ${LTFLAGS}"
SH_LIBTOOL="${SHELL} ${LIBTOOL_SCRIPT} ${LTFLAGS}"
SHLTCFLAGS=""
LTCFLAGS=""
AC_SUBST(LTFLAGS)
AC_SUBST(LIBTOOL_SCRIPT)
AC_SUBST(LIBTOOL)
AC_SUBST(SH_LIBTOOL)
AC_SUBST(LTCFLAGS)
AC_SUBST(EGREP)
INCLUDES=""
plugins=common
LIBEXEC=libexec
AC_SUBST(plugins)
AC_SUBST(resin_pro_plugins)
AC_SUBST(LIBEXEC)
dnl should be unnecessary
AC_SUBST(LD)
ACLOCAL=aclocal
AUTOMAKE=automake
AC_SUBST(ACLOCAL)
AC_SUBST(AUTOMAKE)
#
# additional CFLAGS
#
# for solaris
CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
#
# --with-apache-src
#
AC_ARG_WITH(apache-src,
[AS_HELP_STRING([--with-apache-src=DIR],
[Apache src static compilation])],
[
apache_src=${withval}
if test -d "${apache_src}/modules"; then
a=b
elif test -d "${apache_src}/src/modules"; then
apache_src=${apache_src}/src
else
AC_MSG_ERROR([Can't find valid Apache source ${apache_src}])
fi
echo "using Apache source in ${apache_src}"
])
#
# --with-apache
#
AC_ARG_WITH(apache,
[AS_HELP_STRING([--with-apache=DIR],
[the Apache root directory])],
[
apache_dir=${withval}
if test "${apache_dir}" = "yes"; then
if test -d /usr/local/apache; then
apache_dir=/usr/local/apache
else
apxs=`which apxs2`
fi
fi
if test ! -d "${apache_dir}" -a ! -x "${apxs}"; then
AC_MSG_ERROR([--with-apache=${apache_dir} is not a valid Apache directory])
fi
apache=1
])
#
# --with-apxs
#
AC_ARG_WITH(apxs,
[AS_HELP_STRING([--with-apxs=PATH],
[the Apache configuration utility])],
[
apxs=${withval}
if test "${apxs}" = "yes"; then
apxs=`which apxs2` 2>/dev/null
if test -z "$apxs"; then
apxs=`which apxs` 2>/dev/null
fi
if test -z "$apxs"; then
apxs=apxs2
fi
if test ! -x "$apxs"; then
AC_ERROR("'$apxs' is not a valid apxs")
fi
fi
apache=1
])
#
# --with-apache-eapi
#
AC_ARG_WITH(apache-eapi,
[AS_HELP_STRING([--with-apache-eapi=DIR],
[Apache eapi support])],
[apache_eapi=${withval}])
#
# --with-apache-include
#
AC_ARG_WITH(apache-include,
[AS_HELP_STRING([--with-apache-include=DIR],
[the Apache include directory])],
[
apache_include=${withval}
if test "${apache_include}" = "yes"; then
apache_include=
fi
apache=1
])
#
# --with-apache-libexec
#
AC_ARG_WITH(apache-libexec,
[AS_HELP_STRING([--with-apache-libexec=DIR],
[the Apache module directory])],
[
apache_libexec=${withval}
if test "${apache_libexec}" = "yes"; then
apache_libexec=
fi
apache=1
])
#
# --with-apache-conf
#
AC_ARG_WITH(apache-conf,
[AS_HELP_STRING([--with-apache-conf=DIR],
[the Apache configuration])],
[
apache_conf=${withval}
if test "${apache_conf}" = "yes"; then
apache_conf=
fi
apache=1
])
apache_cflags=
#
# --with-apache-cflags
#
AC_ARG_WITH(apache-cflags,
[AS_HELP_STRING([--with-apache-cflags=flags],
[flags for compiling mod_caucho])],
[
apache_cflags=${withval}
apache=1
])
#
# check that apxs is okay
#
if test -n "${apxs}"; then
${apxs} -q PREFIX >/dev/null 2>/dev/null
if test "$?" -ne 0; then
AC_MSG_ERROR(Apache ${apxs} is not a valid apxs script)
fi
elif test -x "${apache_bin}/apxs"; then
apxs=${apache_bin}/apxs
elif test -x "${apache_dir}/bin/apxs"; then
apxs=${apache_dir}/bin/apxs
elif test -x "${apache_dir}/sbin/apxs"; then
apxs=${apache_dir}/sbin/apxs
elif test -x "/sbin/apxs"; then
apxs=/sbin/apxs
elif test -x "/usr/sbin/apxs"; then
apxs=/usr/sbin/apxs
fi
#
# heuristics for finding the Apache include directory
#
if test -z "${apache_include}" -a -n "${apxs}"; then
apache_include=`${apxs} -q INCLUDEDIR`
fi
if test -z "${apache_include}" -a -r "${apache_dir}/include/httpd.h"; then
apache_include=${apache_dir}/include
fi
if test -n "${apache_include}"; then
APACHE_INC="-I${apache_include}"
fi
#
# deal with stronghold
#
if test -z "${apache_include}" -a -r "${apache_dir}/src/include/httpd.h"; then
apache_include=${apache_dir}/src/include
APACHE_INC="-I${apache_dir}/src/include"
APACHE_INC="-I${apache_dir}/ssl/include $APACHE_INC"
APACHE_INC="-I${apache_dir}/src/os/unix $APACHE_INC"
fi
if test -n "$apache" -a ! -r ${apache_include}/httpd.h; then
AC_MSG_ERROR([Can't find Apache include directory ${apache_include}])
fi
#
# heuristics for finding the Apache bin directory
#
if test -n "${apache_bin}"; then
a=b
elif test -x "${apxs}"; then
apache_bin=`${apxs} -q SBINDIR`
apache_exe="${apache_bin}/`${apxs} -q TARGET`"
elif test -n "${apache_dir}"; then
apache_bin="${apache_dir}/bin"
fi
if test -n "${apache_exe}"; then
a=b;
elif test -z "${apache_bin}"; then
a=b;
elif test -x "${apache_bin}/httpd"; then
apache_exe="${apache_bin}/httpd"
elif test -x "${apache_bin}/apache"; then
apache_exe="${apache_bin}/apache"
elif test -x "${apache_bin}/httpd2"; then
apache_exe="${apache_bin}/httpd2"
elif test -x "${apache_bin}/apache2"; then
apache_exe="${apache_bin}/apache2"
fi
if test -n "${apache_exe}" -a ! -x "${apache_exe}"; then
AC_MSG_ERROR([Can't find Apache binary in directory ${apache_exe}])
fi
#
# heuristics for finding the Apache module directory
#
if test -z "${apache_libexec}" -a -n "${apxs}"; then
apache_libexec=`${apxs} -q LIBEXECDIR`
fi
if test -z "${apache_libexec}" -a -d "${apache_dir}/libexec"; then
apache_libexec=${apache_dir}/libexec
fi
if test -z "${apache_libexec}" -a -d "${apache_dir}/modules"; then
apache_libexec=${apache_dir}/modules
fi
if test -n "$apache" -a ! -d "${apache_libexec}"; then
AC_MSG_ERROR([Can't find Apache module directory ${apache_libexec}])
fi
#
# Heuristics for finding the Apache configuration directory
#
if test -z "${apache_conf}" -a -n "${apxs}"; then
apache_confdir=`${apxs} -q SYSCONFDIR`
if test -r "${apache_confdir}"/httpd.conf; then
apache_conf=${apache_confdir}/httpd.conf
elif test -r "${apache_confdir}"/apache.conf; then
apache_conf=${apache_confdir}/apache.conf
elif test -r "${apache_confdir}"/apache2.conf; then
apache_conf=${apache_confdir}/apache2.conf
elif test -r "${apache_confdir}"/httpsd.conf; then
apache_conf=${apache_confdir}/httpsd.conf
fi
fi
if test -z "${apache_conf}" -a -r "${apache_dir}/conf/httpd.conf"; then
apache_conf=${apache_dir}/conf/httpd.conf
fi
if test -z "${apache_conf}" -a -r "${apache_dir}/etc/httpd.conf"; then
apache_conf=${apache_dir}/etc/httpd.conf
fi
if test -n "$apache" -a ! -r "${apache_conf}"; then
AC_MSG_ERROR([Can't find Apache module configuration ${apache_conf}])
fi
#
# check for apr
#
if test -x "${apxs}"; then
apr_bin=`${apxs} -q APR_BINDIR 2> /dev/null`
if test -x "${apr_bin}/apr-config"; then
apr_inc=`"${apr_bin}/apr-config" --includes`
APACHE_INC="${APACHE_INC} ${apr_inc}"
elif test -x "${apr_bin}/apr-1-config"; then
apr_inc=`"${apr_bin}/apr-1-config" --includes`
APACHE_INC="${APACHE_INC} ${apr_inc}"
fi
fi
#
# Apache CFLAGS
#
if test -z "$apache_cflags" -a -x "${apxs}"; then
if test -x "${apr_bin}/apr-config"; then
apache_cflags="$apache_cflags `${apr_bin}/apr-config --cppflags`"
apache_cflags="$apache_cflags `${apr_bin}/apr-config --cflags`"
elif test -x "${apr_bin}/apr-1-config"; then
apache_cflags="$apache_cflags `${apr_bin}/apr-1-config --cppflags`"
apache_cflags="$apache_cflags `${apr_bin}/apr-1-config --cflags`"
else
apache_cflags="`${apxs} -q CFLAGS`"
fi
fi
if test -z "$apache_cflags" -a -x "${apache_exe}"; then
flags=`${apache_exe} -V | grep EAPI`
if test -n "$flags"; then
apache_cflags=-DEAPI
fi
fi
if test -z "$apache_dir" -a -x "${apxs}"; then
apache_dir=`${apxs} -q PREFIX`
fi
#
# test posix shared memory
#
if test -n "${apache_dir}"; then
cat >conftest.$ac_ext <<_ACEOF
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#define SHM_PATH "/mod_caucho_127.1:8080"
int main(int argc, char **argv)
{
shm_open(SHM_PATH, O_CREAT | O_RDWR, S_IRWXU | S_IRWXG);
shm_unlink(SHM_PATH);
return errno;
}
_ACEOF
apache_shm=""
CC_conftest="${CC} -o conftest ${apache_cflags} -lrt conftest.$ac_ext"
$CC_conftest 1>/dev/null 2>/dev/null
if test "$?" != 0; then
$CC_conftest
AC_MSG_WARN(Can't compile posix shared memory test. Check compilation flags: $CC_conftest)
elif ./conftest; then
apache_shm="-DSHM"
apache_cflags="$apache_cflags -lrt"
AC_MSG_RESULT(mod_caucho will use shared between processes srun status)
else
AC_MSG_WARN(mod_caucho will not use shared between processes srun status)
fi
rm -f conftest conftest.$ac_ext
fi
#
# test apache 2.4
# request_rec->remote_ip became client_ip
# request_rec->remote_addr became client_addr
#
if test -n "${apache}"; then
cat >conftest.$ac_ext <<_ACEOF
#include "httpd.h"
int main(int argc, char *argv[]) {
conn_rec *c;
c = malloc(sizeof(request_rec));
&c->client_ip;
&c->client_addr;
return 0;
}
_ACEOF
apache_24=""
echo $ECHO_N "checking if apache is 2.4 or later... "
CC_conftest="${CC} -o conftest ${APACHE_INC} ${apache_cflags} conftest.$ac_ext"
$CC_conftest 1>/dev/null 2>/dev/null
if test "$?" == 0; then
apache_24=-DAPACHE_24
echo "yes";
else
echo "no";
$CC_conftest
AC_MSG_WARN(Can't compile apache 2.4 test. Check compilation flags if apache is 2.4: $CC_conftest)
AC_MSG_WARN(Assuming lower apache version)
fi
rm -f conftest conftest.$ac_ext
fi
AC_SUBST(APACHE_INC)
AC_SUBST(apache_libexec)
AC_SUBST(apache_conf)
AC_SUBST(apache_dir)
AC_SUBST(apache_cflags)
AC_SUBST(apache_cflags_shlib)
AC_SUBST(apache_ld_shlib)
AC_SUBST(apache_ldflags_shlib)
AC_SUBST(apache_libs_shlib)
AC_SUBST(apache_shm)
AC_SUBST(apache_24)
#
# --with-setuid
#
setuid_user=resin
setuid_group=resin
AC_ARG_WITH(setuid,
[AS_HELP_STRING([--with-setuid=user],
[configure default setuid user])],
[
setuid_user=${withval}
setuid_set=true
])
#
# --with-setgid
#
AC_ARG_WITH(setgid,
[AS_HELP_STRING([--with-setgid=group],
[configure default setgid group])],
[
setuid_group=${withval};
setuid_set=true
])
AC_SUBST(setuid_user)
AC_SUBST(setuid_group)
AC_SUBST(setuid_set)
user_add=`which useradd`
group_add=`which groupadd`
AC_SUBST(user_add)
AC_SUBST(group_add)
#
# fill in compilation stuff
#
SO=so
is_gcc=`${CC} -v 2>&1 | grep gcc`
is_gnu_ld=`${LD} -v 2>&1 | grep GNU`
#
# Use apxs if it's available
#
if test -z "${apache_ldflags_shlib}"; then
if test -x "${apr_bin}/apr-config"; then
apache_cflags_shlib=`${apr_bin}/apr-config --cflags`
apache_ldflags_shlib=`${apr_bin}/apr-config --link-ld`
# apache_ldflags_shlib=`${apr_bin}/apr-config --ldflags`
apache_libs_shlib=`${apr_bin}/apr-config --libs`
elif test -x "${apr_bin}/apr-1-config"; then
apache_cflags_shlib=`${apr_bin}/apr-1-config --cflags`
apache_ldflags_shlib=`${apr_bin}/apr-1-config --link-ld`
# apache_ldflags_shlib=`${apr_bin}/apr-1-config --ldflags`
apache_libs_shlib=`${apr_bin}/apr-1-config --libs`
elif test -n "${apxs}"; then
apache_cflags_shlib=`${apxs} -q CFLAGS_SHLIB`
apache_ld_shlib=`${apxs} -q LD_SHLIB`
apache_ldflags_shlib=`${apxs} -q LDFLAGS_SHLIB`
apache_libs_shlib=`${apxs} -q LIBS_SHLIB`
echo "Using shared library flags from ${apxs}"
fi
fi
#
# Java 1.6 check
#
echo $ECHO_N "checking if ${JAVA_EXE} is Java 1.6... "
tmpname="/tmp/java$$.out"
$JAVA_EXE -version 2> $tmpname
grep "1\.@<:@678]" $tmpname 1> /dev/null
if test "$?" != "0"; then
echo "no"
java_version=`cat $tmpname`
AC_MSG_ERROR([Java 1.6 required. ${JAVA_EXE} returned: ${java_version}])
fi
echo "yes"
rm -f $tmpname
#
# 64bit heuristics
#
echo $ECHO_N "checking if ${JAVA_EXE} is 64-bit... "
$JAVA_EXE -d64 -version 1>/dev/null 2>/dev/null
if test $? = "0"; then
b64_jni=true
fi
# Require user to use --enable-64bit if the version is optional in the javac
if test -n "$b64_jni"; then
echo "yes"
else
echo "no"
fi
if test -n "$b64_jni" -a -z "$b64"; then
b64=$b64_jni
fi
#
# --enable-64bit
#
AC_ARG_ENABLE(64bit,
[AS_HELP_STRING([--enable-64bit], [Enable 64 bit])],
[case "${enableval}" in
yes) b64=true; b64_jni=true ;;
no) b64=""; b64_jni="" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-64bit) ;;
esac],[])
#
# --enable-64bit-jni
#
AC_ARG_ENABLE(64bit-jni,
[AS_HELP_STRING([--enable-64bit-jni], [Enable 64 bit JNI only (not Apache)])],
[case "${enableval}" in
yes) b64_jni=true ;;
no) b64_jni="" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-64bit-jni) ;;
esac],[])
#
# --enable-64bit-plugin
#
AC_ARG_ENABLE(64bit-plugin,
[AS_HELP_STRING([--enable-64bit-plugin], [Enable 64 bit plugin (Apache) (not JNI)])],
[case "${enableval}" in
yes) b64=true ;;
no) b64="" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-64bit-plugin) ;;
esac],[])
if test -n "${b64}"; then
b64_jni=true
fi
if test -n "${b64_jni}"; then
CFLAGS="$CFLAGS -DB64"
LIBEXEC=libexec64
fi
#
# --enable-lfs
#
AC_ARG_ENABLE(lfs,
[AS_HELP_STRING([--enable-lfs], [Enable large file source support])],
[case "${enableval}" in
yes) lfs=true ;;
no) lfs="";;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-lfs) ;;
esac],[])
if test -n "${lfs}"; then
jni_cflags="$jni_cflags -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
fi
#
# fill in based on known configurations
#
if test -z "${jni_ld_shlib}"; then
jni_ld_shlib=${LD}
jni_cflags_shlib="-fpic"
jni_ldflags_shlib="-shared"
plugin_cflags_shlib=$jni_cflags_shlib
plugin_ldflags_shlib=$jni_ldflags_shlib
case "$target_os" in
linux*)
jni_ld_shlib=${CC}
CFLAGS="$CFLAGS -pthread -fPIC -fno-omit-frame-pointer -O2"
jni_cflags="$jni_cflags -fPIC"
jni_ldflags_shlib="-shared -fPIC"
if test -n "$b64_jni"; then
jni_cflags_jni="$jni_cflags_jni -m64 -fPIC"
jni_ldflags_shlib="$jni_ldflags_shlib -m64"
else
jni_cflags="$jni_cflags -m32"
jni_ldflags_shlib="$jni_ldflags_shlib -m32"
fi
plugin_cflags_shlib=$jni_cflags_shlib
plugin_ldflags_shlib=$jni_ldflags_shlib
if test -n "$b64"; then
plugin_cflags_jni="$jni_cflags_jni -m64 -fPIC"
plugin_ldflags_shlib="$jni_ldflags_shlib -m64"
else
plugin_cflags="$jni_cflags -m32"
plugin_ldflags_shlib="$jni_ldflags_shlib -m32"
fi
if test "$target_cpu" = "armv6l"; then
jni_cflags_shlib="-fPIC"
plugin_cflags_shlib=$jni_cflags_shlib
jni_ldflags_shlib="-shared -fPIC"
plugin_ldflags_shlib=$jni_ldflags_shlib
jni_cflags="-fPIC"
plugin_cflags=$jni_cflags
fi
;;
*solaris*)
jni_ldflags_shlib=""
plugin_ldflags_shlib=""
if test -n "$is_gcc"; then
jni_cflags_shlib="-fPIC"
plugin_cflags_shlib="-fPIC"
CFLAGS="$CFLAGS -fPIC -fno-omit-frame-pointer"
jni_cflags="$jni_cflags -fPIC -fno-omit-frame-pointer"
plugin_cflags_shlib="-fPIC"
if test -n "$b64"; then
CFLAGS="$CFLAGS -m64"
plugin_cflags_shlib="-m64"
case $target_cpu in
*86*)
plugin_ldflags_shlib="-m64 -R /usr/sfw/lib/64";;
*)
plugin_ldflags_shlib="-m64 -R /usr/sfw/lib/64 -R /usr/local/lib/sparcv9";;
esac
fi
if test -n "${b64_jni}"; then
jni_cflags="$jni_cflags -m64"
case $target_cpu in
*86*)
jni_ldflags_shlib="-m64 -R /usr/sfw/lib/64";;
*)
jni_ldflags_shlib="-m64 -R /usr/sfw/lib/64 -R /usr/local/lib/sparcv9";;
esac
fi
jni_ldflags_shlib="$jni_ldflags_shlib -shared"
plugin_ldflags_shlib="$plugin_ldflags_shlib -shared"
else
CFLAGS="-mt -KPIC -xO2"
jni_cflags_shlib="-mt -KPIC -xO2"
plugin_cflags_shlib="-mt -KPIC -xO2"
if test -n "$b64"; then
CFLAGS="$CFLAGS -m64"
fi
if test -n "$b64"; then
plugin_cflags="$plugin_cflags -m64"
plugin_ldflags_shlib="$jni_ldflags_shlib -m64 -G -mt -z defs -z text"
plugin_ldflags_shlib="$jni_ldflags_shlib -R/usr/lib/64:/usr/sfw/lib/64:/usr/local/lib/sparcv9 -YP,/usr/lib/64:/usr/sfw/lib/64:/usr/local/lib/sparcv9"
fi
if test -n "$b64_jni"; then
jni_cflags="$jni_cflags -m64"
jni_ldflags_shlib="$jni_ldflags_shlib -m64 -G -mt -z defs -z text"
jni_ldflags_shlib="$jni_ldflags_shlib -R/usr/lib/64:/usr/sfw/lib/64:/usr/local/lib/sparcv9 -YP,/usr/lib/64:/usr/sfw/lib/64:/usr/local/lib/sparcv9"
fi
jni_ldflags_shlib="$jni_ldflags_shlib -G -mt -z defs -z text"
plugin_ldflags_shlib="$plugin_ldflags_shlib -G -mt -z defs -z text"
fi
;;
darwin*)
jni_cflags_shlib="-DSHARED_MODULE"
jni_ld_shlib=${CC}
jni_ldflags_shlib="-dynamiclib -undefined suppress -flat_namespace"
plugin_ld_shlib=${jni_ld_shlib}
plugin_ldflags_shlib=${jni_ldflags_shlib}
if test -n "$b64"; then
CFLAGS="$CFLAGS -arch x86_64"
jni_ldflags_shlib="-arch x86_64 $jni_ldflags_shlib"
plugin_ldflags_shlib="-arch x86_64 $jni_ldflags_shlib"
fi
if test -n "$b64_jni"; then
jni_cflags_jni="$CFLAGS_JNI -m64"
jni_ldflags_shlib="-arch x86_64 $jni_ldflags_shlib"
fi
;;
*freebsd*)
CFLAGS="$CFLAGS -fPIC"
;;
*aix*)
if test -z "$is_gcc"; then
jni_cflags_shlib="-bexpall"
else
jni_cflags_shlib="-fpic"