File: configure.ac

package info (click to toggle)
libexosip2 4.1.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 3,040 kB
  • ctags: 1,597
  • sloc: ansic: 21,465; sh: 11,005; makefile: 89
file content (405 lines) | stat: -rw-r--r-- 10,983 bytes parent folder | download | duplicates (2)
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
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.62 $)dnl
AC_PREREQ(2.50)
AC_INIT(include/eXosip2/eXosip.h)

dnl require at least autoconf v 2.00
dnl AC_COPYRIGHT (COPYRIGHT-NOTICE)

AC_MSG_NOTICE([eXosip2                 The Extended Open SIP library.])
AC_MSG_NOTICE([Copyright (C) 2002-2012 Aymeric MOIZARD - <amoizard@antisip.com>])

dnl *********************************************************************
dnl Source packaging numbers
EXOSIP_MAJOR_VERSION=4
EXOSIP_MINOR_VERSION=1
EXOSIP_MICRO_VERSION=0

SONAME_MAJOR_VERSION=11
SONAME_MINOR_VERSION=0
SONAME_MICRO_VERSION=0

dnl program extension
EXOSIP_VERSION=$EXOSIP_MAJOR_VERSION.$EXOSIP_MINOR_VERSION.$EXOSIP_MICRO_VERSION

LIBEXOSIP_SO_VERSION=$SONAME_MAJOR_VERSION:$SONAME_MINOR_VERSION:$SONAME_MICRO_VERSION

AC_SUBST(LIBEXOSIP_SO_VERSION, $LIBEXOSIP_SO_VERSION)
AC_SUBST(EXOSIP_VERSION)

if test "x$PRERELEASE" = "x"; then
 VERSION=$EXOSIP_VERSION
else
 VERSION="$EXOSIP_VERSION-$PRERELEASE"
fi

PACKAGE=libeXosip2

AC_MSG_RESULT([Configuring ${PACKAGE} ${VERSION}])
OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
AC_MSG_RESULT([Building Package on ${OS}])

dnl *********************************************************************
dnl Initialize automake stuff
AC_CONFIG_AUX_DIR(scripts)
AC_CONFIG_HEADERS(exosip-config.h)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_ACLOCAL_INCLUDE(scripts)

AC_CANONICAL_HOST

AC_SUBST(ac_aux_dir)

dnl Checks for programs.

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL

dnl enable --enable-shared and --disable-shared options
LT_AC_PROG_SED
AC_PROG_LIBTOOL

#AC_ENABLE_SHARED(yes)

dnl declare --enable-* args and collect ac_help strings

AC_ARG_ENABLE(tools,
[  --disable-tools         compile tools programs (yes).],
enable_tools=$enableval,enable_tools="yes")

AC_ARG_ENABLE(debug,
[  --disable-debug         turn on debugging (yes).],
enable_debug=$enableval,enable_debug="yes")

AC_ARG_ENABLE(trace,
[  --disable-trace         turn on trace (yes).],
enable_trace=$enableval,enable_trace="yes")

AC_ARG_ENABLE(mpatrol,
[  --enable-mpatrol        turn on memory leak detection with patrol (no).],
enable_mpatrol=$enableval,enable_mpatrol="no")

AC_ARG_ENABLE(gprof,
[  --enable-gprof          turn on profiling support.],
enable_gprof=$enableval,enable_gprof="no")

dnl support for linux-thread or posix thread (pthread.h)
AC_ARG_ENABLE(pthread,
[  --enable-pthread        enable support for POSIX threads. (autodetect)],
enable_pthread=$enableval,enable_pthread="no")

dnl support for semaphore.h (linux/sun...)
AC_ARG_ENABLE(semaphore,
[  --enable-semaphore      enable support for semaphore (semaphore.h)],
enable_semaphore=$enableval,enable_semaphore="no")

dnl support for sysV semaphore in sys/sem.h (BSD/linux...)
AC_ARG_ENABLE(sysv,
[  --enable-sysv           enable support for sysV semaphore (sys/sem.h).],
enable_sysv=$enableval,enable_sysv="no")

dnl minimize size of code.
AC_ARG_ENABLE(minisize,
[  --enable-minisize       only compile minimal voip related code).],
enable_minisize=$enableval,enable_minisize="no")

dnl build with multithreaded support (need semaphore).
AC_ARG_ENABLE(mt,
[  --enable-mt             compile eXosip2 without multi-thread support.],
enable_mt=$enableval,enable_mt="yes")

dnl compile with mt support
if test "x$enable_mt" = "xyes"; then
  if test "x$enable_pthread" = "xyes"; then
    EXOSIP_FLAGS="-DHAVE_PTHREAD"
    SIP_FSM_FLAGS="-DHAVE_PTHREAD"
    dnl FSM_LIB="-lpthread"
  else
    ACX_PTHREAD()
  fi
else
    EXOSIP_FLAGS="$EXOSIP_FLAGS -DOSIP_MONOTHREAD"
fi



if test "x$enable_semaphore" = "xyes"; then
  EXOSIP_FLAGS="$EXOSIP_FLAGS -DHAVE_SEMAPHORE_H"
  AC_CHECK_HEADERS(semaphore.h)
elif test "x$enable_sysv" = "xyes"; then
  EXOSIP_FLAGS="$EXOSIP_FLAGS -UHAVE_SEMAPHORE_H -DHAVE_SYS_SEM_H"
  AC_CHECK_HEADERS(sys/sem.h)
else
  AC_CHECK_HEADERS(semaphore.h)
  AC_CHECK_HEADERS(sys/sem.h)
fi

if test "x$host_cpu" = "x$build_cpu"; then
  case $OS in
   linux*)
     EXOSIP_FLAGS="$EXOSIP_FLAGS -pedantic"
     ;;
   irix*)
     ;;
   hpux* | hp-ux*)
     ;;
   aix*)
     ;;
   osf*)
     AC_CHECK_LIB(rt,sem_open,[EXOSIP_LIB="$EXOSIP_LIB -lrt"])
     ;;
   sunos*)
     ;;
   darwin*)
     EXOSIP_FLAGS="$EXOSIP_FLAGS -pedantic"
     ;;
   *mingw*)
     EXOSIP_FLAGS="$EXOSIP_FLAGS  -D_WIN32_WINNT=0x0501"
     EXOSIP_LIB="EXOSIP_LIB -lws2_32 -liphlpapi -ldnsapi"
dnl tools are not ported to win32
     enable_tools=no
     ;;
   *)
     ;;
 esac
else
 AC_MSG_NOTICE([Cross compiling exosip.])
fi

if test "x$enable_debug" = "xyes"; then
  EXOSIP_FLAGS="$EXOSIP_FLAGS -DENABLE_DEBUG -g"
  CFLAGS=`echo $CFLAGS | sed 's/-O.//'`
fi

if test "x$enable_trace" = "xyes"; then
  EXOSIP_FLAGS="$EXOSIP_FLAGS -DENABLE_TRACE"
fi

if test "x$enable_mpatrol" = "xyes"; then
  EXOSIP_FLAGS="$EXOSIP_FLAGS -DENABLE_MPATROL"
  EXOSIP_LIB="$EXOSIP_LIB -lmpatrolmt -lelf"
fi

if test "x$enable_gprof" = "xyes"; then
  EXOSIP_FLAGS="$EXOSIP_FLAGS -pg"
fi

if test "x$enable_minisize" = "xyes"; then
  EXOSIP_FLAGS="$EXOSIP_FLAGS -DMINISIZE"
fi
AM_CONDITIONAL(BUILD_MAXSIZE, test x$enable_minisize = xno)
AM_CONDITIONAL(COMPILE_TOOLS, test "x$enable_tools" = "xyes")

dnl Checks for libraries.
AC_CHECK_LIB(posix4,sem_open,[EXOSIP_LIB="$EXOSIP_LIB -lposix4 -mt"])
AC_CHECK_LIB(nsl,nis_add,[EXOSIP_LIB="$EXOSIP_LIB -lnsl"])
AC_CHECK_LIB(socket,sendto,[EXOSIP_LIB="$EXOSIP_LIB -lsocket"])
AC_CHECK_LIB(rt,clock_gettime,[EXOSIP_LIB="$EXOSIP_LIB -lrt"])

case $OS in
  openbsd*)
     ;;
  *)
     AC_CHECK_LIB(resolv,res_query,[EXOSIP_LIB="$EXOSIP_LIB -lresolv"])
     AC_CHECK_LIB(resolv,__res_query,[EXOSIP_LIB="$EXOSIP_LIB -lresolv"])
     ;;
esac

AC_CHECK_LIB([cares], [ares_init],
     [AC_CHECK_HEADER(ares.h,
	[EXOSIP_LIB="$EXOSIP_LIB -lcares"
        EXOSIP_FLAGS="$EXOSIP_FLAGS -DHAVE_CARES_H"],
	[AC_MSG_WARN([c-ares header files are not installed])])
     ],
     [AC_MSG_WARN([c-ares library is not installed])]
)

PKG_CHECK_MODULES(OSIP, libosip2 >= 3.5, [], [
AC_MSG_WARN([assuming osip can be found in -I$includedir and -L$libdir])
OSIP_CFLAGS='-I$(includedir) -I$(prefix)/include'
OSIP_LIBS='-L$(libdir) -L$(prefix)/lib -losip2 -losipparser2'
])

EXOSIP_FLAGS="$EXOSIP_FLAGS"

AC_CACHE_CHECK([whether -Wall works], Wall_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wall"
  AC_TRY_COMPILE(, , Wall_cv_flag=yes, Wall_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wall_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wall"
fi

AC_CACHE_CHECK([whether -Wcast-align works], Wcast_align_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wcast-align"
  AC_TRY_COMPILE(, , Wcast_align_cv_flag=yes, Wcast_align_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wcast_align_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wcast-align"
fi

AC_CACHE_CHECK([whether -Wchar-subscripts works], Wchar_subscripts_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wchar-subscripts"
  AC_TRY_COMPILE(, , Wchar_subscripts_cv_flag=yes, Wchar_subscripts_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wchar_subscripts_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wchar-subscripts"
fi

AC_CACHE_CHECK([whether -Wformat works], Wformat_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wformat"
  AC_TRY_COMPILE(, , Wformat_cv_flag=yes, Wformat_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wformat_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wformat"
fi

AC_CACHE_CHECK([whether -Winline works], Winline_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Winline"
  AC_TRY_COMPILE(, , Winline_cv_flag=yes, Winline_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Winline_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Winline"
fi

AC_CACHE_CHECK([whether -Wmissing-declarations works], Wmissing_declarations_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wmissing-declarations"
  AC_TRY_COMPILE(, , Wmissing_declarations_cv_flag=yes, Wmissing_declarations_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wmissing_declarations_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wmissing-declarations"
fi

AC_CACHE_CHECK([whether -Wmissing-prototypes works], Wmissing_prototypes_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wmissing-prototypes"
  AC_TRY_COMPILE(, , Wmissing_prototypes_cv_flag=yes, Wmissing_prototypes_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wmissing_prototypes_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wmissing-prototypes"
fi

AC_CACHE_CHECK([whether -Wnested-externs works], Wnested_externs_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wnested-externs"
  AC_TRY_COMPILE(, , Wnested_externs_cv_flag=yes, Wnested_externs_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wnested_externs_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wnested-externs"
fi

AC_CACHE_CHECK([whether -Wpointer-arith works], Wpointer_arith_cv_flag, [
  saved_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Wpointer-arith"
  AC_TRY_COMPILE(, , Wpointer_arith_cv_flag=yes, Wpointer_arith_cv_flag=no)
  CPPFLAGS=$saved_CPPFLAGS
])

if test "x$Wpointer_arith_cv_flag" = xyes; then
  CPPFLAGS="$CPPFLAGS -Wpointer-arith"
fi

TOOLS_LIBS=$TOOLS_LIBS
AC_SUBST(TOOLS_LIBS)

AC_SUBST(EXOSIP_FLAGS)
AC_SUBST(EXOSIP_LIB)

AC_SUBST(CFLAGS)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(stdio.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(varargs.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(assert.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(sys/signal.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(sys/soundcard.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(arpa/nameser.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(nameser8_compat.h)
AC_CHECK_HEADERS(arpa/nameser_compat.h)
AC_CHECK_HEADERS(netinet/tcp.h)

AC_CHECK_HEADERS([resolv.h], [], [],
[#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#if HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
])

dnl check if we have the getifaddrs() sytem call
AC_CHECK_FUNCS(getifaddrs)

AC_ARG_ENABLE(openssl,
	[  --enable-openssl        enable support for openssl],
	enable_openssl=$enableval,enable_openssl="yes")

if test "$enable_openssl" = "yes" ; then
	AC_CHECK_HEADERS(openssl/ssl.h)
	AC_CHECK_LIB(ssl,SSL_CTX_new,[EXOSIP_LIB="$EXOSIP_LIB -lssl"])
	AC_CHECK_LIB(crypto,X509_get_issuer_name,[EXOSIP_LIB="$EXOSIP_LIB -lcrypto"])
fi

AC_ARG_ENABLE(srvrec,
	[  --enable-srvrec         enable support for SRV records DNS queries (yes) ],
	enable_srvrec=$enableval,enable_srvrec="yes")

if test "x$enable_srvrec" = "xyes" ; then
  CPPFLAGS="$CPPFLAGS -DSRV_RECORD"
fi

AC_OUTPUT(
 Makefile
 scripts/Makefile
 platform/Makefile
 platform/vsnet/Makefile
 include/Makefile
 include/eXosip2/Makefile
 src/Makefile
 tools/Makefile 
 help/Makefile
 help/doxygen/Makefile
 help/doxygen/doxygen.dox
)