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