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