1 # Process this file with autoconf to produce a configure script.
5 m4_define([PBX_VERSION],
6 m4_bpatsubst(m4_esyscmd([build_tools/make_version .]),
7 [\([0-9.]*\)\(\w\|\W\)*],
9 AC_INIT(asterisk, PBX_VERSION, www.asterisk.org)
11 # cross-compile macros
16 # check existence of the package
17 AC_CONFIG_SRCDIR([asterisk.c])
19 # specify output header file
20 AC_CONFIG_HEADER(include/autoconfig.h)
22 AC_COPYRIGHT("Asterisk")
23 AC_REVISION($Revision$)
28 AC_DEFINE_UNQUOTED(PBX_PLATFORM, "${host}",
29 [Define this to be the canonical name (cpu-vendor-os) of your system.])
30 AC_DEFINE_UNQUOTED(PBX_CPU, "${host_cpu}",
31 [Define this to be the name of the CPU of your system.])
32 AC_DEFINE_UNQUOTED(PBX_VENDOR, "${host_vendor}",
33 [Define this to be the name of the vendor of your system.])
34 AC_DEFINE_UNQUOTED(PBX_OS, "${host_os}",
35 [Define this to be the name of the OS of your system.])
37 # export some useful defines
40 PBX_VENDOR=${host_vendor}
42 AC_SUBST(PBX_PLATFORM)
48 AC_PATH_TOOL([UNAME], [uname], No)
49 if test ! x"${UNAME}" = xNo; then
50 PBX_OSREV=$(${UNAME} -r)
56 cygwin*|mingw*|windows*|winnt)
58 [Define according to your operating system type.])
66 [Define according to your operating system type.])
71 [Define according to your operating system type.])
76 [Define according to your operating system type.])
81 [Define according to your operating system type.])
86 [Define according to your operating system type.])
91 [Define according to your operating system type.])
96 [Define according to your operating system type.])
102 # This needs to be before any macros that use the C compiler
111 # cross-compile checks
112 if test x"${build}" != x"${host}";
114 AC_CHECK_TOOL(CC, gcc, :)
115 AC_CHECK_TOOL(CXX, g++, :)
116 AC_CHECK_TOOL(RANLIB, ranlib, :)
117 AC_CHECK_TOOL(AR, ar, :)
119 if test x"${PBX_OSTYPE}" = xWin32;
121 AC_CHECK_TOOL(NM, nm, :)
122 AC_CHECK_TOOL(WINDRES, windres, :)
123 AC_CHECK_TOOL(DLLWRAP, dllwrap, :)
128 # Checks for programs.
139 AC_PATH_PROG([GREP], [grep], :)
140 AC_PATH_PROG([AR], [ar], :)
141 AC_PATH_PROG([FIND], [find], :)
142 AC_PATH_PROG([COMPRESS], [compress], :)
143 AC_PATH_PROG([BASENAME], [basename], :)
144 AC_PATH_PROG([DIRNAME], [dirname], :)
145 AC_PATH_PROG([SHELL], [sh], :)
146 AC_PATH_PROG([LN], [ln], :)
147 AC_PATH_PROG([DOT], [dot], :)
151 AC_ARG_ENABLE(dev-mode,
152 [ --enable-dev-mode Turn on developer mode],
153 [case "${enableval}" in
154 y|ye|yes) AST_DEVMODE=yes ;;
155 n|no) AST_DEVMODE=no ;;
156 *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode) ;;
158 AC_SUBST(AST_DEVMODE)
160 AST_EXT_LIB([asound], [snd_spcm_init], [alsa/asoundlib.h], [ALSA], [Advanced Linux Sound Architecture], [-lm -ldl])
161 AST_EXT_LIB([curses], [initscr], [curses.h], [CURSES], [curses], [])
162 AST_EXT_LIB([mfcr2], [mfcr2_MakeCall], [libmfcr2.h], [MFCR2], [MFCR2])
163 AST_EXT_LIB([nbs], [nbs_setup], [nbs.h], [NBS], [Network Broadcast Sound])
164 AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt])
165 AST_EXT_LIB([odbc], [SQLConnect], [sql.h], [UNIXODBC], [unixODBC])
166 AST_EXT_LIB([ogg], [ogg_sync_init], [], [OGG], [OGG])
167 AST_EXT_LIB([osptk], [OSPPCryptoDecrypt], [osp/osp.h], [OSPTK], [OSP Toolkit], [-lcrypto -lssl])
168 AST_EXT_LIB([popt], [poptStrerror], [popt.h], [POPT], [popt])
169 AST_EXT_LIB([pri], [pri_call], [libpri.h], [LIBPRI], [ISDN PRI])
170 AST_EXT_LIB([speex], [speex_encode], [speex/speex.h], [SPEEX], [Speex], [-lm])
171 AST_EXT_LIB([sqlite], [sqlite_exec], [sqlite.h], [SQLITE], [SQLite])
172 AST_EXT_LIB([ssl], [ssl2_connect], [openssl/ssl.h], [OPENSSL], [OpenSSL], [-lcrypto])
173 AST_EXT_LIB([tds], [tds_version], [tds.h], [FREETDS], [FreeTDS])
174 AST_EXT_LIB([vorbis], [vorbis_info_init], [vorbis/codec.h], [VORBIS], [Vorbis], [-lm -lvorbisenc])
175 AST_EXT_LIB([z], [compress], [zlib.h], [ZLIB], [zlib])
177 if test "x${PBX_OSTYPE}" = "xLinux" ; then
178 AST_EXT_LIB([ossaudio], [oss_ioctl_mixer], [linux/soundcard.h], [OSS], [Open Sound System])
179 elif test "x${PBX_OSTYPE}" = "xFreeBSD" ; then
180 AST_EXT_LIB([ossaudio], [oss_ioctl_mixer], [sys/soundcard.h], [OSS], [Open Sound System])
182 AST_EXT_LIB([ossaudio], [oss_ioctl_mixer], [soundcard.h], [OSS], [Open Sound System])
185 if test "x${PBX_OSTYPE}" = "xLinux" ; then
186 AST_EXT_LIB([tonezone], [tone_zone_find], [linux/zaptel.h], [ZAPTEL], [Zaptel])
188 AST_EXT_LIB([tonezone], [tone_zone_find], [zaptel.h], [ZAPTEL], [Zaptel])
193 AC_ARG_WITH([gsm], AC_HELP_STRING([--with-gsm=PATH], [use libgsm files in PATH, or 'internal']), [
212 if test "${USE_GSM}" != "no"; then
213 if test "${GSM_SYSTEM}" = "yes"; then
214 AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
215 [Define to indicate the GSM library]), [], -L${GSM_DIR}/lib)
216 if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
218 if test "x${GSM_DIR}" != "x"; then
219 gsm_LIB="-L${GSM_DIR}/lib ${gsm_LIB}"
220 gsm_INCLUDE="-I${GSM_DIR}/include"
226 if test "${GSM_INTERNAL}" = "yes"; then
230 if test "x${PBX_LIBgsm}" = "x0"; then
232 echo "*** The GSM installation on this system appears to be broken."
233 echo "*** Either correct the installation, or run configure"
234 echo "*** including --without-gsm"
240 AC_SUBST([gsm_INCLUDE])
241 AC_SUBST([PBX_LIBgsm])
243 AC_ARG_WITH([pq], AC_HELP_STRING([--with-pq=PATH],[use PostgreSQL files in PATH]),[
260 if test "${USE_PQ}" != "no"; then
261 if test "x${PQ_DIR}" != "x"; then
262 AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PQ_DIR}/bin])
263 if test x"${PG_CONFIG}" = xNo; then
265 echo "*** pg_config was not found in the path you specified:"
266 echo "*** ${PQ_DIR}/bin"
267 echo "*** Either correct the installation, or run configure"
268 echo "*** including --without-pq"
272 AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
276 if test x"${PG_CONFIG}" != xNo; then
277 PQ_libdir=`pg_config --libdir`
278 PQ_includedir=`pg_config --includedir`
280 AC_CHECK_LIB([pq], [PQexec], AC_DEFINE_UNQUOTED([HAVE_PQ], 1,
281 [Define to indicate the PostgreSQL library]), [], -L${PQ_libdir} -lz)
283 if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
284 pq_LIB="-L${PQ_libdir} -lpq -lz"
285 pq_INCLUDE="-I${PQ_includedir}"
287 elif test ! -z "${PQ_MANDATORY}";
290 echo "*** The PostgreSQL installation on this system appears to be broken."
291 echo "*** Either correct the installation, or run configure"
292 echo "*** including --without-pq"
296 AC_SUBST([pq_INCLUDE])
298 AC_SUBST([PBX_LIBpq])
301 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [])
305 AC_CHECK_HEADER([ixjuser.h], [HAVE_QUICKNET=1],[])
306 AC_SUBST(HAVE_QUICKNET)
308 AC_ARG_WITH([vpb], AC_HELP_STRING([--with-vpb=PATH],[use vpb files in PATH]),[
322 if test "${USE_VPB}" != "no"; then
323 echo -n "checking for vpb_open in -lvpb..."
324 saved_ldflags="${LDFLAGS}"
325 LDFLAGS="${LDFLAGS} -L${VPB_DIR} -lvpb"
329 [#include "${VPB_DIR}vpbapi.h"],
330 [int q = vpb_open(0,0);])
333 ac_cv_lib_vpb_vpb_open="yes"
336 ac_cv_lib_vpb_vpb_open="no"
339 LDFLAGS="${saved_ldflags}"
342 if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
344 if test "${VPB_DIR}" != ""; then
345 VPB_LIB="-L${VPB_DIR}/lib ${VPB_LIB}"
346 VPB_INCLUDE="-I${VPB_DIR}/include"
347 AC_SUBST([VPB_INCLUDE])
351 AC_DEFINE([HAVE_LIBVPB], 1, [Define if your system has the VoiceTronix (vpb) libraries.])
352 elif test ! -z "${VPB_MANDATORY}";
355 echo "*** The VoiceTronix (vpb) installation on this system appears to be broken."
356 echo "*** Either correct the installation, or run configure"
357 echo "*** including --without-vpb."
361 AC_SUBST([PBX_LIBvpb])
366 AC_ARG_WITH([qt], AC_HELP_STRING([--with-qt=PATH],[use Qt files in PATH]),[
382 if test "${USE_QT}" != "no"; then
383 echo -n "checking for QDate in -lqt..."
384 saved_ldflags="${LDFLAGS}"
385 LDFLAGS="${LDFLAGS} -L${QT_DIR}/lib -lqt"
390 [#include "${QT_DIR}include/qdatetime.h"],
393 [ac_cv_lib_qt_qt_date="yes"],
394 [ac_cv_lib_qt_qt_date="no"])
396 if test "${ac_cv_lib_qt_qt_date}" = "no"; then
398 LDFLAGS="${saved_ldflags} -L${QT_DIR}/lib -lqt-mt"
402 [#include "${QT_DIR}include/qdatetime.h"],
405 [ac_cv_lib_qt_qt_date="yes"],
406 [ac_cv_lib_qt_qt_date="no"])
409 LDFLAGS="${saved_ldflags}"
411 if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
417 if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
419 if test "${QT_DIR}" != ""; then
420 QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
421 QT_INCLUDE="-I${QT_DIR}/include"
422 AC_SUBST([QT_INCLUDE])
426 AC_DEFINE([HAVE_LIBQT], 1, [Define if your system has the Qt library])
427 AC_PATH_TOOL(QTMOC, moc, No)
428 elif test ! -z "${QT_MANDATORY}";
431 echo "*** The Qt installation on this system appears to be broken."
432 echo "*** Either correct the installation, or run configure"
433 echo "*** including --without-qt."
442 AC_ARG_WITH([kde], AC_HELP_STRING([--with-kde=PATH],[use KDE files in PATH]),[
458 if test "${USE_KDE}" != "no"; then
459 echo -n "checking for crashHandler in -lkdecore..."
460 saved_ldflags="${LDFLAGS}"
461 LDFLAGS="-I${KDE_DIR}/include ${LDFLAGS} -L${KDE_DIR}/lib -lkdecore"
465 [#include "kcrash.h"],
466 [KCrash::defaultCrashHandler(1);])
468 [ac_cv_lib_kde_crash="yes"],
469 [ac_cv_lib_kde_crash="no"])
471 LDFLAGS="${saved_ldflags}"
473 if test "${ac_cv_lib_kde_crash}" = "yes"; then
479 if test "${ac_cv_lib_kde_crash}" = "yes"; then
480 KDE_LIBS="-lkdecore -lkdeui"
481 if test "${KDE_DIR}" != ""; then
482 KDE_LIBS="-L${KDE_DIR}/lib ${KDE_LIBS}"
483 KDE_INCLUDE="-I${KDE_DIR}/include"
484 AC_SUBST([KDE_INCLUDE])
488 AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE library])
489 elif test ! -z "${KDE_MANDATORY}";
492 echo "*** The KDE installation on this system appears to be broken."
493 echo "*** Either correct the installation, or run configure"
494 echo "*** including --without-kde."
500 if test x"${PBX_KDE}" = x1; then
501 AC_PATH_TOOL(KDEINIT, kdeinit, No)
502 if test ! x"${KDEINIT}" = xNo; then
503 KDEDIR=$(${DIRNAME} ${KDEINIT})
504 KDEDIR=$(${DIRNAME} ${KDEDIR})
512 AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
513 if test ! "x${GTKCONFIG}" = xNo; then
514 GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
515 GTK_LIBS=$(${GTKCONFIG} --libs gthread)
517 AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
520 AC_SUBST(GTK_INCLUDE)
523 PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
525 AC_ARG_WITH([pwlib], AC_HELP_STRING([--with-pwlib=PATH],[use PWLib files in PATH]),[
533 PWLIB_DIR="${withval}"
537 if test "${USE_PWLIB}" != "no"; then
538 echo -n "checking for existence of pwlib..."
540 saved_ldflags="${LDFLAGS}"
541 LDFLAGS="${LDFLAGS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
546 [#include "${PWDIR_DIR}ptime.h"],
547 [int q = PTime::IsDaylightSaving();])
550 ac_cv_lib_pwlib="yes"
556 LDFLAGS="${saved_ldflags}"
560 if test "${ac_cv_lib_pwlib}" = "yes"; then
561 PWLIB_LIB="-l{PLATFORM_PWLIB}"
562 if test "${PWLIB_DIR}" != ""; then
563 PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
564 PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
565 AC_SUBST([PWLIB_INCLUDE])
567 AC_SUBST([PWLIB_LIB])
569 AC_DEFINE([HAVE_LIBPWLIB], 1, [Define if your system has the pwlib libraries.])
570 elif test ! -z "${PWLIB_DIR}";
573 echo "*** The PWLIB installation on this system appears to be broken."
574 echo "*** Either correct the installation, or run configure"
575 echo "*** including --without-pwlib"
579 AC_SUBST([PBX_LIBPWLIB])
582 AC_PATH_TOOL([CURL], [curl-config], No)
583 if test ! x"${CURL}" = xNo; then
585 CURLLIBS=$(${CURL} --libs)
587 AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
596 AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h])
600 # Checks for typedefs, structures, and compiler characteristics.
609 AC_CHECK_MEMBERS([struct stat.st_blksize])
613 AC_CHECK_TYPES([ptrdiff_t])
615 # Checks for library functions.
617 AC_FUNC_CLOSEDIR_VOID
618 AC_FUNC_ERROR_AT_LINE
621 AC_PROG_GCC_TRADITIONAL
627 AC_FUNC_SELECT_ARGTYPES
628 AC_FUNC_SETVBUF_REVERSED
637 AC_CHECK_FUNCS([atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strchr strcspn strdup strerror strncasecmp strndup strrchr strsep strspn strstr strtol unsetenv utime strtoq strcasestr asprintf vasprintf])
639 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
643 echo " .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=.. "
644 echo " .\$7\$7.. .7\$\$7:. "
645 echo " .\$\$:. ,\$7.7 "
646 echo " .\$7. 7\$\$\$\$ .\$\$77 "
647 echo " ..\$\$. \$\$\$\$\$ .\$\$\$7 "
648 echo " ..7\$ .?. \$\$\$\$\$ .?. 7\$\$\$."
649 echo " \$.\$. .\$\$\$7. \$\$\$\$7 .7\$\$\$. .\$\$\$."
650 echo " .777. .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7. \$\$\$,"
651 echo " \$\$\$~ .7\$\$\$\$\$\$\$\$\$\$\$\$\$7. .\$\$\$."
652 echo ".\$\$7 .7\$\$\$\$\$\$\$7: ?\$\$\$."
653 echo "\$\$\$ ?7\$\$\$\$\$\$\$\$\$\$I .\$\$\$7 "
654 echo "\$\$\$ .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ :\$\$\$. "
655 echo "\$\$\$ \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$ .\$\$\$. "
656 echo "\$\$\$ \$\$\$ 7\$\$\$7 .\$\$\$ .\$\$\$. "
657 echo "\$\$\$\$ \$\$\$\$7 .\$\$\$. "
658 echo "7\$\$\$7 7\$\$\$\$ 7\$\$\$ "
659 echo " \$\$\$\$\$ \$\$\$ "
660 echo " \$\$\$\$7. \$\$ (TM) "
661 echo " \$\$\$\$\$\$\$. .7\$\$\$\$\$\$ \$\$ "
662 echo " \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$ "
663 echo " \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$. "
666 echo "Package configured for: "
667 echo " OS type : $PBX_OSTYPE"
668 echo " host cpu : $host_cpu"
669 if test "x${crossCompile}" = xYes; then
671 echo " Cross Compilation = YES"
672 echo " Target = ${host}"