forked from signalwire/freeswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2388 lines (2083 loc) · 87.1 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
AC_INIT([freeswitch], [1.10.13-dev], [email protected])
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [10])
AC_SUBST(SWITCH_VERSION_MICRO, [13-dev])
AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
AC_CONFIG_AUX_DIR(build/config)
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_SRCDIR([src/switch.c])
AC_CONFIG_HEADER([src/include/switch_private.h])
AC_CONFIG_HEADER([libs/esl/src/include/esl_config_auto.h])
AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
AC_CANONICAL_HOST
# Absolute source/build directory
switch_srcdir=`(cd $srcdir && pwd)`
switch_builddir=`pwd`
AC_SUBST(switch_srcdir)
AC_SUBST(switch_builddir)
#
# --enable-64 has been moved up higher prior to AC_PROG_CC so that we can tuck in the -m64 flag
# so devs on with Solaris wanting to build 64bit can not bother with adding any additional
# flags on the ./configure line. User friendly.
#
# Enable 64 bit build
AC_ARG_ENABLE(64,
[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
if test "${enable_64}" = "yes"; then
case "$host" in
*-solaris2*)
# All three have to have -m64 for AC_PROG_CC to pick the right libtool
CFLAGS="$CFLAGS -m64"
LDFLAGS="$LDFLAGS -m64"
CXXFLAGS="$CXXFLAGS -m64"
;;
*)
;;
esac
fi
# use mtmalloc on Solaris SPARC if available
AS_CASE([$host], [sparc-*-solaris2*], [AC_CHECK_LIB(mtmalloc, malloc)])
# Whether to follow FHS
AC_ARG_ENABLE([fhs],[AS_HELP_STRING([--disable-fhs],
[Do Not follow the FHS when placing files and directories (default only when not specifying prefix])],[enable_fhs="$enableval"],[enable_fhs="yes"])
AC_PREFIX_DEFAULT(/usr/local/freeswitch)
# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
if test "x$prefix" = "xNONE" ; then
enable_fhs=no
prefix='/usr/local/freeswitch'
fi
if test "x${exec_prefix}" = "xNONE" ; then
exec_prefix="$prefix"
fi
default_scriptdir="$prefix/scripts"
default_grammardir="$prefix/grammar"
default_soundsdir="$prefix/sounds"
default_htdocsdir="$prefix/htdocs"
default_modulesdir="$prefix/mod"
default_dbdir="$prefix/db"
default_storagedir="$prefix/storage"
default_cachedir="$prefix/cache"
default_recordingsdir="$prefix/recordings"
rundir="$prefix/run"
logdir="${prefix}/log"
confdir="$prefix/conf"
default_certsdir="$prefix/certs"
default_fontsdir="$prefix/fonts"
default_imagesdir="$prefix/images"
if test "${enable_fhs}" = "yes"; then
eval full_datadir="${datadir}/freeswitch"
eval datadir=$full_datadir
eval full_localstatedir="${localstatedir}"
eval localstatedir=$full_localstatedir
eval libdir=$libdir
default_cachedir="${localstatedir}/cache/freeswitch"
rundir="${localstatedir}/run/freeswitch"
logdir="${localstatedir}/log/freeswitch"
localstatedir="${localstatedir}/lib/freeswitch"
default_scriptdir="${datadir}/scripts"
default_grammardir="${datadir}/grammar"
default_soundsdir="${datadir}/sounds"
default_htdocsdir="${datadir}/htdocs"
default_fontsdir="${datadir}/fonts"
default_modulesdir="${libdir}/freeswitch/mod"
default_dbdir="${localstatedir}/db"
default_storagedir="${localstatedir}/storage"
default_recordingsdir="${localstatedir}/recordings"
default_imagesdir="${localstatedir}/images"
eval confdir="${sysconfdir}/freeswitch"
eval default_certsdir="${confdir}/tls"
else
if test "$datadir" = "\${datarootdir}" ; then
datadir="${prefix}"
fi
if test "$localstatedir" = "\${prefix}/var" ; then
localstatedir="${prefix}"
fi
fi
if test "$includedir" = "\${prefix}/include" ; then
includedir="${prefix}/include/freeswitch"
fi
default_pkgconfigdir="$libdir/pkgconfig"
default_runtimedir="$rundir"
default_logfiledir="$logdir"
AC_SUBST(libdir)
# Where to install the modules
AC_ARG_WITH([modinstdir],
[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modulesdir="$withval"], [modulesdir="${default_modulesdir}"])
eval modulesdir="${modulesdir}"
AC_SUBST(modulesdir)
AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modulesdir}",[where to install the modules to])
# Where to put pidfile
AC_ARG_WITH([rundir],
[AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/run)])], [runtimedir="$withval"], [runtimedir="${default_runtimedir}"])
AC_SUBST(runtimedir)
AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${runtimedir}",[where to put pidfile to])
AC_ARG_WITH([logfiledir],
[AS_HELP_STRING([--with-logfiledir=DIR], [Put logfiles into this location (default: $localstatedir/log)])], [logfiledir="$withval"], [logfiledir="${default_logfiledir}"])
AC_SUBST(logfiledir)
AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],"${logfiledir}",[where to put log files])
AC_ARG_WITH([dbdir],
[AS_HELP_STRING([--with-dbdir=DIR], [Put database files into this location (default: $prefix/db)])], [dbdir="$withval"], [dbdir="${default_dbdir}"])
AC_SUBST(dbdir)
AC_DEFINE_UNQUOTED([SWITCH_DB_DIR],"${dbdir}",[where to put db files])
AC_ARG_WITH([htdocsdir],
[AS_HELP_STRING([--with-htdocsdir=DIR], [Put html files into this location (default: $prefix/htdocs)])], [htdocsdir="$withval"], [htdocsdir="${default_htdocsdir}"])
AC_SUBST(htdocsdir)
AC_DEFINE_UNQUOTED([SWITCH_HTDOCS_DIR],"${htdocsdir}",[where to put htdocs files])
AC_ARG_WITH([fontsdir],
[AS_HELP_STRING([--with-fontsdir=DIR], [Put font files into this location (default: $prefix/fonts)])], [fontsdir="$withval"], [fontsdir="${default_fontsdir}"])
AC_SUBST(fontsdir)
AC_DEFINE_UNQUOTED([SWITCH_FONTS_DIR],"${fontsdir}",[where to put font files])
AC_ARG_WITH([soundsdir],
[AS_HELP_STRING([--with-soundsdir=DIR], [Put sound files into this location (default: $prefix/sounds)])], [soundsdir="$withval"], [soundsdir="${default_soundsdir}"])
AC_SUBST(soundsdir)
AC_DEFINE_UNQUOTED([SWITCH_SOUNDS_DIR],"${soundsdir}",[where to put sounds files])
AC_ARG_WITH([grammardir],
[AS_HELP_STRING([--with-grammardir=DIR], [Put grammar files into this location (default: $prefix/grammar)])], [grammardir="$withval"], [grammardir="${default_grammardir}"])
AC_SUBST(grammardir)
AC_DEFINE_UNQUOTED([SWITCH_GRAMMAR_DIR],"${grammardir}",[where to put grammar files])
AC_ARG_WITH([certsdir],
[AS_HELP_STRING([--with-certsdir=DIR], [Put certs files into this location (default: $prefix/certs)])], [certsdir="$withval"], [certsdir="${default_certsdir}"])
AC_SUBST(certsdir)
AC_DEFINE_UNQUOTED([SWITCH_CERTS_DIR],"${certsdir}",[where to put certs files])
AC_ARG_WITH([scriptdir],
[AS_HELP_STRING([--with-scriptdir=DIR], [Put script files into this location (default: $prefix/scripts)])], [scriptdir="$withval"], [scriptdir="${default_scriptdir}"])
AC_SUBST(scriptdir)
AC_DEFINE_UNQUOTED([SWITCH_SCRIPT_DIR],"${scriptdir}",[where to put script files])
AC_ARG_WITH([recordingsdir],
[AS_HELP_STRING([--with-recordingsdir=DIR], [Put recordings files into this location (default: $prefix/recordings)])], [recordingsdir="$withval"], [recordingsdir="${default_recordingsdir}"])
AC_SUBST(recordingsdir)
AC_DEFINE_UNQUOTED([SWITCH_RECORDINGS_DIR],"${recordingsdir}",[where to put recording files])
AC_ARG_WITH([imagesdir],
[AS_HELP_STRING([--with-imagesdir=DIR], [Put images files into this location (default: $prefix/images)])], [imagesdir="$withval"], [imagesdir="${default_imagesdir}"])
AC_SUBST(imagesdir)
AC_DEFINE_UNQUOTED([SWITCH_IMAGES_DIR],"${imagesdir}",[where to put image files])
AC_ARG_WITH([storagedir],
[AS_HELP_STRING([--with-storagedir=DIR], [Put storage files into this location (default: $prefix/storage)])], [storagedir="$withval"], [storagedir="${default_storagedir}"])
AC_SUBST(storagedir)
AC_DEFINE_UNQUOTED([SWITCH_STORAGE_DIR],"${storagedir}",[where to put storage files])
AC_ARG_WITH([cachedir],
[AS_HELP_STRING([--with-cachedir=DIR], [Put cache files into this location (default: $prefix/cache)])], [cachedir="$withval"], [cachedir="${default_cachedir}"])
AC_SUBST(cachedir)
AC_DEFINE_UNQUOTED([SWITCH_CACHE_DIR],"${cachedir}",[where to put cache files])
AC_SUBST(confdir)
AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR],"${confdir}",[directory for configuration files])
AC_SUBST(datadir)
AC_DEFINE_UNQUOTED([SWITCH_DATA_DIR],"${datadir}",[directory for data files])
AC_SUBST(localstatedir)
AC_DEFINE_UNQUOTED([SWITCH_LOCALSTATE_DIR],"${localstatedir}",[directory for local state files])
AC_SUBST(bindir)
AC_SUBST(includedir)
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir=DIR], [Installation directory for pkgconfig file (default: ${libdir}/pkgconfig)])],
[case "${withval}" in
yes|no) AC_MSG_ERROR([Invalid value ${withval} for option --with-pkgconfigdir]) ;;
*) pkgconfigdir="${withval}" ;;
esac
],
[pkgconfigdir="${default_pkgconfigdir}"]
)
AC_SUBST([pkgconfigdir])
#Set default language
AC_LANG_C
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
#check if the g++ compiler works
AC_CACHE_CHECK([whether the C++ compiler works], [ac_cv_sys_cxx_works], [
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { }])], [ac_cv_sys_cxx_works=yes],
[ac_cv_sys_cxx_works=no])
AC_LANG_POP([C++])
])
[ if [ "x$ac_cv_sys_cxx_works" = "xno" ]; then ]
AC_MSG_FAILURE([The C++ compiler does not work. Please (re)install the C++ compiler])
[ fi ]
AC_PROG_AWK
AC_PROG_MAKE_SET
AC_PROG_INSTALL
#override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
AM_PROG_CC_C_O
LT_INIT([disable-static])
#Check for compiler vendor
AX_COMPILER_VENDOR
# Set CC_FOR_BUILD
if test "x${cross_compiling}" = "xyes"; then
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
case "$host" in
arm*-linux-gnueabi*|arm*-*-linux-gnueabi*)
# spandsp modem
ac_cv_file__dev_ptmx=yes
# libjs
export ac_cv_va_copy=yes
# srtp
export ac_cv_file__dev_urandom=yes
# rpl_malloc
export ac_cv_func_realloc_0_nonnull=yes
export ac_cv_func_malloc_0_nonnull=yes
# apr
export ac_cv_func_setpgrp_void=yes
export ac_cv_file__dev_zero=yes
export apr_cv_tcp_nodelay_with_cork=yes
export ac_cv_file_dbd_apr_dbd_mysql_c=no
export ac_cv_sizeof_ssize_t=4
export apr_cv_mutex_recursive=yes
export ac_cv_func_pthread_rwlock_init=yes
export apr_cv_type_rwlock_t=yes
export apr_cv_process_shared_works=yes
export apr_cv_mutex_robust_shared=yes
;;
esac
else
CC_FOR_BUILD='$(CC)'
fi
AC_SUBST(CC_FOR_BUILD)
if test -n "$lt_sysroot" ; then
APR_ADDTO(CFLAGS, --sysroot=$lt_sysroot)
APR_ADDTO(CXXFLAGS, --sysroot=$lt_sysroot)
APR_ADDTO(CPPFLAGS, --sysroot=$lt_sysroot)
APR_ADDTO(LDFLAGS, --sysroot=$lt_sysroot)
PKG_CONFIG_SYSROOT_DIR=$lt_sysroot
fi
# Optimize
AC_ARG_ENABLE(optimization,
[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
if test "${enable_optimizer}" = "yes" ; then
AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
AX_CC_MAXOPT
fi
# set defaults for use on all platforms
SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
SWITCH_AM_CPPFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
SWITCH_AM_LDFLAGS="-lm"
#set SOLINK variable based on compiler and host
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
SOLINK="-Bdynamic -dy -G"
elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
case "$host" in
*darwin*)
SOLINK="-dynamic -force-flat-namespace"
;;
*)
SOLINK="-shared -Xlinker -x"
;;
esac
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
case "$host" in
# older Xcode test for darwin, Xcode 4/5 use clang above
*darwin*)
SOLINK="-dynamic -bundle -force-flat-namespace"
;;
*-solaris2*)
SOLINK="-shared -Xlinker"
;;
*)
SOLINK="-shared -Xlinker -x"
;;
esac
elif test "x${ax_cv_c_compiler_vendor}" = "xintel" ; then
case "$host" in
*)
SOLINK="-shared -Xlinker -x"
;;
esac
else
AC_ERROR([Please update configure.in with SOLINK values for your compiler])
fi
##
# detect libtool major version,
# set libtool library extension based on this
# to work around some brokeness when using 'la' with libtool-1.5
#
AC_MSG_CHECKING([libtool major version])
libtool="${switch_builddir}/libtool"
LIBTOOL_MAJOR_VERSION="`$libtool --version 2>/dev/null| sed -e 's/([[^)]]*)//g;s/^[[^0-9]]*//;s/[[- ]].*//g;q'| awk 'BEGIN { FS = "." } { print $1 }' `"
if test -z "$LIBTOOL_MAJOR_VERSION" ; then
LIBTOOL_MAJOR_VERSION="`sed -n -e '/^VERSION/{s/^.*=\"\{0,1\}\([[0-9]]\{1,\}\)\..*/\1/;p;}' ${switch_srcdir}/build/config/ltmain.sh`"
fi
if test -z "$LIBTOOL_MAJOR_VERSION" ; then
AC_MSG_ERROR([Failed to detect your libtool version, please open a bug report on https://freeswitch.org/jira])
fi
AC_MSG_RESULT([${LIBTOOL_MAJOR_VERSION}])
LIBTOOL_LIB_EXTEN=so
if test "${LIBTOOL_MAJOR_VERSION}" = "2" ; then
LIBTOOL_LIB_EXTEN="la"
fi
AC_MSG_RESULT([using libtool library extension... ${LIBTOOL_LIB_EXTEN}])
if test "$ax_cv_c_compiler_vendor" = "gnu"; then
saved_CFLAGS="$CFLAGS"
AC_CACHE_CHECK([whether compiler supports -Wno-unused-result],
[ac_cv_gcc_supports_w_no_unused_result], [
CFLAGS="$CFLAGS -Wno-unused-result -Wno-error=unused-result"
AC_TRY_COMPILE([],[return 0;],
[ac_cv_gcc_supports_w_no_unused_result=yes],
[ac_cv_gcc_supports_w_no_unused_result=no])])
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT($ac_cv_gcc_supports_w_no_unused_result)
saved_CFLAGS="$CFLAGS"
AC_CACHE_CHECK([whether compiler supports -Wno-misleading-indentation],
[ac_cv_gcc_supports_w_no_misleading_indentation], [
CFLAGS="$CFLAGS -Wno-misleading-indentation -Wno-error=misleading-indentation"
AC_TRY_COMPILE([],[return 0;],
[ac_cv_gcc_supports_w_no_misleading_indentation=yes],
[ac_cv_gcc_supports_w_no_misleading_indentation=no])])
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT($ac_cv_gcc_supports_w_no_misleading_indentation)
fi
# tweak compiler specific flags
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC)
APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
APR_ADDTO(SWITCH_AM_CFLAGS, -erroff=E_END_OF_LOOP_CODE_NOT_REACHED)
APR_ADDTO(SWITCH_AM_CFLAGS, -errtags=yes)
APR_ADDTO(SWITCH_AM_CFLAGS, -D__FUNCTION__=__func__ )
APR_ADDTO(SWITCH_AM_CFLAGS, -mt)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -errtags=yes)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions")
APR_ADDTO(SWITCH_AM_CXXFLAGS, -D__FUNCTION__=__func__)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -mt)
APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib)
if test "${enable_64}" = "yes"; then
APR_ADDTO(SWITCH_AM_CFLAGS, -m64)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -m64)
APR_ADDTO(SWITCH_AM_LDFLAGS, -m64)
LIBS="$LIBS -m64"
fi
elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC -ffast-math)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC -ffast-math)
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC -ffast-math)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC -ffast-math)
AC_SUBST([AM_MOD_AVMD_CXXFLAGS], [-std=gnu99]) # FS-8809, needed for MAP_POPULATE
if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result)
fi
if test "$ac_cv_gcc_supports_w_no_misleading_indentation" = yes; then
APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-misleading-indentation)
fi
if test "${enable_64}" = "yes"; then
case "$host" in
*darwin*)
osxvrm=`sw_vers -productVersion` # Get version.release.modlevel
osxrel=`echo $osxvrm | cut -d. -f2` # Get release only
if test "$osxrel" -ge 4; then # 10.4 and up are x64
APR_ADDTO(CFLAGS, -arch x86_64)
APR_ADDTO(LDFLAGS, -arch x86_64)
APR_ADDTO(CXXFLAGS, -arch x86_64)
fi
;;
*-solaris2*)
APR_ADDTO(CFLAGS, -m64)
APR_ADDTO(LDFLAGS, -m64)
APR_ADDTO(CXXFLAGS, -m64)
;;
*)
LIBS="$LIBS -m64"
;;
esac
fi
fi
case "${ax_cv_c_compiler_vendor}" in
sun)
VISIBILITY_FLAG=-xldscope=hidden
;;
*)
VISIBILITY_FLAG=-fvisibility=hidden
;;
esac
AC_SUBST(VISIBILITY_FLAG)
#
# gcc visibility cflag checks
#
AC_ARG_ENABLE([visibility],
[AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
[enable_visibility="${enableval}"],
[enable_visibility="detect"]
)
HAVE_VISIBILITY="no"
if test "x${enable_visibility}" != "xno" ; then
case "${ax_cv_c_compiler_vendor}" in
gnu)
save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -fvisibility=hidden"
AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[int foo __attribute__ ((visibility("default")));],
[;]
)],
[AC_MSG_RESULT([yes])
APR_ADDTO([SWITCH_AM_CFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DCJSON_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
APR_ADDTO([SWITCH_AM_CXXFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DCJSON_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
HAVE_VISIBILITY="yes"],
[AC_MSG_RESULT([no])]
)
CFLAGS="${save_CFLAGS}"
;;
sun)
# save_CFLAGS="${CFLAGS}"
# CFLAGS="${CFLAGS} -xldscope=hidden"
# AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
# AC_COMPILE_IFELSE(
# [AC_LANG_PROGRAM(
# [int foo __attribute__ ((visibility("default")));],
# [;]
# )],
#
# [AC_MSG_RESULT([yes])
# APR_ADDTO([SWITCH_AM_CFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
# APR_ADDTO([SWITCH_AM_CXXFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
# HAVE_VISIBILITY="yes"],
#
# [AC_MSG_RESULT([no])]
# )
# CFLAGS="${save_CFLAGS}"
;;
*)
if test "x${enable_visibility}" = "xyes" ; then
AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
else
AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
fi
;;
esac
#
# visibility explicitly requested but not supported by this compiler => error
#
if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
AC_MSG_ERROR([API visibility not supported by this compiler])
fi
fi
# Enable debugging (default: on)
# (rename option if the default is changed)
AC_ARG_ENABLE(debug,
[AC_HELP_STRING([--disable-debug],[build without debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
if test "${enable_debug}" = "yes"; then
AC_DEFINE([DEBUG],[],[Enable extra debugging.])
saved_CFLAGS="$CFLAGS"
CFLAGS=
AX_CFLAGS_WARN_ALL_ANSI
SWITCH_ANSI_CFLAGS=$CFLAGS
CFLAGS="$saved_CFLAGS"
if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then
APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result)
fi
APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
export DEBUG_CFLAGS="-g -ggdb"
fi
fi
AC_ARG_ENABLE(libyuv,
[AC_HELP_STRING([--disable-libyuv],[build without libyuv])],[enable_libyuv="$enableval"],[enable_libyuv="yes"])
AM_CONDITIONAL([ENABLE_LIBYUV],[test "${enable_libyuv}" = "yes"])
AC_ARG_ENABLE(libvpx,
[AC_HELP_STRING([--disable-libvpx],[build without libvpx])],[enable_libvpx="$enableval"],[enable_libvpx="yes"])
AM_CONDITIONAL([ENABLE_LIBVPX],[test "${enable_libvpx}" = "yes"])
AC_ARG_ENABLE(cpp,
[AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"])
AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"])
AM_CONDITIONAL([DISABLE_CC],[test "${disable_cc}" = "yes"])
AC_ARG_ENABLE([system-xmlrpc-c],
[AS_HELP_STRING([--enable-system-xmlrpc-c],
[use system lib for xmlrpc-c])],,
[enable_xmlrpcc="no"])
if test "${enable_xmlrpcc}" = "yes" ; then
SYS_XMLRPC_CFLAGS=`xmlrpc-c-config --cflags`
SYS_XMLRPC_LDFLAGS=`xmlrpc-c-config --libs`
fi
AC_SUBST(SYS_XMLRPC_CFLAGS)
AC_SUBST(SYS_XMLRPC_LDFLAGS)
AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"])
for luaversion in luajit lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do
PKG_CHECK_MODULES([LUA],[${luaversion}],[have_lua=yes],[have_lua=no])
if test ${have_lua} = yes; then
break
fi
done
if test x"${LUA_LIBS}" = x"" ; then
LUA_LIBS="-llua"
fi
AC_ARG_ENABLE(srtp,
[AC_HELP_STRING([--disable-srtp],[build without srtp support])],[enable_srtp="$enableval"],[enable_srtp="yes"])
AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"])
have_openal=no
AC_CHECK_LIB(openal, alcLoopbackOpenDeviceSOFT, [have_openal="yes"])
AM_CONDITIONAL([HAVE_OPENAL],[test "${have_openal}" = "yes"])
PA_LIBS=
PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
if test "x$have_jack" = "xyes" ; then
PA_LIBS+=$JACK_LIBS
fi
AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
if test "x$have_alsa" = "xyes" ; then
PA_LIBS+=-lasound
fi
AC_SUBST(PA_LIBS)
AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
AC_ARG_ENABLE(core-odbc-support,
[AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support (default is optional)])],,[enable_core_odbc_support="optional"])
if ! test "$enable_core_odbc_support" = "no"; then
AX_LIB_ODBC
if test "$ac_cv_found_odbc" = "yes" ; then
enable_core_odbc_support="yes"
elif test "$enable_core_odbc_support" = "yes"; then
AC_MSG_ERROR([no usable libodbc; please install unixodbc devel package or equivalent])
else
enable_core_odbc_support="no"
fi
fi
CHECK_LIBUUID
SWITCH_AM_LDFLAGS="$LIBUUID_LIBS $SWITCH_AM_LDFLAGS"
SWITCH_AM_CFLAGS="$LIBUUID_CFLAGS $SWITCH_AM_CFLAGS"
AC_ARG_ENABLE(core-pgsql-pkgconfig,
[AS_HELP_STRING([--disable-core-pgsql-pkgconfig], [Use pg_config to get PGQSL build options])],[enable_core_pgsql_pkgconfig="$enableval"],[enable_core_pgsql_pkgconfig="yes"])
path_remove () {
echo "$1" | tr ':' '\n' | grep -Fxv "$2" | tr '\n' ':' | sed 's/:$//'
}
path_push_unique () {
x="$(eval echo \$$1)"
x="$(path_remove "$x" "$2")"
if test -z "$x"; then
eval export $1="$2"
else
eval export $1="$2:$x"
fi
}
AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
case $host in
*-darwin*)
path_push_unique PKG_CONFIG_PATH /usr/local/opt/libpq/lib/pkgconfig
path_push_unique PKG_CONFIG_PATH /usr/local/opt/openssl/lib/pkgconfig
;;
esac
if test "$PKG_CONFIG" = "no" \
|| test x"$enable_core_pgsql_pkgconfig" = x"no" \
|| ! pkg-config --modversion libpq > /dev/null; then
if test "$PG_CONFIG" != "no"; then
AC_MSG_CHECKING([for PostgreSQL libraries via pg_config])
POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
POSTGRESQL_LIBDIR="-L`$PG_CONFIG --libdir`"
POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
POSTGRESQL_VERSION=`$PG_CONFIG --version | awk '{ print $NF }'`
POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $1 }'`
POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $2 }'`
POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $3 }'`
fi
else
AC_MSG_CHECKING([for PostgreSQL libraries via pkg_config])
POSTGRESQL_CFLAGS="`$PKG_CONFIG --cflags libpq`"
POSTGRESQL_LIBDIR="`$PKG_CONFIG libpq --libs-only-L`"
POSTGRESQL_LDFLAGS="`$PKG_CONFIG --libs libpq`"
POSTGRESQL_VERSION="`$PKG_CONFIG --modversion libpq`"
POSTGRESQL_MAJOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f1 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
POSTGRESQL_MINOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f2 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
POSTGRESQL_PATCH_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f3 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
test -n "$POSTGRESQL_PATCH_VERSION" || POSTGRESQL_PATCH_VERSION=0
fi
AC_MSG_RESULT([$POSTGRESQL_LIBDIR])
AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
AC_DEFINE_UNQUOTED([POSTGRESQL_PATCH_VERSION], ${POSTGRESQL_PATCH_VERSION}, [Specifies the version of PostgreSQL we are linking against])
have_libpq=no
save_LIBS="${LIBS}"
save_CPPFLAGS="${CPPFLAGS}"
LIBS="${POSTGRESQL_LDFLAGS}"
CPPFLAGS="${POSTGRESQL_CFLAGS}"
AC_CHECK_LIB([pq], [PQgetvalue], [have_libpq="yes"])
LIBS="${save_LIBS}"
CPPFLAGS="${save_CPPFLAGS}"
AM_CONDITIONAL([HAVE_PGSQL],[test "${have_libpq}" = "yes"])
AC_SUBST([POSTGRESQL_CFLAGS], [$POSTGRESQL_CFLAGS])
AC_SUBST([POSTGRESQL_LDFLAGS], [$POSTGRESQL_LDFLAGS])
AC_SUBST([POSTGRESQL_LIBDIR], [$POSTGRESQL_LIBDIR])
PKG_CHECK_MODULES([MARIADB], [libmariadb >= 3.0.9],[
AM_CONDITIONAL([HAVE_MARIADB],[true])],[
PKG_CHECK_MODULES([MARIADB], [mariadb >= 3.0.9],[
AM_CONDITIONAL([HAVE_MARIADB],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MARIADB],[false])
])
])
PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[
AM_CONDITIONAL([HAVE_SPANDSP],[true])],[
AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent])
])
PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.17],[
AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[
AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent])
])
AC_ARG_ENABLE(deprecated-core-db-events,
[AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"])
if test x"$enable_deprecated_core_db_events" = x"yes" ; then
AC_DEFINE([SWITCH_DEPRECATED_CORE_DB], [1], [Define to 1 to enable deprecated core db events])
fi
ESL_LDFLAGS=
PLATFORM_CORE_LDFLAGS=
PLATFORM_CORE_LIBS=
# tweak platform specific flags
case "$host" in
*darwin*)
# Common Apple Darwin settings
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
APR_ADDTO(CPPFLAGS, -I/usr/local/opt/openssl/include)
APR_ADDTO(LDFLAGS, -L/usr/local/opt/openssl/lib)
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
# Get OSX and clang version
osxvrm=`sw_vers -productVersion` # Get version.release.modlevel
osxrel=`echo $osxvrm | cut -d. -f2` # Get release only
clangvers="`clang -v 2>&1 >/dev/null | grep version | sed -e 's/.*version \([[0-9]]*\).*$/\1/'`"
if test "$clangvers" -ge 6; then # Xcode 6 drops std lib search, add it to clang
APR_ADDTO(LDFLAGS, -L/usr/local/lib)
APR_ADDTO(CPPFLAGS, -I/usr/local/include)
fi
if test "$clangvers" -ge 4; then # Xcode 4 / 10.7 and up
APR_ADDTO(CFLAGS, -Wno-deprecated-declarations)
fi
if test "$osxrel" -ge 6; then # 10.6 and up
APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)
APR_ADDTO(LDFLAGS, -pipe -bind_at_load)
APR_ADDTO(CXXFLAGS, -pipe)
fi
;;
*-solaris2*)
if test "${enable_64}" = "yes"; then
APR_ADDTO(CPPFLAGS, [-I/opt/64/include])
APR_ADDTO(LDFLAGS, [-L/opt/64/lib -Wl,-rpath,/opt/64/lib])
APR_ADDTO(SWITCH_AM_CFLAGS, [-I/opt/64/include])
APR_ADDTO(SWITCH_AM_LDFLAGS, [-L/opt/64/lib -Wl,-rpath,/opt/64/lib])
else
APR_ADDTO(CPPFLAGS, [-I/opt/include])
APR_ADDTO(LDFLAGS, [-L/opt/lib -Wl,-rpath,/opt/lib])
APR_ADDTO(SWITCH_AM_CFLAGS, [-I/opt/include])
APR_ADDTO(SWITCH_AM_LDFLAGS, [-L/opt/lib -Wl,-rpath,/opt/lib])
fi
APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048 -D__EXTENSIONS__)
APR_ADDTO(SWITCH_AM_LDFLAGS, -lsendfile -lresolv -lsocket -lnsl -luuid)
APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt -lsendfile -lresolv -lsocket -lnsl -luuid])
;;
*dragonfly*)
APR_ADDTO(CPPFLAGS, -I/usr/local/include)
APR_ADDTO(LDFLAGS, -L/usr/local/lib)
APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
;;
*openbsd*)
APR_ADDTO(CPPFLAGS, -I/usr/local/include)
APR_ADDTO(LDFLAGS, -L/usr/local/lib -ltermcap)
APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
;;
*netbsd*)
APR_ADDTO(CPPFLAGS, -I/usr/pkg/include)
APR_ADDTO(LDFLAGS, [-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib])
APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/pkg/include)
;;
*bsd*)
APR_ADDTO(CPPFLAGS, -I/usr/local/include)
APR_ADDTO(LDFLAGS, -L/usr/local/lib)
APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
APR_ADDTO([PLATFORM_CORE_LIBS], [-lcrypt -lrt])
;;
*linux*)
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
;;
esac
APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
# check for usable system MD5 library
AS_CASE([$host],
[*-solaris2*], [AC_CHECK_LIB(md5, MD5Init)],
[*-freebsd*], [AC_CHECK_LIB(md, MD5Init)],
[*-openbsd*|*-netbsd*], [AC_CHECK_FUNCS([MD5Init])])
AC_CHECK_LIB(z, inflateReset, have_libz=yes, AC_MSG_ERROR([no usable zlib; please install zlib devel package or equivalent]))
if test "x$have_libz" = "xyes" ; then
APR_ADDTO([PLATFORM_CORE_LIBS], [-lz])
fi
PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.16.0],[
AM_CONDITIONAL([HAVE_MPG123],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])])
PKG_CHECK_MODULES([AMR], [opencore-amrnb >= 0.1.0],[
AM_CONDITIONAL([HAVE_AMR],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMR],[false])])
PKG_CHECK_MODULES([AMRWB], [opencore-amrwb >= 0.1.0 vo-amrwbenc >= 0.1.0],[
AM_CONDITIONAL([HAVE_AMRWB],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMRWB],[false])])
PKG_CHECK_MODULES([STIRSHAKEN], [stirshaken],[
AM_CONDITIONAL([HAVE_STIRSHAKEN],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_STIRSHAKEN],[false])])
AC_CHECK_LIB(apr-1, apr_pool_mutex_set, use_system_apr=yes, use_system_apr=no)
AM_CONDITIONAL([SYSTEM_APR],[test "${use_system_apr}" = "yes"])
save_LIBS="$LIBS"
LIBS=
AC_CHECK_LIB(jpeg, jpeg_std_error,, AC_MSG_ERROR([no usable libjpeg; please install libjpeg devel package or equivalent]))
AC_CHECK_LIB(jbig, jbg_enc_out, have_libjbig=yes, have_libjbig=no)
if test "x$have_libjbig" = "xyes" ; then
SPANDSP_LA_JBIG="-ljbig $LIBS"
AC_SUBST(SPANDSP_LA_JBIG)
fi
LIBS="$save_LIBS"
AC_CHECK_LIB(lzma, lzma_code, have_liblzma=yes, have_liblzma=no)
if test "x$have_liblzma" = "xyes" ; then
SPANDSP_LA_LZMA="-llzma"
AC_SUBST(SPANDSP_LA_LZMA)
fi
AC_CHECK_LIB(resolv, res_init, have_libresolv=yes, have_libresolv=no)
if test "x$have_libresolv" = "xyes" ; then
APR_ADDTO(SWITCH_AM_LDFLAGS, -lresolv)
fi
AC_SUBST(SWITCH_AM_CFLAGS)
AC_SUBST(SWITCH_ANSI_CFLAGS)
AC_SUBST(SWITCH_AM_CXXFLAGS)
AC_SUBST(SWITCH_AM_CPPFLAGS)
AC_SUBST(SWITCH_AM_LDFLAGS)
AC_SUBST(ESL_LDFLAGS)
AC_SUBST(PLATFORM_CORE_LDFLAGS)
AC_SUBST(PLATFORM_CORE_LIBS)
AC_SUBST(SOLINK)
AC_SUBST(LIBTOOL_LIB_EXTEN)
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/prctl.h sys/select.h netdb.h sys/time.h])
# Solaris 11 privilege management
AS_CASE([$host],
[*-*-solaris2.11], [AC_CHECK_HEADER([priv.h], [AC_DEFINE([SOLARIS_PRIVILEGES],[1],[Solaris 11 privilege management])])]
)
if test x"$ac_cv_header_wchar_h" = xyes; then
HAVE_WCHAR_H_DEFINE=1
else
HAVE_WCHAR_H_DEFINE=0
fi
AC_SUBST(HAVE_WCHAR_H_DEFINE)
# Needed by Abyss on Solaris:
if test x"$ac_cv_header_sys_filio_h" = xyes; then
HAVE_SYS_FILIO_H_DEFINE=1
else
HAVE_SYS_FILIO_H_DEFINE=0
fi
AC_SUBST(HAVE_SYS_FILIO_H_DEFINE)
# Needed by Abyss on Solaris:
if test x"$ac_cv_header_sys_ioctl_h" = xyes; then
HAVE_SYS_IOCTL_H_DEFINE=1
else
HAVE_SYS_IOCTL_H_DEFINE=0
fi
AC_SUBST(HAVE_SYS_IOCTL_H_DEFINE)
if test x"$ac_cv_header_sys_select_h" = xyes; then
HAVE_SYS_SELECT_H_DEFINE=1
else
HAVE_SYS_SELECT_H_DEFINE=0
fi
AC_SUBST(HAVE_SYS_SELECT_H_DEFINE)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs timerfd_create getdtablesize posix_openpt poll])
AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups getrusage])
AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
# Check availability and return type of strerror_r
# (NOTE: apr-1-config sets -D_GNU_SOURCE at build-time, need to run the check with it too)
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
AC_FUNC_STRERROR_R
CPPFLAGS="$save_CPPFLAGS"
AX_HAVE_CPU_SET
AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
AC_CHECK_LIB(rt, clock_getres, [AC_DEFINE(HAVE_CLOCK_GETRES, 1, [Define if you have clock_getres()])])
AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])])
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
AC_CHECK_FILE(/dev/ptmx, [AC_DEFINE(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx])])
AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty()])])
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
#include <sys/types.h>
#include <time.h>])
AC_CHECK_MEMBERS([struct tm.tm_zone],,,[
#include <sys/types.h>
#include <time.h>])
AC_CHECK_DECL([RLIMIT_MEMLOCK],
[AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
[#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif])
AC_CHECK_DECL([SCHED_RR],
[AC_DEFINE([HAVE_SCHED_RR],[1],[SCHED_RR constant for sched_setscheduler])],,
[#ifdef HAVE_SCHED_H
#include <sched.h>
#endif])
AC_CHECK_DECL([SCHED_FIFO],
[AC_DEFINE([HAVE_SCHED_FIFO],[1],[SCHED_FIFO constant for sched_setscheduler])],,
[#ifdef HAVE_SCHED_H
#include <sched.h>
#endif])
#
# use mlockall only on linux (for now; if available)
#
if test "x${ac_cv_func_mlockall}" = "xyes"; then
AC_MSG_CHECKING([whether to use mlockall])
case "$host" in
*-linux-*)
AC_DEFINE([USE_MLOCKALL],[1],[Enable mlockall support])
AC_MSG_RESULT([yes])
USE_MLOCKALL=yes
;;
*-freebsd*)
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
AC_MSG_RESULT([no, broken for non-root users])
;;
*)
AC_MSG_RESULT([no])
;;
esac
#
# setrlimit prerequisites
#
if test "x${USE_MLOCKALL}" = "xyes" -a \