forked from pjsip/pjproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aconfigure.ac
2638 lines (2377 loc) · 82.1 KB
/
aconfigure.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_INIT([pjproject],[2.x])
host_orig="$host"
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CONFIG_HEADERS([pjlib/include/pj/compat/os_auto.h
pjlib/include/pj/compat/m_auto.h
pjmedia/include/pjmedia/config_auto.h
pjmedia/include/pjmedia-codec/config_auto.h
pjsip/include/pjsip/sip_autoconf.h
])
AC_CONFIG_FILES([build.mak
build/os-auto.mak
build/cc-auto.mak
pjlib/build/os-auto.mak
pjlib-util/build/os-auto.mak
pjmedia/build/os-auto.mak
pjsip/build/os-auto.mak
third_party/build/os-auto.mak
])
dnl
dnl Setup default CFLAGS
dnl
if test "$CFLAGS" = ""; then
CFLAGS="-O2"
fi
dnl #
dnl # Configure tools
dnl #
AC_PROG_CC
AC_PROG_CXX
AC_LANG([C])
dnl Make sure C++ compiler works
AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[AC_MSG_ERROR(C++ compiler does not work)])
AC_LANG_POP([C++])
AC_PROG_RANLIB
AC_CHECK_TOOLS([AR], [ar gar], :)
if test "$AR_FLAGS" = ""; then AR_FLAGS="rv"; fi
AC_SUBST(AR_FLAGS)
if test "$LD" = ""; then LD="$CXX"; fi
AC_SUBST(LD)
if test "$LDOUT" = ""; then LDOUT="-o "; fi
AC_SUBST(LDOUT)
if test "$OBJEXT" = ""; then OBJEXT='o'; fi
AC_SUBST(OBJEXT)
if test "$LIBEXT" = ""; then LIBEXT='a'; fi
AC_SUBST(LIBEXT)
if test "$LIBEXT2" = ""; then LIBEXT2=""; fi
AC_SUBST(LIBEXT2)
if test "$CC_OUT" = ""; then CC_OUT="-c -o "; fi
AC_SUBST(CC_OUT)
if test "$CC_INC" = ""; then CC_INC="-I"; fi
AC_SUBST(CC_INC)
if test "$CC_DEF" = ""; then CC_DEF="-D"; fi
AC_SUBST(CC_DEF)
if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi
AC_SUBST(CC_OPTIMIZE)
if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
AC_SUBST(CC_CFLAGS)
AC_SUBST(ac_pjdir)
AC_SUBST(ac_build_mak_vars)
AC_SUBST(ac_cflags)
case $host in
*mingw* | *cygw* | *win32* | *w32* )
if pwd -W 2&> /dev/null; then
ac_pjdir=`pwd -W`
else
# We're probably cross-compiling mingw on Linux
ac_pjdir=`pwd`
fi
;;
*)
ac_pjdir=`pwd`
;;
esac
AC_SUBST(ac_shlib_suffix)
case $target in
*mingw* | *cygw* | *win32* | *w32* )
ac_shlib_suffix=dll
;;
*darwin*)
ac_shlib_suffix=dylib
;;
*)
ac_shlib_suffix=so
;;
esac
AC_SUBST(ac_cross_compile)
if test "$build" = "$host"; then
ac_cross_compile=
else
ac_cross_compile=${host_orig}-
fi
AC_CHECK_LIB(pthread,pthread_create)
AC_CHECK_LIB(wsock32,puts)
AC_CHECK_LIB(ws2_32,puts)
AC_CHECK_LIB(ole32,puts)
AC_CHECK_LIB(winmm,puts)
AC_CHECK_LIB(socket,puts)
AC_CHECK_LIB(rt,puts)
AC_CHECK_LIB(m,sin)
dnl
dnl libuuid
dnl
AC_ARG_ENABLE(libuuid,
AS_HELP_STRING([--disable-libuuid],
[Exclude libuuid(default: autodetect)]),
[if test "$enable_libuuid" = "no"; then
AC_MSG_RESULT([Checking if libuuid disabled... yes])
ac_has_uuid_lib=0
fi],
[
AC_CHECK_LIB(uuid,uuid_generate)
AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
])
AC_SEARCH_LIBS(gethostbyname,nsl)
AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
dnl
dnl Memory alignment detection
dnl
AC_MSG_CHECKING([memory alignment])
case $target in
sparc64-* | ia64-* | x86_64-* | arm64-* | aarch64-* | mips64* )
AC_DEFINE(PJ_POOL_ALIGNMENT, 8)
AC_MSG_RESULT([8 bytes])
;;
* )
AC_DEFINE(PJ_POOL_ALIGNMENT, 4)
AC_MSG_RESULT([4 bytes (default)])
;;
esac
dnl
dnl Endianness detection
dnl
AC_C_BIGENDIAN
if test "x$ac_cv_c_bigendian" = "xyes"; then
CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
else
CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
fi
dnl
dnl Legacy macros
dnl
AC_SUBST(ac_target_arch)
AC_SUBST(ac_std_cpp_lib)
case $target in
*android*)
AC_DEFINE(PJ_ANDROID,1)
ac_target_arch=$TARGET_ABI
ac_std_cpp_lib=$STD_CPP_LIB
;;
*mingw* | *cygw* | *win32* | *w32* )
AC_DEFINE(PJ_WIN32,1)
AC_DEFINE(PJ_WIN32_WINNT,0x0400)
AC_DEFINE(WIN32_LEAN_AND_MEAN)
case $target in
*_64-w64-mingw* )
AC_DEFINE(PJ_WIN64,1)
;;
esac
;;
*darwin*)
AC_DEFINE(PJ_DARWINOS,1)
ac_target_arch=$ARCH_VAL
;;
*linux*)
AC_DEFINE(PJ_LINUX,1)
;;
*bsd*)
AC_DEFINE(PJ_BSD,1)
;;
*rtems*)
AC_DEFINE(PJ_RTEMS,1)
;;
*sunos* | *solaris* )
AC_DEFINE(PJ_SUNOS,1)
;;
*)
;;
esac
dnl # --disable-floating-point option
AC_ARG_ENABLE(floating-point,
AS_HELP_STRING([--disable-floating-point],
[Disable floating point where possible]),
[if test "$enable_floating_point" = "no"; then
AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
AC_MSG_RESULT([Checking if floating point is disabled... yes])
fi],
[
AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
AC_MSG_RESULT([Checking if floating point is disabled... no])
])
AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
case $target in
*mingw* | *cygw* | *win32* | *w32* )
AC_DEFINE(PJ_HAS_ERRNO_H,0)
;;
*)
AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
;;
esac
AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)])
AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
AC_CHECK_HEADER(limits.h,[AC_DEFINE(PJ_HAS_LIMITS_H,1)])
AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
[#if PJ_HAS_SYS_TYPES_H
# include <sys/types.h>
#endif
#if PJ_HAS_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#if PJ_HAS_NETINET_IN_H
# include <netinet/in.h>
#endif
])
AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
AC_CHECK_HEADER(ifaddrs.h,
[AC_CHECK_FUNC(getifaddrs,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])])
AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)])
AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
AC_CHECK_HEADER(stdint.h,[AC_DEFINE(PJ_HAS_STDINT_H,1)])
AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
AC_CHECK_HEADER(inttypes.h,[AC_DEFINE(PJ_HAS_INTTYPES_H,1)])
AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
AC_CHECK_HEADER(sys/filio.h,[AC_DEFINE(PJ_HAS_SYS_FILIO_H,1)])
AC_CHECK_HEADER(sys/sockio.h,[AC_DEFINE(PJ_HAS_SYS_SOCKIO_H,1)])
AC_CHECK_HEADER(sys/utsname.h,[AC_DEFINE(PJ_HAS_SYS_UTSNAME_H,1)])
AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
AC_CHECK_HEADER(execinfo.h,[AC_DEFINE(PJ_HAS_EXECINFO_H,1)])
AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
[#if PJ_HAS_WINSOCK2_H
# include <winsock2.h>
#elif PJ_HAS_WINSOCK_H
# include <winsock.h>
#endif
])
AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
[#if PJ_HAS_SYS_TYPES_H
# include <sys/types.h>
#endif
#if PJ_HAS_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
case $target in
*android*)
AC_CHECK_HEADER(linux/android_alarm.h,[AC_DEFINE(PJ_HAS_ANDROID_ALARM_H,1)])
;;
esac
AC_CHECK_FUNC(localtime_r,[AC_DEFINE(PJ_HAS_LOCALTIME_R,1)])
AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
AC_DEFINE(PJ_HAS_MALLOC,1)
AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
dnl # Determine if inet_aton() is available
AC_MSG_CHECKING([if inet_aton() is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>]],
[inet_aton(0, 0);])],
[AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl # Determine if inet_pton() is available
AC_MSG_CHECKING([if inet_pton() is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>]],
[inet_pton(0, 0, 0);])],
[AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl # Determine if inet_ntop() is available
AC_MSG_CHECKING([if inet_ntop() is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>]],
[inet_ntop(0, 0, 0, 0);])],
[AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl # Determine if getaddrinfo() is available
AC_MSG_CHECKING([if getaddrinfo() is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>]],
[getaddrinfo(0, 0, 0, 0);])],
[AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl # Determine if socketpair() is available
AC_MSG_CHECKING([if socketpair() is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[socketpair(0, 0, 0, 0);])],
[AC_DEFINE(PJ_SOCK_HAS_SOCKETPAIR,1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl # Determine if sockaddr_in has sin_len member
AC_MSG_CHECKING([if sockaddr_in has sin_len member])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>]],
[struct sockaddr_in a; a.sin_len=0;])],
[AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
dnl # Determine if socklen_t is available
AC_MSG_CHECKING([if socklen_t is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[socklen_t xxx = 0;])],
[AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
dnl # Determine if IPV6_V6ONLY is available
AC_MSG_CHECKING([if IPV6_V6ONLY is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
#include <netinet/in.h>]],
[int opt = IPV6_V6ONLY;])],
[AC_DEFINE(PJ_SOCK_HAS_IPV6_V6ONLY,1)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
dnl # Determine if SO_ERROR is available
AC_MSG_CHECKING([if SO_ERROR is available])
case $target in
*mingw* | *cygw* | *win32* | *w32* )
AC_DEFINE(PJ_HAS_SO_ERROR,1)
AC_MSG_RESULT(yes)
;;
*)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>]],
[int i=SO_ERROR;])],
[AC_DEFINE(PJ_HAS_SO_ERROR,1)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
;;
esac
dnl # Determine if RW-mutex is available
AC_MSG_CHECKING([if pthread_rwlock_t is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[pthread_rwlock_t *x;])],
[AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
ac_rwmutex="yes"
AC_MSG_RESULT(yes)],
[AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
ac_rwmutex="no"
AC_MSG_RESULT(no)])
dnl # If rwmutex is not detected, check again but this time
dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
if test "$ac_rwmutex" = "no"; then
AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
#include <pthread.h>]],
[pthread_rwlock_t *x;])],
[AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
AC_MSG_RESULT(yes)],
[AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
AC_MSG_RESULT(no)])
fi
dnl # Do we have pthread_mutexattr_settype()?
AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
[AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl # Does pthread_mutexattr_t has "recursive" member?
AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[[pthread_mutexattr_t attr;
attr.recursive=1;]])],
[AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
dnl ######################
dnl # ioqueue selection
dnl #
AC_SUBST(ac_os_objs)
AC_SUBST(ac_linux_poll)
AC_MSG_CHECKING([ioqueue backend])
ac_os_objs=ioqueue_select.o
ac_linux_poll=select
case $target in
*darwin* | *bsd*)
AC_ARG_ENABLE(kqueue,
AS_HELP_STRING([--enable-kqueue],
[Use kqueue ioqueue on macos/BSD (experimental)]),
[
if test "$enable_kqueue" = "yes"; then
ac_os_objs=ioqueue_kqueue.o
AC_MSG_RESULT([kqueue()])
else
AC_MSG_RESULT([select()])
fi
],
[
AC_MSG_RESULT([select()])
])
;;
*)
AC_ARG_ENABLE(epoll,
AS_HELP_STRING([--enable-epoll],
[Use /dev/epoll ioqueue on Linux (experimental)]),
[
if test "$enable_epoll" = "yes"; then
ac_os_objs=ioqueue_epoll.o
AC_MSG_RESULT([/dev/epoll])
AC_DEFINE(PJ_HAS_LINUX_EPOLL,1)
ac_linux_poll=epoll
else
AC_MSG_RESULT([select()])
fi
],
[
AC_MSG_RESULT([select()])
])
;;
esac
AC_SUBST(ac_shared_libraries)
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared],
[Build shared libraries]),
[if test "$enable_shared" = "yes"; then
[ac_shared_libraries=1]
CFLAGS="$CFLAGS -fPIC"
AC_MSG_RESULT([Building shared libraries... yes])
fi],
AC_MSG_RESULT([Building shared libraries... no])
)
AC_SUBST(ac_no_pjsua2)
AC_ARG_ENABLE(pjsua2,
AS_HELP_STRING([--disable-pjsua2],
[Exclude pjsua2 library and application from the build]),
[if test "$enable_pjsua2" = "no"; then
[ac_no_pjsua2=1]
AC_MSG_RESULT([Building pjsua2 library and application... no])
fi],
AC_MSG_RESULT([Building pjsua2 library and application... yes])
)
dnl ######################
dnl # OS specific files
dnl #
case $target in
*mingw* | *cygw* | *win32* | *w32* )
ac_os_objs="$ac_os_objs file_access_win32.o file_io_win32.o os_core_win32.o os_error_win32.o os_time_win32.o os_timestamp_win32.o guid_win32.o sock_qos_bsd.o unicode_win32.o"
;;
*)
ac_os_objs="$ac_os_objs file_access_unistd.o file_io_ansi.o os_core_unix.o os_error_unix.o os_time_unix.o os_timestamp_posix.o"
case $target in
*-apple-darwin_ios*)
ac_os_objs="$ac_os_objs os_info_iphone.o os_core_darwin.o"
;;
*darwin*)
ac_os_objs="$ac_os_objs os_core_darwin.o"
;;
esac
# QoS
case $target in
*darwin*)
ac_os_objs="$ac_os_objs sock_qos_darwin.o sock_qos_bsd.o"
;;
*)
ac_os_objs="$ac_os_objs sock_qos_bsd.o"
;;
esac
# SSL
case $target in
*darwin*)
ac_os_objs="$ac_os_objs ssl_sock_apple.o"
;;
esac
# UUID
case $target in
*android*)
ac_os_objs="$ac_os_objs guid_android.o"
;;
*darwin*)
ac_os_objs="$ac_os_objs guid_darwin.o"
;;
*bsd*)
ac_os_objs="$ac_os_objs guid_bsd.o"
;;
*)
if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
ac_os_objs="$ac_os_objs guid_uuid.o"
else
ac_os_objs="$ac_os_objs guid_simple.o"
fi
;;
esac
;;
esac
dnl ##########################################
dnl # PJLIB-UTIL
dnl #
dnl # UPnP alt prefix
AC_ARG_WITH(upnp,
AS_HELP_STRING([--with-upnp=DIR],
[Specify alternate libupnp prefix]),
[],
[with_upnp=no]
)
dnl # Do not use default libupnp installation if we are cross-compiling
if test "x$ac_cross_compile" != "x" -a "x$with_upnp" = "xno"; then
enable_upnp=no
fi
dnl # UPnP
AC_ARG_ENABLE(upnp,
AS_HELP_STRING([--disable-upnp],
[Disable UPnP (default: not disabled)]),
[
if test "$enable_upnp" = "no"; then
AC_MSG_RESULT([Checking if UPnP is disabled... yes])
fi
],
[
if test "x$with_upnp" != "xno" -a "x$with_upnp" != "x"; then
UPNP_PREFIX=$with_upnp
UPNP_CFLAGS="-I$UPNP_PREFIX/upnp/inc -I$UPNP_PREFIX/ixml/inc"
UPNP_LDFLAGS="-L$UPNP_PREFIX/upnp/.libs -L$UPNP_PREFIX/imxl/.libs"
AC_MSG_RESULT([Using UPnP prefix... $with_upnp])
else
UPNP_CFLAGS=""
UPNP_LDFLAGS=""
fi
AC_MSG_CHECKING([UPnP usability])
UPNP_LIBS="-lupnp -lixml"
SAVED_LIBS="$LIBS"
SAVED_LDFLAGS="$LDFLAGS"
SAVED_CFLAGS="$CFLAGS"
LIBS="$UPNP_LIBS $LIBS"
LDFLAGS="$UPNP_LDFLAGS $LDFLAGS"
CFLAGS="$UPNP_CFLAGS $CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <upnp/upnp.h>]],
[UpnpInit2(NULL, 0);]
)],
[ CFLAGS="$CFLAGS -DPJNATH_HAS_UPNP=1 $UPNP_CFLAGS"
LDFLAGS="$LDFLAGS $UPNP_LDFLAGS $UPNP_LIBS"
AC_MSG_RESULT(yes)
],
[
LIBS="$SAVED_LIBS"
LDFLAGS="$SAVED_LDFLAGS"
CFLAGS="$SAVED_CFLAGS"
AC_MSG_RESULT(no)
])
])
dnl ##########################################
dnl #
dnl # PJMEDIA
dnl #
dnl # Use external Speex installation
AC_SUBST(ac_external_speex,0)
AC_ARG_WITH(external-speex,
AS_HELP_STRING([--with-external-speex],
[Use external Speex development files, not the one in "third_party" directory. When this option is set, make sure that Speex is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_speex" != "xno"; then
# Test Speex installation
AC_MSG_CHECKING([if external Speex devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
#include <speex/speex_echo.h>
]],
[speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
[AC_MSG_RESULT(yes!!)
AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
ac_external_speex="1"
],
[AC_MSG_ERROR([Unable to use external Speex library. If Speex development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
dnl # Use external GSM codec library installation
AC_SUBST(ac_external_gsm,0)
AC_ARG_WITH(external-gsm,
AS_HELP_STRING([--with-external-gsm],
[Use external GSM codec library, not the one in "third_party" directory. When this option is set, make sure that the GSM include/lib files are accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_gsm" != "xno"; then
# Test GSM library installation
AC_MSG_CHECKING([if external GSM devkit is installed as gsm/gsm.h])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <gsm/gsm.h> ]], [gsm_create(); ]) ],
[AC_MSG_RESULT(yes!!)
AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
AC_DEFINE(PJMEDIA_EXTERNAL_GSM_GSM_H, 1)
ac_external_gsm="1"
],
[
AC_MSG_RESULT(no)
AC_MSG_CHECKING([if external GSM devkit is installed as gsm.h])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <gsm.h> ]], [gsm_create(); ]) ],
[AC_MSG_RESULT(yes!!)
AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
AC_DEFINE(PJMEDIA_EXTERNAL_GSM_H, 1)
ac_external_gsm="1"
],
[AC_MSG_ERROR([Unable to use external GSM library. If GSM development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])
]
)
]
)
fi
]
)
dnl # Use external SRTP installation
AC_SUBST(ac_external_srtp,0)
AC_SUBST(ac_external_srtp_lib)
AC_ARG_WITH(external-srtp,
AS_HELP_STRING([--with-external-srtp],
[Use external SRTP development files, not the one in "third_party" directory. When this option is set, make sure that SRTP is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_srtp" != "xno"; then
# Test SRTP installation
AC_MSG_CHECKING([if external SRTP devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp2/srtp.h>
]],
[srtp_init();])],
[AC_MSG_RESULT(yes: version 2.x)
ac_external_srtp="2"
ac_external_srtp_lib="srtp2"
],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h>
]],
[srtp_init();])],
[AC_MSG_RESULT(yes: version 1.x)
ac_external_srtp="1"
ac_external_srtp_lib="srtp"
],
[AC_MSG_ERROR([Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])])
fi
]
)
dnl # For external SRTP, check availability of srtp_deinit() or srtp_shutdown()
if test "x$ac_external_srtp" != "x0"; then
AC_SUBST(ac_srtp_deinit_present,0)
AC_SUBST(ac_srtp_shutdown_present,0)
AC_CHECK_LIB($ac_external_srtp_lib,srtp_deinit,[ac_srtp_deinit_present=1])
if test "x$ac_srtp_deinit_present" != "x1"; then
AC_CHECK_LIB($ac_external_srtp_lib,srtp_shutdown,[ac_srtp_shutdown_present=1])
fi
fi
dnl # Use external libyuv installation
AC_SUBST(ac_external_yuv,0)
AC_ARG_WITH(external-yuv,
AS_HELP_STRING([--with-external-yuv],
[Use external libyuv development files, not the one in "third_party" directory. When this option is set, make sure that libyuv is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_yuv" != "xno"; then
# Test libyuv installation
AC_MSG_CHECKING([if external libyuv devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libyuv.h>]],
[RGB24ToI420(0,0,0,0,0,0,0,0,0,0);])],
[AC_MSG_RESULT(yes!!)
ac_external_yuv="1"
],
[AC_MSG_ERROR([Unable to use external libyuv. If libyuv development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
dnl # Use external webrtc installation
AC_SUBST(ac_external_webrtc,0)
AC_ARG_WITH(external-webrtc,
AS_HELP_STRING([--with-external-webrtc],
[Use external webrtc development files, not the one in "third_party" directory. When this option is set, make sure that webrtc is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_webrtc" != "xno"; then
# Test webrtc installation
AC_MSG_CHECKING([if external webrtc devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <webrtc/modules/audio_processing/aec/aec_core.h>
#include <webrtc/modules/audio_processing/aec/include/echo_cancellation.h>
]],
[WebRtcAec_Create();])],
[AC_MSG_RESULT(yes!!)
ac_external_webrtc="1"
],
[AC_MSG_ERROR([Unable to use external webrtc. If webrtc development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
dnl # Use external webrtc AEC3 installation
AC_SUBST(ac_external_webrtc_aec3,0)
AC_ARG_WITH(external-webrtc-aec3,
AS_HELP_STRING([--with-external-webrtc-aec3],
[Use external webrtc AEC3 development files, not the one in "third_party" directory. When this option is set, make sure that webrtc is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_webrtc_aec3" != "xno"; then
# Test webrtc AEC3 installation
AC_MSG_CHECKING([if external webrtc AEC3 is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "modules/audio_processing/aec3/echo_canceller3.h"
]],
[EchoCanceller3 ec(EchoCanceller3Config(), 16000, 1, 1);])],
[AC_MSG_RESULT(yes!!)
ac_external_webrtc_aec3="1"
],
[AC_MSG_ERROR([Unable to use external webrtc AEC3. If webrtc development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
dnl # Resample implementation
AC_SUBST(ac_pjmedia_resample,libresample)
AC_ARG_ENABLE(resample,
AS_HELP_STRING([--disable-resample],
[Disable resampling implementations]),
[if test "$enable_resample" = "no"; then
[ac_pjmedia_resample=none]
AC_MSG_RESULT([Checking if resampling is disabled...yes])
fi]
)
dnl # Sound device backend selection
AC_SUBST(ac_pjmedia_snd)
AC_ARG_ENABLE(sound,
AS_HELP_STRING([--disable-sound],
[Exclude sound (i.e. use null sound)]),
[if test "$enable_sound" = "no"; then
[ac_pjmedia_snd=null]
AC_MSG_RESULT([Checking if sound is disabled... yes])
fi]
)
dnl # Use external PortAudio installation
AC_SUBST(ac_external_pa,0)
AC_ARG_WITH(external-pa,
AS_HELP_STRING([--with-external-pa],
[Use external PortAudio development files. When this option is set, make sure that PortAudio is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_pa" != "xno"; then
# Test PortAudio installation
AC_MSG_CHECKING([if external PortAudio devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
]],
[Pa_Initialize();])],
[AC_MSG_RESULT(yes!!)
ac_external_pa="1"
],
[AC_MSG_ERROR([Unable to use PortAudio. If PortAudio development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
AC_SUBST(ac_pa_cflags)
AC_CHECK_HEADER(sys/soundcard.h,
[ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
AC_CHECK_HEADER(linux/soundcard.h,
[ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
AC_CHECK_HEADER(machine/soundcard.h,
[ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
if test "x$ac_cv_c_bigendian" = "xyes"; then
ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
else
ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
fi
dnl # Enable Android Oboe audio device
AC_SUBST(ac_oboe_cflags)
AC_SUBST(ac_oboe_ldflags)
AC_ARG_WITH(oboe,
AS_HELP_STRING([--with-oboe],
[Enable Android Oboe audio device backend.]),
[
if test "x$with_oboe" != "xno" -a "x$with_oboe" != "x"; then
OBOE_PREFIX=$with_oboe
OBOE_CFLAGS="-I$OBOE_PREFIX/prefab/modules/oboe/include"
OBOE_LDFLAGS="-L$OBOE_PREFIX/prefab/modules/oboe/libs/android.$TARGET_ABI"
AC_MSG_RESULT([Using Oboe prefix... $with_oboe])
else
OBOE_CFLAGS=""
OBOE_LDFLAGS=""
fi
AC_MSG_CHECKING([Oboe usability])
OBOE_LIBS="-loboe -lOpenSLES -llog"
SAVED_LIBS="$LIBS"
SAVED_LDFLAGS="$LDFLAGS"
SAVED_CXXFLAGS="$CXXFLAGS"
LIBS="$OBOE_LIBS $LIBS"
LDFLAGS="$OBOE_LDFLAGS $LDFLAGS"
CXXFLAGS="$OBOE_CFLAGS $CXXFLAGS"
AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <oboe/Oboe.h>]],
[oboe::AudioStreamBuilder sb; sb.setDeviceId(0);]
)],
[ ac_oboe_cflags="-DPJMEDIA_AUDIO_DEV_HAS_OBOE=1 $OBOE_CFLAGS"
ac_oboe_ldflags="$OBOE_LDFLAGS $OBOE_LIBS"
AC_MSG_RESULT(yes)
],
[
LIBS="$SAVED_LIBS"
LDFLAGS="$SAVED_LDFLAGS"
AC_MSG_RESULT(no)
])
AC_LANG_POP([C++])
# Put back original CXXFLAGS as app won't needed it.
CXXFLAGS="$SAVED_CFLAGS"
]
)
if test "$enable_sound" = "no"; then
true;
else
AC_SUBST(ac_pjmedia_audiodev_objs)
case $target in
*android*)
if test "x$ac_oboe_cflags" != "x"; then
AC_MSG_RESULT([Checking sound device backend... Oboe])
else
LIBS="$LIBS -lOpenSLES"
AC_MSG_RESULT([Checking sound device backend... Android])
fi
;;
*-apple-darwin_ios*)
LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox -framework CFNetwork -framework UIKit -framework AVFoundation"
ac_pjmedia_audiodev_objs="coreaudio_dev.o"
AC_MSG_RESULT([Checking sound device backend... AudioUnit])
;;
*darwin*)
LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
ac_pjmedia_audiodev_objs="coreaudio_dev.o"
if test "`uname -r`" = "6.8"; then
#ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
#AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
#ac_pjmedia_snd=pa_old_darwinos
AC_MSG_RESULT([Checking sound device backend... old coreaudio])
else
ac_pjmedia_snd=coreaudio
AC_MSG_RESULT([Checking sound device backend... coreaudio])
fi
;;
*cygwin* | *mingw*)
ac_pjmedia_snd=win32
AC_MSG_RESULT([Checking sound device backend... win32 sound])
;;
*rtems*)
ac_pjmedia_snd=null
AC_MSG_RESULT([Checking sound device backend... null sound])
;;
*)
if test "x$ac_external_pa" != "x1"; then
dnl # Check if ALSA is available
AC_CHECK_HEADER(alsa/version.h,
[LIBS="$LIBS -lasound"
ac_pjmedia_snd=alsa])
if test "x$ac_pjmedia_snd" = "xalsa"; then
AC_MSG_RESULT([Checking sound device backend... alsa])
else
ac_pjmedia_snd=null
AC_MSG_RESULT([Checking sound device backend... null sound])
fi
fi
;;
esac
fi
AC_SUBST(ac_pjmedia_video)
# Disable video on mingw by default (but respect --enable-video=yes)
case $target in
*mingw*)
if test ! "$enable_video" = "yes"; then
enable_video="no"
fi
;;
esac
dnl # --disable-video option
AC_ARG_ENABLE(video,
AS_HELP_STRING([--disable-video],
[Disable video feature]),
[if test "$enable_video" = "no"; then
#AC_DEFINE(PJMEDIA_HAS_VIDEO,0)
AC_MSG_RESULT([Video is disabled])