-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfigure.ac
530 lines (461 loc) · 14.4 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT([freetdm], [0.1], [[email protected]])
AC_CONFIG_SRCDIR([src/ftdm_io.c])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build])
AM_INIT_AUTOMAKE
# >=automake-1.11
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# 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], [:])
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_PROG_INSTALL
# NOTE: pkg-config is used to detect libisdn
m4_ifdef([PKG_PROG_PKG_CONFIG],
[PKG_PROG_PKG_CONFIG],
[AC_MSG_WARN([pkg-config missing (required for libisdn detection)])]
)
AX_COMPILER_VENDOR
# AC_PREFIX_DEFAULT does not get expanded until too late so we need
# to do this to use prefix in this script
AC_PREFIX_DEFAULT([/usr/local/freetdm])
if test "x${prefix}" = "xNONE" ; then
prefix='/usr/local/freetdm'
fi
# Absolute source/build directory
FT_SRCDIR=`(cd $srcdir && pwd)`
ft_builddir=`pwd`
AC_SUBST([FT_SRCDIR])
AC_SUBST([ft_builddir])
if test "$sysconfdir" = "\${prefix}/etc" ; then
confdir="$prefix/conf"
else
confdir="$sysconfdir"
fi
AC_SUBST([confdir])
DEFAULT_INCLUDES="-I. -I./src/include -I\$(srcdir)"
AC_SUBST([DEFAULT_INCLUDES])
# Where to install the modules
AC_ARG_WITH([modinstdir],
[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: ${prefix}/mod)])],
[case "${withval}" in
no|yes) AC_MSG_ERROR([Invalid value \"${withval}\", option requires a valid path]) ;;
*) modinstdir="${withval}" ;;
esac],
[modinstdir="${prefix}/mod"]
)
AC_SUBST([modinstdir])
# freetdm.pc pkgconfig file
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="${libdir}/pkgconfig"]
)
AC_SUBST([pkgconfigdir])
AC_ARG_ENABLE([enable_64],
[AS_HELP_STRING([--enable-64], [Enable 64bit compilation])],
[enable_64="${enableval}"],
[enable_64="no"]
)
case "${ax_cv_c_compiler_vendor}" in
gnu)
COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0"
;;
sun)
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -xvpara"
if test "$enable_64" != "no" ; then
COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS"
fi
;;
*)
COMP_VENDOR_COMPAT_CFLAGS="-Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
COMP_VENDOR_CFLAGS="-std=c99 $COMP_VENDOR_COMPAT_CFLAGS"
;;
esac
AC_SUBST([COMP_VENDOR_COMPAT_CFLAGS])
AC_SUBST([COMP_VENDOR_CFLAGS])
# Enable debugging
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--enable-debug], [build with debug information])],
[enable_debug="${enableval}"],
[enable_debug="yes"]
)
if test "${enable_debug}" != "no"; then
AC_DEFINE([DEBUG], [], [Enable extra debugging.])
if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb"
fi
fi
AC_SUBST([COMP_VENDOR_CFLAGS])
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([m], [cos])
AC_CHECK_HEADERS([netdb.h sys/select.h execinfo.h])
AC_CHECK_FUNC([gethostbyname_r],
[], [AC_CHECK_LIB([nsl], [gethostbyname_r])]
)
if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes"
then
AC_MSG_CHECKING([whether gethostbyname_r requires five arguments])
ac_cv_func_gethostbyname_r_five_args="no"
AC_TRY_COMPILE([#include <netdb.h>],
[char *name;
struct hostent *he, *res;
char buffer[2048];
int buflen = 2048;
(void)gethostbyname_r(name, he, buffer, buflen, &res)],
[ac_cv_func_gethostbyname_r_five_args="yes"
AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])]
)
AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args])
AC_DEFINE([HAVE_GETHOSTBYNAME_R], [1], [threadsafe gethostbyname])
fi
##
## Modules and optional features
##
AC_MSG_RESULT([${as_nl}<<>> Modules and optional features])
##
# pritap (TODO: add checks)
#
HAVE_PRITAP="no"
AC_ARG_WITH([pritap],
[AS_HELP_STRING([--with-pritap], [Install ftmod_pritap])],
[case "${withval}" in
no) enable_pritap="no" ;;
*) enable_pritap="yes" ;;
esac],
[enable_pritap="no"]
)
HAVE_PRITAP="${enable_pritap}"
AM_CONDITIONAL([HAVE_PRITAP],[test "${enable_pritap}" = "yes"])
##
# OpenR2 stack
#
HAVE_OPENR2="no"
AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [HAVE_OPENR2="yes"])
AC_MSG_RESULT([checking whether to build ftmod_r2... ${HAVE_OPENR2}])
AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"])
##
# WAT GSM stack
#
HAVE_WAT="no"
AC_CHECK_LIB([wat], [wat_version], [HAVE_WAT="yes"])
AC_MSG_RESULT([checking whether to build ftmod_wat... ${HAVE_WAT}])
AM_CONDITIONAL([HAVE_WAT], [test "${HAVE_WAT}" = "yes"])
##
# Digium libpri (TODO: add checks)
#
HAVE_LIBPRI="no"
AC_ARG_WITH([libpri],
[AS_HELP_STRING([--with-libpri@<:@=PREFIX@:>@], [Install ftmod_libpri])],
[case "${withval}" in
no|yes) with_libpri="${withval}" ;;
*) AS_IF([test -d "${withval}"],
[with_libpri="${withval}"],
[AC_MSG_ERROR([Invalid argument for --with-libpri, \"${withval}\" is not a directory])]
) ;;
esac],
[with_libpri="no"]
)
if test "x${with_libpri}" != "xno"
then
save_LIBS="${LIBS}"
save_CPPFLAGS="${CPPFLAGS}"
save_LDFLAGS="${LDFLAGS}"
LIBPRI_CPPFLAGS=""
LIBPRI_LDFLAGS=""
AC_MSG_RESULT([${as_nl}<<>> Digium libpri])
AS_IF([test "x${with_libpri}" != "xyes"],
[LIBPRI_CPPFLAGS="-I${with_libpri}/include"
LIBPRI_LDFLAGS="-L${with_libpri}/lib"],
)
LDFLAGS="${save_LDFLAGS} ${LIBPRI_LDFLAGS}"
CPPFLAGS="${save_CPPFLAGS} ${LIBPRI_CPPFLAGS}"
LIBS="${LIBS} -lpri"
AC_MSG_CHECKING([whether libpri is usable])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <libpri.h>],
[const char *version = pri_get_version();
(void)version;]
)],
[AC_MSG_RESULT([yes])
HAVE_LIBPRI="yes"],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([libpri not found or unusable (see config.log for details)])]
)
AC_MSG_CHECKING([whether libpri is too old])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM(
[#include <libpri.h>],
[#if !defined(PRI_IO_FUNCS)
#error "libpri is lacking PRI_IO_FUNCS"
#elif !defined(PRI_NEW_SET_API)
#error "libpri is lacking PRI_NEW_SET_API"
#endif]
)],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])
AC_MSG_ERROR([Your version of libpri is too old (pre 1.2), please update!])]
)
AC_MSG_CHECKING([whether libpri has BRI support])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[extern void pri_new_bri_cb(void);],
[pri_new_bri_cb();]
)],
[AC_DEFINE([HAVE_LIBPRI_BRI], [1], [libpri has BRI support])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for BRI support])]
)
AC_MSG_CHECKING([whether libpri has AOC event support])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[extern void pri_aoc_events_enable(void);],
[pri_aoc_events_enable();]
)],
[AC_DEFINE([HAVE_LIBPRI_AOC], [1], [libpri has AOC event support])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for AOC event support])]
)
AC_MSG_CHECKING([whether libpri has pri_maintenance_service()])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[extern int pri_maintenance_service(void);],
[pri_maintenance_service();]
)],
[AC_DEFINE([HAVE_LIBPRI_MAINT_SERVICE], [1], [libpri has pri_maintenance_service()])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_NOTICE([You will need libpri-1.4.11 or newer for the ftdm libpri maintenance set of commands])]
)
# libpri is available, set variables for Makefile(.am)
AC_SUBST([LIBPRI_LIBS], [-lpri])
AC_SUBST([LIBPRI_LDFLAGS])
AC_SUBST([LIBPRI_CPPFLAGS])
LIBS="${save_LIBS}"
LDFLAGS="${save_LDFLAGS}"
CPPFLAGS="${save_CPPFLAGS}"
fi
AM_CONDITIONAL([HAVE_LIBPRI],[test "x${HAVE_LIBPRI}" = "xyes"])
##
# Sangoma Wanpipe
#
HAVE_LIBSANGOMA="no"
AC_MSG_RESULT([${as_nl}<<>> Sangoma Wanpipe])
AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [HAVE_LIBSANGOMA="yes"])
AC_MSG_RESULT([checking whether to build ftmod_wanpipe... ${HAVE_LIBSANGOMA}])
AM_CONDITIONAL([HAVE_LIBSANGOMA], [test "${HAVE_LIBSANGOMA}" = "yes"])
##
# Sangoma ISDN stack
#
HAVE_SNG_ISDN="no"
AC_MSG_RESULT([${as_nl}<<>> Sangoma ISDN stack])
AC_CHECK_LIB([sng_isdn], [sng_isdn_init], [HAVE_SNG_ISDN="yes"])
AC_MSG_RESULT([checking whether to build ftmod_sangoma_isdn... ${HAVE_SNG_ISDN}])
AM_CONDITIONAL([HAVE_SNG_ISDN], [test "${HAVE_SNG_ISDN}" = "yes"])
if test "${HAVE_SNG_ISDN}" = "yes"; then
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
# X86_64 machines need additional flags when compiling against libsng_isdn
CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT"
;;
esac
fi
fi
##
# Sangoma SS7 stack
#
HAVE_SNG_SS7="no"
AC_MSG_RESULT([${as_nl}<<>> Sangoma SS7 stack])
AC_CHECK_LIB([sng_ss7], [sng_isup_init_gen], [HAVE_SNG_SS7="yes"])
AC_MSG_RESULT([checking whether to build ftmod_sangoma_ss7... ${HAVE_SNG_SS7}])
AM_CONDITIONAL([HAVE_SNG_SS7], [test "${HAVE_SNG_SS7}" = "yes"])
if test "${HAVE_SNG_SS7}" = "yes"; then
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
# X86_64 machines need additional flags when compiling against libsng_isdn
CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT"
;;
esac
fi
fi
##
# zlib (required for Sangoma SS7 Transparent IAM)
#
HAVE_ZLIB="no"
AC_MSG_RESULT([${as_nl}<<>> zlib])
AC_CHECK_LIB([z], [compress], [HAVE_ZLIB="yes"])
AC_MSG_RESULT([checking whether zlib is installed... ${HAVE_ZLIB}])
AM_CONDITIONAL([HAVE_ZLIB], [test "{HAVE_ZLIB]" = "yes"])
if test "${HAVE_ZLIB}" = "yes"; then
CFLAGS="$CFLAGS -DHAVE_ZLIB"
fi
##
# libisdn
#
HAVE_LIBISDN="no"
AC_ARG_WITH([libisdn],
[AS_HELP_STRING([--with-libisdn], [Install ftmod_isdn (libisdn stack)])],
[case "${withval}" in
no) with_libisdn="no" ;;
*) with_libisdn="yes" ;;
esac
],
[with_libisdn="no"]
)
if test "${with_libisdn}" != "no"
then
AC_MSG_RESULT([${as_nl}<<>> ftmod_isdn (libisdn stack)])
m4_ifdef([PKG_CHECK_MODULES],
[PKG_CHECK_MODULES([libisdn],
[libisdn >= 0.0.1],
[AC_MSG_CHECKING([libisdn version])
LIBISDN_VERSION="`${PKG_CONFIG} --modversion libisdn`"
if test -z "${LIBISDN_VERSION}"; then
AC_MSG_ERROR([Failed to retrieve libisdn version])
fi
AC_MSG_RESULT([${LIBISDN_VERSION}])
# check features
AC_MSG_CHECKING([for new experimental API])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <libisdn/version.h>
#if !LIBISDN_FEATURE(API2)
#error "libisdn API v2 not available"
#endif
],
[;]
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
)
HAVE_LIBISDN="yes"
AC_DEFINE([HAVE_LIBISDN], [1], [libisdn support])
AC_SUBST([LIBISDN_CFLAGS], [${libisdn_CFLAGS}])
AC_SUBST([LIBISDN_CPPFLAGS],[${libisdn_CPPFLAGS}])
AC_SUBST([LIBISDN_LDFLAGS], [${libisdn_LDFLAGS}])
AC_SUBST([LIBISDN_LIBS], [${libisdn_LIBS}])
AC_SUBST([LIBISDN_VERSION])
],
[AC_MSG_ERROR([Need libisdn-0.0.1 or higher])]
)
AX_LIB_PCAP],
[AC_MSG_WARN([pkg-config missing (required for libisdn detection)])]
)
fi
AM_CONDITIONAL([HAVE_LIBISDN], [test "${HAVE_LIBISDN}" = "yes"])
##
# mISDN dependencies
#
HAVE_MISDN="no"
AC_ARG_WITH([misdn],
[AS_HELP_STRING([--with-misdn], [Install ftmod_misdn (mISDN I/O plugin)])],
[case "${withval}" in
no|yes) with_misdn="${withval}" ;;
*) AC_MSG_ERROR([Invalid value \"${with_misdn}\" for --with-misdn option]) ;;
esac],
[with_misdn="auto"]
)
AS_IF([test "${with_misdn}" != "no"],
[AC_MSG_RESULT([${as_nl}<<>> ftmod_misdn (Linux mISDN I/O plugin)])
AC_CHECK_HEADER([mISDN/mISDNif.h],
[HAVE_MISDN="yes"
AC_CHECK_LIB([rt], [clock_gettime])],
[AS_IF([test "${with_misdn}" = "yes"],
[AC_MSG_ERROR([mISDN/mISDNif.h not found])],
[AC_MSG_NOTICE([mISDN/mISDNif.h not found])]
)],
[#include <sys/socket.h>]
)]
)
AM_CONDITIONAL([HAVE_MISDN], [test "${HAVE_MISDN}" = "yes"])
#
# FreeSWITCH Module
#
# backwards compat with older pkg-config
# - pull in AC_DEFUN from pkg.m4
m4_ifndef([PKG_CHECK_VAR], [
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR
])
AC_DEFUN([PKG_CHECK_VER],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [version for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [modversion], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$4], [$3])dnl
])# PKG_CHECK_VAR
PKG_CHECK_MODULES([FREESWITCH],[freeswitch],[],[])
PKG_CHECK_VAR([fsmoddir],[freeswitch],[modulesdir])
PKG_CHECK_VAR([fsconfdir],[freeswitch],[confdir])
PKG_CHECK_VER([version],[freeswitch])
SWITCH_VERSION_MAJOR=`echo $version|cut -d. -f1`
SWITCH_VERSION_MINOR=`echo $version|cut -d. -f2`
SWITCH_VERSION_MICRO=`echo $version|cut -d. -f3`
AC_SUBST(SWITCH_VERSION_MAJOR, [$SWITCH_VERSION_MAJOR])
AC_SUBST(SWITCH_VERSION_MINOR, [$SWITCH_VERSION_MINOR])
AC_SUBST(SWITCH_VERSION_MICRO, [$SWITCH_VERSION_MICRO])
AC_SUBST(FREESWITCH_CFLAGS)
AC_SUBST(FREESWITCH_LDFLAGS)
AC_SUBST(fsmoddir)
AC_SUBST(fsconfdir)
#
#
#
AC_MSG_RESULT([${as_nl}<<>> Creating output files])
AC_CONFIG_FILES([
Makefile
freetdm.pc
])
AC_OUTPUT
#
# summary screen
#
AC_MSG_RESULT([
============================ FreeTDM configuration ============================
+ Modules
Signalling:
ftmod_analog....................... yes
ftmod_analog_em.................... yes
ftmod_isdn......................... ${HAVE_LIBISDN}
ftmod_libpri....................... ${HAVE_LIBPRI}
ftmod_sangoma_isdn................. ${HAVE_SNG_ISDN}
ftmod_sangoma_ss7.................. ${HAVE_SNG_SS7}
ftmod_r2........................... ${HAVE_OPENR2}
ftmod_gsm.......................... ${HAVE_WAT}
ftmod_pritap....................... ${HAVE_PRITAP}
I/O:
ftmod_zt........................... yes
ftmod_wanpipe...................... ${HAVE_LIBSANGOMA}
ftmod_misdn........................ ${HAVE_MISDN}
===============================================================================
])