2dba79ecbfe092f982f50133677d27cad87ef028
[asterisk/asterisk.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.59)
4
5 m4_define([PBX_VERSION],
6           m4_bpatsubst(m4_esyscmd([build_tools/make_version .]),
7                        [\([0-9.]*\)\(\w\|\W\)*],
8                        [\1]))
9 AC_INIT(asterisk, PBX_VERSION, www.asterisk.org)
10
11 # cross-compile macros
12 AC_CANONICAL_BUILD
13 AC_CANONICAL_HOST
14 AC_CANONICAL_TARGET
15
16 # check existence of the package
17 AC_CONFIG_SRCDIR([asterisk.c])
18
19 # specify output header file
20 AC_CONFIG_HEADER(include/autoconfig.h)
21
22 AC_COPYRIGHT("Asterisk")
23 AC_REVISION($Revision$)
24
25 case "${host}" in
26      *freebsd*)
27      ac_default_prefix=/usr/local
28      ;;
29      *)
30      ac_default_prefix=/usr
31      if test ${sysconfdir} = '${prefix}/etc'; then
32         sysconfdir=/etc
33      fi
34      if test ${mandir} = '${prefix}/man'; then
35         mandir=/usr/share/man
36      fi
37      ;;
38 esac
39
40 if test ${localstatedir} = '${prefix}/var'; then
41      localstatedir=/var
42 fi
43
44 ### ** Platform.
45 AC_DEFINE_UNQUOTED(PBX_PLATFORM, "${host}",
46 [Define this to be the canonical name (cpu-vendor-os) of your system.])
47 AC_DEFINE_UNQUOTED(PBX_CPU, "${host_cpu}",
48 [Define this to be the name of the CPU of your system.])
49 AC_DEFINE_UNQUOTED(PBX_VENDOR, "${host_vendor}",
50 [Define this to be the name of the vendor of your system.])
51 AC_DEFINE_UNQUOTED(PBX_OS, "${host_os}",
52 [Define this to be the name of the OS of your system.])
53
54 # export some useful defines
55 PBX_PLATFORM=${host}
56 PBX_CPU=${host_cpu}
57 PBX_VENDOR=${host_vendor}
58 PBX_OS=${host_os}
59 AC_SUBST(PBX_PLATFORM)
60 AC_SUBST(PBX_CPU)
61 AC_SUBST(PBX_VENDOR)
62 AC_SUBST(PBX_OS)
63
64 #  check for uname
65 AC_PATH_TOOL([UNAME], [uname], No)
66 if test ! x"${UNAME}" = xNo; then
67    PBX_OSREV=$(${UNAME} -r)
68 fi
69 AC_SUBST(PBX_OSREV)
70
71 # guest OS type
72 case "${host}" in
73   cygwin*|mingw*|windows*|winnt)
74     AC_DEFINE(Win32, 1,
75               [Define according to your operating system type.])
76     PBX_OSTYPE="CYGWIN"
77 # this is ugly - KPF
78   OSISWIN32=1
79   AC_SUBST(OSISWIN32)
80     ;;
81   *linux*)
82     AC_DEFINE(Linux, 1,
83               [Define according to your operating system type.])
84     PBX_OSTYPE="Linux"
85     ;;
86   *netbsd*)
87     AC_DEFINE(NetBSD, 1,
88               [Define according to your operating system type.])
89     PBX_OSTYPE="NetBSD"
90     ;;
91   *freebsd*)
92     AC_DEFINE(FreeBSD, 1,
93               [Define according to your operating system type.])
94     PBX_OSTYPE="FreeBSD"
95     # XXX temporary hack to let FreeBSD use the default paths
96     # for local stuff. We need a better solution.
97     if test x"${CPPFLAGS}" = x; then
98         CPPFLAGS="-I /usr/local/include"
99     fi
100     if test x"${LDFLAGS}" = x; then
101         LDFLAGS="-L /usr/local/lib"
102     fi
103     ;;
104   *openbsd*)
105     AC_DEFINE(OpenBSD, 1,
106               [Define according to your operating system type.])
107     PBX_OSTYPE="OpenBSD"
108     ;;
109   *sun*)
110     AC_DEFINE(SunOS, 1,
111               [Define according to your operating system type.])
112     PBX_OSTYPE="SunOS"
113     ;;
114   *darwin*)
115     AC_DEFINE(Darwin, 1,
116               [Define according to your operating system type.])
117     PBX_OSTYPE="Darwin"
118     ;;
119   *)
120     AC_DEFINE(Unix, 1,
121               [Define according to your operating system type.])
122     PBX_OSTYPE="Unix"
123    ;;
124 esac
125 AC_SUBST(PBX_OSTYPE)
126
127 # This needs to be before any macros that use the C compiler
128 AC_GNU_SOURCE
129
130 AH_TOP(
131 #ifndef MENUSELECT
132 #include "asterisk/buildopts.h"
133 #endif
134
135 #ifndef _REENTRANT
136 #define _REENTRANT
137 #endif
138 )
139
140 # cross-compile checks
141 if test x"${build}" != x"${host}"; 
142 then
143    AC_CHECK_TOOL(CC, gcc, :)
144    AC_CHECK_TOOL(CXX, g++, :)
145    AC_CHECK_TOOL(RANLIB, ranlib, :)
146    AC_CHECK_TOOL(AR, ar, :)
147
148    if test x"${PBX_OSTYPE}" = xWin32;
149    then
150       AC_CHECK_TOOL(NM, nm, :)
151       AC_CHECK_TOOL(WINDRES, windres, :)
152       AC_CHECK_TOOL(DLLWRAP, dllwrap, :)
153    fi
154    crossCompile="Yes"
155 fi
156
157 # Checks for programs.
158 AC_PROG_CC
159 AC_PROG_CXX
160 AC_PROG_CPP
161 AC_PROG_CXXCPP
162 AC_PROG_AWK
163 AC_PROG_INSTALL
164 AC_PROG_LN_S
165 AC_PROG_RANLIB
166 AST_CHECK_GNU_MAKE
167
168 AC_PATH_PROG([GREP], [grep], :)
169 AC_PATH_PROG([AR], [ar], :)
170 AC_PATH_PROG([FIND], [find], :)
171 AC_PATH_PROG([COMPRESS], [compress], :)
172 AC_PATH_PROG([BASENAME], [basename], :)
173 AC_PATH_PROG([DIRNAME], [dirname], :)
174 AC_PATH_PROG([SHELL], [sh], :)
175 AC_PATH_PROG([LN], [ln], :)
176 AC_PATH_PROG([DOT], [dot], :)
177
178 AC_LANG(C)
179
180 AC_ARG_ENABLE(dev-mode,
181         [  --enable-dev-mode    Turn on developer mode],
182         [case "${enableval}" in
183               y|ye|yes) AST_DEVMODE=yes ;;
184               n|no)  AST_DEVMODE=no ;;
185               *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode)  ;;
186         esac])
187 AC_SUBST(AST_DEVMODE)
188
189 AST_EXT_LIB([asound], [snd_spcm_init], [alsa/asoundlib.h], [ALSA], [Advanced Linux Sound Architecture], [-lm -ldl])
190 AST_EXT_LIB([curses], [initscr], [curses.h], [CURSES], [curses], [])
191 AST_EXT_LIB([iksemel], [iks_start_sasl], [iksemel.h], [IKSEMEL], [Iksemel Jabber Library])
192 AST_EXT_LIB([nbs], [nbs_connect], [nbs.h], [NBS], [Network Broadcast Sound])
193 AST_EXT_LIB([ncurses], [initscr], [curses.h], [NCURSES], [ncurses], [])
194 AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt])
195 AST_EXT_LIB([odbc], [SQLConnect], [sql.h], [UNIXODBC], [unixODBC])
196 AST_EXT_LIB([ogg], [ogg_sync_init], [], [OGG], [OGG])
197 AST_EXT_LIB([osptk], [OSPPCryptoDecrypt], [osp/osp.h], [OSPTK], [OSP Toolkit], [-lcrypto -lssl])
198 AST_EXT_LIB([popt], [poptStrerror], [popt.h], [POPT], [popt])
199 AST_EXT_LIB([pri], [pri_call], [libpri.h], [LIBPRI], [ISDN PRI])
200 AST_EXT_LIB([radiusclient-ng], [rc_read_config], [radiusclient-ng.h], [RADIUSCLIENT], [Radius Client])
201 AST_EXT_LIB([speex], [speex_encode], [speex/speex.h], [SPEEX], [Speex], [-lm])
202 AST_EXT_LIB([sqlite], [sqlite_exec], [sqlite.h], [SQLITE], [SQLite])
203 AST_EXT_LIB([ssl], [ssl2_connect], [openssl/ssl.h], [OPENSSL], [OpenSSL], [-lcrypto])
204 AST_EXT_LIB([tds], [tds_version], [tds.h], [FREETDS], [FreeTDS])
205 AST_EXT_LIB([termcap], [tgetent], [], [TERMCAP], [Termcap])
206 AST_EXT_LIB([tinfo], [tgetent], [], [TINFO], [Term Info])
207 AST_EXT_LIB([vorbis], [vorbis_info_init], [vorbis/codec.h], [VORBIS], [Vorbis], [-lm -lvorbisenc])
208 AST_EXT_LIB([z], [compress], [zlib.h], [ZLIB], [zlib])
209
210 EDITLINE_LIBS=""
211 if test "x$TERMCAP_LIB" != "x" ; then
212   EDITLINE_LIBS="$TERMCAP_LIB"
213 elif test "x$TINFO_LIB" != "x" ; then
214   EDITLINE_LIBS="$TINFO_LIB"
215 elif test "x$CURSES_LIB" != "x" ; then
216   EDITLINE_LIBS="$CURSES_LIB"
217 elif test "x$NCURSES_LIB" != "x" ; then
218   EDITLINE_LIBS="$NCURSES_LIB"
219 else
220   echo "*** termcap support not found"
221   exit 1
222 fi
223 AC_SUBST(EDITLINE_LIBS)
224
225 PBX_LIBOSS=0
226 AC_CHECK_HEADER([linux/soundcard.h],
227                 [
228                 PBX_LIBOSS=1
229                 AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
230                 ])
231 if test "$PBX_LIBOSS" = "0"; then
232    AC_CHECK_HEADER([sys/soundcard.h],
233                    [
234                    PBX_LIBossaudio=1
235                    AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
236                    ])
237 fi
238 if test "$PBX_LIBOSS" = "0"; then
239    AST_EXT_LIB([ossaudio], [oss_ioctl_mixer], [soundcard.h], [OSS], [Open Sound System])
240 fi
241
242 AC_SUBST([PBX_LIBOSS])
243
244 if test "${PBX_OSTYPE}" = "Linux" ; then
245   AST_EXT_LIB([tonezone], [tone_zone_find], [linux/zaptel.h], [ZAPTEL], [Zaptel])
246 else
247   AST_EXT_LIB([tonezone], [tone_zone_find], [zaptel.h], [ZAPTEL], [Zaptel], [-lm])
248 fi
249
250 GSM_INTERNAL="yes"
251 GSM_SYSTEM="yes"
252 AC_ARG_WITH([gsm], AC_HELP_STRING([--with-gsm=PATH], [use libgsm files in PATH, or 'internal']), [
253 case ${withval} in
254      n|no)
255      USE_GSM=no
256      ;;
257      y|ye|yes)
258      ;;
259      internal)
260      GSM_SYSTEM="no"
261      ;;
262      *)
263      GSM_DIR="${withval}"
264      GSM_INTERNAL="no"
265      ;;
266 esac
267 ])
268
269 PBX_LIBgsm=0
270
271 if test "${USE_GSM}" != "no"; then
272    if test "${GSM_SYSTEM}" = "yes"; then
273       gsmlibdir=""
274       if test "x${GSM_DIR}" != "x"; then
275          gsmlibdir="-L${GSM_DIR}/lib"
276       fi
277       AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
278       [Define to indicate the GSM library]), [], ${gsmlibdir})
279       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
280          gsm_LIB="-lgsm"
281          if test "x${GSM_DIR}" != "x"; then
282             gsm_LIB="${gsmlibdir} ${gsm_LIB}"
283             gsm_INCLUDE="-I${GSM_DIR}/include"
284          fi
285          PBX_LIBgsm=1
286          GSM_INTERNAL="no"
287       fi
288    fi
289    if test "${GSM_INTERNAL}" = "yes"; then
290       gsm_LIB="internal"
291       PBX_LIBgsm=1
292    fi
293    if test "x${PBX_LIBgsm}" = "x0"; then
294       echo "***"
295       echo "*** The GSM installation on this system appears to be broken."
296       echo "*** Either correct the installation, or run configure"
297       echo "*** including --without-gsm"
298       exit 1
299    fi
300 fi
301
302 AC_SUBST([gsm_LIB])
303 AC_SUBST([gsm_INCLUDE])
304 AC_SUBST([PBX_LIBgsm])
305
306 AC_ARG_WITH([pq], AC_HELP_STRING([--with-pq=PATH],[use PostgreSQL files in PATH]),[
307 case ${withval} in
308      n|no)
309      USE_PQ=no
310      ;;
311      y|ye|yes)
312      PQ_MANDATORY="yes"
313      ;;
314      *)
315      PQ_DIR="${withval}"
316      PQ_MANDATORY="yes"
317      ;;
318 esac
319 ])
320
321 PBX_LIBpq=0
322 PG_CONFIG=No
323 if test "${USE_PQ}" != "no"; then       
324    if test "x${PQ_DIR}" != "x"; then
325       AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PQ_DIR}/bin])
326       if test x"${PG_CONFIG}" = xNo; then
327          echo "***"
328          echo "*** pg_config was not found in the path you specified:"
329          echo "*** ${PQ_DIR}/bin"
330          echo "*** Either correct the installation, or run configure"
331          echo "*** including --without-pq"
332          exit 1
333       fi
334    else
335       AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
336    fi
337 fi
338
339 if test x"${PG_CONFIG}" != xNo; then
340    PQ_libdir=`pg_config --libdir`
341    PQ_includedir=`pg_config --includedir`
342    
343    AC_CHECK_LIB([pq], [PQexec], AC_DEFINE_UNQUOTED([HAVE_PQ], 1,
344    [Define to indicate the PostgreSQL library]), [], -L${PQ_libdir} -lz)
345
346    if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
347       pq_LIB="-L${PQ_libdir} -lpq -lz"
348       pq_INCLUDE="-I${PQ_includedir}"
349       PBX_LIBpq=1
350    elif test ! -z "${PQ_MANDATORY}";
351    then
352       echo "***"
353       echo "*** The PostgreSQL installation on this system appears to be broken."
354       echo "*** Either correct the installation, or run configure"
355       echo "*** including --without-pq"
356       exit 1
357    fi
358 fi
359 AC_SUBST([pq_INCLUDE])
360 AC_SUBST([pq_LIB])
361 AC_SUBST([PBX_LIBpq])
362
363 AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
364 AC_SUBST(PBX_H323)
365
366 AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
367                                    #include <linux/version.h>
368                                    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
369                                    #include <linux/compiler.h>
370                                    #endif
371                                    ])
372 AC_SUBST(PBX_IXJUSER)
373
374 AC_LANG_PUSH(C++)
375
376 AC_ARG_WITH([vpb], AC_HELP_STRING([--with-vpb=PATH],[use vpb files in PATH]),[
377 case ${withval} in
378      n|no)
379      USE_VPB=no
380      VPB_MANDATORY="yes"
381      ;;
382      y|ye|yes)
383      ;;
384      *)
385      VPB_DIR="${withval}"
386      VPB_MANDATORY="yes"
387      ;;
388 esac
389 ])
390 if test "${USE_VPB}" != "no"; then
391    echo -n "checking for vpb_open in -lvpb... "
392    saved_libs="${LIBS}"
393    saved_cppflags="${CPPFLAGS}"
394    if test "x${VPB_DIR}" != "x"; then
395       LIBS="${LIBS} -L${VPB_DIR}/lib"
396       CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
397    fi
398    LIBS="${LIBS} -lvpb -lpthread"
399    AC_LINK_IFELSE(
400         [
401         AC_LANG_PROGRAM(
402         [#include <vpbapi.h>],
403         [int q = vpb_open(0,0);])
404         ],
405         [       AC_MSG_RESULT(yes) 
406                 ac_cv_lib_vpb_vpb_open="yes" 
407         ],
408         [       AC_MSG_RESULT(no) 
409                 ac_cv_lib_vpb_vpb_open="no" 
410         ]
411         )
412    LIBS="${saved_libs}"
413    CPPFLAGS="${saved_cppflags}"
414    PBX_LIBvpb=0
415    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
416         VPB_LIB="-lvpb"
417         if test "${VPB_DIR}" != ""; then
418            VPB_LIB="-L${VPB_DIR}/lib ${VPB_LIB}"
419            VPB_INCLUDE="-I${VPB_DIR}/include"
420            AC_SUBST([VPB_INCLUDE])
421         fi
422         AC_SUBST([VPB_LIB])
423         PBX_LIBvpb=1
424         AC_DEFINE([HAVE_LIBVPB], 1, [Define if your system has the VoiceTronix (vpb) libraries.])
425    elif test ! -z "${VPB_MANDATORY}"; 
426    then
427       echo "***"
428       echo "*** The VoiceTronix (vpb) installation on this system appears to be broken."
429       echo "*** Either correct the installation, or run configure"
430       echo "*** including --without-vpb."
431       exit 1
432    fi
433 fi
434 AC_SUBST([PBX_LIBvpb])
435
436 AC_ARG_WITH([qt], AC_HELP_STRING([--with-qt=PATH],[use Qt files in PATH]),[
437 case ${withval} in
438      n|no)
439      USE_QT=no
440      QT_MANDATORY="yes"
441      ;;
442      y|ye|yes)
443      ;;
444      *)
445      QT_DIR="${withval}"
446      QT_MANDATORY="yes"
447      ;;
448 esac
449 ])
450
451 PBX_QT=0
452 if test "${USE_QT}" != "no"; then
453    echo -n "checking for QDate in -lqt... "
454    saved_libs="${LIBS}"
455    saved_cppflags="${CPPFLAGS}"
456    if test "x${QT_DIR}" != "x"; then
457       LIBS="${LIBS} -L${QT_DIR}/lib"
458       CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
459    fi
460    LIBS="${LIBS} -lqt"
461    qtlib="qt"
462    AC_LINK_IFELSE(
463         [
464                 AC_LANG_PROGRAM(
465                 [#include <qt3/qdatetime.h>],
466                 [QDate date();])
467         ],
468         [ac_cv_lib_qt_qt_date="yes"],
469         [ac_cv_lib_qt_qt_date="no"])
470    LIBS="${saved_libs}"
471    CPPFLAGS="${saved_cppflags}"
472         
473    if test "${ac_cv_lib_qt_qt_date}" = "no"; then
474       saved_libs="${LIBS}"
475       saved_cppflags="${CPPFLAGS}"
476       if test "x${QT_DIR}" != "x"; then
477          LIBS="${LIBS} -L${QT_DIR}/lib"
478          CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
479       fi
480       LIBS="${LIBS} -lqt-mt"
481       qtlib="qt-mt"     
482       AC_LINK_IFELSE(
483                 [
484                         AC_LANG_PROGRAM(
485                         [#include <qt3/qdatetime.h>],
486                         [QDate date();])
487                 ],
488                 [ac_cv_lib_qt_qt_date="yes"],
489                 [ac_cv_lib_qt_qt_date="no"])
490       LIBS="${saved_libs}"
491       CPPFLAGS="${saved_cppflags}"
492    fi   
493
494    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
495       AC_MSG_RESULT(yes) 
496    else
497       AC_MSG_RESULT(no) 
498    fi
499         
500    if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
501       QT_LIB="-l${qtlib}"
502       if test "${QT_DIR}" != ""; then
503          QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
504          QT_INCLUDE="-I${QT_DIR}/include"
505          AC_SUBST([QT_INCLUDE])
506       fi
507       AC_SUBST([QT_LIB])
508       PBX_QT=1
509       AC_DEFINE([HAVE_LIBQT], 1, [Define if your system has the Qt library])
510       AC_PATH_TOOL(QTMOC, moc, No)
511    elif test ! -z "${QT_MANDATORY}"; 
512    then
513       echo "***"
514       echo "*** The Qt installation on this system appears to be broken."
515       echo "*** Either correct the installation, or run configure"
516       echo "*** including --without-qt."
517       exit 1
518    fi
519 fi
520 AC_SUBST([PBX_QT])
521
522 AC_ARG_WITH([kde], AC_HELP_STRING([--with-kde=PATH],[use KDE files in PATH]),[
523 case ${withval} in
524      n|no)
525      USE_KDE=no
526      KDE_MANDATORY="yes"
527      ;;
528      y|ye|yes)
529      ;;
530      *)
531      KDE_DIR="${withval}"
532      KDE_MANDATORY="yes"
533      ;;
534 esac
535 ])
536
537 PBX_KDE=0
538 if test "${USE_KDE}" != "no"; then
539    echo -n "checking for crashHandler in -lkdecore... "
540    saved_ldflags="${LDFLAGS}"
541    LDFLAGS="-I${KDE_DIR}/include ${LDFLAGS} -L${KDE_DIR}/lib -lkdecore"
542         AC_LINK_IFELSE(
543         [
544                 AC_LANG_PROGRAM(
545                 [#include "kcrash.h"],
546                 [KCrash::defaultCrashHandler(1);])
547         ],
548         [ac_cv_lib_kde_crash="yes"],
549         [ac_cv_lib_kde_crash="no"])
550                 
551         LDFLAGS="${saved_ldflags}"
552         
553         if test "${ac_cv_lib_kde_crash}" = "yes"; then
554                 AC_MSG_RESULT(yes) 
555         else
556                 AC_MSG_RESULT(no) 
557         fi
558         
559         if test "${ac_cv_lib_kde_crash}" = "yes"; then
560                 KDE_LIBS="-lkdecore -lkdeui"
561                 if test "${KDE_DIR}" != ""; then
562                         KDE_LIBS="-L${KDE_DIR}/lib ${KDE_LIBS}"
563                         KDE_INCLUDE="-I${KDE_DIR}/include"
564                         AC_SUBST([KDE_INCLUDE])
565                 fi
566                 AC_SUBST([KDE_LIBS])
567                 PBX_KDE=1
568                 AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE library])
569    elif test ! -z "${KDE_MANDATORY}"; 
570    then
571       echo "***"
572       echo "*** The KDE installation on this system appears to be broken."
573       echo "*** Either correct the installation, or run configure"
574       echo "*** including --without-kde."
575       exit 1
576    fi
577 fi
578 AC_SUBST([PBX_KDE])
579
580 if test x"${PBX_KDE}" = x1; then
581         AC_PATH_TOOL(KDEINIT, kdeinit, No)
582         if test ! x"${KDEINIT}" = xNo; then
583         KDEDIR=$(${DIRNAME} ${KDEINIT})
584         KDEDIR=$(${DIRNAME} ${KDEDIR})
585         fi
586         AC_SUBST([KDEDIR])
587 fi
588
589 AC_LANG_POP
590
591 PBX_GTK=0
592 AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
593 if test ! "x${GTKCONFIG}" = xNo; then
594    GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
595    GTK_LIBS=$(${GTKCONFIG} --libs gthread)
596    PBX_GTK=1
597    AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
598 fi
599 AC_SUBST(PBX_GTK)
600 AC_SUBST(GTK_INCLUDE)
601 AC_SUBST(GTK_LIBS)
602
603 PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
604
605 AC_ARG_WITH([pwlib], AC_HELP_STRING([--with-pwlib=PATH],[use PWLib files in PATH]),[
606 case ${withval} in
607      n|no)
608      USE_PWLIB=no
609      ;;
610      y|ye|yes)
611      ;;
612      *)
613      PWLIB_DIR="${withval}"
614      ;;
615 esac
616 ])
617 if test "${USE_PWLIB}" != "no"; then
618         echo -n "checking for existence of pwlib... "
619         
620         saved_ldflags="${LDFLAGS}"
621         LDFLAGS="${LDFLAGS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
622         
623         AC_LINK_IFELSE(
624         [
625         AC_LANG_PROGRAM(
626         [#include "${PWDIR_DIR}ptime.h"],
627         [int q = PTime::IsDaylightSaving();])
628         ],
629         [       AC_MSG_RESULT(yes) 
630                 ac_cv_lib_pwlib="yes" 
631         ],
632         [       AC_MSG_RESULT(no) 
633                 ac_cv_lib_pwlib="no" 
634         ]
635         )
636         LDFLAGS="${saved_ldflags}"
637
638         PBX_LIBPWLIB=0
639    
640    if test "${ac_cv_lib_pwlib}" = "yes"; then
641       PWLIB_LIB="-l{PLATFORM_PWLIB}"
642       if test "${PWLIB_DIR}" != ""; then
643          PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
644                         PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
645                         AC_SUBST([PWLIB_INCLUDE])
646       fi
647         AC_SUBST([PWLIB_LIB])
648         PBX_LIBPWLIB=1
649         AC_DEFINE([HAVE_LIBPWLIB], 1, [Define if your system has the pwlib libraries.])
650    elif test ! -z "${PWLIB_DIR}"; 
651    then
652       echo "***"
653       echo "*** The PWLIB installation on this system appears to be broken."
654       echo "*** Either correct the installation, or run configure"
655       echo "*** including --without-pwlib"
656       exit 1
657    fi
658 fi
659 AC_SUBST([PBX_LIBPWLIB])
660
661 PBX_CURL=0
662 AC_PATH_TOOL([CURL], [curl-config], No)
663 if test ! x"${CURL}" = xNo; then
664 # check for version
665    CURLLIBS=$(${CURL} --libs)
666    PBX_CURL=1
667    AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
668 fi
669 AC_SUBST(PBX_CURL)
670 AC_SUBST(CURLLIBS)
671
672 AC_FUNC_ALLOCA
673 AC_HEADER_DIRENT
674 AC_HEADER_STDC
675 AC_HEADER_SYS_WAIT
676 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])
677
678 AC_SYS_LARGEFILE
679
680 # Checks for typedefs, structures, and compiler characteristics.
681 AC_HEADER_STDBOOL
682 AC_C_CONST
683 AC_TYPE_UID_T
684 AC_C_INLINE
685 AC_TYPE_MODE_T
686 AC_TYPE_OFF_T
687 AC_TYPE_PID_T
688 AC_TYPE_SIZE_T
689 AC_CHECK_MEMBERS([struct stat.st_blksize])
690 AC_HEADER_TIME
691 AC_STRUCT_TM
692 AC_C_VOLATILE
693 AC_CHECK_TYPES([ptrdiff_t])
694
695 # Checks for library functions.
696 AC_FUNC_CHOWN
697 AC_FUNC_CLOSEDIR_VOID
698 AC_FUNC_ERROR_AT_LINE
699 AC_FUNC_FORK
700 AC_FUNC_FSEEKO
701 AC_PROG_GCC_TRADITIONAL
702 AC_FUNC_MALLOC
703 AC_FUNC_MEMCMP
704 AC_FUNC_MKTIME
705 AC_FUNC_MMAP
706 AC_FUNC_REALLOC
707 AC_FUNC_SELECT_ARGTYPES
708 AC_FUNC_SETVBUF_REVERSED
709 AC_TYPE_SIGNAL
710 AC_FUNC_STAT
711 AC_FUNC_STRCOLL
712 AC_FUNC_STRFTIME
713 AC_FUNC_STRNLEN
714 AC_FUNC_STRTOD
715 AC_FUNC_UTIME_NULL
716 AC_FUNC_VPRINTF
717 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])
718
719 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
720 AC_OUTPUT
721
722 echo
723 echo "               .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=..      "
724 echo "            .\$7\$7..          .7\$\$7:.    "
725 echo "          .\$\$:.                 ,\$7.7   "
726 echo "        .\$7.     7\$\$\$\$           .\$\$77  "
727 echo "     ..\$\$.       \$\$\$\$\$            .\$\$\$7 "
728 echo "    ..7\$   .?.   \$\$\$\$\$   .?.       7\$\$\$."
729 echo "   \$.\$.   .\$\$\$7. \$\$\$\$7 .7\$\$\$.      .\$\$\$."
730 echo " .777.   .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7.      \$\$\$,"
731 echo " \$\$\$~      .7\$\$\$\$\$\$\$\$\$\$\$\$\$7.       .\$\$\$."
732 echo ".\$\$7          .7\$\$\$\$\$\$\$7:          ?\$\$\$."
733 echo "\$\$\$          ?7\$\$\$\$\$\$\$\$\$\$I        .\$\$\$7 "
734 echo "\$\$\$       .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$      :\$\$\$. "
735 echo "\$\$\$       \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$    .\$\$\$.  "
736 echo "\$\$\$        \$\$\$   7\$\$\$7  .\$\$\$    .\$\$\$.   "
737 echo "\$\$\$\$             \$\$\$\$7         .\$\$\$.    "
738 echo "7\$\$\$7            7\$\$\$\$        7\$\$\$      "
739 echo " \$\$\$\$\$                        \$\$\$       "
740 echo "  \$\$\$\$7.                       \$\$  (TM)     "
741 echo "   \$\$\$\$\$\$\$.           .7\$\$\$\$\$\$  \$\$      "
742 echo "     \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$      "
743 echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
744 echo
745
746 echo "Package configured for: "
747 echo " OS type  : $PBX_OSTYPE"
748 echo " Host CPU : $host_cpu"
749 if test "x${crossCompile}" = xYes; then
750    echo ""
751    echo " Cross Compilation = YES"
752    echo " Target            = ${host}"
753 fi
754