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