configure.ac 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740
  1. # Process this file with autoconf to produce a configure script.
  2. #
  3. # Make sure we use autoconf 2.60 to generate the "configure" script,
  4. # in case we want to commit it. Other than that, version 2.59 is
  5. # perfectly fine for our purposes, so people who want to modify
  6. # this file just have to remember to set the AC_PREREQ argument
  7. # to something that suits their needs.
  8. AC_PREREQ(2.60)
  9. AC_INIT(asterisk, 1.6, www.asterisk.org)
  10. # cross-compile macros
  11. AC_CANONICAL_BUILD
  12. AC_CANONICAL_HOST
  13. # check existence of the package
  14. AC_CONFIG_SRCDIR([main/asterisk.c])
  15. AC_CONFIG_AUX_DIR(`pwd`)
  16. AC_COPYRIGHT("Asterisk")
  17. AC_REVISION($Revision$)
  18. # preserve any CFLAGS or LDFLAGS that may be set
  19. # NOTE: This must be done before calling any macros that end up
  20. # calling AC_PROG_CC or the like, since they will set a default
  21. # set of CFLAGS ("-g -O2") if the user did not supply any, and
  22. # we don't want those default flags to be carried over into the
  23. # rest of the build system since we have other means of controlling
  24. # debugging symbol generation and optimization.
  25. CONFIG_CFLAGS="${CFLAGS}"
  26. CONFIG_LDFLAGS="${LDFLAGS}"
  27. AC_SUBST(CONFIG_CFLAGS)
  28. AC_SUBST(CONFIG_LDFLAGS)
  29. # specify output header file
  30. AC_CONFIG_HEADER(include/asterisk/autoconfig.h)
  31. AC_USE_SYSTEM_EXTENSIONS # note- does not work on FreeBSD
  32. case "${host_os}" in
  33. freebsd*)
  34. ac_default_prefix=/usr/local
  35. CPPFLAGS=-I/usr/local/include
  36. LDFLAGS=-L/usr/local/lib
  37. ;;
  38. darwin*)
  39. AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])
  40. ;;
  41. *)
  42. ac_default_prefix=/usr
  43. if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
  44. if test ${sysconfdir} = '${prefix}/etc'; then
  45. sysconfdir=/etc
  46. fi
  47. if test ${mandir} = '${prefix}/man'; then
  48. mandir=/usr/share/man
  49. fi
  50. fi
  51. ;;
  52. esac
  53. if test ${prefix} = ${ac_default_prefix} || test ${prefix} = 'NONE'; then
  54. if test ${localstatedir} = '${prefix}/var'; then
  55. localstatedir=/var
  56. fi
  57. fi
  58. BUILD_PLATFORM=${build}
  59. BUILD_CPU=${build_cpu}
  60. BUILD_VENDOR=${build_vendor}
  61. BUILD_OS=${build_os}
  62. AC_SUBST(BUILD_PLATFORM)
  63. AC_SUBST(BUILD_CPU)
  64. AC_SUBST(BUILD_VENDOR)
  65. AC_SUBST(BUILD_OS)
  66. HOST_PLATFORM=${host}
  67. HOST_CPU=${host_cpu}
  68. HOST_VENDOR=${host_vendor}
  69. HOST_OS=${host_os}
  70. AC_SUBST(HOST_PLATFORM)
  71. AC_SUBST(HOST_CPU)
  72. AC_SUBST(HOST_VENDOR)
  73. AC_SUBST(HOST_OS)
  74. WINARCH=0
  75. case "${host_os}" in
  76. freebsd*)
  77. OSARCH=FreeBSD
  78. ;;
  79. netbsd*)
  80. OSARCH=NetBSD
  81. ;;
  82. openbsd*)
  83. OSARCH=OpenBSD
  84. ;;
  85. solaris*)
  86. OSARCH=SunOS
  87. ;;
  88. mingw32)
  89. OSARCH=mingw32
  90. WINARCH=1
  91. ;;
  92. cygwin)
  93. OSARCH=cygwin
  94. WINARCH=1
  95. ;;
  96. linux-gnueabi)
  97. OSARCH=linux-gnu
  98. ;;
  99. *)
  100. OSARCH=${host_os}
  101. ;;
  102. esac
  103. AC_SUBST(OSARCH)
  104. AC_SUBST(WINARCH)
  105. # check for uname
  106. AC_PATH_TOOL([UNAME], [uname], No)
  107. if test ! x"${UNAME}" = xNo; then
  108. PBX_OSREV=$(${UNAME} -r)
  109. fi
  110. AC_SUBST(PBX_OSREV)
  111. AH_TOP(
  112. #ifndef ASTERISK_AUTOCONFIG_H
  113. #define ASTERISK_AUTOCONFIG_H
  114. #include "asterisk/buildopts.h"
  115. )
  116. AH_BOTTOM(
  117. #endif
  118. )
  119. # cross-compile checks
  120. if test "${cross_compiling}" = "yes";
  121. then
  122. AC_CHECK_TOOL(CC, gcc, :)
  123. AC_CHECK_TOOL(CXX, g++, :)
  124. AC_CHECK_TOOL(LD, ld, :)
  125. AC_CHECK_TOOL(RANLIB, ranlib, :)
  126. fi
  127. # Checks for programs.
  128. AC_PROG_CC
  129. AC_PROG_CXX
  130. AC_PROG_CPP
  131. AC_PROG_CXXCPP
  132. # This macro is just copied into our local acinclude.m4 from libtool.m4 so that
  133. # the developers regenerating the configure script don't have to install libtool.
  134. AST_PROG_LD # note, does not work on FreeBSD
  135. AC_PROG_AWK
  136. AC_PROG_INSTALL
  137. AC_PROG_LN_S
  138. AC_PROG_RANLIB
  139. AST_CHECK_GNU_MAKE
  140. AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
  141. AC_CHECK_TOOLS([AR], [ar gar], :)
  142. GNU_LD=0
  143. if test "x$with_gnu_ld" = "xyes" ; then
  144. GNU_LD=1
  145. fi
  146. AC_SUBST(GNU_LD)
  147. AC_PATH_PROG([BISON], [bison], :)
  148. AC_PATH_PROG([FLEX], [flex], :)
  149. AC_PATH_PROG([GREP], [grep], :)
  150. AC_PATH_PROG([FIND], [find], :)
  151. AC_PATH_PROG([COMPRESS], [compress], :)
  152. AC_PATH_PROG([BASENAME], [basename], :)
  153. AC_PATH_PROG([DIRNAME], [dirname], :)
  154. AC_PATH_PROG([SHELL], [sh], :)
  155. AC_PATH_PROG([LN], [ln], :)
  156. AC_PATH_PROG([DOT], [dot], :)
  157. AC_PATH_PROG([WGET], [wget], :)
  158. AC_PATH_PROG([RUBBER], [rubber], :)
  159. AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
  160. if test "${WGET}" != ":" ; then
  161. DOWNLOAD=${WGET}
  162. else
  163. AC_PATH_PROG([FETCH], [fetch], [:])
  164. DOWNLOAD=${FETCH}
  165. fi
  166. AC_SUBST(DOWNLOAD)
  167. AC_CACHE_CHECK([for bison that supports parse-param], [ac_cv_path_BISON2], [
  168. if test "x$BISON" != "x:" ; then
  169. # Create a temporary directory $tmp in $TMPDIR (default /tmp).
  170. # Use mktemp if possible; otherwise fall back on mkdir,
  171. # with $RANDOM to make collisions less likely.
  172. : ${TMPDIR=/tmp}
  173. {
  174. tmp=`
  175. (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
  176. ` &&
  177. test -n "$tmp" && test -d "$tmp"
  178. } || {
  179. tmp=$TMPDIR/foo$$-$RANDOM
  180. (umask 077 && mkdir "$tmp")
  181. } || exit $?
  182. cat >$tmp/test.y <<__EOL__
  183. %parse-param {struct parse_io *parseio}
  184. %%
  185. file : { \$\$ = parseio->pval = 1; }
  186. ;
  187. %%
  188. __EOL__
  189. ${BISON} -o ${tmp}/test.tab.c ${tmp}/test.y >/dev/null 2>&1
  190. if test -e "${tmp}/test.tab.c"; then
  191. ac_cv_path_BISON2=${BISON}
  192. fi
  193. rm -rf ${tmp}
  194. fi
  195. ])
  196. if test "x${ac_cv_path_BISON2}" = "x" ; then
  197. BISON=:
  198. PBX_BISON=0
  199. else
  200. PBX_BISON=1
  201. fi
  202. AC_SUBST(PBX_BISON)
  203. if test "x${FLEX}" = "x:" ; then
  204. PBX_FLEX=0
  205. else
  206. PBX_FLEX=1
  207. fi
  208. AC_SUBST(PBX_FLEX)
  209. AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
  210. if test "${SOXMIX}" != ":" ; then
  211. AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
  212. fi
  213. AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])
  214. if test "${MD5}" = "digest" ; then
  215. MD5="${MD5} -a md5"
  216. fi
  217. ACX_PTHREAD
  218. AC_LANG(C)
  219. AC_ARG_ENABLE(dev-mode,
  220. [ --enable-dev-mode Turn on developer mode],
  221. [case "${enableval}" in
  222. y|ye|yes) AST_DEVMODE=yes ;;
  223. n|no) AST_DEVMODE=no ;;
  224. *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode) ;;
  225. esac])
  226. AC_SUBST(AST_DEVMODE)
  227. # AST_EXT_LIB_SETUP is used to tell configure to handle variables for
  228. # various packages.
  229. # $1 is the prefix for the variables in makeopts and autoconfig.h
  230. # $2 is the short comment, $4 is the long comment
  231. # $3 is the name used in --with- or --without- flags for configure.
  232. #
  233. # Package option names should be in alphabetical order
  234. # by the --with option name (the third field),
  235. # to make things easier for the users.
  236. AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
  237. # BKTR is used for backtrace support on platforms that do not
  238. # have it natively.
  239. AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
  240. AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
  241. AST_EXT_LIB_SETUP([CURL], [cURL], [curl])
  242. AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
  243. AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
  244. AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
  245. AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
  246. AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
  247. AST_EXT_LIB_SETUP([GTK], [gtk], [gtk])
  248. AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
  249. AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
  250. AST_EXT_LIB_SETUP([HOARD], [Hoard Memory Allocator], [hoard])
  251. AST_EXT_LIB_SETUP([ICONV], [Iconv], [iconv])
  252. AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber], [iksemel])
  253. AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
  254. AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux], [isdnnet])
  255. AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
  256. AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
  257. AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
  258. AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
  259. AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn])
  260. AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
  261. AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
  262. AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
  263. AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
  264. AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [odbc])
  265. AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
  266. AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
  267. AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
  268. AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
  269. AST_EXT_LIB_SETUP([POPT], [popt], [popt])
  270. AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
  271. AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
  272. AST_EXT_LIB_SETUP_DEPENDENT([PRI_INBANDDISCONNECT], [ISDN PRI set_inbanddisconnect], [PRI], [pri])
  273. AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
  274. AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
  275. AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
  276. AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
  277. AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
  278. AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
  279. AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
  280. AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
  281. AST_EXT_LIB_SETUP([OPENAIS], [OpenAIS], [openais])
  282. AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
  283. AST_EXT_LIB_SETUP([SPEEX_PREPROCESS], [Speex preprocess routines], [speex])
  284. AST_EXT_LIB_SETUP([SPEEXDSP], [SpeexDSP], [speexdsp])
  285. AST_EXT_LIB_SETUP_DEPENDENT([SPEEX_PREPROCESS], [speex_preprocess_ctl], [], [speex])
  286. AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
  287. AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
  288. AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
  289. AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
  290. AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
  291. AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
  292. AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
  293. AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
  294. AST_EXT_LIB_SETUP([USB], [usb], [usb])
  295. AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
  296. AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
  297. AST_EXT_LIB_SETUP([X11], [X11], [x11])
  298. AST_EXT_LIB_SETUP([ZLIB], [zlib compression], [z])
  299. # check for basic system features and functionality before
  300. # checking for package libraries
  301. AC_FUNC_ALLOCA
  302. AC_HEADER_DIRENT
  303. AC_HEADER_STDC
  304. AC_HEADER_SYS_WAIT
  305. 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 arpa/nameser.h sys/io.h])
  306. AC_CHECK_HEADERS([winsock.h winsock2.h])
  307. AC_CHECK_HEADER([sys/poll.h],
  308. [],
  309. AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]))
  310. AC_SYS_LARGEFILE
  311. # Checks for typedefs, structures, and compiler characteristics.
  312. AC_HEADER_STDBOOL
  313. AC_C_CONST
  314. AC_TYPE_UID_T
  315. AC_C_INLINE
  316. AC_TYPE_MODE_T
  317. AC_TYPE_OFF_T
  318. AC_TYPE_PID_T
  319. AC_TYPE_SIZE_T
  320. AC_CHECK_MEMBERS([struct stat.st_blksize])
  321. AC_HEADER_TIME
  322. AC_STRUCT_TM
  323. AC_C_VOLATILE
  324. AC_CHECK_TYPES([ptrdiff_t])
  325. # Checks for library functions.
  326. AC_FUNC_CHOWN
  327. AC_FUNC_CLOSEDIR_VOID
  328. AC_FUNC_ERROR_AT_LINE
  329. AST_FUNC_FORK
  330. AC_FUNC_FSEEKO
  331. AC_PROG_GCC_TRADITIONAL
  332. # XXX: these are commented out until we determine whether it matters if our malloc()
  333. # acts exactly like glibc's or not
  334. # AC_FUNC_MALLOC
  335. # AC_FUNC_REALLOC
  336. AC_FUNC_MEMCMP
  337. AC_FUNC_MMAP
  338. AC_FUNC_SELECT_ARGTYPES
  339. AC_FUNC_SETVBUF_REVERSED
  340. AC_TYPE_SIGNAL
  341. AC_FUNC_STAT
  342. AC_FUNC_STRCOLL
  343. AC_FUNC_STRFTIME
  344. AC_FUNC_STRNLEN
  345. AC_FUNC_STRTOD
  346. AC_FUNC_UTIME_NULL
  347. AC_FUNC_VPRINTF
  348. AC_CHECK_FUNCS([asprintf atexit dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf])
  349. # BSD might not have exp2, and/or log2
  350. AC_CHECK_LIB([m], [sqrt])
  351. AC_CHECK_FUNCS([exp2l log2l exp10l log10l sinl cosl tanl asinl acosl atanl atan2l powl sqrtl rintl expl logl remainderl fmodl roundl truncl floorl ceill exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil])
  352. AC_MSG_CHECKING(for timersub in time.h)
  353. AC_LINK_IFELSE(
  354. AC_LANG_PROGRAM([#include <sys/time.h>],
  355. [struct timeval *a; timersub(a, a, a);]),
  356. AC_MSG_RESULT(yes)
  357. AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system defines timersub.]),
  358. AC_MSG_RESULT(no)
  359. )
  360. AC_CHECK_HEADER([sys/poll.h],
  361. [HAS_POLL=1]
  362. AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
  363. )
  364. AC_ARG_ENABLE(internal-poll,
  365. [ --enable-internal-poll Use Asterisk's poll implementation],
  366. [case "${enableval}" in
  367. y|ye|yes) HAS_POLL="";;
  368. n|no) HAS_POLL="${HAS_POLL}" ;;
  369. *) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
  370. esac])
  371. AC_SUBST(HAS_POLL)
  372. # https support (in main/http.c) uses funopen on BSD systems,
  373. # fopencookie on linux
  374. AC_CHECK_FUNCS([funopen fopencookie])
  375. AC_CHECK_FUNCS([inet_aton])
  376. # check if we have IP_PKTINFO constant defined
  377. AC_MSG_CHECKING(for IP_PKTINFO)
  378. AC_LINK_IFELSE(
  379. AC_LANG_PROGRAM([#include <netinet/in.h>],
  380. [int pi = IP_PKTINFO;]),
  381. AC_MSG_RESULT(yes)
  382. AC_DEFINE([HAVE_PKTINFO], 1, [Define to 1 if your system defines IP_PKTINFO.]),
  383. AC_MSG_RESULT(no)
  384. )
  385. # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
  386. AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
  387. AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
  388. AC_LINK_IFELSE(
  389. AC_LANG_PROGRAM([#include <stdlib.h>
  390. #include <netdb.h>],
  391. [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);]),
  392. AC_MSG_RESULT(yes)
  393. AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
  394. AC_MSG_RESULT(no)
  395. )
  396. AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
  397. AC_LINK_IFELSE(
  398. AC_LANG_PROGRAM([#include <stdlib.h>
  399. #include <netdb.h>],
  400. [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);]),
  401. AC_MSG_RESULT(yes)
  402. AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
  403. AC_MSG_RESULT(no)
  404. )
  405. AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])
  406. AC_MSG_CHECKING(for __swap16 variant of <sys/endian.h> byteswapping macros)
  407. AC_LINK_IFELSE(
  408. AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = __swap16(a);]),
  409. AC_MSG_RESULT(yes)
  410. AC_DEFINE([HAVE_SYS_ENDIAN_SWAP16], 1, [Define to 1 if your sys/endian.h header file provides the __swap16 macro.]),
  411. AC_MSG_RESULT(no)
  412. )
  413. AC_MSG_CHECKING(for bswap16 variant of <sys/endian.h> byteswapping macros)
  414. AC_LINK_IFELSE(
  415. AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = bswap16(a);]),
  416. AC_MSG_RESULT(yes)
  417. AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
  418. AC_MSG_RESULT(no)
  419. )
  420. if test "${cross_compiling}" = "no";
  421. then
  422. AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
  423. fi
  424. AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_INITIALIZER], [PTHREAD_RWLOCK_INITIALIZER], [pthread.h])
  425. AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h)
  426. AC_LINK_IFELSE(
  427. AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;]),
  428. AC_MSG_RESULT(yes)
  429. AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system defines PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h]),
  430. AC_MSG_RESULT(no)
  431. )
  432. AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h)
  433. AC_LINK_IFELSE(
  434. AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_MUTEX_RECURSIVE_NP;]),
  435. AC_MSG_RESULT(yes)
  436. AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, [Define to 1 if your system defines PTHREAD_MUTEX_RECURSIVE_NP in pthread.h]),
  437. AC_MSG_RESULT(no)
  438. )
  439. AC_MSG_CHECKING(for pthread_rwlock_timedwrlock() in pthread.h)
  440. save_LIBS="$LIBS"
  441. save_CFLAGS="$CFLAGS"
  442. LIBS="$PTHREAD_LIBS $LIBS"
  443. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  444. AC_LINK_IFELSE(
  445. [AC_LANG_PROGRAM(
  446. [#include <pthread.h>
  447. #include <time.h>],
  448. [pthread_rwlock_t foo; struct timespec bar; pthread_rwlock_timedwrlock(&foo, &bar)])
  449. ],[
  450. AC_MSG_RESULT(yes)
  451. ac_cv_pthread_rwlock_timedwrlock="yes"
  452. ],[
  453. AC_MSG_RESULT(no)
  454. ac_cv_pthread_rwlock_timedwrlock="no"
  455. ]
  456. )
  457. LIBS="$save_LIBS"
  458. CFLAGS="$save_CFLAGS"
  459. if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
  460. AC_DEFINE([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK], 1, [Define if your system has pthread_rwlock_timedwrlock()])
  461. fi
  462. AC_MSG_CHECKING(if PTHREAD_ONCE_INIT needs braces)
  463. saved_CFLAGS="${CFLAGS}"
  464. CFLAGS="${CFLAGS} -Werror -Wmissing-braces"
  465. AC_COMPILE_IFELSE(
  466. [AC_LANG_PROGRAM(
  467. [#include <pthread.h>
  468. void empty(){}],
  469. [pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, empty);])
  470. ],[
  471. AC_MSG_RESULT(no)
  472. ac_cv_pthread_once_needsbraces="no"
  473. ],[
  474. AC_MSG_RESULT(yes)
  475. ac_cv_pthread_once_needsbraces="yes"
  476. ]
  477. )
  478. CFLAGS="${saved_CFLAGS}"
  479. if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
  480. AC_DEFINE([PTHREAD_ONCE_INIT_NEEDS_BRACES], 1, [Define if your system needs braces around PTHREAD_ONCE_INIT])
  481. fi
  482. AST_C_DEFINE_CHECK([PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [pthread.h])
  483. # Can we compare a mutex to its initial value?
  484. # Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
  485. AC_MSG_CHECKING(whether we can compare a mutex to its initial value)
  486. AC_LINK_IFELSE(
  487. AC_LANG_PROGRAM([#include <pthread.h>], [pthread_mutex_t lock;
  488. if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
  489. return 0;
  490. }
  491. return 0]),
  492. AC_MSG_RESULT(yes)
  493. AC_DEFINE([CAN_COMPARE_MUTEX_TO_INIT_VALUE], 1, [Define to 1 if your system's implementation of mutexes supports comparison of a mutex to its initializer.]),
  494. AC_MSG_RESULT(no)
  495. )
  496. #if test "${cross_compiling}" = "no";
  497. #then
  498. #AC_MSG_CHECKING(for working epoll support)
  499. #AC_LINK_IFELSE(
  500. #AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
  501. # if (res < 0)
  502. # return 1;
  503. # close (res);
  504. # return 0;]),
  505. #AC_MSG_RESULT(yes)
  506. #AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
  507. #AC_MSG_RESULT(no)
  508. #)
  509. #fi
  510. AC_MSG_CHECKING(for compiler atomic operations)
  511. AC_LINK_IFELSE(
  512. AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
  513. AC_MSG_RESULT(yes)
  514. AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
  515. AC_MSG_RESULT(no)
  516. )
  517. AST_GCC_ATTRIBUTE(pure)
  518. AST_GCC_ATTRIBUTE(malloc)
  519. AST_GCC_ATTRIBUTE(const)
  520. AST_GCC_ATTRIBUTE(unused)
  521. AST_GCC_ATTRIBUTE(always_inline)
  522. AST_GCC_ATTRIBUTE(deprecated)
  523. AST_GCC_ATTRIBUTE(sentinel)
  524. AST_GCC_ATTRIBUTE(warn_unused_result)
  525. AST_GCC_ATTRIBUTE(weak)
  526. AC_MSG_CHECKING(for -ffunction-sections support)
  527. saved_CFLAGS="${CFLAGS}"
  528. CFLAGS="${CFLAGS} -ffunction-sections"
  529. AC_COMPILE_IFELSE(
  530. AC_LANG_PROGRAM([], [int x = 1;]),
  531. AC_MSG_RESULT(yes)
  532. [saved_LDFLAGS="${LDFLAGS}"]
  533. [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
  534. AC_MSG_CHECKING(for --gc-sections support)
  535. AC_LINK_IFELSE(
  536. AC_LANG_PROGRAM([], [int x = 1;]),
  537. AC_MSG_RESULT(yes)
  538. [GC_CFLAGS="-ffunction-sections"]
  539. [[GC_LDFLAGS="-Wl,--gc-sections"]],
  540. AC_MSG_RESULT(no)
  541. )
  542. [LDFLAGS="${saved_LDFLAGS}"],
  543. AC_MSG_RESULT(no)
  544. )
  545. CFLAGS="${saved_CFLAGS}"
  546. AC_SUBST(GC_CFLAGS)
  547. AC_SUBST(GC_LDFLAGS)
  548. AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
  549. if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  550. AC_MSG_RESULT(yes)
  551. AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
  552. else
  553. AC_MSG_RESULT(no)
  554. AST_DECLARATION_AFTER_STATEMENT=
  555. fi
  556. AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
  557. AC_MSG_CHECKING(for _FORTIFY_SOURCE support)
  558. if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  559. AC_MSG_RESULT(yes)
  560. AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
  561. else
  562. AC_MSG_RESULT(no)
  563. AST_FORTIFY_SOURCE=
  564. fi
  565. AC_SUBST(AST_FORTIFY_SOURCE)
  566. AC_MSG_CHECKING(for -fno-strict-overflow)
  567. if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  568. AC_MSG_RESULT(yes)
  569. AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
  570. else
  571. AC_MSG_RESULT(no)
  572. AST_NO_STRICT_OVERFLOW=
  573. fi
  574. AC_SUBST(AST_NO_STRICT_OVERFLOW)
  575. AC_MSG_CHECKING(for -Wshadow)
  576. if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  577. AC_MSG_RESULT(yes)
  578. AST_SHADOW_WARNINGS=-Wshadow
  579. else
  580. AC_MSG_RESULT(no)
  581. AST_SHADOW_WARNINGS=
  582. fi
  583. AC_SUBST(AST_SHADOW_WARNINGS)
  584. AC_MSG_CHECKING(for sysinfo)
  585. AC_LINK_IFELSE(
  586. AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
  587. [struct sysinfo sys_info; int uptime = sys_info.uptime]),
  588. AC_MSG_RESULT(yes)
  589. AC_DEFINE([HAVE_SYSINFO], 1, [Define to 1 if your system has sysinfo support]),
  590. AC_MSG_RESULT(no)
  591. )
  592. AC_SEARCH_LIBS(res_9_ninit, resolv)
  593. AC_MSG_CHECKING(for res_ninit)
  594. AC_LINK_IFELSE(
  595. AC_LANG_PROGRAM([
  596. #ifdef HAVE_SYS_SOCKET_H
  597. #include <sys/socket.h>
  598. #endif
  599. #ifdef HAVE_NETINET_IN_H
  600. #include <netinet/in.h>
  601. #endif
  602. #ifdef HAVE_ARPA_NAMESER_H
  603. #include <arpa/nameser.h>
  604. #endif
  605. #include <resolv.h>],
  606. [int foo = res_ninit(NULL);]),
  607. AC_MSG_RESULT(yes)
  608. AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
  609. AC_SEARCH_LIBS(res_9_ndestroy, resolv)
  610. AC_MSG_CHECKING(for res_ndestroy)
  611. AC_LINK_IFELSE(
  612. AC_LANG_PROGRAM([
  613. #ifdef HAVE_SYS_SOCKET_H
  614. #include <sys/socket.h>
  615. #endif
  616. #ifdef HAVE_NETINET_IN_H
  617. #include <netinet/in.h>
  618. #endif
  619. #ifdef HAVE_ARPA_NAMESER_H
  620. #include <arpa/nameser.h>
  621. #endif
  622. #include <resolv.h>],
  623. [res_ndestroy(NULL);]),
  624. AC_MSG_RESULT(yes)
  625. AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
  626. AC_MSG_RESULT(no)
  627. ),
  628. AC_MSG_RESULT(no)
  629. )
  630. AST_C_DEFINE_CHECK([GLOB_NOMAGIC], [GLOB_NOMAGIC], [glob.h])
  631. AST_C_DEFINE_CHECK([GLOB_BRACE], [GLOB_BRACE], [glob.h])
  632. AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
  633. AC_CHECK_HEADER([libkern/OSAtomic.h],
  634. [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
  635. AC_CHECK_SIZEOF(int)
  636. # do the package library checks now
  637. AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
  638. AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
  639. if test "x${OSARCH}" = "xlinux-gnu" ; then
  640. AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
  641. fi
  642. AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
  643. AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
  644. GSM_INTERNAL="yes"
  645. AC_SUBST(GSM_INTERNAL)
  646. GSM_SYSTEM="yes"
  647. if test "${USE_GSM}" != "no"; then
  648. if test "${GSM_DIR}" = "internal"; then
  649. GSM_SYSTEM="no"
  650. elif test "${GSM_DIR}" != ""; then
  651. GSM_INTERNAL="no"
  652. fi
  653. if test "${GSM_SYSTEM}" = "yes"; then
  654. gsmlibdir=""
  655. if test "x${GSM_DIR}" != "x"; then
  656. if test -d ${GSM_DIR}/lib; then
  657. gsmlibdir="-L${GSM_DIR}/lib"
  658. else
  659. gsmlibdir="-L${GSM_DIR}"
  660. fi
  661. fi
  662. AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
  663. [Define to indicate the GSM library]), [], ${gsmlibdir})
  664. if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
  665. if test "x${GSM_DIR}" != "x" ; then
  666. AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
  667. AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
  668. else
  669. AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
  670. AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
  671. fi
  672. if test "${GSM_HEADER_FOUND}" = "0" ; then
  673. if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
  674. if test "x${GSM_MANDATORY}" = "xyes" ; then
  675. AC_MSG_NOTICE([***])
  676. AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
  677. AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
  678. AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
  679. exit 1
  680. fi
  681. fi
  682. fi
  683. GSM_OK=0
  684. if test "${GSM_HEADER_FOUND}" = "1" ; then
  685. AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
  686. GSM_OK=1
  687. else
  688. if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
  689. AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
  690. GSM_OK=1
  691. fi
  692. fi
  693. if test "${GSM_OK}" = "1" ; then
  694. GSM_LIB="-lgsm"
  695. if test "x${GSM_DIR}" != "x"; then
  696. GSM_LIB="${gsmlibdir} ${GSM_LIB}"
  697. GSM_INCLUDE="-I${GSM_DIR}/include"
  698. fi
  699. PBX_GSM=1
  700. GSM_INTERNAL="no"
  701. fi
  702. fi
  703. fi
  704. if test "${GSM_INTERNAL}" = "yes"; then
  705. PBX_GSM=1
  706. AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
  707. fi
  708. fi
  709. AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
  710. # Some versions of Linux package iconv in glibc
  711. AST_EXT_LIB_CHECK([ICONV], [c], [iconv_close], [iconv.h])
  712. AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
  713. if test "${USE_IMAP_TK}" != "no"; then
  714. saved_cppflags="${CPPFLAGS}"
  715. saved_libs="${LIBS}"
  716. switch_to_system_on_failure="no"
  717. if test "${IMAP_TK_DIR}" = ""; then
  718. IMAP_TK_DIR=`pwd`"/../imap-2004g"
  719. switch_to_system_on_failure="yes"
  720. fi
  721. if test "${IMAP_TK_DIR}" != "system"; then
  722. AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
  723. if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
  724. imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
  725. fi
  726. imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
  727. imap_include="-I${IMAP_TK_DIR}/c-client"
  728. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  729. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  730. AC_LINK_IFELSE(
  731. AC_LANG_PROGRAM(
  732. [#include "c-client.h"
  733. void mm_searched (MAILSTREAM *stream,unsigned long number)
  734. {
  735. }
  736. void mm_exists (MAILSTREAM *stream,unsigned long number)
  737. {
  738. }
  739. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  740. {
  741. }
  742. void mm_flags (MAILSTREAM *stream,unsigned long number)
  743. {
  744. }
  745. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  746. {
  747. }
  748. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  749. {
  750. }
  751. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  752. {
  753. }
  754. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  755. {
  756. }
  757. void mm_log (char *string,long errflg)
  758. {
  759. }
  760. void mm_dlog (char *string)
  761. {
  762. }
  763. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  764. {
  765. }
  766. void mm_critical (MAILSTREAM *stream)
  767. {
  768. }
  769. void mm_nocritical (MAILSTREAM *stream)
  770. {
  771. }
  772. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  773. {
  774. }
  775. void mm_fatal (char *string)
  776. {
  777. }],
  778. [
  779. MAILSTREAM *foo = mail_open(NULL, "", 0);
  780. ]
  781. ),
  782. [ac_cv_imap_tk="yes"],
  783. [ac_cv_imap_tk="no"]
  784. )
  785. if test "${ac_cv_imap_tk}" = "yes"; then
  786. AC_LINK_IFELSE(
  787. AC_LANG_PROGRAM(
  788. [#include "c-client.h"
  789. void mm_searched (MAILSTREAM *stream,unsigned long number)
  790. {
  791. }
  792. void mm_exists (MAILSTREAM *stream,unsigned long number)
  793. {
  794. }
  795. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  796. {
  797. }
  798. void mm_flags (MAILSTREAM *stream,unsigned long number)
  799. {
  800. }
  801. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  802. {
  803. }
  804. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  805. {
  806. }
  807. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  808. {
  809. }
  810. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  811. {
  812. }
  813. void mm_log (char *string,long errflg)
  814. {
  815. }
  816. void mm_dlog (char *string)
  817. {
  818. }
  819. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  820. {
  821. }
  822. void mm_critical (MAILSTREAM *stream)
  823. {
  824. }
  825. void mm_nocritical (MAILSTREAM *stream)
  826. {
  827. }
  828. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  829. {
  830. }
  831. void mm_fatal (char *string)
  832. {
  833. }],
  834. [
  835. long check = mail_expunge_full(NULL, "", 0);
  836. ]
  837. ),
  838. [ac_cv_imap_tk2006="yes"],
  839. [ac_cv_imap_tk2006="no"]
  840. )
  841. fi
  842. CPPFLAGS="${saved_cppflags}"
  843. LIBS="${saved_libs}"
  844. if test "${ac_cv_imap_tk}" = "no"; then
  845. AC_MSG_RESULT(no)
  846. if test "${switch_to_system_on_failure}" = "yes"; then
  847. IMAP_TK_DIR="system"
  848. else #This means they specified a directory. Search for a package installation there too
  849. AC_MSG_CHECKING([for system c-client library...])
  850. CPPFLAGS="${saved_cppflags}"
  851. LIBS="${saved_libs}"
  852. imap_include="-I${IMAP_TK_DIR}/include"
  853. imap_ldflags="-L${IMAP_TK_DIR}/lib"
  854. imap_libs="-lc-client"
  855. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  856. LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
  857. AC_LINK_IFELSE(
  858. AC_LANG_PROGRAM(
  859. [#include "c-client.h"
  860. void mm_searched (MAILSTREAM *stream,unsigned long number)
  861. {
  862. }
  863. void mm_exists (MAILSTREAM *stream,unsigned long number)
  864. {
  865. }
  866. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  867. {
  868. }
  869. void mm_flags (MAILSTREAM *stream,unsigned long number)
  870. {
  871. }
  872. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  873. {
  874. }
  875. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  876. {
  877. }
  878. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  879. {
  880. }
  881. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  882. {
  883. }
  884. void mm_log (char *string,long errflg)
  885. {
  886. }
  887. void mm_dlog (char *string)
  888. {
  889. }
  890. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  891. {
  892. }
  893. void mm_critical (MAILSTREAM *stream)
  894. {
  895. }
  896. void mm_nocritical (MAILSTREAM *stream)
  897. {
  898. }
  899. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  900. {
  901. }
  902. void mm_fatal (char *string)
  903. {
  904. }],
  905. [
  906. MAILSTREAM *foo = mail_open(NULL, "", 0);
  907. ]
  908. ),
  909. [ac_cv_imap_tk="yes"],
  910. [ac_cv_imap_tk="no"]
  911. )
  912. if test "${ac_cv_imap_tk}" = "yes"; then
  913. AC_LINK_IFELSE(
  914. AC_LANG_PROGRAM(
  915. [#include "c-client.h"
  916. void mm_searched (MAILSTREAM *stream,unsigned long number)
  917. {
  918. }
  919. void mm_exists (MAILSTREAM *stream,unsigned long number)
  920. {
  921. }
  922. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  923. {
  924. }
  925. void mm_flags (MAILSTREAM *stream,unsigned long number)
  926. {
  927. }
  928. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  929. {
  930. }
  931. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  932. {
  933. }
  934. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  935. {
  936. }
  937. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  938. {
  939. }
  940. void mm_log (char *string,long errflg)
  941. {
  942. }
  943. void mm_dlog (char *string)
  944. {
  945. }
  946. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  947. {
  948. }
  949. void mm_critical (MAILSTREAM *stream)
  950. {
  951. }
  952. void mm_nocritical (MAILSTREAM *stream)
  953. {
  954. }
  955. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  956. {
  957. }
  958. void mm_fatal (char *string)
  959. {
  960. }],
  961. [
  962. long check = mail_expunge_full(NULL, "", 0);
  963. ]
  964. ),
  965. [ac_cv_imap_tk2006="yes"],
  966. [ac_cv_imap_tk2006="no"]
  967. )
  968. fi
  969. fi
  970. fi
  971. fi
  972. if test "${IMAP_TK_DIR}" = "system"; then
  973. #We will enter here if user specified "system" or if any of above checks failed
  974. AC_MSG_CHECKING([for system c-client library...])
  975. CPPFLAGS="${saved_cppflags}"
  976. LIBS="${saved_libs}"
  977. imap_ldflags=""
  978. imap_libs="-lc-client"
  979. imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
  980. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  981. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  982. AC_LINK_IFELSE(
  983. AC_LANG_PROGRAM(
  984. [#include <stdio.h>
  985. #include <imap/c-client.h>
  986. void mm_searched (MAILSTREAM *stream,unsigned long number)
  987. {
  988. }
  989. void mm_exists (MAILSTREAM *stream,unsigned long number)
  990. {
  991. }
  992. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  993. {
  994. }
  995. void mm_flags (MAILSTREAM *stream,unsigned long number)
  996. {
  997. }
  998. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  999. {
  1000. }
  1001. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1002. {
  1003. }
  1004. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1005. {
  1006. }
  1007. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1008. {
  1009. }
  1010. void mm_log (char *string,long errflg)
  1011. {
  1012. }
  1013. void mm_dlog (char *string)
  1014. {
  1015. }
  1016. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1017. {
  1018. }
  1019. void mm_critical (MAILSTREAM *stream)
  1020. {
  1021. }
  1022. void mm_nocritical (MAILSTREAM *stream)
  1023. {
  1024. }
  1025. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1026. {
  1027. }
  1028. void mm_fatal (char *string)
  1029. {
  1030. }],
  1031. [
  1032. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1033. ]
  1034. ),
  1035. [ac_cv_imap_tk="yes"],
  1036. [ac_cv_imap_tk="no"]
  1037. )
  1038. if test "${ac_cv_imap_tk}" = "yes"; then
  1039. AC_LINK_IFELSE(
  1040. AC_LANG_PROGRAM(
  1041. [#include <stdio.h>
  1042. #include <imap/c-client.h>
  1043. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1044. {
  1045. }
  1046. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1047. {
  1048. }
  1049. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1050. {
  1051. }
  1052. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1053. {
  1054. }
  1055. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1056. {
  1057. }
  1058. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1059. {
  1060. }
  1061. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1062. {
  1063. }
  1064. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1065. {
  1066. }
  1067. void mm_log (char *string,long errflg)
  1068. {
  1069. }
  1070. void mm_dlog (char *string)
  1071. {
  1072. }
  1073. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1074. {
  1075. }
  1076. void mm_critical (MAILSTREAM *stream)
  1077. {
  1078. }
  1079. void mm_nocritical (MAILSTREAM *stream)
  1080. {
  1081. }
  1082. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1083. {
  1084. }
  1085. void mm_fatal (char *string)
  1086. {
  1087. }],
  1088. [
  1089. long check = mail_expunge_full(NULL, "", 0);
  1090. ]
  1091. ),
  1092. [ac_cv_imap_tk2006="yes"],
  1093. [ac_cv_imap_tk2006="no"]
  1094. )
  1095. else #looking in imap directory didn't work, try c-client
  1096. imap_ldflags=""
  1097. imap_libs="-lc-client"
  1098. imap_include="-DUSE_SYSTEM_CCLIENT"
  1099. CPPFLAGS="${saved_cppflags}"
  1100. LIBS="${saved_libs}"
  1101. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  1102. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  1103. AC_LINK_IFELSE(
  1104. AC_LANG_PROGRAM(
  1105. [#include <stdio.h>
  1106. #include <c-client/c-client.h>
  1107. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1108. {
  1109. }
  1110. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1111. {
  1112. }
  1113. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1114. {
  1115. }
  1116. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1117. {
  1118. }
  1119. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1120. {
  1121. }
  1122. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1123. {
  1124. }
  1125. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1126. {
  1127. }
  1128. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1129. {
  1130. }
  1131. void mm_log (char *string,long errflg)
  1132. {
  1133. }
  1134. void mm_dlog (char *string)
  1135. {
  1136. }
  1137. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1138. {
  1139. }
  1140. void mm_critical (MAILSTREAM *stream)
  1141. {
  1142. }
  1143. void mm_nocritical (MAILSTREAM *stream)
  1144. {
  1145. }
  1146. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1147. {
  1148. }
  1149. void mm_fatal (char *string)
  1150. {
  1151. }],
  1152. [
  1153. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1154. ]
  1155. ),
  1156. [ac_cv_imap_tk="yes"],
  1157. [ac_cv_imap_tk="no"]
  1158. )
  1159. if test "${ac_cv_imap_tk}" = "yes"; then
  1160. AC_LINK_IFELSE(
  1161. AC_LANG_PROGRAM(
  1162. [#include <stdio.h>
  1163. #include <c-client/c-client.h>
  1164. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1165. {
  1166. }
  1167. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1168. {
  1169. }
  1170. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1171. {
  1172. }
  1173. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1174. {
  1175. }
  1176. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1177. {
  1178. }
  1179. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1180. {
  1181. }
  1182. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1183. {
  1184. }
  1185. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1186. {
  1187. }
  1188. void mm_log (char *string,long errflg)
  1189. {
  1190. }
  1191. void mm_dlog (char *string)
  1192. {
  1193. }
  1194. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1195. {
  1196. }
  1197. void mm_critical (MAILSTREAM *stream)
  1198. {
  1199. }
  1200. void mm_nocritical (MAILSTREAM *stream)
  1201. {
  1202. }
  1203. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1204. {
  1205. }
  1206. void mm_fatal (char *string)
  1207. {
  1208. }],
  1209. [
  1210. long check = mail_expunge_full(NULL, "", 0);
  1211. ]
  1212. ),
  1213. [ac_cv_imap_tk2006="yes"],
  1214. [ac_cv_imap_tk2006="no"]
  1215. )
  1216. fi
  1217. fi
  1218. fi
  1219. if test "${ac_cv_imap_tk}" = "yes"; then
  1220. AC_MSG_RESULT(yes)
  1221. IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
  1222. IMAP_TK_INCLUDE="${imap_include}"
  1223. PBX_IMAP_TK=1
  1224. AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
  1225. if test "${ac_cv_imap_tk2006}" = "yes"; then
  1226. AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
  1227. fi
  1228. else
  1229. AC_MSG_RESULT(no)
  1230. fi
  1231. CPPFLAGS="${saved_cppflags}"
  1232. LIBS="${saved_libs}"
  1233. fi
  1234. AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
  1235. # Needed by unixodbc
  1236. AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
  1237. AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
  1238. AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
  1239. if test "${PBX_MISDN}" = 1; then
  1240. AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
  1241. AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
  1242. AST_C_DEFINE_CHECK([MISDN_FAC_RESULT], [Fac_RESULT], [mISDNuser/suppserv.h])
  1243. AST_C_DEFINE_CHECK([MISDN_FAC_ERROR], [Fac_ERROR], [mISDNuser/suppserv.h])
  1244. AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
  1245. fi
  1246. AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
  1247. AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
  1248. AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp], , [--agent-libs],
  1249. [#include <net-snmp/net-snmp-config.h>
  1250. #include <net-snmp/net-snmp-includes.h>
  1251. #include <net-snmp/agent/net-snmp-agent-includes.h>],
  1252. [int callback = snmp_register_callback(0, 0, NULL, NULL)])
  1253. AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
  1254. AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
  1255. AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
  1256. # Non-glibc platforms require libexecinfo for backtrace support
  1257. AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
  1258. # Linux, however, has backtrace directly in glibc
  1259. AST_EXT_LIB_CHECK([BKTR], [c], [backtrace], [execinfo.h])
  1260. # possible places for oss definitions
  1261. AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
  1262. AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
  1263. AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
  1264. PG_CONFIG=No
  1265. if test "${USE_PGSQL}" != "no"; then
  1266. if test "x${PGSQL_DIR}" != "x"; then
  1267. AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
  1268. if test x"${PG_CONFIG}" = xNo; then
  1269. AC_MSG_NOTICE([***])
  1270. AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
  1271. AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
  1272. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1273. AC_MSG_NOTICE([*** including --without-postgres])
  1274. exit 1
  1275. fi
  1276. else
  1277. AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
  1278. fi
  1279. fi
  1280. if test "${PG_CONFIG}" != No; then
  1281. PGSQL_libdir=`${PG_CONFIG} --libdir`
  1282. PGSQL_includedir=`${PG_CONFIG} --includedir`
  1283. if test "x$?" != "x0" ; then
  1284. if test -n "${PGSQL_MANDATORY}" ; then
  1285. AC_MSG_NOTICE([***])
  1286. AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
  1287. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1288. AC_MSG_NOTICE([*** including --without-postgres])
  1289. exit 1
  1290. fi
  1291. else
  1292. AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
  1293. [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
  1294. if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
  1295. PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
  1296. PGSQL_INCLUDE="-I${PGSQL_includedir}"
  1297. PBX_PGSQL=1
  1298. elif test -n "${PGSQL_MANDATORY}";
  1299. then
  1300. AC_MSG_NOTICE([***])
  1301. AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
  1302. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1303. AC_MSG_NOTICE([*** including --without-postgres])
  1304. exit 1
  1305. fi
  1306. fi
  1307. fi
  1308. AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
  1309. AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
  1310. AST_EXT_LIB_CHECK([PRI], [pri], [pri_new_bri], [libpri.h])
  1311. AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
  1312. AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
  1313. AST_C_COMPILE_CHECK([SPANDSP], [
  1314. #if SPANDSP_RELEASE_DATE < 20080516
  1315. #error "spandsp 0.0.5 or greater is required"
  1316. #endif
  1317. ], [spandsp/version.h], , [minimum version of SpanDSP])
  1318. if test "x${PBX_SPANDSP}" = "x1" ; then
  1319. # We found the correct version in the header, now let's make sure it links
  1320. # properly, and that libtiff is available
  1321. PBX_SPANDSP=0
  1322. AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
  1323. fi
  1324. if test "x${PBX_SPANDSP}" = "x1" ; then
  1325. # We also need t38_terminal_init()
  1326. PBX_SPANDSP=0
  1327. AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [t38_terminal_init], [spandsp.h], [-ltiff])
  1328. fi
  1329. if test "x${PBX_SPANDSP}" = "x1" ; then
  1330. AC_CHECK_HEADER([spandsp/expose.h], [AC_DEFINE_UNQUOTED([HAVE_SPANDSP_EXPOSE_H], 1, [Define to 1 if spandsp/expose.h is available.])], [], [#include <spandsp.h>])
  1331. fi
  1332. AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
  1333. if test "${USE_PWLIB}" != "no"; then
  1334. if test -n "${PWLIB_DIR}"; then
  1335. PWLIBDIR="${PWLIB_DIR}"
  1336. fi
  1337. AST_CHECK_PWLIB()
  1338. AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2], [P[[WT]]LIB_VERSION])
  1339. if test "${HAS_PWLIB:-unset}" != "unset"; then
  1340. AST_CHECK_PWLIB_PLATFORM()
  1341. PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
  1342. AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
  1343. [Define if your system has the PWLib libraries.],
  1344. [#include "ptlib.h"],
  1345. [int q = (int) PTime::IsDaylightSavings();])
  1346. fi
  1347. fi
  1348. if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
  1349. if test -n "${OPENH323_DIR}"; then
  1350. OPENH323DIR="${OPENH323_DIR}"
  1351. fi
  1352. AST_CHECK_OPENH323()
  1353. AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3])
  1354. AST_CHECK_OPENH323_BUILD()
  1355. PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
  1356. AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
  1357. [Define if your system has the OpenH323 libraries.],
  1358. [#include "ptlib.h"
  1359. #include "h323.h"
  1360. #include "h323ep.h"],
  1361. [H323EndPoint ep = H323EndPoint();],
  1362. [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
  1363. fi
  1364. AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm])
  1365. if test "x${PBX_LUA}" = "x1" ; then
  1366. AC_DEFINE_UNQUOTED([LUA51_PREFIX], [1], [Define to 1 if lua is found with a lua5.1 prefix])
  1367. fi
  1368. # Some distributions (like SuSE) remove the 5.1 suffix.
  1369. AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm])
  1370. AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
  1371. # This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
  1372. # *any* implementation of AIS, not just OpenAIS. However, the configure script needs
  1373. # to know the specifics of each possible implementation, and then represent the one
  1374. # that was found as 'AIS'.
  1375. PBX_AIS=0
  1376. # OpenAIS installs its libraries into /usr/lib/openais by default, so check there
  1377. AST_EXT_LIB_CHECK([OPENAIS], [SaClm], [saClmInitialize], [openais/saClm.h], [-L/usr/lib/openais -L/usr/lib64/openais])
  1378. if test "${PBX_OPENAIS}" = 1; then
  1379. PBX_AIS=1
  1380. if test -n "${OPENAIS_DIR}"; then
  1381. AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
  1382. AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
  1383. else
  1384. AIS_INCLUDE="-I/usr/include/openais"
  1385. AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais -L/usr/lib64/openais"
  1386. fi
  1387. fi
  1388. AC_SUBST(PBX_AIS)
  1389. AC_SUBST(AIS_INCLUDE)
  1390. AC_SUBST(AIS_LIB)
  1391. AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
  1392. # See if the main speex library contains the preprocess functions
  1393. AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
  1394. if test "${PBX_SPEEX_PREPROCESS}" = 1; then
  1395. PBX_SPEEX_PREPROCESS=1
  1396. fi
  1397. AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
  1398. if test "${PBX_SPEEXDSP}" = 1; then
  1399. PBX_SPEEX_PREPROCESS=1
  1400. fi
  1401. AC_SUBST(PBX_SPEEX_PREPROCESS)
  1402. AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
  1403. AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h])
  1404. AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
  1405. if test "$PBX_CRYPTO" = "1";
  1406. then
  1407. AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
  1408. fi
  1409. if test "$PBX_OPENSSL" = "1";
  1410. then
  1411. AST_CHECK_OSPTK([3], [5], [0])
  1412. fi
  1413. AST_EXT_TOOL_CHECK([GMIME], [gmime], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
  1414. AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
  1415. AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
  1416. AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
  1417. AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
  1418. AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)
  1419. if test "${tonezone_does_not_need_lm}" = "no" ; then
  1420. tonezone_extra="-lm"
  1421. fi
  1422. AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
  1423. AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
  1424. AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
  1425. AC_LANG_PUSH(C++)
  1426. if test "${USE_VPB}" != "no"; then
  1427. AC_MSG_CHECKING(for vpb_open in -lvpb)
  1428. saved_libs="${LIBS}"
  1429. saved_cppflags="${CPPFLAGS}"
  1430. if test "x${VPB_DIR}" != "x"; then
  1431. if test -d ${VPB_DIR}/lib; then
  1432. vpblibdir=${VPB_DIR}/lib
  1433. else
  1434. vpblibdir=${VPB_DIR}
  1435. fi
  1436. LIBS="${LIBS} -L${vpblibdir}"
  1437. CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
  1438. fi
  1439. LIBS="${PTHREAD_LIBS} ${LIBS} -lvpb"
  1440. CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS}"
  1441. AC_LINK_IFELSE(
  1442. [
  1443. AC_LANG_PROGRAM(
  1444. [#include <vpbapi.h>],
  1445. [int q = vpb_open(0,0);])
  1446. ],
  1447. [ AC_MSG_RESULT(yes)
  1448. ac_cv_lib_vpb_vpb_open="yes"
  1449. ],
  1450. [ AC_MSG_RESULT(no)
  1451. ac_cv_lib_vpb_vpb_open="no"
  1452. ]
  1453. )
  1454. LIBS="${saved_libs}"
  1455. CPPFLAGS="${saved_cppflags}"
  1456. if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
  1457. VPB_LIB="-lvpb"
  1458. if test "${VPB_DIR}" != ""; then
  1459. VPB_LIB="-L${vpblibdir} ${VPB_LIB}"
  1460. VPB_INCLUDE="-I${VPB_DIR}/include"
  1461. fi
  1462. PBX_VPB=1
  1463. AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
  1464. fi
  1465. fi
  1466. AC_LANG_POP
  1467. AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
  1468. EDITLINE_LIB=""
  1469. if test "x$TERMCAP_LIB" != "x" ; then
  1470. EDITLINE_LIB="$TERMCAP_LIB"
  1471. elif test "x$TINFO_LIB" != "x" ; then
  1472. EDITLINE_LIB="$TINFO_LIB"
  1473. elif test "x$CURSES_LIB" != "x" ; then
  1474. EDITLINE_LIB="$CURSES_LIB"
  1475. elif test "x$NCURSES_LIB" != "x" ; then
  1476. EDITLINE_LIB="$NCURSES_LIB"
  1477. else
  1478. AC_MSG_ERROR([*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)])
  1479. fi
  1480. AC_SUBST(EDITLINE_LIB)
  1481. if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
  1482. # Does ODBC support wide characters?
  1483. AC_MSG_CHECKING(whether ODBC has support for Unicode types)
  1484. AC_LINK_IFELSE(
  1485. AC_LANG_PROGRAM(
  1486. [#include <sql.h>
  1487. #include <sqlext.h>],
  1488. [int foo = SQL_WCHAR]),
  1489. AC_MSG_RESULT(yes)
  1490. AC_DEFINE([HAVE_ODBC_WCHAR], [1], [Define to 1 if your ODBC library has wide (Unicode) types.]),
  1491. AC_MSG_RESULT(no)
  1492. )
  1493. fi
  1494. AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
  1495. AC_SUBST(PBX_H323)
  1496. AC_CHECK_HEADER([linux/compiler.h],
  1497. [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
  1498. AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
  1499. #include <linux/version.h>
  1500. #ifdef HAVE_LINUX_COMPILER_H
  1501. #include <linux/compiler.h>
  1502. #endif
  1503. ])
  1504. AC_SUBST(PBX_IXJUSER)
  1505. AST_EXT_TOOL_CHECK([SDL], [sdl])
  1506. AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
  1507. AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [${PTHREAD_LIBS} -lz -lm], [${PTHREAD_CFLAGS}])
  1508. # possible places for video4linux version 1
  1509. AC_CHECK_HEADER([linux/videodev.h],
  1510. [AC_DEFINE_UNQUOTED([HAVE_VIDEODEV_H], 1, [Define to 1 if your system has linux/videodev.h.])])
  1511. # possible places for X11
  1512. AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
  1513. AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
  1514. if test "${cross_compiling}" = "no";
  1515. then
  1516. AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
  1517. fi
  1518. PBX_GTK=0
  1519. AST_EXT_TOOL_CHECK([GTK], [gtk], [--cflags gthread], [--libs gthread])
  1520. PBX_GTK2=0
  1521. AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
  1522. if test ! "x${PKGCONFIG}" = xNo; then
  1523. GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
  1524. GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
  1525. PBX_GTK2=1
  1526. AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
  1527. fi
  1528. AC_SUBST(PBX_GTK2)
  1529. AC_SUBST(GTK2_INCLUDE)
  1530. AC_SUBST(GTK2_LIB)
  1531. AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
  1532. AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
  1533. AST_CHECK_MANDATORY
  1534. AC_OUTPUT
  1535. if test "x${silent}" != "xyes" ; then
  1536. echo
  1537. echo " .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=.. "
  1538. echo " .\$7\$7.. .7\$\$7:. "
  1539. echo " .\$\$:. ,\$7.7 "
  1540. echo " .\$7. 7\$\$\$\$ .\$\$77 "
  1541. echo " ..\$\$. \$\$\$\$\$ .\$\$\$7 "
  1542. echo " ..7\$ .?. \$\$\$\$\$ .?. 7\$\$\$."
  1543. echo " \$.\$. .\$\$\$7. \$\$\$\$7 .7\$\$\$. .\$\$\$."
  1544. echo " .777. .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7. \$\$\$,"
  1545. echo " \$\$\$~ .7\$\$\$\$\$\$\$\$\$\$\$\$\$7. .\$\$\$."
  1546. echo ".\$\$7 .7\$\$\$\$\$\$\$7: ?\$\$\$."
  1547. echo "\$\$\$ ?7\$\$\$\$\$\$\$\$\$\$I .\$\$\$7 "
  1548. echo "\$\$\$ .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ :\$\$\$. "
  1549. echo "\$\$\$ \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$ .\$\$\$. "
  1550. echo "\$\$\$ \$\$\$ 7\$\$\$7 .\$\$\$ .\$\$\$. "
  1551. echo "\$\$\$\$ \$\$\$\$7 .\$\$\$. "
  1552. echo "7\$\$\$7 7\$\$\$\$ 7\$\$\$ "
  1553. echo " \$\$\$\$\$ \$\$\$ "
  1554. echo " \$\$\$\$7. \$\$ (TM) "
  1555. echo " \$\$\$\$\$\$\$. .7\$\$\$\$\$\$ \$\$ "
  1556. echo " \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$ "
  1557. echo " \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$. "
  1558. echo
  1559. fi
  1560. AC_MSG_NOTICE(Package configured for: )
  1561. AC_MSG_NOTICE( OS type : $host_os)
  1562. AC_MSG_NOTICE( Host CPU : $host_cpu)
  1563. AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :)
  1564. AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :)
  1565. if test "${cross_compiling}" = "yes"; then
  1566. AC_MSG_NOTICE( Cross Compilation = YES)
  1567. fi