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([nbs], [nbs_connect], [nbs.h], [NBS], [Network Broadcast Sound])
163 AST_EXT_LIB([ncurses], [initscr], [curses.h], [NCURSES], [ncurses], [])
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])
178 AC_CHECK_HEADER([linux/soundcard.h],
181 AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
183 if test "$PBX_LIBossaudio" = "0"; then
184 AC_CHECK_HEADER([sys/soundcard.h],
187 AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
190 if test "$PBX_LIBossaudio" = "0"; then
191 AST_EXT_LIB([ossaudio], [oss_ioctl_mixer], [soundcard.h], [OSS], [Open Sound System])
194 AC_SUBST([PBX_LIBossaudio])
196 AST_EXT_LIB([tonezone], [tone_zone_find], [linux/zaptel.h], [ZAPTEL], [Zaptel])
197 if test "$PBX_LIBtonezone" = "0"; then
198 AST_EXT_LIB([tonezone], [tone_zone_find], [zaptel.h], [ZAPTEL], [Zaptel], [-lm])
203 AC_ARG_WITH([gsm], AC_HELP_STRING([--with-gsm=PATH], [use libgsm files in PATH, or 'internal']), [
222 if test "${USE_GSM}" != "no"; then
223 if test "${GSM_SYSTEM}" = "yes"; then
225 if test "x${GSM_DIR}" != "x"; then
226 libdir="-L${GSM_DIR}/lib"
228 AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
229 [Define to indicate the GSM library]), [], ${libdir})
230 if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
232 if test "x${GSM_DIR}" != "x"; then
233 gsm_LIB="${libdir} ${gsm_LIB}"
234 gsm_INCLUDE="-I${GSM_DIR}/include"
240 if test "${GSM_INTERNAL}" = "yes"; then
244 if test "x${PBX_LIBgsm}" = "x0"; then
246 echo "*** The GSM installation on this system appears to be broken."
247 echo "*** Either correct the installation, or run configure"
248 echo "*** including --without-gsm"
254 AC_SUBST([gsm_INCLUDE])
255 AC_SUBST([PBX_LIBgsm])
257 AC_ARG_WITH([pq], AC_HELP_STRING([--with-pq=PATH],[use PostgreSQL files in PATH]),[
274 if test "${USE_PQ}" != "no"; then
275 if test "x${PQ_DIR}" != "x"; then
276 AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PQ_DIR}/bin])
277 if test x"${PG_CONFIG}" = xNo; then
279 echo "*** pg_config was not found in the path you specified:"
280 echo "*** ${PQ_DIR}/bin"
281 echo "*** Either correct the installation, or run configure"
282 echo "*** including --without-pq"
286 AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
290 if test x"${PG_CONFIG}" != xNo; then
291 PQ_libdir=`pg_config --libdir`
292 PQ_includedir=`pg_config --includedir`
294 AC_CHECK_LIB([pq], [PQexec], AC_DEFINE_UNQUOTED([HAVE_PQ], 1,
295 [Define to indicate the PostgreSQL library]), [], -L${PQ_libdir} -lz)
297 if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
298 pq_LIB="-L${PQ_libdir} -lpq -lz"
299 pq_INCLUDE="-I${PQ_includedir}"
301 elif test ! -z "${PQ_MANDATORY}";
304 echo "*** The PostgreSQL installation on this system appears to be broken."
305 echo "*** Either correct the installation, or run configure"
306 echo "*** including --without-pq"
310 AC_SUBST([pq_INCLUDE])
312 AC_SUBST([PBX_LIBpq])
314 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
317 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
318 #include <linux/version.h>
319 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
320 #include <linux/compiler.h>
323 AC_SUBST(PBX_IXJUSER)
327 AC_ARG_WITH([vpb], AC_HELP_STRING([--with-vpb=PATH],[use vpb files in PATH]),[
341 if test "${USE_VPB}" != "no"; then
342 echo -n "checking for vpb_open in -lvpb..."
344 saved_cppflags="${CPPFLAGS}"
345 if test "x${VPB_DIR}" != "x"; then
346 LIBS="${LIBS} -L${VPB_DIR}/lib"
347 CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
349 LIBS="${LIBS} -lvpb -lpthread"
353 [#include <vpbapi.h>],
354 [int q = vpb_open(0,0);])
357 ac_cv_lib_vpb_vpb_open="yes"
360 ac_cv_lib_vpb_vpb_open="no"
364 CPPFLAGS="${saved_cppflags}"
366 if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
368 if test "${VPB_DIR}" != ""; then
369 VPB_LIB="-L${VPB_DIR}/lib ${VPB_LIB}"
370 VPB_INCLUDE="-I${VPB_DIR}/include"
371 AC_SUBST([VPB_INCLUDE])
375 AC_DEFINE([HAVE_LIBVPB], 1, [Define if your system has the VoiceTronix (vpb) libraries.])
376 elif test ! -z "${VPB_MANDATORY}";
379 echo "*** The VoiceTronix (vpb) installation on this system appears to be broken."
380 echo "*** Either correct the installation, or run configure"
381 echo "*** including --without-vpb."
385 AC_SUBST([PBX_LIBvpb])
387 AC_ARG_WITH([qt], AC_HELP_STRING([--with-qt=PATH],[use Qt files in PATH]),[
403 if test "${USE_QT}" != "no"; then
404 echo -n "checking for QDate in -lqt..."
406 saved_cppflags="${CPPFLAGS}"
407 if test "x${QT_DIR}" != "x"; then
408 LIBS="${LIBS} -L${QT_DIR}/lib"
409 CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
416 [#include <qt3/qdatetime.h>],
419 [ac_cv_lib_qt_qt_date="yes"],
420 [ac_cv_lib_qt_qt_date="no"])
422 CPPFLAGS="${saved_cppflags}"
424 if test "${ac_cv_lib_qt_qt_date}" = "no"; then
426 saved_cppflags="${CPPFLAGS}"
427 if test "x${QT_DIR}" != "x"; then
428 LIBS="${LIBS} -L${QT_DIR}/lib"
429 CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
431 LIBS="${LIBS} -lqt-mt"
436 [#include <qt3/qdatetime.h>],
439 [ac_cv_lib_qt_qt_date="yes"],
440 [ac_cv_lib_qt_qt_date="no"])
442 CPPFLAGS="${saved_cppflags}"
445 if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
451 if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
453 if test "${QT_DIR}" != ""; then
454 QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
455 QT_INCLUDE="-I${QT_DIR}/include"
456 AC_SUBST([QT_INCLUDE])
460 AC_DEFINE([HAVE_LIBQT], 1, [Define if your system has the Qt library])
461 AC_PATH_TOOL(QTMOC, moc, No)
462 elif test ! -z "${QT_MANDATORY}";
465 echo "*** The Qt installation on this system appears to be broken."
466 echo "*** Either correct the installation, or run configure"
467 echo "*** including --without-qt."
473 AC_ARG_WITH([kde], AC_HELP_STRING([--with-kde=PATH],[use KDE files in PATH]),[
489 if test "${USE_KDE}" != "no"; then
490 echo -n "checking for crashHandler in -lkdecore..."
491 saved_ldflags="${LDFLAGS}"
492 LDFLAGS="-I${KDE_DIR}/include ${LDFLAGS} -L${KDE_DIR}/lib -lkdecore"
496 [#include "kcrash.h"],
497 [KCrash::defaultCrashHandler(1);])
499 [ac_cv_lib_kde_crash="yes"],
500 [ac_cv_lib_kde_crash="no"])
502 LDFLAGS="${saved_ldflags}"
504 if test "${ac_cv_lib_kde_crash}" = "yes"; then
510 if test "${ac_cv_lib_kde_crash}" = "yes"; then
511 KDE_LIBS="-lkdecore -lkdeui"
512 if test "${KDE_DIR}" != ""; then
513 KDE_LIBS="-L${KDE_DIR}/lib ${KDE_LIBS}"
514 KDE_INCLUDE="-I${KDE_DIR}/include"
515 AC_SUBST([KDE_INCLUDE])
519 AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE library])
520 elif test ! -z "${KDE_MANDATORY}";
523 echo "*** The KDE installation on this system appears to be broken."
524 echo "*** Either correct the installation, or run configure"
525 echo "*** including --without-kde."
531 if test x"${PBX_KDE}" = x1; then
532 AC_PATH_TOOL(KDEINIT, kdeinit, No)
533 if test ! x"${KDEINIT}" = xNo; then
534 KDEDIR=$(${DIRNAME} ${KDEINIT})
535 KDEDIR=$(${DIRNAME} ${KDEDIR})
543 AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
544 if test ! "x${GTKCONFIG}" = xNo; then
545 GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
546 GTK_LIBS=$(${GTKCONFIG} --libs gthread)
548 AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
551 AC_SUBST(GTK_INCLUDE)
554 PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
556 AC_ARG_WITH([pwlib], AC_HELP_STRING([--with-pwlib=PATH],[use PWLib files in PATH]),[
564 PWLIB_DIR="${withval}"
568 if test "${USE_PWLIB}" != "no"; then
569 echo -n "checking for existence of pwlib..."
571 saved_ldflags="${LDFLAGS}"
572 LDFLAGS="${LDFLAGS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
577 [#include "${PWDIR_DIR}ptime.h"],
578 [int q = PTime::IsDaylightSaving();])
581 ac_cv_lib_pwlib="yes"
587 LDFLAGS="${saved_ldflags}"
591 if test "${ac_cv_lib_pwlib}" = "yes"; then
592 PWLIB_LIB="-l{PLATFORM_PWLIB}"
593 if test "${PWLIB_DIR}" != ""; then
594 PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
595 PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
596 AC_SUBST([PWLIB_INCLUDE])
598 AC_SUBST([PWLIB_LIB])
600 AC_DEFINE([HAVE_LIBPWLIB], 1, [Define if your system has the pwlib libraries.])
601 elif test ! -z "${PWLIB_DIR}";
604 echo "*** The PWLIB installation on this system appears to be broken."
605 echo "*** Either correct the installation, or run configure"
606 echo "*** including --without-pwlib"
610 AC_SUBST([PBX_LIBPWLIB])
613 AC_PATH_TOOL([CURL], [curl-config], No)
614 if test ! x"${CURL}" = xNo; then
616 CURLLIBS=$(${CURL} --libs)
618 AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
627 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])
631 # Checks for typedefs, structures, and compiler characteristics.
640 AC_CHECK_MEMBERS([struct stat.st_blksize])
644 AC_CHECK_TYPES([ptrdiff_t])
646 # Checks for library functions.
648 AC_FUNC_CLOSEDIR_VOID
649 AC_FUNC_ERROR_AT_LINE
652 AC_PROG_GCC_TRADITIONAL
658 AC_FUNC_SELECT_ARGTYPES
659 AC_FUNC_SETVBUF_REVERSED
668 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])
670 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
674 echo " .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=.. "
675 echo " .\$7\$7.. .7\$\$7:. "
676 echo " .\$\$:. ,\$7.7 "
677 echo " .\$7. 7\$\$\$\$ .\$\$77 "
678 echo " ..\$\$. \$\$\$\$\$ .\$\$\$7 "
679 echo " ..7\$ .?. \$\$\$\$\$ .?. 7\$\$\$."
680 echo " \$.\$. .\$\$\$7. \$\$\$\$7 .7\$\$\$. .\$\$\$."
681 echo " .777. .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7. \$\$\$,"
682 echo " \$\$\$~ .7\$\$\$\$\$\$\$\$\$\$\$\$\$7. .\$\$\$."
683 echo ".\$\$7 .7\$\$\$\$\$\$\$7: ?\$\$\$."
684 echo "\$\$\$ ?7\$\$\$\$\$\$\$\$\$\$I .\$\$\$7 "
685 echo "\$\$\$ .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ :\$\$\$. "
686 echo "\$\$\$ \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$ .\$\$\$. "
687 echo "\$\$\$ \$\$\$ 7\$\$\$7 .\$\$\$ .\$\$\$. "
688 echo "\$\$\$\$ \$\$\$\$7 .\$\$\$. "
689 echo "7\$\$\$7 7\$\$\$\$ 7\$\$\$ "
690 echo " \$\$\$\$\$ \$\$\$ "
691 echo " \$\$\$\$7. \$\$ (TM) "
692 echo " \$\$\$\$\$\$\$. .7\$\$\$\$\$\$ \$\$ "
693 echo " \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$ "
694 echo " \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$. "
697 echo "Package configured for: "
698 echo " OS type : $PBX_OSTYPE"
699 echo " host cpu : $host_cpu"
700 if test "x${crossCompile}" = xYes; then
702 echo " Cross Compilation = YES"
703 echo " Target = ${host}"