forked from asterisk/asterisk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2922 lines (2654 loc) · 98.7 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_PREREQ(2.60a)
AC_INIT([asterisk], [trunk], [https://issues.asterisk.org])
# cross-compile macros
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
# check existence of the package
AC_CONFIG_SRCDIR([main/asterisk.c])
AC_COPYRIGHT("Asterisk")
# preserve any CFLAGS or LDFLAGS that may be set
# NOTE: This must be done before calling any macros that end up
# calling AC_PROG_CC or the like, since they will set a default
# set of CFLAGS ("-g -O2") if the user did not supply any, and
# we don't want those default flags to be carried over into the
# rest of the build system since we have other means of controlling
# debugging symbol generation and optimization.
CONFIG_CFLAGS="${CFLAGS}"
CONFIG_LDFLAGS="${LDFLAGS}"
AC_SUBST(CONFIG_CFLAGS)
AC_SUBST(CONFIG_LDFLAGS)
# specify output header file
AC_CONFIG_HEADER(include/asterisk/autoconfig.h)
# Note: AC_PROG_CC *must* be specified before AC_USE_SYSTEM_EXTENSIONS or any
# other macro that uses the C compiler, or the default order will be used.
AC_PROG_CC([gcc cc])
AC_USE_SYSTEM_EXTENSIONS dnl note- does not work on FreeBSD
# System default paths
AC_SUBST([astsbindir], ['${sbindir}'])dnl
AC_SUBST([astcachedir], ['${localstatedir}/cache/asterisk'])dnl
AC_SUBST([astetcdir], ['${sysconfdir}/asterisk'])dnl
AC_SUBST([astheaderdir], ['${includedir}/asterisk'])dnl
AC_SUBST([astlibdir], ['${libdir}'])dnl
AC_SUBST([astmoddir], ['${libdir}/asterisk/modules'])dnl
AC_SUBST([astmandir], ['${mandir}'])dnl
AC_SUBST([astvarlibdir], ['${localstatedir}/lib/asterisk'])dnl
AC_SUBST([astdatadir], ['${astvarlibdir}'])dnl
AC_SUBST([astdbdir], ['${astvarlibdir}'])dnl
AC_SUBST([astkeydir], ['${astvarlibdir}'])dnl
AC_SUBST([astspooldir], ['${localstatedir}/spool/asterisk'])dnl
AC_SUBST([astlogdir], ['${localstatedir}/log/asterisk'])dnl
AC_SUBST([astvarrundir], ['${localstatedir}/run/asterisk'])dnl
case "${host_os}" in
*bsd*)
if test ${prefix} != 'NONE'; then
astvarlibdir='${prefix}/share/asterisk'
astdbdir='${localstatedir}/db/asterisk'
fi
;;
darwin*)
if test ${prefix} = 'NONE'; then
astvarrundir='/Library/Application Support/Asterisk/Run'
fi
;;
esac
case "${host_os}" in
netbsd*)
ac_default_prefix=/usr/pkg
CPPFLAGS=-I/usr/pkg/include
LDFLAGS=-L/usr/pkg/lib
;;
dragonfly*|freebsd*)
ac_default_prefix=/usr/local
CPPFLAGS=-I/usr/local/include
LDFLAGS=-L/usr/local/lib
;;
openbsd*)
ac_default_prefix=/usr/local
if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
if test ${sysconfdir} = '${prefix}/etc'; then
astetcdir=/etc/asterisk
fi
if test ${mandir} = '${prefix}/man'; then
astmandir=/usr/share/man
fi
fi
CPPFLAGS=-I/usr/local/include
LDFLAGS=-L/usr/local/lib
;;
darwin*)
ac_default_prefix=/usr/local
if test ${prefix} = 'NONE'; then
astmoddir='/Library/Application Support/Asterisk/Modules'
astvarlibdir='/Library/Application Support/Asterisk'
astlogdir=/Library/Logs/Asterisk
astvarrundir='/Library/Application Support/Asterisk/Run'
fi
AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])
AC_DEFINE([_DARWIN_UNLIMITED_SELECT], 1, [Define to 1 if running on Darwin.])
;;
solaris*)
if test ${prefix} = 'NONE'; then
astcachedir=/var/cache/asterisk
astetcdir=/var/etc/asterisk
astsbindir=/opt/asterisk/sbin
astlibdir=/opt/asterisk/lib
astmoddir=/opt/asterisk/lib/modules
astheaderdir=/opt/asterisk/include
astmandir=/opt/asterisk/man
astvarlibdir=/var/opt/asterisk
astspooldir=/var/spool/asterisk
astlogdir=/var/log/asterisk
astvarrundir=/var/run/asterisk
fi
;;
*)
ac_default_prefix=/usr
if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
if test ${sysconfdir} = '${prefix}/etc'; then
sysconfdir=/etc
fi
if test ${mandir} = '${prefix}/man'; then
mandir=/usr/share/man
fi
fi
;;
esac
if test ${prefix} = ${ac_default_prefix} || test ${prefix} = 'NONE'; then
if test ${localstatedir} = '${prefix}/var'; then
localstatedir=/var
fi
fi
BUILD_PLATFORM=${build}
BUILD_CPU=${build_cpu}
BUILD_VENDOR=${build_vendor}
BUILD_OS=${build_os}
AC_SUBST(BUILD_PLATFORM)
AC_SUBST(BUILD_CPU)
AC_SUBST(BUILD_VENDOR)
AC_SUBST(BUILD_OS)
HOST_PLATFORM=${host}
HOST_CPU=${host_cpu}
HOST_VENDOR=${host_vendor}
HOST_OS=${host_os}
AC_SUBST(HOST_PLATFORM)
AC_SUBST(HOST_CPU)
AC_SUBST(HOST_VENDOR)
AC_SUBST(HOST_OS)
PBX_WINARCH=0
case "${host_os}" in
dragonfly*|freebsd*)
OSARCH=FreeBSD
;;
netbsd*)
OSARCH=NetBSD
;;
openbsd*)
OSARCH=OpenBSD
;;
solaris*)
OSARCH=SunOS
;;
mingw32)
OSARCH=mingw32
PBX_WINARCH=1
;;
cygwin)
OSARCH=cygwin
PBX_WINARCH=1
;;
linux-gnu*)
OSARCH=linux-gnu
;;
linux-musl*)
OSARCH=linux-musl
;;
kfreebsd*-gnu)
OSARCH=kfreebsd-gnu
;;
*)
OSARCH=${host_os}
;;
esac
AC_SUBST(OSARCH)
AC_SUBST(PBX_WINARCH)
AC_MSG_CHECKING(whether char is unsigned)
AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE(
#include <limits.h>
#if CHAR_MIN == 0
#error
#endif
)
],[
AC_MSG_RESULT(no)
CONFIG_SIGNED_CHAR=""
],[
AC_MSG_RESULT(yes)
CONFIG_SIGNED_CHAR="-fsigned-char"
]
)
AC_SUBST(CONFIG_SIGNED_CHAR)
# check for uname
AC_PATH_TOOL([UNAME], [uname], :)
if test "x${UNAME}" != "x:"; then
PBX_OSREV=$(${UNAME} -r)
fi
AC_SUBST(PBX_OSREV)
AH_TOP([#ifndef ASTERISK_AUTOCONFIG_H
#define ASTERISK_AUTOCONFIG_H
/* IWYU pragma: private, include "asterisk.h" */
#include "asterisk/buildopts.h" /* IWYU pragma: export */])
AH_BOTTOM([#endif /* ASTERISK_AUTOCONFIG_H */])
# cross-compile checks
if test "${cross_compiling}" = "yes";
then
AC_CHECK_TOOL(CC, gcc, :)
AC_CHECK_TOOL(CXX, g++, :)
AC_CHECK_TOOL(LD, ld, :)
AC_CHECK_TOOL(RANLIB, ranlib, :)
CROSS_COMPILING=1
AC_SUBST(CROSS_COMPILING)
fi
# Checks for programs.
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_CXXCPP
# This macro is just copied into our local acinclude.m4 from libtool.m4 so that
# the developers regenerating the configure script don't have to install libtool.
AST_PROG_LD # note, does not work on FreeBSD
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AST_CHECK_GNU_MAKE
AC_PROG_EGREP
AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
AC_CHECK_TOOLS([AR], [ar gar], :)
GNU_LD=0
if test "x$with_gnu_ld" = "xyes" ; then
GNU_LD=1
fi
AC_SUBST(GNU_LD)
AC_PATH_PROG([BISON], [bison], :)
AC_PATH_PROG([CMP], [cmp], :)
AC_PATH_PROG([CAT], [cat], :)
AC_PATH_PROG([CUT], [cut], :)
AC_PATH_PROG([FLEX], [flex], :)
AC_PATH_PROG([GREP], [grep], :)
AC_PATH_PROGS([PYTHON], [python2.7 python2 python python3], :)
AC_PATH_PROG([FIND], [find], :)
AC_PATH_PROG([BASENAME], [basename], :)
AC_PATH_PROG([DIRNAME], [dirname], :)
AC_PATH_PROG([SHELL], [sh], :)
AC_PATH_PROG([LN], [ln], :)
AC_PATH_PROG([DOXYGEN], [doxygen], :)
AC_PATH_PROG([DOT], [dot], :)
AC_PATH_PROG([WGET], [wget], :)
AC_PATH_PROG([CURL], [curl], :)
AC_PATH_PROG([XMLLINT], [xmllint], :)
AC_PATH_PROGS([XMLSTARLET], [xmlstarlet xml], :)
AC_PATH_PROG([BASH], [bash], :)
AC_PATH_PROG([GIT], [git], :)
AC_PATH_PROG([ALEMBIC], [alembic], :)
AC_PATH_PROG([BZIP2], [bzip2], :)
AC_PATH_PROG([TAR], [tar], :)
AC_PATH_PROG([PATCH], [patch], :)
AC_PATH_PROG([SED], [sed], :)
AC_PATH_PROG([NM], [nm], :)
AC_PATH_PROG([REALPATH], [realpath], :)
DOWNLOAD=":"
DOWNLOAD_TO_STDOUT=
DOWNLOAD_TIMEOUT=
if test "x${WGET}" != "x:"; then
DOWNLOAD=${WGET}
DOWNLOAD_TO_STDOUT="${WGET} -q -O-"
DOWNLOAD_TIMEOUT='--timeout=$1'
elif test "x${CURL}" != "x:"; then
DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
DOWNLOAD_TO_STDOUT="${CURL} -Ls"
DOWNLOAD_TIMEOUT='--max-time $(or $2,$1)'
else
AC_PATH_PROG([FETCH], [fetch], :)
if test "x${FETCH}" != "x:"; then
DOWNLOAD=${FETCH}
DOWNLOAD_TO_STDOUT="${FETCH} -o-"
DOWNLOAD_TIMEOUT='--timeout=$(or $2,$1)'
fi
fi
AC_SUBST(DOWNLOAD)
AC_SUBST(DOWNLOAD_TO_STDOUT)
AC_SUBST(DOWNLOAD_TIMEOUT)
AC_PATH_PROG([LDCONFIG], [ldconfig], :)
AC_PATH_PROG([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
AC_PATH_PROG([OPENSSL], [openssl], :)
PKG_PROG_PKG_CONFIG()
AC_CACHE_CHECK([for bison that supports parse-param], [ac_cv_path_BISON2], [
if test "x$BISON" != "x:" ; then
# Create a temporary directory $tmp in $TMPDIR (default /tmp).
# Use mktemp if possible; otherwise fall back on mkdir,
# with $RANDOM to make collisions less likely.
: ${TMPDIR=/tmp}
{
tmp=`
(umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
` &&
test -n "$tmp" && test -d "$tmp"
} || {
tmp=$TMPDIR/foo$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || exit $?
cat >$tmp/test.y <<__EOL__
%parse-param {struct parse_io *parseio}
%%
file : { \$\$ = parseio->pval = 1; }
;
%%
__EOL__
${BISON} -o ${tmp}/test.tab.c ${tmp}/test.y >/dev/null 2>&1
if test -e "${tmp}/test.tab.c"; then
ac_cv_path_BISON2=${BISON}
fi
rm -rf ${tmp}
fi
])
if test "x${ac_cv_path_BISON2}" = "x" ; then
BISON=:
PBX_BISON=0
else
PBX_BISON=1
fi
AC_SUBST(PBX_BISON)
if test "${FLEX}" = ":"; then
PBX_FLEX=0
else
PBX_FLEX=1
fi
AC_SUBST(PBX_FLEX)
if test "${XMLSTARLET}" = ":"; then
PBX_XMLSTARLET=0
else
PBX_XMLSTARLET=1
fi
AC_SUBST(PBX_XMLSTARLET)
if test "${BASH}" = ":"; then
PBX_BASH=0
else
PBX_BASH=1
fi
AC_SUBST(PBX_BASH)
AC_CHECK_TOOL([SOXMIX], [soxmix], :)
if test "x${SOXMIX}" != "x:"; then
AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
fi
AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])
if test "${MD5}" = "digest" ; then
MD5="${MD5} -a md5"
fi
AX_PTHREAD
AC_LANG(C)
PBX_NO_BINARY_MODULES=0
AC_ARG_ENABLE([binary-modules],
[AS_HELP_STRING([--disable-binary-modules],
[Block installation of binary modules.])],
[case "${enableval}" in
y|ye|yes) PBX_NO_BINARY_MODULES=0 ;;
n|no) PBX_NO_BINARY_MODULES=1 ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-binary-modules) ;;
esac])
AC_SUBST(PBX_NO_BINARY_MODULES)
AC_ARG_ENABLE([dev-mode],
[AS_HELP_STRING([--enable-dev-mode],
[Turn on developer mode])],
[case "${enableval}" in
y|ye|yes) AST_DEVMODE=yes ;;
n|no) AST_DEVMODE=no ;;
noisy)
AST_DEVMODE=yes
NOISY_BUILD=yes
;;
strict)
AST_DEVMODE=yes
AST_DEVMODE_STRICT=yes
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode) ;;
esac])
AC_SUBST(NOISY_BUILD)
AC_SUBST(AST_DEVMODE)
AC_SUBST(AST_DEVMODE_STRICT)
AST_OPTION_ONLY([download-cache], [AST_DOWNLOAD_CACHE], [cached sound AND external module tarfiles], [])
AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [])
AST_OPTION_ONLY([externals-cache], [EXTERNALS_CACHE_DIR], [cached external module tarfiles], [])
AST_CODE_COVERAGE=no
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],
[Turn on code coverage tracking (for gcov)])],
[case "${enableval}" in
y|ye|yes) AST_CODE_COVERAGE=yes ;;
n|no) AST_CODE_COVERAGE=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-coverage) ;;
esac])
AC_SUBST(AST_CODE_COVERAGE)
AST_CHECK_RAII()
AST_CHECK_STRSEP_ARRAY_BOUNDS()
JANSSON_BUNDLED=no
AC_ARG_WITH([jansson-bundled],
[AS_HELP_STRING([--with-jansson-bundled],
[Use bundled jansson library])],
[case "${withval}" in
y|ye|yes) JANSSON_BUNDLED=yes ;;
*) JANSSON_BUNDLED=no ;;
esac])
PJPROJECT_BUNDLED=yes
AH_TEMPLATE(m4_bpatsubst([[HAVE_PJPROJECT_BUNDLED]], [(.*)]), [Define to 1 when using the bundled pjproject.])
AC_ARG_WITH([pjproject-bundled],
[AS_HELP_STRING([--with-pjproject-bundled],
[Use bundled pjproject libraries (default)])],
[case "${withval}" in
n|no) PJPROJECT_BUNDLED=no ;;
*) PJPROJECT_BUNDLED=yes ;;
esac])
if test "${with_pjproject}" = "no" || test "${with_pjproject}" = "n" ; then
PJPROJECT_BUNDLED=no
fi
#
# OpenSSL stuff has to be done here because we want to pass
# any resulting CFLAGS and LDFLAGS to the bundled pjproject
# configure done in THIRD_PARTY_CONFIGURE()
#
AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
AST_EXT_LIB_SETUP_OPTIONAL([OPENSSL_BIO_METHOD], [OpenSSL BIO Method Support], [CRYPTO], [crypto])
# If neither --without-ssl (PBX_OPENSSL=-1) nor --without-crypto (PBX_CRYPTO=-1)
# and there were no directories atdded to --with-ssl and --with-crypto, and
# pkg-config is installed (which is should be by install_prereq).
if test "x$PKG_CONFIG" != "x" -a $PBX_OPENSSL -ge 0 -a $PBX_CRYPTO -ge 0 -a "x$OPENSSL_DIR" = "x" ; then
AC_MSG_NOTICE(checking OPENSSL with pkg-config)
AC_MSG_NOTICE(checking whether system openssl > 1.1.0)
AST_PKG_CONFIG_CHECK([OPENSSL], [openssl >= 1.1.0])
if test $PBX_OPENSSL -eq 0 ; then
AC_MSG_NOTICE(checking whether alternate openssl11 is installed)
AST_PKG_CONFIG_CHECK([OPENSSL], [openssl11])
fi
if test $PBX_OPENSSL -eq 1 ; then
AC_DEFINE([HAVE_OPENSSL_BIO_METHOD], 1)
PBX_OPENSSL_BIO_METHOD=1
else
AC_MSG_NOTICE(checking fallback system openssl)
AST_PKG_CONFIG_CHECK([OPENSSL], [openssl])
fi
if test $PBX_OPENSSL -eq 1; then
AC_DEFINE([HAVE_CRYPTO], 1)
PBX_CRYPTO=1
fi
else
AC_MSG_NOTICE(Checking OPENSSL without pkg-config)
AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
if test "$PBX_CRYPTO" = "1";
then
AST_EXT_LIB_CHECK([OPENSSL], [ssl], [SSL_connect], [openssl/ssl.h], [-lcrypto])
AST_EXT_LIB_CHECK([OPENSSL_BIO_METHOD], [ssl], [BIO_meth_new], [openssl/ssl.h], [-lcrypto])
fi
fi
if test $PBX_OPENSSL -eq 0 ; then
AC_MSG_WARN(OpenSSL does not seem to be installed)
fi
THIRD_PARTY_CONFIGURE()
# AST_EXT_LIB_SETUP is used to tell configure to handle variables for
# various packages.
# $1 is the prefix for the variables in makeopts and autoconfig.h
# $2 is the short comment, $4 is the long comment
# $3 is the name used in --with- or --without- flags for configure.
#
# Package option names should be in alphabetical order
# by the --with option name (the third field),
# to make things easier for the users.
AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
AST_EXT_LIB_SETUP([BFD], [Debug symbol decoding], [bfd])
# BKTR is used for backtrace support on platforms that do not
# have it natively.
AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
AST_EXT_LIB_SETUP([BLUETOOTH], [Bluetooth], [bluetooth])
AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
AST_EXT_LIB_SETUP([CODEC2], [Codec 2 Audio Decoder/Encoder], [codec2])
AST_EXT_LIB_SETUP([COROSYNC], [Corosync], [cpg])
AST_EXT_LIB_SETUP_OPTIONAL([COROSYNC_CFG_STATE_TRACK], [A callback only in corosync 1.x], [COROSYNC], [cfg])
AST_EXT_LIB_SETUP([CRYPT], [password and data encryption], [crypt])
AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
AST_EXT_LIB_SETUP([ILBC], [System iLBC], [ilbc], [, use 'internal' iLBC otherwise])
AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
AST_EXT_LIB_SETUP([HOARD], [Hoard Memory Allocator], [hoard])
AST_EXT_LIB_SETUP([ICAL], [iCal], [ical])
AST_EXT_LIB_SETUP([ICONV], [Iconv], [iconv])
AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber], [iksemel])
AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
AST_EXT_LIB_SETUP([INOTIFY], [inotify support], [inotify])
AST_EXT_LIB_SETUP([IODBC], [iODBC], [iodbc])
AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
AST_EXT_LIB_SETUP([JANSSON], [Jansson JSON library], [jansson])
AST_EXT_LIB_SETUP([URIPARSER], [uriparser library], [uriparser])
AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit])
AST_EXT_LIB_SETUP_OPTIONAL([LIBEDIT_IS_UNICODE], [Libedit compiled for unicode], [LIBEDIT], [libedit])
AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt])
AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt])
AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
AC_ARG_VAR([LUA_VERSIONS],[A space separated list of target lua versions to test.])
AST_EXT_LIB_SETUP([MYSQLCLIENT], [MySQL client], [mysqlclient])
AST_EXT_LIB_SETUP([NEON], [neon], [neon])
AST_EXT_LIB_SETUP([NEON29], [neon29], [neon29])
AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2])
AST_EXT_LIB_SETUP([OPUS], [Opus], [opus])
AST_EXT_LIB_SETUP([OPUSFILE], [Opusfile], [opusfile])
AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
AST_EXT_LIB_SETUP([BEANSTALK], [Beanstalk Job Queue], [beanstalk])
if test "x${PBX_PJPROJECT}" != "x1" ; then
AST_EXT_LIB_SETUP([PJPROJECT], [PJPROJECT], [pjproject])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [PJSIP Dialog Create UAS with Incremented Lock], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJ_TRANSACTION_GRP_LOCK], [PJSIP Transaction Group Lock Support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_REPLACE_MEDIA_STREAM], [PJSIP Media Stream Replacement Support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj_ssl_cert_load_from_files2 support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EXTERNAL_RESOLVER], [PJSIP External Resolver Support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TLS_TRANSPORT_PROTO], [PJSIP TLS Transport proto field support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_EVSUB_GRP_LOCK], [PJSIP EVSUB Group Lock support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_SESSION_REF], [PJSIP INVITE Session Reference Count support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_AUTH_CLT_DEINIT], [pjsip_auth_clt_deinit support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip_tsx_layer_find_tsx2 support], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], [PJSIP INVITE Accept Multiple SDP Answers], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_ENDPOINT_COMPACT_FORM], [PJSIP Compact Form Support on Endpoint], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TRANSPORT_DISABLE_CONNECTION_REUSE], [PJSIP Transport Connection Reuse Disabling], [PJPROJECT], [pjsip])
AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_OAUTH_AUTHENTICATION], [PJSIP OAuth Authentication Support], [PJPROJECT], [pjsip])
fi
AST_EXT_LIB_SETUP([POPT], [popt], [popt])
AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_ACK_INBAND], [ISDN PRI progress inband ie in SETUP ACK], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_L2_PERSISTENCE], [ISDN Layer 2 persistence option], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_DATETIME_SEND], [ISDN PRI Date/time ie send policy], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_MWI_V2], [ISDN PRI Message Waiting Indication (Fixed)], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_DISPLAY_TEXT], [ISDN PRI user display text IE contents during call], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_MWI], [ISDN PRI Message Waiting Indication], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_MCID], [ISDN PRI Malicious Call ID], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_WAITING], [ISDN PRI call waiting supplementary service], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_AOC_EVENTS], [ISDN PRI advice of charge supplementary service events], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_TRANSFER], [ISDN PRI call transfer supplementary service], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_CCSS], [ISDN PRI call completion supplementary service], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_HANGUP_FIX], [ISDN PRI hangup fix], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_SUBADDR], [ISDN PRI subaddressing], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_HOLD], [ISDN PRI call hold], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_REROUTING], [ISDN PRI call rerouting and call deflection], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_KEYPAD], [ISDN PRI keypad facility in SETUP], [PRI], [pri])
# ------------------------------------v
# TODO: The code can be changed to always include these features now.
# These features will always be present if pri_connected_line_update is available.
AST_EXT_LIB_SETUP_OPTIONAL([PRI_INBANDDISCONNECT], [ISDN PRI set_inbanddisconnect], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_PROG_W_CAUSE], [ISDN progress with cause], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_SERVICE_MESSAGES], [ISDN service messages], [PRI], [pri])
AST_EXT_LIB_SETUP_OPTIONAL([PRI_REVERSE_CHARGE], [ISDN reverse charge], [PRI], [pri])
# ------------------------------------^
AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
AST_EXT_LIB_SETUP([FFTW3], [LIBFFTW3], [fftw3])
AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
AST_EXT_LIB_SETUP([SNDFILE], [libsndfile], [sndfile])
AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
AST_EXT_LIB_SETUP([SPEEX_PREPROCESS], [Speex preprocess routines], [speex])
AST_EXT_LIB_SETUP([SPEEXDSP], [SpeexDSP], [speexdsp])
AST_EXT_LIB_SETUP_DEPENDENT([SPEEX_PREPROCESS], [speex_preprocess_ctl], [], [speex])
AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
AST_EXT_LIB_SETUP([SRTP], [Secure RTP], [srtp])
AST_EXT_LIB_SETUP_OPTIONAL([SRTP_256], [SRTP Library AES-256 (ICM)], [SRTP], [srtp])
AST_EXT_LIB_SETUP_OPTIONAL([SRTP_192], [SRTP Library AES-192 (ICM)], [SRTP], [srtp])
AST_EXT_LIB_SETUP_OPTIONAL([SRTP_GCM], [SRTP Library AES-128 (GCM) and AES-256 (GCM)], [SRTP], [srtp])
AST_EXT_LIB_SETUP_OPTIONAL([SRTP_SHUTDOWN], [SRTP Library Shutdown Function], [SRTP], [srtp])
AST_EXT_LIB_SETUP_OPTIONAL([SRTP_GET_VERSION], [SRTP Library Version Function], [SRTP], [srtp])
AST_EXT_LIB_SETUP_OPTIONAL([RT], [Realtime functions], [rt])
AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
AST_EXT_LIB_SETUP([UNBOUND], [unbound], [unbound])
AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
AST_EXT_LIB_SETUP([X11], [X11], [x11])
AST_EXT_LIB_SETUP([ZLIB], [zlib compression], [z])
# check for basic system features and functionality before
# checking for package libraries
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
if test -z $ac_header_dirent -o "$ac_header_dirent" = "no"; then
AC_MSG_ERROR([*** Could not find dirent header that defines 'DIR'.])
fi
AC_HEADER_SYS_WAIT
if test "$ac_cv_header_sys_wait_h" != "yes"; then
AC_MSG_ERROR([*** POSIX.1 compatible sys/wait.h is required.])
fi
AC_HEADER_RESOLV
if test "$ac_cv_header_resolv_h" != "yes"; then
AC_MSG_ERROR([*** resolv.h is required.])
fi
# Check for headers that are unconditionally required on all platforms. Do not use
# this to check for headers that are only needed by modules.
AC_CHECK_HEADERS([ \
arpa/nameser.h assert.h ctype.h dlfcn.h errno.h fcntl.h float.h grp.h \
inttypes.h limits.h locale.h math.h pwd.h netinet/in.h regex.h \
sched.h stdarg.h stdint.h stdio.h stdlib.h string.h syslog.h \
sys/file.h sys/ioctl.h sys/param.h sys/resource.h sys/socket.h sys/stat.h \
sys/time.h sys/types.h sys/un.h \
termios.h time.h unistd.h \
], [], [
AC_MSG_ERROR([*** A required header was not found.])
])
AC_CHECK_HEADERS([arpa/inet.h libintl.h malloc.h netdb.h stddef.h strings.h sys/event.h utime.h])
# Find required NetBSD Editline library (libedit).
AST_PKG_CONFIG_CHECK(LIBEDIT, libedit)
# some platforms do not list libedit via pkg-config, for example OpenBSD 6.2
AST_EXT_LIB_CHECK([LIBEDIT], [edit], [history_init], [histedit.h], [-ltermcap])
if test "${PBX_LIBEDIT}" != 1; then
AC_MSG_ERROR(*** Please install the 'libedit' development package.)
exit 1
fi
AST_C_COMPILE_CHECK([LIBEDIT_IS_UNICODE], [el_rfunc_t *callback;], [histedit.h], [], [Testing for libedit unicode support])
# Find required UUID support.
# * -luuid on Linux
# * -le2fs-uuid on OpenBSD
# * in libsystem on OS X
AST_EXT_LIB_CHECK([LIBUUID], [uuid], [uuid_generate_random], [uuid/uuid.h])
if test "x$LIBUUID_LIB" != "x" ; then
UUID_INCLUDE="$LIBUUID_INCLUDE"
UUID_LIB="$LIBUUID_LIB"
else
AST_EXT_LIB_CHECK([E2FSUUID], [e2fs-uuid], [uuid_generate_random], [uuid/uuid.h])
if test "x$E2FSUUID_LIB" != "x" ; then
UUID_INCLUDE="$E2FSUUID_INCLUDE"
UUID_LIB="$E2FSUUID_LIB"
else
AC_CHECK_FUNCS([uuid_generate_random], [SYSUUID=true], [SYSUUID=""])
if test "x$SYSUUID" != "x" ; then
UUID_INCLUDE=""
UUID_LIB=""
else
AC_MSG_ERROR([*** uuid support not found (this typically means the uuid development package is missing)])
fi
fi
fi
AC_SUBST(UUID_INCLUDE)
AC_SUBST(UUID_LIB)
# Find required JSON support if bundled is not enabled.
if test "$JANSSON_BUNDLED" = "no" ; then
AST_PKG_CONFIG_CHECK([JANSSON], [jansson >= 2.11])
# json_sprintf is available in 2.11+
AST_EXT_LIB_CHECK([JANSSON], [jansson], [json_sprintf], [jansson.h])
if test "${PBX_JANSSON}" != 1; then
AC_MSG_NOTICE(*** Asterisk requires libjansson >= 2.11 and no system copy was found.)
AC_MSG_NOTICE(*** Please install the 'libjansson' development package or)
AC_MSG_NOTICE(*** use './configure --with-jansson-bundled')
exit 1
fi
JANSSON_DEFINE_JSON_INT()
else
PBX_JANSSON=1
fi
# See if clock_gettime is in librt
AST_EXT_LIB_CHECK([RT], [rt], [clock_gettime], [])
AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
[#include <libxml/tree.h>
#include <libxml/parser.h>],
[LIBXML_TEST_VERSION])
if test "${PBX_LIBXML2}" != 1; then
AC_MSG_NOTICE(*** The Asterisk menuselect tool requires the 'libxml2' development package.)
AC_MSG_NOTICE(*** Please install the 'libxml2' development package.)
exit 1
fi
AST_EXT_LIB_CHECK([URIPARSER], [uriparser], [uriParseUriA], [uriparser/Uri.h])
# Another mandatory item (unless it's explicitly disabled)
AC_ARG_ENABLE([xmldoc],
[AS_HELP_STRING([--disable-xmldoc],
[Explicitly disable XML documentation])],
[case "${enableval}" in
y|ye|yes) DISABLE_XMLDOC=no ;;
n|no) DISABLE_XMLDOC=yes ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-xmldoc) ;;
esac], [DISABLE_XMLDOC=no])
AC_SUBST([DISABLE_XMLDOC])
if test "${DISABLE_XMLDOC}" != "yes"; then
AC_DEFINE([AST_XML_DOCS], 1, [Define to enable XML documentation.])
AST_EXT_LIB_CHECK([LIBXSLT], [xslt], [xsltLoadStylesheetPI], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
AST_EXT_LIB_CHECK([LIBXSLT_CLEANUP], [xslt], [xsltCleanupGlobals], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
fi
AC_ARG_ENABLE([permanent-dlopen],
[AS_HELP_STRING([--enable-permanent-dlopen],
[Enable when your libc has a permanent dlopen like musl])],
[case "${enableval}" in
y|ye|yes) PERMANENT_DLOPEN=yes ;;
n|no) PERMANENT_DLOPEN=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-permanent-dlopen) ;;
esac], [PERMANENT_DLOPEN=no])
AC_SUBST([PERMANENT_DLOPEN])
if test "${PERMANENT_DLOPEN}" = "yes"; then
AC_DEFINE([HAVE_PERMANENT_DLOPEN], 1, [Define to support libc with permanent dlopen.])
fi
# some embedded systems omit internationalization (locale) support
AC_CHECK_HEADERS([xlocale.h])
AC_CHECK_HEADERS([winsock.h winsock2.h])
AC_CHECK_HEADER([sys/poll.h],
[],
AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]))
AC_SYS_LARGEFILE
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_LONG_DOUBLE_WIDER
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_MEMBERS([struct ucred.uid, struct ucred.cr_uid, struct sockpeercred.uid], [], [], [#include <sys/types.h>
#include <sys/socket.h> ])
AC_CHECK_MEMBERS([struct ifreq.ifr_ifru.ifru_hwaddr], [], [], [#include <net/if.h>])
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_VOLATILE
AC_CHECK_TYPES([ptrdiff_t])
stat_nsec_found=no
AC_CHECK_MEMBERS([struct stat.st_mtim, struct stat.st_mtimensec, struct stat.st_mtimespec], [stat_nsec_found=yes], [], [[#include <sys/stat.h>]])
if test "${stat_nsec_found}" != yes; then
AC_MSG_WARN(Cannot determine nanosecond field of struct stat)
fi
# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AST_FUNC_FORK
AC_FUNC_FSEEKO
AC_PROG_GCC_TRADITIONAL
# XXX: these are commented out until we determine whether it matters if our malloc()
# acts exactly like glibc's or not
# AC_FUNC_MALLOC
# AC_FUNC_REALLOC
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_FUNC_STRCOLL
AC_FUNC_STRFTIME
AC_FUNC_STRNLEN
AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale pipe2 ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv uselocale utime vasprintf getpeereid sysctl swapctl malloc_trim])
AC_MSG_CHECKING(for htonll)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <arpa/inet.h>],
[return htonll(0);])],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_HTONLL, 1, [Define to 1 if arpa/inet.h includes a htonll definition.]),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for ntohll)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <arpa/inet.h>],
[return ntohll(0);])],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_NTOHLL, 1, [Define to 1 if arpa/inet.h includes a ntohll definition.]),
AC_MSG_RESULT(no)
)
# NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
# so that AC_CHECK_FUNCS can detect functions in that library.
AC_CHECK_LIB([m], [sqrt])
# BSD might not have exp2, and/or log2
AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil])
# Certain architectures don't really have long double, even though
# AC_CHECK_FUNCS would otherwise find the following functions.
if test "x${ac_cv_type_long_double_wider}" = "xyes" ; then
AC_CHECK_FUNCS([exp2l log2l exp10l log10l sinl cosl tanl asinl acosl atanl atan2l powl sqrtl rintl expl logl remainderl fmodl roundl truncl floorl ceill])
fi
AC_MSG_CHECKING(for LLONG_MAX in limits.h)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <limits.h>],
[long long foo = LLONG_MAX])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_LLONG_MAX], 1, [Define to 1 if limits.h includes a LLONG_MAX definition.]),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for timersub in time.h)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <sys/time.h>],
[struct timeval *a; timersub(a, a, a);])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system defines timersub.]),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for a version of GNU ld that supports the --dynamic-list flag)
old_LDFLAGS=${LDFLAGS}
cat >conftest.dynamics <<_ACEOF
{
*ast_*;
};
_ACEOF
LDFLAGS="${LDFLAGS} -Wl,--dynamic-list,conftest.dynamics"
PBX_DYNAMIC_LIST=0
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [])],
PBX_DYNAMIC_LIST=1
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_SUBST(PBX_DYNAMIC_LIST)
LDFLAGS=${old_LDFLAGS}
rm -f conftest.dynamics
AC_CHECK_HEADER([sys/poll.h],
[HAS_POLL=1]
AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
)
AC_ARG_ENABLE([internal-poll],
[AS_HELP_STRING([--enable-internal-poll],
[Use Asterisk's poll implementation])],
[case "${enableval}" in
y|ye|yes) HAS_POLL="";;
n|no) HAS_POLL="${HAS_POLL}" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
esac])
AC_SUBST(HAS_POLL)
AC_ARG_ENABLE([asteriskssl],
[AS_HELP_STRING([--disable-asteriskssl],
[Disable Asterisk's SSL wrapper library])],
[case "${enableval}" in
y|ye|yes) AST_ASTERISKSSL=yes ;;
n|no) AST_ASTERISKSSL=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-asteriskssl) ;;
esac], [AST_ASTERISKSSL=yes])
AC_SUBST(AST_ASTERISKSSL)
AC_CHECK_FUNCS([inet_aton])
# check if we have IP_PKTINFO constant defined
AC_MSG_CHECKING(for IP_PKTINFO)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <netinet/in.h>],
[int pi = IP_PKTINFO;])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_PKTINFO], 1, [Define to 1 if your system defines IP_PKTINFO.]),
AC_MSG_RESULT(no)
)
# some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>
#include <netdb.h>],
[struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>
#include <netdb.h>],
[struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
AC_MSG_RESULT(no)
)
AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])
AC_MSG_CHECKING(for __swap16 variant of <sys/endian.h> byteswapping macros)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = __swap16(a);])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_SYS_ENDIAN_SWAP16], 1, [Define to 1 if your sys/endian.h header file provides the __swap16 macro.]),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for bswap16 variant of <sys/endian.h> byteswapping macros)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = bswap16(a);])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for locale_t in locale.h)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <locale.h>], [locale_t lt = NULL])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_LOCALE_T_IN_LOCALE_H], 1, [Define to 1 if your system defines the locale_t type in locale.h]),
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for locale_t in xlocale.h)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <xlocale.h>], [locale_t lt = NULL])],
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_LOCALE_T_IN_XLOCALE_H], 1, [Define to 1 if your system defines the locale_t type in xlocale.h]),
AC_MSG_RESULT(no)