-
Notifications
You must be signed in to change notification settings - Fork 34
/
configure.ac
2004 lines (1656 loc) · 52.2 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
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_REVISION($Revision: 1.19 $)
AC_COPYRIGHT([Copyright 2007-2023 by Massimiliano Pala and OpenCA Labs])
# AC_CONFIG_SUBDIRS(src/core/openca.c)
dnl Autoconf
AC_INIT(libpki, 0.9.9, [[email protected]], [libpki])
AC_PREREQ(2.13)
AC_CONFIG_AUX_DIR(build)
AC_CONFIG_MACRO_DIR([m4])
dnl Release Subversion (for binary packages)
RC=1
AC_SUBST(RC)
dnl Set Version Numbers
# PACKAGE_NAME="libpki"
TODAY=`/bin/date +%Y%m%d`
AC_SUBST(TODAY)
mybits="32"
mybits_install=""
is_sparc="no"
is_aix="no"
my_arch=`uname -m`
case "$my_arch" in
*i686)
mybits="32"
;;
*i386)
mybits="32"
;;
*86_64)
mybits="64"
mybits_install="64"
;;
*amd64)
mybits="64"
mybits_install="64"
;;
*arm|*armv?)
mybits="32"
;;
*powerpc)
mybits="32"
;;
*aarch64|*arm64)
mybits="64"
mybits_install="64"
;;
*sparc*)
mybits="64"
mybits_install="64"
is_sparc="yes"
;;
*aix*)
mybits="64"
mybits_install="64"
is_aix="yes"
;;
*powerpc*)
mybits="64"
mybits_install="64"
;;
*)
AC_MSG_ERROR([Not supported arch ($my_arch)])
;;
esac
if [[ "$mybits" = "64" ]] ; then
AC_DEFINE(ENABLE_ARCH_64, 1, [Forces 64bits builds])
else
AC_DEFINE(ENABLE_ARCH_32, 1, [Forces 32bits builds])
fi
AC_SUBST(mybits)
my_v=$PACKAGE_VERSION
dnl my_v=`cat IFACE_VERSION`
revision=`echo $my_v | sed -e 's|[[0-9]]\.[[0-9]]\.[[0-9]]\.||'`
my_v=`echo ${my_v%.${revision}}`
minor=`echo $my_v | sed -e 's|[[0-9]]\.[[0-9]].||'`
tmp=`echo $my_v | sed -e 's|[[0-9]]\.[[0-9]]*||'`
major=`echo ${my_v%.$minor} | sed -e 's|^0*||' | sed -e 's|\.||g'`
let "iface_version=$major * 10 + $minor"
# Most Recent Implemented Interface
iface_current=$iface_version
# Implementation number of the current interface
iface_revision=$iface_current
# Oldest Interface Supported
iface_oldest=88
# Range of supported interfaces (current - oldest)
let "iface_age=$iface_current - $iface_oldest"
# Builds the major, minor, micro, and revision variables
# from the PACKAGE_VERSION set with the init
lib_major=`echo $PACKAGE_VERSION | sed -e "s|\..*||"`
lib_minor=`echo $PACKAGE_VERSION | sed -e "s|[[0-9]]*\.||" | sed -e "s|\..*||g"`
lib_micro=`echo $PACKAGE_VERSION | sed -e "s|[[0-9]]*\.[[0-9]]*\.||"`
# lib_revision=`echo $PACKAGE_VERSION | sed -e "s|[[0-9]]*\.[[0-9]]*\.[[0-9]]*\.*||"`
# Basic Library Config
shlib_version="$lib_major.$lib_minor"
shlib_history="$lib_major.$lib_minor"
if [[ $lib_major -lt 10 ]] ; then
lib_major="0"$lib_major
fi
if [[ $lib_minor -lt 10 ]] ; then
lib_minor="0"$lib_minor
fi
if [[ $lib_micro -lt 10 ]] ; then
lib_micro="0"$lib_micro
fi
lib_revision=$(printf "%02d" $((RC-1)))
if [[ $lib_revision -le 0 ]] ; then
lib_revision=00
txt_revision=
else
base_value=$(printf "%d" \'a)
letter_value=$((base_value+lib_revision-1))
txt_revision=$(printf "%b" $(printf '\\%03o' $letter_value));
if [[ $lib_revision -lt 10 ]] ; then
lib_revision = "0"$lib_revision
fi
fi
AC_SUBST(iface_age)
AC_SUBST(iface_current)
AC_SUBST(iface_revision)
AC_SUBST(iface_version)
AC_SUBST(lib_major)
AC_SUBST(lib_minor)
AC_SUBST(lib_micro)
AC_SUBST(lib_revision)
AC_SUBST(txt_revision)
AC_SUBST(shlib_version)
AC_SUBST(shlib_history)
# Build Date Information
yr=`TZ=GMT date +%Y`
mon=`TZ=GMT date +%m`
day=`TZ=GMT date +%d`
hr=`TZ=GMT date +%H`
min=`TZ=GMT date +%M`
sec=`TZ=GMT date +%S`
BUILD_DATE=`date +%Y-%m-%d`
BUILD_DATE_FULL=`TZ=GMT date`
BUILD_DATE_PRETTY=`TZ=GMT date +"%d %h %Y"`
AC_SUBST(yr)
AC_SUBST(mon)
AC_SUBST(day)
AC_SUBST(hr)
AC_SUBST(min)
AC_SUBST(sec)
AC_SUBST(BUILD_DATE)
AC_SUBST(BUILD_DATE_FULL)
AC_SUBST(BUILD_DATE_PRETTY)
# Checks for header files.
dnl #### For iPhone Support we use the special gcc from Apple ###############
dnl enable_iphone_build=no
AC_ARG_ENABLE(iphone,
AC_HELP_STRING( [--enable-iphone],
[enable iPhone build support ( default is yes)]),
iphone_build=$enableval, iphone_build=no )
AC_ARG_WITH(sdk,
AC_HELP_STRING( [--with-sdk=LIBPREFIX],
[uses the iPhone SDK (default is 5.0)]),
sdkver=$withval, sdkver=5.0 )
AC_SUBST(sdkver)
AC_ARG_ENABLE(extra-checks,
AC_HELP_STRING( [--enable-extra-checks=LIBPREFIX],
[enables extra compile-time checks (GCC) (for devel only)]),
extra_checks=$enableval, extra_checks=no )
AC_SUBST(extra_checks)
AC_ARG_ENABLE(debug,
AC_HELP_STRING( [--enable-debug],
[enables extra debug information in the code (GCC) (for devel only)]),
enable_debug=$enableval, enable_debug=no )
AC_SUBST(enable_debug)
enable_rpath=yes
# Export variables to prevent autoconf to use rpl_malloc instead
# of malloc (it won't link properly otherwise!) - needed for iPhone
# build (cross compiling)
jm_cv_func_working_malloc=yes
ac_cv_func_malloc_0_nonnull=yes
if [[ "x$iphone_build" = "xyes" ]] ; then
AC_MSG_RESULT([*** WARNING: iPhone Development Selected])
AC_MSG_RESULT([*** Selected SDK is ${sdkver}])
iphone_dev=/Developer/Platforms/iPhoneOS.platform/Developer
iphone_sdk=$iphone_dev/SDKs/iPhoneOS${sdkver}.sdk
iphone_include=$iphone_sdk/usr/include
iphone_bin=$iphone_dev/usr/bin
default_path=$iphone_bin
build_os=arm-apple-iphone
if ! [[ "$host" = "arm-apple-darwin" ]] ; then
AC_MSG_RESULT([*** ERROR: Please add the '--host=arm-apple-darwin' option (now used '$host') *** ])
fi
CC=$iphone_bin/arm-apple-darwin9-gcc-4.0.1
CC=$iphone_bin/arm-apple-darwin10-llvm-gcc-4.2
dnl CPP=$iphone_bin/arm-apple-darwin9-g++-4.0.1
CFLAGS="-arch armv6 -bundle -isysroot $iphone_sdk -miphoneos-version-min=2.0"
dnl CXX=$iphone_bin/arm-apple-darwin9-g++-4.0.1
CXX=$iphone_bin/arm-apple-darwin10-llvm-g++-4.2
CXXFLAGS="-arch armv6 -bundle -isysroot $iphone_sdk -miphoneos-version-min=2.0 -std=c99"
LDFLAGS="-dead_strip -framework Foundation -framework UIKit -dynamic"
CPPFLAGS="$CFLAGS"
enable_rpath="no"
else
jm_cv_func_working_malloc=yes
ac_cv_func_malloc_0_nonnull=yes
fi
AC_CANONICAL_SYSTEM
dnl AC_CONFIG_SRCDIR([src/drivers/openssl/pki_x509.c])
dnl ifdef ([LT_INIT], [LT_INIT],[AC_PROG_LIBTOOL])
AC_PROG_LIBTOOL
AC_PROG_EGREP
CPU=`uname -p`
AC_SUBST(CPU)
AM_INIT_AUTOMAKE([subdir-objects])
myarch=
dnl Select OS specific versions of source files.
rpath_opt="-Wl,-rpath -Wl,"
rpath=
shlext=so
dnl enable_shared=yes
case "${build_os}" in
*linux*)
myarch=linux
shlext=so
;;
*bsd*) myarch=bsd
shlext=so
mybits_install=""
;;
*iphone*)
myarch=iphone
shlext=dylib
;;
*darwin*)
myarch=darwin
shlext=dylib
mybits_install=""
;;
*sun*) myarch=solaris
shlext=so
rpath_opt="-R "
;;
*solaris*)
myarch=solaris
shlext=so
rpath_opt="-R "
;;
*hpux*) myarch=hpux
shlext=so
;;
*aix*)
myarch=aix
shlext=so
;;
*cygwin*) myarch=cygwin
shlext=dll
;;
*) AC_MSG_ERROR([Operating system ${build_os} not supported]) ;;
esac
arch_target=
case "$target" in
i*86-*)
arch_target=x86
;;
x86_64-*)
arch_target=x86_64
;;
amd64*-*)
arch_target=x86_64
;;
sparc*-*)
arch_target=Sparc
;;
powerpc*-*)
arch_target=PowerPC
;;
*sparc*solaris*)
arch_target=Sparc
;;
*arm*)
arch_target=armv6
;;
*)
[ `uname -p` ] && arch_target=`uname -p` || \
arch_target="Unknown" ;;
esac
AC_SUBST(shlext)
AC_SUBST(arch_target)
AC_SUBST(myarch)
AC_SUBST(mybits_install)
AM_CONDITIONAL(LIBPKI_ARCH_LINUX, test x$myarch = xlinux)
AM_CONDITIONAL(LIBPKI_ARCH_BSD, test x$myarch = xbsd)
AM_CONDITIONAL(LIBPKI_ARCH_OSX, test x$myarch = xdarwin)
AM_CONDITIONAL(LIBPKI_ARCH_SOLARIS, test x$myarch = xsolaris)
AM_CONDITIONAL(LIBPKI_ARCH_HPUX, test x$myarch = xhpux)
AM_CONDITIONAL(LIBPKI_ARCH_AIX, test x$myarch = xaix)
AM_CONDITIONAL(LIBPKI_ENABLE_IPHONE, test x$enable_iphone = xyes)
if [[ "x$myarch" = "xsolaris" ]] ; then
DIST_VERSION=`uname -r`
else
if [[ -f "/etc/system-release" ]] ; then
DIST_VERSION=`$EGREP -o [[0-9.]]+ /etc/system-release | head -n 1`
else
if [[ -f "/etc/issue" ]] ; then
DIST_VERSION=`$EGREP -o [[0-9.]]+ /etc/issue | head -n 1`
else
DIST_VERSION=`echo ${build_os} | $EGREP -o [[0-9.]]+`
fi
fi
fi
AC_SUBST(DIST_VERSION)
if [[ -f "/etc/system-release" ]] ; then
DIST_NAME=`head -n 1 /etc/system-release | cut -f 1,1 -d ' '`
else
if [[ -f "/etc/issue" ]] ; then
DIST_NAME=`head -n 1 /etc/issue | cut -f 1,1 -d ' '`
else
DIST_NAME=`echo ${build_os} | $EGREP -o [[A-Za-z]]+`
fi
fi
AC_SUBST(DIST_NAME)
default_path=$PATH
if [[ "x$is_sparc" = "xyes" ]] ; then
AC_PATH_PROG(CC, CC, , $default_path)
AC_PATH_PROG(CXX, CC, , $default_path)
fi
if [[ "x$is_aix" = "xyes" ]] ; then
AC_PATH_PROG(CC, cc, , $default_path)
AC_PATH_PROG(CXX, cc, , $default_path)
arch_opt="-q"
ar_opt="-X$mybits"
fi
AC_PATH_PROG(MAKE, make, , $default_path)
AC_PATH_PROG(AR, ar, , $default_path)
AR="$AR $ar_opt"
if [[ "x$iphone_build" = "xno" ]] ; then
AC_MSG_RESULT([Not an iPhone Build])
AM_PROG_CC_C_O
fi
AM_MAINTAINER_MODE
dnl Check for install program
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_MAKE_SET
dnl Automatically update the libtool script if it becomes out-of-date.
AC_SUBST(LIBTOOL_DEPS)
dnl Setup dist stuff
AC_SUBST(ac_aux_dir)
AC_CHECK_LIB(c, calloc,
[ AC_DEFINE(HAVE_CALLOC, 1, [Calloc in C library])],
[ AC_MSG_RESULT([no calloc was found]) ]
)
dnl ===== Symbolic and Symbolic Functions =====
# symbolic_build=
# symbolic_start=
# symbolic_end=
# AC_ARG_ENABLE(symbolic,
# AC_HELP_STRING( [--enable-symbolic],
# [enable the use of -Bsymbolic and -Bsymbolic-functions (default is no)]),
# symbolic_build=$enableval, symbolic_build=no )
# if [[ "x$symbolic_build" = "xyes"]] ; then
# symbolic_start="-Bsymbolic -Bsymbolic-functions"
# symbolic_end="-Bno-symbolic"
# fi
dnl ===== iPhone build =====
if [[ "x$iphone_build" = "xno" ]] ; then
dnl check for libraries
dnl AC_CHECK_LIB(nsl, gethostbyname)
dnl AC_CHECK_LIB(socket, socket)
dnl AC_CHECK_LIB(resolv, res_query)
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([stdlib.h string.h sys/socket.h syslog.h])
# Checks for the POSIX.1-2001 net includes
AC_CHECK_HEADERS([sys/select.h])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_CHECK_FUNCS([bzero memset setenv socket strcasecmp strchr strrchr strstr])
dnl ===== Symbolic and Symbolic Functions =====
# symbolic_build=
# symbolic_start=
# symbolic_end=
# AC_ARG_ENABLE(symbolic,
# AC_HELP_STRING( [--enable-symbolic],
# [enable the use of -Bsymbolic and -Bsymbolic-functions (default is no)]),
# symbolic_build=$enableval, symbolic_build=no )
# if [[ "x$symbolic_build" = "xyes"]] ; then
# symbolic_start="-Bsymbolic -Bsymbolic-functions"
# symbolic_end="-Bno-symbolic"
# fi
old_cflags="$CFLAGS"
dnl check for stack protection of gcc
if [[ "$CC" = "gcc" ]] ; then
# AC_CHECK_C_OPTION(-fstack-check)
AC_CHECK_C_OPTION(-fstack-clash_protection)
AC_CHECK_C_OPTION(-maccumulate-outgoing-args)
AC_CHECK_C_OPTION(-Wno-deprecated)
if [[ "x${extra_checks}" = "xyes" ]] ; then
AC_CHECK_C_OPTION(-Wall)
AC_CHECK_C_OPTION(-Wmissing-field-initializers)
AC_CHECK_C_OPTION(-Wmissing-parameter-type)
AC_CHECK_C_OPTION(-Wtype-limits)
AC_CHECK_C_OPTION(-Wuninitialized)
AC_CHECK_C_OPTION(-Wconversion)
AC_CHECK_C_OPTION(-Wfatal-errors)
AC_CHECK_C_OPTION(-Wunused-variable)
AC_CHECK_C_OPTION(-Werror)
AC_CHECK_C_OPTION(-Wno-switch)
dnl AC_CHECK_C_OPTION(-fsanitize=address)
fi
if [[ "$DIST_NAME" = "darwin" ]] ; then
AC_CHECK_C_OPTION(-Wno-unknown-pragmas)
fi
if [[ "x${enable_debug}" = "xyes" ]] ; then
AC_CHECK_C_OPTION(-ggdb)
fi
AC_GCC_CHECK_PRAGMA_IGNORED
AC_GCC_CHECK_PRAGMA_POP
dnl AC_CHECK_C_OPTION(-m64)
dnl AC_CHECK_C_OPTION(-rdynamic)
dnl AC_CHECK_C_OPTION(--export-dynamic)
dnl AC_CHECK_C_OPTION(--export-all-symbols)
fi
EXTRA_CFLAGS=$CFLAGS
CFLAGS="$old_cflags"
dnl Check for package and related programs
AC_PATH_PROG(DATE, date)
AC_PATH_PROG(CHMOD, chmod)
AC_PATH_PROG(PKGMK, pkgmk)
AC_PATH_PROG(RPM, rpm)
if test -n "${PKGMK}"
then
PKGMK=package
else
if test -n "${RPM}"
then
PKGMK=rpm
fi
fi
AC_SUBST(PKGMK)
AC_PATH_PROG(PERL, perl)
AC_SUBST(PERL)
dnl ============================ Pthread Support =======================
AC_CHECK_LIB(pthread, pthread_create,
[ AC_DEFINE(HAVE_LIBPTHREAD, 1, [PTHREAD Library])],
[ AC_MSG_ERROR([pthread library is needed!]) ]
)
pthread_opts=""
dnl AC_MSG_RESULT([Detecting pthread cflags ... ])
dnl AC_TRY_COMPILE( [
dnl #include <sys/types.h>
dnl #include <pthread.h>],
dnl [ pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;]
dnl [ return (0); ],
dnl [ pthread_rw=yes ] ,
dnl [ pthread_rw=no ] )
dnl AC_TRY_COMPILE( [
AC_COMPILE_IFELSE( AC_LANG_SOURCE([[
#include <sys/types.h>
#include <pthread.h>
pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;
int main() {
return (0);
} ]]),
[ pthread_rw=yes ] ,
[ pthread_rw=no ] )
if [[ x"$pthread_rw" = xno ]] ; then
AC_MSG_RESULT([Detecting pthread cflags (2) ... ])
AC_TRY_COMPILE([
#define _BSD_SOURCE
#define _XOPEN_SOURCE 500
#define __USE_UNIX98
#include <sys/types.h>
#include <pthread.h>] ,
[ pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;]
[ return (0); ],
[ pthread_rw=yes ] , [ pthread_rw=no ])
if test x"$pthread_rw" = xyes ; then
pthread_opts="-D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D__USE_UNIX98"
fi
fi
if [[ x"$pthread_opts" = x ]] ; then
AC_MSG_RESULT([pthread cflags ... none])
else
AC_MSG_RESULT([pthread cflags ... $pthread_opts])
fi
AC_SUBST(pthread_opts)
if [[ x"$pthread_rw" = xyes ]] ; then
AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, [HAVE_PTHREAD_RWLOCK])
fi
dnl ================= enable package building specific option ================
AC_ARG_WITH( package-prefix,
[ --with-package-prefix=DIR installed package prefix directory],
[ package_prefix_cnf=$withval ] , [ package_prefix_cnf= ] )
if ! [[ "x$package_prefix_cnf" = "x" ]] ; then
package_prefix=$package_prefix_cnf
else
if [[ "x$prefix" = "xNONE" ]] ; then
if [[ "$DIST_NAME" = "darwin" ]] ; then
prefix=/usr/local
else
prefix=/usr
fi
package_prefix=${prefix}
else
package_prefix=${prefix}
fi
fi
AC_ARG_WITH(libdir,
[ --with-libdir=DIR installed package prefix directory],
[ libdir=$withval ] , [ libdir=$prefix/lib$mybits_install ] )
AC_SUBST(package_prefix)
AC_SUBST(prefix)
AC_SUBST(libdir)
dnl =========================== Global Report Variables ================
# rpath="-rpath=${prefix}/lib$myarch"
supported_urls="file http https"
dnl =========================== Include and lib prefixes ===============
AC_ARG_WITH(lib-prefix,
AC_HELP_STRING( [--with-lib-prefix=LIBPREFIX],
[sets library prefix (default is PREFIX/$libdir)]),
lib_prefix=$withval, lib_prefix=${libdir})
AC_SUBST(lib_prefix)
dnl databases, tmp, crypto, mails
AC_ARG_WITH( include-prefix,
AC_HELP_STRING( [--with-include-prefix=INCLUDEPREFIX],
[sets include prefix (default is PREFIX/include)]),
include_prefix=$withval, include_prefix=${prefix}/include)
AC_SUBST(include_prefix)
dnl ############################## BEGIN #############################
dnl definitions for distribution building
AC_ARG_WITH( dist-user,
AC_HELP_STRING( [--with-dist-user=madwolf],
[sets user for distribution building(default is madwolf)]),
dist_user=$withval, dist_user=madwolf)
AC_SUBST( dist_user)
AC_ARG_WITH( dist-group,
AC_HELP_STRING( [--with-dist-group=openca],
[sets group for distribution building(default is openca)]),
dist_group=$withval, dist_group=openca)
AC_SUBST( dist_group)
AC_ARG_ENABLE( package-build,
AC_HELP_STRING( [--enable-package-build],
[enable package build (default is no)]),
package_build=$enableval, package_build=no)
AC_SUBST(package_build)
default_path=$PATH:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/opt/csw/bin
dnl Check for program paths
AC_PATH_PROG( SHELL, bash, sh, $default_path)
AC_PATH_PROG( POD2MAN, pod2man,pod2man, $default_path)
AC_PATH_PROG( MKDIR, mkdir, , $default_path)
AC_PATH_PROG( SED, sed, , $default_path)
AC_PATH_PROG( GZIP, gzip, , $default_path)
AC_PATH_PROG( ZIP, gzip, , $default_path)
AC_PATH_PROG( TAR, tar, , $default_path)
AC_PATH_PROG( PWD, pwd, , $default_path)
AC_PATH_PROG( CHMOD, chmod, , $default_path)
AC_PATH_PROG( CHOWN, chown, , $default_path)
AC_PATH_PROG( CP, cp, , $default_path)
AC_PATH_PROG( ECHO, echo, , $default_path)
AC_PATH_PROG( DOXYGEN, doxygen, , $default_path)
AC_PATH_PROG( PDFLATEX, pdflatex, , $default_path)
AC_CHECK_PROG( HAS_PKGCONF, pkg-config, yes, [] , $PATH)
dnl ========================== Install Builder Path Search ===================
builder_path=$default_path:$HOME/installbuilder/bin:$HOME/installbuilder-5.4.10/bin:$HOME/installbuilder/bin/Builder.app/Contents/MacOS/
ibuilder="builder"
if [[ "x$DIST_NAME" = "xdarwin" ]] ; then
ibuilder="installbuilder.sh"
fi
AC_PATH_PROG(INSTALL_BUILDER, $ibuilder, , $builder_path )
AC_SUBST(INSTALL_BUILDER)
dnl AC_MSG_ERROR( [****** ($DIST_NAME) IBUILDER is : $ibuilder and INSTALL_BUILDER is $INSTALL_BUILDER] );
dnl ==================== BEGIN LDAP Support =======================
ldap_vendor=
ldap="yes"
ldap_prefix=""
ldap_path=""
ldap_cflags=""
ldap_deprecated=
ldap_ldadd=
ldap_ldflags=
library_prefix=
library_ldflags=
library_cflags=
library_ldadd=
AC_ARG_ENABLE(ldap,
AC_HELP_STRING( [--enable-ldap],
[enable ldap support ( default is yes)]),
ldap=$enableval, ldap=yes )
if [[ "x$enable_iphone" = "xyes" ]] ; then
ldap="no"
fi
if ! [[ "x$ldap" = "xno" ]] ; then
AC_ARG_WITH( ldap-prefix,
AC_HELP_STRING( [--with-ldap-prefix],
[ldap prefix directory)]),
[ldap_prefix=$withval],[ldap_prefix=])
if [[ "x$ldap_prefix" = "x" ]] ; then
case "${myarch}" in
bsd)
ldap_prefix="/usr/local";
;;
solaris)
ldap_prefix="/usr";
;;
*)
ldap_prefix=
;;
esac
dnl if [[ "${myarch}" = "bsd" ]] ; then
dnl ldap_prefix="/usr/local"
dnl fi
fi
dnl Now we have to check which LDAP vendor is available
AC_LDAP_VENDOR( $ldap_prefix )
if [[ "x$ldap_vendor" = "x" ]] ; then
AC_MSG_RESULT([*** ERROR: No supported LDAP vendor found.])
AC_MSG_ERROR([*** ERROR: Do you have the *devel* package installed ?])
fi
AC_DEFINE( HAVE_LDAP, 1, [HAVE LDAP])
ldap_ldadd=$library_ldadd
ldap_ldflags=$library_ldflags
ldap_cflags=$library_cflags
AC_MSG_RESULT([LDAP Vendor......: $ldap_vendor])
AC_MSG_RESULT([LDAP CFLAGS......: $library_cflags])
AC_MSG_RESULT([LDAP LDADD.......: $library_ldadd])
AC_MSG_RESULT([LDAP LDFLAGS.....: $library_ldflags])
else
ldap_cflags=
ldap_libs=
ldap_ldadd=
fi
AM_CONDITIONAL(LDAP_PREFIX, test ! x$ldap_prefix = x )
if [[ "x$ldap_vendor" = "xOPENLDAP" ]] ; then
AC_DEFINE( LDAP_VENDOR_OPENLDAP, 1, [HAVE OPENLDAP])
dnl AC_DEFINE( LDAP_DEPRECATED, 1, [LDAP DEPRECATED])
dnl ldap_deprecated="yes";
fi
if [[ "x$ldap_vendor" = "xSUN" ]] ; then
AC_DEFINE( LDAP_VENDOR_SUN, 1, [HAVE SUN LDAP])
fi
dnl Should be checked..
if ! [[ "x${ldap}" = "xno" ]] ; then
supported_urls="$supported_urls ldap"
fi
if [[ "x${ldap_deprecated}" = "xyes" ]] ; then
ldap_cflags="${ldap_cflags} -DLDAP_DEPRECATED=1"
fi
AC_SUBST(ldap_vendor)
AC_SUBST(ldap_ldadd)
AC_SUBST(ldap_ldflags)
AC_SUBST(ldap_cflags)
AC_SUBST(ldap_prefix)
dnl ====================== xml2 - xml LIBRARIES ===================
dnl Defaults
xml2_config=xml2-config
xml2_cflags=
xml2_prefix=/usr
xml2_ldflags=
xml2_ldadd=
xml2_include=
dnl xml2 with prefix
AC_ARG_WITH( xml2-prefix,
[ --with-xml2-prefix=DIR xml2 lib prefix directory],
[ xml2_prefix=$withval ] , [ xml2_prefix= ] )
if ! [[ "x$xml2_prefix" = "x" ]]; then
if [[ -d "$xml2_prefix/lib$mybits_install" ]] ; then
rpath="$rpath ${rpath_opt}\"$xml2_prefix/lib$mybits_install\""
else
rpath="$rpath ${rpath_opt}\"$xml2_prefix/lib$mybits_install\""
fi
ld_lib_path="$xml2_path:$ld_lib_path"
fi
if [[ "x$iphone_build" = "xno" ]] ; then
AC_PATH_PROG(xml2_config, xml2-config, ,
$xml2_prefix/bin:/opt/csw/bin:$PATH:/bin:/usr/bin:/usr/local/bin )
if ! [[ "x$xml2_config" = "x" ]] ; then
if [[ "x$DIST_NAME" = "xdarwin" ]] ; then
if [[ "$xml2_prefix" = "x" ]] ; then
xml2_prefix=/usr
else
xml2_prefix=`$xml2_config --prefix`
fi
else
xml2_prefix=`$xml2_config --prefix`
fi
xml2_config=$xml2_config
else
xml2_prefix=/usr
fi
else
xml2_prefix=$iphone_sdk/usr
xml2_config=
fi
AC_SUBST(xml2_prefix)
if ! [[ "x$xml2_config" = "x" ]] ; then
if [[ "$DIST_NAME" = "darwin" ]] ; then
if [[ -d "${xml2_prefix}/include/libxml2" ]] ; then
xml2_cflags=-I${xml2_prefix}/include/libxml2
xml2_include=${xml2_prefix}/include/libxml2
else
xml2_cflags=`$xml2_config --cflags`
xml2_include=`$xml2_config --cflags | sed -E 's|^\-I||g'`
fi
xml2_ldadd=`$xml2_config --exec-prefix=/usr --libs`
else
xml2_include=`$xml2_config --cflags | sed -E 's|^\-I||g'`
xml2_cflags=`$xml2_config --cflags`
xml2_ldadd=`$xml2_config --libs`
fi
if [[ "$DIST_NAME" = "darwin" ]] ; then
xml2_ldflags=-L${xml2_prefix}/lib
else
xml2_ldflags=-L${xml2_prefix}/lib${mybits_install}
fi
dnl if [[ "$DIST_NAME" = "darwin" ]] ; then
dnl XML2_LIBTOOL_LIBS=`$xml2_config --exec-prefix=/usr --libtool-libs`
dnl else
dnl XML2_LIBTOOL_LIBS=`$xml2_config --libtool-libs`
dnl fi
else
xml2_cflags=-I${xml2_prefix}/include/libxml2
xml2_include=${xml2_prefix}/include/libxml2
xml2_ldflags="-L${xml2_prefix}/lib$mybits_install"
xml2_ldadd="-lxml2"
dnl XML2_LIBTOOL_LIBS=
fi
xml2_config="$xml2_prefix/bin/xml2-config"
AC_MSG_RESULT([with xml2-prefix : $xml2_prefix])
AC_MSG_RESULT([with xml2-cflags : $xml2_cflags])
AC_MSG_RESULT([with xml2-ldflags : $xml2_ldflags])
AC_MSG_RESULT([with xml2-ldadd : $xml2_ldadd])
AC_MSG_RESULT([with xml2-include : $xml2_include])
AM_CONDITIONAL(xml2_prefix, test ! x$xml2_prefix = x )
if ! [[ -d "$xml2_prefix/include/libxml2/libxml" ]] ; then
AC_MSG_ERROR([*** ERROR: Missing include files for libxml2! ***])
fi
dnl Export our XML2 build settings
AC_DEFINE(HAVE_XML2, 1, [LIBXML2])
AC_SUBST(xml2_config)
AC_SUBST(xml2_prefix)
AC_SUBST(xml2_cflags)
AC_SUBST(xml2_ldadd)
AC_SUBST(xml2_ldflags)
AC_SUBST(xml2_include)
dnl ====================== mySQL LIBRARIES ===================
dnl Defaults
MYSQL_CONFIG=mysql_config
mysql_cflags=-I/usr/include/mysql
mysql_prefix=/usr
mysql_prefix_SPECIFIED=
mysql_ldflags=
mysql_ldadd=
mysql_cflags=
mysql_libs=
enablemysql=yes
AC_ARG_ENABLE(mysql,
AC_HELP_STRING( [--enable-mysql],
[enable mysql support ( default is yes)]),
enablemysql=$enableval, enablemysql= )
if [[ "x$iphone_build" = "xyes" ]] ; then
enablemysql=no
fi
if ! [[ "${enablemysql}" = "no" ]] ; then
dnl xmlsec with prefix
AC_ARG_WITH( mysql-prefix,
[ --with-mysql-prefix=DIR mysql lib prefix directory],
[ mysql_prefix_SPECIFIED=$withval ] , [ mysql_prefix_SPECIFIED= ] )
AC_PATH_PROG(mysql_config, mysql_config, ,
$mysql_prefix_SPECIFIED/bin:$mysql_prefix/bin:/opt/csw/bin:$PATH:/bin:/usr/bin:/usr/local/bin:/opt/csw/mysql5/bin:/opt/csw/mysql4/bin )
if ! [[ "x${mysql_config}" = "x" ]] ; then
mysql_prefix=${mysql_config%%/bin/mysql_config}
MYSQL_CONFIG=$mysql_config
else
if [[ "x${mysql_prefix_SPECIFIED}" = "x" ]] ; then
mysql_prefix=${mysql_prefix_SPECIFIED}
fi
fi
AC_SUBST(mysql_prefix)
if ! [[ "x$mysql_config" = "x" ]] ; then
mysql_cflags=`$mysql_config --cflags`
# mysql_ldadd=`$mysql_config --libs`
mysql_ldadd=
mysql_ldflags=`$mysql_config --libs_r`
else
mysql_cflags="-I$mysql_prefix/include"
mysql_ldflags="-L$mysql_prefix/lib"
mysql_ldadd="-lmysqlclient_r"
fi
dnl Export our MYSQL build settings
OLD_CFLAGS="$CFLAGS"
OLD_LDFLAGS="$LDFLAGS"
CFLAGS="$mysql_cflags"
LDFLAGS="$mysql_ldflags $mysql_ldadd"
ok=0
AC_RUN_IFELSE([ AC_LANG_SOURCE([
#include <mysql.h>
int main(void) {
MYSQL *x;
return(0);
}])], [ ok=1 ], [ ok=0 ])
CFLAGS="$OLD_CFLAGS"
LDFLAGS="$OLD_LDFLAGS"
if [[ "x${ok}" = "x1" ]] ; then
AC_DEFINE(HAVE_MYSQL, 1, test "${enablemysql}" = "yes")
# mysql_cflags="$mysql_cflags"
# mysql_libs="$mysql_libs"
enablemysql="yes"
supported_urls="$supported_urls mysql"
AC_MSG_RESULT([Enable MySQL URLs : yes ])
AC_MSG_RESULT([MySQL LDFLAGS : $mysql_ldflags])
AC_MSG_RESULT([MySQL CFLags : $mysql_cflags])
AC_MSG_RESULT([MySQL LDAdd : $mydql_ldadd])
else
enablemysql="no"
mysql_cflags=
mysql_ldadd=
mysql_ldflags=
MYSQL_CONFIG=
MYSQL_CPPFLAGS=