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