forked from sippy/rtpproxy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
176 lines (156 loc) · 4.68 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.58)
AC_INIT(rtpproxy, 2.0.beta.20150106, sobomax@sippysoft.com)
AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
# cross-compile macros
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_MKDIR_P
AM_PROG_CC_C_O
LT_INIT
case "${host_os}" in
freebsd*)
CPPFLAGS="-I/usr/local/include -pthread"
LDFLAGS="-L/usr/local/lib"
#LIBS=
;;
linux*)
CPPFLAGS="-D_BSD_SOURCE -D_ISOC99_SOURCE -DLINUX_XXX"
LIBS="-lrt"
;;
solaris*)
LIBS="-lsocket -lnsl -lxnet -lrt"
;;
*)
;;
esac
AC_ARG_ENABLE(systemd,
AS_HELP_STRING([--enable-systemd], [enable systemd support in rtpproxy]),
[],
[enable_systemd=no])
# Checks for libraries.
if test "$enable_systemd" = 'yes'
then
AC_SEARCH_LIBS(sd_listen_fds,[systemd systemd-daemon],
[have_sd_listen_fds=yes],
[AC_MSG_ERROR([Cannot find sd_listen_fds function])],)
AC_CHECK_HEADER(systemd/sd-daemon.h,
[have_systemd_sd_daemon_h=yes],
[AC_MSG_ERROR([Cannot find <systemd/sd-daemon.h> header])])
if test x"$have_sd_listen_fds" = x"yes" && \
test x"$have_systemd_sd_daemon_h" = x"yes"
then
AC_DEFINE([HAVE_SYSTEMD_DAEMON],[1],[Define if you have systemd daemon])
fi
fi
# dlopen et al
AC_CHECK_HEADER(dlfcn.h, found_dlfcn=yes)
if test "$found_dlfcn" = yes
then
ENABLE_MODULE_IF=1
AC_DEFINE([ENABLE_MODULE_IF], 1, [Define to enable dymanic modules])
AC_CHECK_LIB([dl], [dladdr], [LIBS_DL=-ldl], [LIBS_DL=])
fi
# GSM
AC_CHECK_HEADER(gsm.h, found_libgsm=yes)
if test "$found_libgsm" = yes
then
AC_CHECK_LIB(gsm, gsm_create,
LIBS_GSM="-lgsm"
AC_DEFINE([ENABLE_GSM], 1, [Define if you have libgsm library installed]))
fi
# G.729
AC_CHECK_HEADER(g729_encoder.h, found_libg729=yes)
if test "$found_libg729" = yes
then
AC_CHECK_LIB(g729, g729_encoder_new,
LIBS_G729="-lg729 -lm"
AC_DEFINE([ENABLE_G729], 1, [Define if you have G.729 support]),,
-lm
)
else
AC_CHECK_HEADER(bcg729/encoder.h, found_libbcg729=yes)
if test "$found_libbcg729" = yes
then
AC_CHECK_LIB(bcg729, initBcg729EncoderChannel,
LIBS_G729=`pkg-config --libs libbcg729`
AC_DEFINE([ENABLE_G729], 1, [Define if you have G.729 support])
AC_DEFINE([ENABLE_BCG729], 1, [Define if you have bcg729 library])
)
fi
fi
# G.722
AC_CHECK_HEADER(g722.h, found_libg722=yes)
if test "$found_libg722" = yes
then
AC_CHECK_LIB(g722, g722_encoder_new,
LIBS_G722="-lg722"
AC_DEFINE([ENABLE_G722], 1, [Define if you have libg722 library installed]))
fi
# libsndfile
AC_CHECK_HEADER(sndfile.h, found_libsndfile=yes)
if test "$found_libsndfile" = yes
then
AC_CHECK_LIB(sndfile, sf_open,
LIBS_SNDFILE="-lsndfile"
AC_DEFINE([ENABLE_SNDFILE], 1, [Define if you have libsndfile library installed]))
fi
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h err.h endian.h sys/endian.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
dnl check for the sockaddr_un.sun_len member
AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
[AC_DEFINE(HAVE_SOCKADDR_SUN_LEN,1,[Have the sockaddr_un.sun_len member.])],
[],
[ #include <sys/types.h>
#include <sys/un.h>
])
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([atexit gettimeofday memset mkdir socket strchr strdup strerror])
if test "x$GCC" = "xyes"; then
## We like to use C99 routines when available. This makes sure that
## __STDC_VERSION__ is set such that libc includes make them available.
AM_CFLAGS="-std=gnu99 -Wall -Wno-uninitialized"
fi
AC_MSG_CHECKING([for __sync_fetch_and_add])
AC_LINK_IFELSE(
[AC_LANG_SOURCE([
int main(void) {
volatile int rcval = 1, rcval_pre;
rcval_pre = __sync_fetch_and_add(&rcval, -1);
return(rcval == 0 && rcval_pre == 1 ? 0 : 1);
}
])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_GCC_ATOMICS],[1],[Define if you have gcc-style atomic operations])],
[AC_MSG_RESULT([no])]
)
AM_CONDITIONAL(BUILD_EXTRACTAUDIO, [test "${LIBS_SNDFILE}" != ""])
AM_CONDITIONAL(BUILD_MODULES, [test "${ENABLE_MODULE_IF}" = 1])
AM_CONDITIONAL(ENABLE_MODULE_IF, [test "${ENABLE_MODULE_IF}" = 1])
AC_CONFIG_FILES([Makefile src/Makefile makeann/Makefile tests/Makefile
extractaudio/Makefile libexecinfo/Makefile modules/Makefile
modules/acct_csv/Makefile])
AC_SUBST(AM_CFLAGS)
AC_SUBST(LIBS_DL)
AC_SUBST(LIBS_GSM)
AC_SUBST(LIBS_G729)
AC_SUBST(LIBS_G722)
AC_SUBST(LIBS_SNDFILE)
AC_SUBST(LIBS_DL)
AC_OUTPUT