configure.ac 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710
  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 libraries], [gtk])
  248. AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
  249. AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
  250. AST_EXT_LIB_SETUP([ICONV], [Iconv], [iconv])
  251. AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber], [iksemel])
  252. AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
  253. AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux], [isdnnet])
  254. AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
  255. AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
  256. AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
  257. AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
  258. AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn])
  259. AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
  260. AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
  261. AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
  262. AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
  263. AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [odbc])
  264. AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
  265. AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
  266. AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
  267. AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
  268. AST_EXT_LIB_SETUP([POPT], [popt], [popt])
  269. AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
  270. AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
  271. AST_EXT_LIB_SETUP_DEPENDENT([PRI_VERSION], [ISDN PRI get_version], [PRI], [pri])
  272. AST_EXT_LIB_SETUP_DEPENDENT([PRI_INBANDDISCONNECT], [ISDN PRI set_inbanddisconnect], [PRI], [pri])
  273. AST_EXT_LIB_SETUP_DEPENDENT([PRI_PROG_W_CAUSE], [ISDN progress with cause], [PRI], [pri])
  274. AST_EXT_LIB_SETUP_DEPENDENT([PRI_SERVICE_MESSAGES], [ISDN service messages], [PRI], [pri])
  275. AST_EXT_LIB_SETUP_DEPENDENT([PRI_REVERSE_CHARGE], [ISDN reverse charge], [PRI], [pri])
  276. AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
  277. AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
  278. AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
  279. AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
  280. AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
  281. AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
  282. AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
  283. AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
  284. AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
  285. AST_EXT_LIB_SETUP([SPEEX_PREPROCESS], [Speex preprocess routines], [speex])
  286. AST_EXT_LIB_SETUP([SPEEXDSP], [SpeexDSP], [speexdsp])
  287. AST_EXT_LIB_SETUP_DEPENDENT([SPEEX_PREPROCESS], [speex_preprocess_ctl], [], [speex])
  288. AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
  289. AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
  290. AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
  291. AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
  292. AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
  293. AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
  294. AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
  295. AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
  296. AST_EXT_LIB_SETUP([USB], [usb], [usb])
  297. AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
  298. AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
  299. AST_EXT_LIB_SETUP([X11], [X11], [x11])
  300. AST_EXT_LIB_SETUP([ZLIB], [zlib compression], [z])
  301. # check for basic system features and functionality before
  302. # checking for package libraries
  303. AC_FUNC_ALLOCA
  304. AC_HEADER_DIRENT
  305. AC_HEADER_STDC
  306. AC_HEADER_SYS_WAIT
  307. 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])
  308. AC_CHECK_HEADERS([winsock.h winsock2.h])
  309. AC_CHECK_HEADER([sys/poll.h],
  310. [],
  311. AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]))
  312. AC_SYS_LARGEFILE
  313. # Checks for typedefs, structures, and compiler characteristics.
  314. AC_HEADER_STDBOOL
  315. AC_C_CONST
  316. AC_TYPE_UID_T
  317. AC_C_INLINE
  318. AC_TYPE_MODE_T
  319. AC_TYPE_OFF_T
  320. AC_TYPE_PID_T
  321. AC_TYPE_SIZE_T
  322. AC_CHECK_MEMBERS([struct stat.st_blksize])
  323. AC_HEADER_TIME
  324. AC_STRUCT_TM
  325. AC_C_VOLATILE
  326. AC_CHECK_TYPES([ptrdiff_t])
  327. # Checks for library functions.
  328. AC_FUNC_CHOWN
  329. AC_FUNC_CLOSEDIR_VOID
  330. AC_FUNC_ERROR_AT_LINE
  331. AST_FUNC_FORK
  332. AC_FUNC_FSEEKO
  333. AC_PROG_GCC_TRADITIONAL
  334. # XXX: these are commented out until we determine whether it matters if our malloc()
  335. # acts exactly like glibc's or not
  336. # AC_FUNC_MALLOC
  337. # AC_FUNC_REALLOC
  338. AC_FUNC_MEMCMP
  339. AC_FUNC_MMAP
  340. AC_FUNC_SELECT_ARGTYPES
  341. AC_FUNC_SETVBUF_REVERSED
  342. AC_TYPE_SIGNAL
  343. AC_FUNC_STAT
  344. AC_FUNC_STRCOLL
  345. AC_FUNC_STRFTIME
  346. AC_FUNC_STRNLEN
  347. AC_FUNC_STRTOD
  348. AC_FUNC_UTIME_NULL
  349. AC_FUNC_VPRINTF
  350. AC_CHECK_FUNCS([asprintf atexit dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob 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])
  351. # BSD might not have exp2, and/or log2
  352. AC_CHECK_LIB([m], [sqrt])
  353. 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])
  354. AC_MSG_CHECKING(for timersub in time.h)
  355. AC_LINK_IFELSE(
  356. AC_LANG_PROGRAM([#include <sys/time.h>],
  357. [struct timeval *a; timersub(a, a, a);]),
  358. AC_MSG_RESULT(yes)
  359. AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system defines timersub.]),
  360. AC_MSG_RESULT(no)
  361. )
  362. AC_CHECK_HEADER([sys/poll.h],
  363. [HAS_POLL=1]
  364. AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
  365. )
  366. AC_ARG_ENABLE(internal-poll,
  367. [ --enable-internal-poll Use Asterisk's poll implementation],
  368. [case "${enableval}" in
  369. y|ye|yes) HAS_POLL="";;
  370. n|no) HAS_POLL="${HAS_POLL}" ;;
  371. *) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
  372. esac])
  373. AC_SUBST(HAS_POLL)
  374. # https support (in main/http.c) uses funopen on BSD systems,
  375. # fopencookie on linux
  376. AC_CHECK_FUNCS([funopen fopencookie])
  377. AC_CHECK_FUNCS([inet_aton])
  378. # check if we have IP_PKTINFO constant defined
  379. AC_MSG_CHECKING(for IP_PKTINFO)
  380. AC_LINK_IFELSE(
  381. AC_LANG_PROGRAM([#include <netinet/in.h>],
  382. [int pi = IP_PKTINFO;]),
  383. AC_MSG_RESULT(yes)
  384. AC_DEFINE([HAVE_PKTINFO], 1, [Define to 1 if your system defines IP_PKTINFO.]),
  385. AC_MSG_RESULT(no)
  386. )
  387. # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
  388. AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
  389. AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
  390. AC_LINK_IFELSE(
  391. AC_LANG_PROGRAM([#include <stdlib.h>
  392. #include <netdb.h>],
  393. [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);]),
  394. AC_MSG_RESULT(yes)
  395. AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
  396. AC_MSG_RESULT(no)
  397. )
  398. AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
  399. AC_LINK_IFELSE(
  400. AC_LANG_PROGRAM([#include <stdlib.h>
  401. #include <netdb.h>],
  402. [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);]),
  403. AC_MSG_RESULT(yes)
  404. AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
  405. AC_MSG_RESULT(no)
  406. )
  407. AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])
  408. AC_MSG_CHECKING(for __swap16 variant of <sys/endian.h> byteswapping macros)
  409. AC_LINK_IFELSE(
  410. AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = __swap16(a);]),
  411. AC_MSG_RESULT(yes)
  412. AC_DEFINE([HAVE_SYS_ENDIAN_SWAP16], 1, [Define to 1 if your sys/endian.h header file provides the __swap16 macro.]),
  413. AC_MSG_RESULT(no)
  414. )
  415. AC_MSG_CHECKING(for bswap16 variant of <sys/endian.h> byteswapping macros)
  416. AC_LINK_IFELSE(
  417. AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = bswap16(a);]),
  418. AC_MSG_RESULT(yes)
  419. AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
  420. AC_MSG_RESULT(no)
  421. )
  422. if test "${cross_compiling}" = "no";
  423. then
  424. AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
  425. fi
  426. AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_INITIALIZER], [PTHREAD_RWLOCK_INITIALIZER], [pthread.h])
  427. AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h)
  428. AC_LINK_IFELSE(
  429. AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;]),
  430. AC_MSG_RESULT(yes)
  431. AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system defines PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h]),
  432. AC_MSG_RESULT(no)
  433. )
  434. AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h)
  435. AC_LINK_IFELSE(
  436. AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_MUTEX_RECURSIVE_NP;]),
  437. AC_MSG_RESULT(yes)
  438. AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, [Define to 1 if your system defines PTHREAD_MUTEX_RECURSIVE_NP in pthread.h]),
  439. AC_MSG_RESULT(no)
  440. )
  441. AC_MSG_CHECKING(for pthread_rwlock_timedwrlock() in pthread.h)
  442. save_LIBS="$LIBS"
  443. save_CFLAGS="$CFLAGS"
  444. LIBS="$PTHREAD_LIBS $LIBS"
  445. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  446. AC_LINK_IFELSE(
  447. [AC_LANG_PROGRAM(
  448. [#include <pthread.h>
  449. #include <time.h>],
  450. [pthread_rwlock_t foo; struct timespec bar; pthread_rwlock_timedwrlock(&foo, &bar)])
  451. ],[
  452. AC_MSG_RESULT(yes)
  453. ac_cv_pthread_rwlock_timedwrlock="yes"
  454. ],[
  455. AC_MSG_RESULT(no)
  456. ac_cv_pthread_rwlock_timedwrlock="no"
  457. ]
  458. )
  459. LIBS="$save_LIBS"
  460. CFLAGS="$save_CFLAGS"
  461. if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
  462. AC_DEFINE([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK], 1, [Define if your system has pthread_rwlock_timedwrlock()])
  463. fi
  464. AC_MSG_CHECKING(if PTHREAD_ONCE_INIT needs braces)
  465. saved_CFLAGS="${CFLAGS}"
  466. CFLAGS="${CFLAGS} -Werror -Wmissing-braces"
  467. AC_COMPILE_IFELSE(
  468. [AC_LANG_PROGRAM(
  469. [#include <pthread.h>
  470. void empty(){}],
  471. [pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, empty);])
  472. ],[
  473. AC_MSG_RESULT(no)
  474. ac_cv_pthread_once_needsbraces="no"
  475. ],[
  476. AC_MSG_RESULT(yes)
  477. ac_cv_pthread_once_needsbraces="yes"
  478. ]
  479. )
  480. CFLAGS="${saved_CFLAGS}"
  481. if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
  482. AC_DEFINE([PTHREAD_ONCE_INIT_NEEDS_BRACES], 1, [Define if your system needs braces around PTHREAD_ONCE_INIT])
  483. fi
  484. AST_C_DEFINE_CHECK([PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [pthread.h])
  485. # Can we compare a mutex to its initial value?
  486. # Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
  487. AC_MSG_CHECKING(whether we can compare a mutex to its initial value)
  488. AC_LINK_IFELSE(
  489. AC_LANG_PROGRAM([#include <pthread.h>], [pthread_mutex_t lock;
  490. if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
  491. return 0;
  492. }
  493. return 0]),
  494. AC_MSG_RESULT(yes)
  495. 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.]),
  496. AC_MSG_RESULT(no)
  497. )
  498. #if test "${cross_compiling}" = "no";
  499. #then
  500. #AC_MSG_CHECKING(for working epoll support)
  501. #AC_LINK_IFELSE(
  502. #AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
  503. # if (res < 0)
  504. # return 1;
  505. # close (res);
  506. # return 0;]),
  507. #AC_MSG_RESULT(yes)
  508. #AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
  509. #AC_MSG_RESULT(no)
  510. #)
  511. #fi
  512. AC_MSG_CHECKING(for compiler atomic operations)
  513. AC_LINK_IFELSE(
  514. AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
  515. AC_MSG_RESULT(yes)
  516. AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
  517. AC_MSG_RESULT(no)
  518. )
  519. AST_GCC_ATTRIBUTE(pure)
  520. AST_GCC_ATTRIBUTE(malloc)
  521. AST_GCC_ATTRIBUTE(const)
  522. AST_GCC_ATTRIBUTE(unused)
  523. AST_GCC_ATTRIBUTE(always_inline)
  524. AST_GCC_ATTRIBUTE(deprecated)
  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 sysinfo)
  576. AC_LINK_IFELSE(
  577. AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
  578. [struct sysinfo sys_info; int uptime = sys_info.uptime]),
  579. AC_MSG_RESULT(yes)
  580. AC_DEFINE([HAVE_SYSINFO], 1, [Define to 1 if your system has sysinfo support]),
  581. AC_MSG_RESULT(no)
  582. )
  583. AC_SEARCH_LIBS(res_9_ninit, resolv)
  584. AC_MSG_CHECKING(for res_ninit)
  585. AC_LINK_IFELSE(
  586. AC_LANG_PROGRAM([
  587. #ifdef HAVE_SYS_SOCKET_H
  588. #include <sys/socket.h>
  589. #endif
  590. #ifdef HAVE_NETINET_IN_H
  591. #include <netinet/in.h>
  592. #endif
  593. #ifdef HAVE_ARPA_NAMESER_H
  594. #include <arpa/nameser.h>
  595. #endif
  596. #include <resolv.h>],
  597. [int foo = res_ninit(NULL);]),
  598. AC_MSG_RESULT(yes)
  599. AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
  600. AC_SEARCH_LIBS(res_9_ndestroy, resolv)
  601. AC_MSG_CHECKING(for res_ndestroy)
  602. AC_LINK_IFELSE(
  603. AC_LANG_PROGRAM([
  604. #ifdef HAVE_SYS_SOCKET_H
  605. #include <sys/socket.h>
  606. #endif
  607. #ifdef HAVE_NETINET_IN_H
  608. #include <netinet/in.h>
  609. #endif
  610. #ifdef HAVE_ARPA_NAMESER_H
  611. #include <arpa/nameser.h>
  612. #endif
  613. #include <resolv.h>],
  614. [res_ndestroy(NULL);]),
  615. AC_MSG_RESULT(yes)
  616. AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
  617. AC_MSG_RESULT(no)
  618. ),
  619. AC_MSG_RESULT(no)
  620. )
  621. AST_C_DEFINE_CHECK([GLOB_NOMAGIC], [GLOB_NOMAGIC], [glob.h])
  622. AST_C_DEFINE_CHECK([GLOB_BRACE], [GLOB_BRACE], [glob.h])
  623. AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
  624. AC_CHECK_HEADER([libkern/OSAtomic.h],
  625. [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
  626. AC_CHECK_SIZEOF(int)
  627. # do the package library checks now
  628. AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
  629. AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
  630. if test "x${OSARCH}" = "xlinux-gnu" ; then
  631. AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
  632. fi
  633. AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
  634. AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
  635. GSM_INTERNAL="yes"
  636. AC_SUBST(GSM_INTERNAL)
  637. GSM_SYSTEM="yes"
  638. if test "${USE_GSM}" != "no"; then
  639. if test "${GSM_DIR}" = "internal"; then
  640. GSM_SYSTEM="no"
  641. elif test "${GSM_DIR}" != ""; then
  642. GSM_INTERNAL="no"
  643. fi
  644. if test "${GSM_SYSTEM}" = "yes"; then
  645. gsmlibdir=""
  646. if test "x${GSM_DIR}" != "x"; then
  647. if test -d ${GSM_DIR}/lib; then
  648. gsmlibdir="-L${GSM_DIR}/lib"
  649. else
  650. gsmlibdir="-L${GSM_DIR}"
  651. fi
  652. fi
  653. AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
  654. [Define to indicate the GSM library]), [], ${gsmlibdir})
  655. if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
  656. if test "x${GSM_DIR}" != "x" ; then
  657. AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
  658. AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
  659. else
  660. AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
  661. AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
  662. fi
  663. if test "${GSM_HEADER_FOUND}" = "0" ; then
  664. if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
  665. if test "x${GSM_MANDATORY}" = "xyes" ; then
  666. AC_MSG_NOTICE([***])
  667. AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
  668. AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
  669. AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
  670. exit 1
  671. fi
  672. fi
  673. fi
  674. GSM_OK=0
  675. if test "${GSM_HEADER_FOUND}" = "1" ; then
  676. AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
  677. GSM_OK=1
  678. else
  679. if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
  680. AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
  681. GSM_OK=1
  682. fi
  683. fi
  684. if test "${GSM_OK}" = "1" ; then
  685. GSM_LIB="-lgsm"
  686. if test "x${GSM_DIR}" != "x"; then
  687. GSM_LIB="${gsmlibdir} ${GSM_LIB}"
  688. GSM_INCLUDE="-I${GSM_DIR}/include"
  689. fi
  690. PBX_GSM=1
  691. GSM_INTERNAL="no"
  692. fi
  693. fi
  694. fi
  695. if test "${GSM_INTERNAL}" = "yes"; then
  696. PBX_GSM=1
  697. AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
  698. fi
  699. fi
  700. AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
  701. # Some versions of Linux package iconv in glibc
  702. AST_EXT_LIB_CHECK([ICONV], [c], [iconv_close], [iconv.h])
  703. AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
  704. if test "${USE_IMAP_TK}" != "no"; then
  705. saved_cppflags="${CPPFLAGS}"
  706. saved_libs="${LIBS}"
  707. switch_to_system_on_failure="no"
  708. if test "${IMAP_TK_DIR}" = ""; then
  709. IMAP_TK_DIR=`pwd`"/../imap-2004g"
  710. switch_to_system_on_failure="yes"
  711. fi
  712. if test "${IMAP_TK_DIR}" != "system"; then
  713. AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
  714. if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
  715. imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
  716. fi
  717. imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
  718. imap_include="-I${IMAP_TK_DIR}/c-client"
  719. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  720. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  721. AC_LINK_IFELSE(
  722. AC_LANG_PROGRAM(
  723. [#include "c-client.h"
  724. void mm_searched (MAILSTREAM *stream,unsigned long number)
  725. {
  726. }
  727. void mm_exists (MAILSTREAM *stream,unsigned long number)
  728. {
  729. }
  730. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  731. {
  732. }
  733. void mm_flags (MAILSTREAM *stream,unsigned long number)
  734. {
  735. }
  736. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  737. {
  738. }
  739. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  740. {
  741. }
  742. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  743. {
  744. }
  745. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  746. {
  747. }
  748. void mm_log (char *string,long errflg)
  749. {
  750. }
  751. void mm_dlog (char *string)
  752. {
  753. }
  754. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  755. {
  756. }
  757. void mm_critical (MAILSTREAM *stream)
  758. {
  759. }
  760. void mm_nocritical (MAILSTREAM *stream)
  761. {
  762. }
  763. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  764. {
  765. }
  766. void mm_fatal (char *string)
  767. {
  768. }],
  769. [
  770. MAILSTREAM *foo = mail_open(NULL, "", 0);
  771. ]
  772. ),
  773. [ac_cv_imap_tk="yes"],
  774. [ac_cv_imap_tk="no"]
  775. )
  776. if test "${ac_cv_imap_tk}" = "yes"; then
  777. AC_LINK_IFELSE(
  778. AC_LANG_PROGRAM(
  779. [#include "c-client.h"
  780. void mm_searched (MAILSTREAM *stream,unsigned long number)
  781. {
  782. }
  783. void mm_exists (MAILSTREAM *stream,unsigned long number)
  784. {
  785. }
  786. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  787. {
  788. }
  789. void mm_flags (MAILSTREAM *stream,unsigned long number)
  790. {
  791. }
  792. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  793. {
  794. }
  795. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  796. {
  797. }
  798. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  799. {
  800. }
  801. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  802. {
  803. }
  804. void mm_log (char *string,long errflg)
  805. {
  806. }
  807. void mm_dlog (char *string)
  808. {
  809. }
  810. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  811. {
  812. }
  813. void mm_critical (MAILSTREAM *stream)
  814. {
  815. }
  816. void mm_nocritical (MAILSTREAM *stream)
  817. {
  818. }
  819. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  820. {
  821. }
  822. void mm_fatal (char *string)
  823. {
  824. }],
  825. [
  826. long check = mail_expunge_full(NULL, "", 0);
  827. ]
  828. ),
  829. [ac_cv_imap_tk2006="yes"],
  830. [ac_cv_imap_tk2006="no"]
  831. )
  832. fi
  833. CPPFLAGS="${saved_cppflags}"
  834. LIBS="${saved_libs}"
  835. if test "${ac_cv_imap_tk}" = "no"; then
  836. AC_MSG_RESULT(no)
  837. if test "${switch_to_system_on_failure}" = "yes"; then
  838. IMAP_TK_DIR="system"
  839. else #This means they specified a directory. Search for a package installation there too
  840. AC_MSG_CHECKING([for system c-client library...])
  841. CPPFLAGS="${saved_cppflags}"
  842. LIBS="${saved_libs}"
  843. imap_include="-I${IMAP_TK_DIR}/include"
  844. imap_ldflags="-L${IMAP_TK_DIR}/lib"
  845. imap_libs="-lc-client"
  846. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  847. LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
  848. AC_LINK_IFELSE(
  849. AC_LANG_PROGRAM(
  850. [#include "c-client.h"
  851. void mm_searched (MAILSTREAM *stream,unsigned long number)
  852. {
  853. }
  854. void mm_exists (MAILSTREAM *stream,unsigned long number)
  855. {
  856. }
  857. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  858. {
  859. }
  860. void mm_flags (MAILSTREAM *stream,unsigned long number)
  861. {
  862. }
  863. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  864. {
  865. }
  866. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  867. {
  868. }
  869. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  870. {
  871. }
  872. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  873. {
  874. }
  875. void mm_log (char *string,long errflg)
  876. {
  877. }
  878. void mm_dlog (char *string)
  879. {
  880. }
  881. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  882. {
  883. }
  884. void mm_critical (MAILSTREAM *stream)
  885. {
  886. }
  887. void mm_nocritical (MAILSTREAM *stream)
  888. {
  889. }
  890. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  891. {
  892. }
  893. void mm_fatal (char *string)
  894. {
  895. }],
  896. [
  897. MAILSTREAM *foo = mail_open(NULL, "", 0);
  898. ]
  899. ),
  900. [ac_cv_imap_tk="yes"],
  901. [ac_cv_imap_tk="no"]
  902. )
  903. if test "${ac_cv_imap_tk}" = "yes"; then
  904. AC_LINK_IFELSE(
  905. AC_LANG_PROGRAM(
  906. [#include "c-client.h"
  907. void mm_searched (MAILSTREAM *stream,unsigned long number)
  908. {
  909. }
  910. void mm_exists (MAILSTREAM *stream,unsigned long number)
  911. {
  912. }
  913. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  914. {
  915. }
  916. void mm_flags (MAILSTREAM *stream,unsigned long number)
  917. {
  918. }
  919. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  920. {
  921. }
  922. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  923. {
  924. }
  925. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  926. {
  927. }
  928. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  929. {
  930. }
  931. void mm_log (char *string,long errflg)
  932. {
  933. }
  934. void mm_dlog (char *string)
  935. {
  936. }
  937. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  938. {
  939. }
  940. void mm_critical (MAILSTREAM *stream)
  941. {
  942. }
  943. void mm_nocritical (MAILSTREAM *stream)
  944. {
  945. }
  946. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  947. {
  948. }
  949. void mm_fatal (char *string)
  950. {
  951. }],
  952. [
  953. long check = mail_expunge_full(NULL, "", 0);
  954. ]
  955. ),
  956. [ac_cv_imap_tk2006="yes"],
  957. [ac_cv_imap_tk2006="no"]
  958. )
  959. fi
  960. fi
  961. fi
  962. fi
  963. if test "${IMAP_TK_DIR}" = "system"; then
  964. #We will enter here if user specified "system" or if any of above checks failed
  965. AC_MSG_CHECKING([for system c-client library...])
  966. CPPFLAGS="${saved_cppflags}"
  967. LIBS="${saved_libs}"
  968. imap_ldflags=""
  969. imap_libs="-lc-client"
  970. imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
  971. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  972. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  973. AC_LINK_IFELSE(
  974. AC_LANG_PROGRAM(
  975. [#include <stdio.h>
  976. #include <imap/c-client.h>
  977. void mm_searched (MAILSTREAM *stream,unsigned long number)
  978. {
  979. }
  980. void mm_exists (MAILSTREAM *stream,unsigned long number)
  981. {
  982. }
  983. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  984. {
  985. }
  986. void mm_flags (MAILSTREAM *stream,unsigned long number)
  987. {
  988. }
  989. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  990. {
  991. }
  992. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  993. {
  994. }
  995. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  996. {
  997. }
  998. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  999. {
  1000. }
  1001. void mm_log (char *string,long errflg)
  1002. {
  1003. }
  1004. void mm_dlog (char *string)
  1005. {
  1006. }
  1007. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1008. {
  1009. }
  1010. void mm_critical (MAILSTREAM *stream)
  1011. {
  1012. }
  1013. void mm_nocritical (MAILSTREAM *stream)
  1014. {
  1015. }
  1016. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1017. {
  1018. }
  1019. void mm_fatal (char *string)
  1020. {
  1021. }],
  1022. [
  1023. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1024. ]
  1025. ),
  1026. [ac_cv_imap_tk="yes"],
  1027. [ac_cv_imap_tk="no"]
  1028. )
  1029. if test "${ac_cv_imap_tk}" = "yes"; then
  1030. AC_LINK_IFELSE(
  1031. AC_LANG_PROGRAM(
  1032. [#include <stdio.h>
  1033. #include <imap/c-client.h>
  1034. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1035. {
  1036. }
  1037. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1038. {
  1039. }
  1040. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1041. {
  1042. }
  1043. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1044. {
  1045. }
  1046. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1047. {
  1048. }
  1049. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1050. {
  1051. }
  1052. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1053. {
  1054. }
  1055. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1056. {
  1057. }
  1058. void mm_log (char *string,long errflg)
  1059. {
  1060. }
  1061. void mm_dlog (char *string)
  1062. {
  1063. }
  1064. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1065. {
  1066. }
  1067. void mm_critical (MAILSTREAM *stream)
  1068. {
  1069. }
  1070. void mm_nocritical (MAILSTREAM *stream)
  1071. {
  1072. }
  1073. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1074. {
  1075. }
  1076. void mm_fatal (char *string)
  1077. {
  1078. }],
  1079. [
  1080. long check = mail_expunge_full(NULL, "", 0);
  1081. ]
  1082. ),
  1083. [ac_cv_imap_tk2006="yes"],
  1084. [ac_cv_imap_tk2006="no"]
  1085. )
  1086. else #looking in imap directory didn't work, try c-client
  1087. imap_ldflags=""
  1088. imap_libs="-lc-client"
  1089. imap_include="-DUSE_SYSTEM_CCLIENT"
  1090. CPPFLAGS="${saved_cppflags}"
  1091. LIBS="${saved_libs}"
  1092. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  1093. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  1094. AC_LINK_IFELSE(
  1095. AC_LANG_PROGRAM(
  1096. [#include <stdio.h>
  1097. #include <c-client/c-client.h>
  1098. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1099. {
  1100. }
  1101. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1102. {
  1103. }
  1104. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1105. {
  1106. }
  1107. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1108. {
  1109. }
  1110. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1111. {
  1112. }
  1113. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1114. {
  1115. }
  1116. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1117. {
  1118. }
  1119. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1120. {
  1121. }
  1122. void mm_log (char *string,long errflg)
  1123. {
  1124. }
  1125. void mm_dlog (char *string)
  1126. {
  1127. }
  1128. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1129. {
  1130. }
  1131. void mm_critical (MAILSTREAM *stream)
  1132. {
  1133. }
  1134. void mm_nocritical (MAILSTREAM *stream)
  1135. {
  1136. }
  1137. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1138. {
  1139. }
  1140. void mm_fatal (char *string)
  1141. {
  1142. }],
  1143. [
  1144. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1145. ]
  1146. ),
  1147. [ac_cv_imap_tk="yes"],
  1148. [ac_cv_imap_tk="no"]
  1149. )
  1150. if test "${ac_cv_imap_tk}" = "yes"; then
  1151. AC_LINK_IFELSE(
  1152. AC_LANG_PROGRAM(
  1153. [#include <stdio.h>
  1154. #include <c-client/c-client.h>
  1155. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1156. {
  1157. }
  1158. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1159. {
  1160. }
  1161. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1162. {
  1163. }
  1164. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1165. {
  1166. }
  1167. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1168. {
  1169. }
  1170. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1171. {
  1172. }
  1173. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1174. {
  1175. }
  1176. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1177. {
  1178. }
  1179. void mm_log (char *string,long errflg)
  1180. {
  1181. }
  1182. void mm_dlog (char *string)
  1183. {
  1184. }
  1185. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1186. {
  1187. }
  1188. void mm_critical (MAILSTREAM *stream)
  1189. {
  1190. }
  1191. void mm_nocritical (MAILSTREAM *stream)
  1192. {
  1193. }
  1194. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1195. {
  1196. }
  1197. void mm_fatal (char *string)
  1198. {
  1199. }],
  1200. [
  1201. long check = mail_expunge_full(NULL, "", 0);
  1202. ]
  1203. ),
  1204. [ac_cv_imap_tk2006="yes"],
  1205. [ac_cv_imap_tk2006="no"]
  1206. )
  1207. fi
  1208. fi
  1209. fi
  1210. if test "${ac_cv_imap_tk}" = "yes"; then
  1211. AC_MSG_RESULT(yes)
  1212. IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
  1213. IMAP_TK_INCLUDE="${imap_include}"
  1214. PBX_IMAP_TK=1
  1215. AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
  1216. if test "${ac_cv_imap_tk2006}" = "yes"; then
  1217. AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
  1218. fi
  1219. else
  1220. AC_MSG_RESULT(no)
  1221. fi
  1222. CPPFLAGS="${saved_cppflags}"
  1223. LIBS="${saved_libs}"
  1224. fi
  1225. AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
  1226. # Needed by unixodbc
  1227. AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
  1228. AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
  1229. AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
  1230. if test "${PBX_MISDN}" = 1; then
  1231. AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
  1232. AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
  1233. AST_C_DEFINE_CHECK([MISDN_FAC_RESULT], [Fac_RESULT], [mISDNuser/suppserv.h])
  1234. AST_C_DEFINE_CHECK([MISDN_FAC_ERROR], [Fac_ERROR], [mISDNuser/suppserv.h])
  1235. AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
  1236. fi
  1237. AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
  1238. AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
  1239. AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp], , [--agent-libs],
  1240. [#include <net-snmp/net-snmp-config.h>
  1241. #include <net-snmp/net-snmp-includes.h>
  1242. #include <net-snmp/agent/net-snmp-agent-includes.h>],
  1243. [int callback = snmp_register_callback(0, 0, NULL, NULL)])
  1244. AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
  1245. AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
  1246. AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
  1247. # Non-glibc platforms require libexecinfo for backtrace support
  1248. AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
  1249. # Linux, however, has backtrace directly in glibc
  1250. AST_EXT_LIB_CHECK([BKTR], [c], [backtrace], [execinfo.h])
  1251. # possible places for oss definitions
  1252. AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
  1253. AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
  1254. AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
  1255. PG_CONFIG=No
  1256. if test "${USE_PGSQL}" != "no"; then
  1257. if test "x${PGSQL_DIR}" != "x"; then
  1258. AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
  1259. if test x"${PG_CONFIG}" = xNo; then
  1260. AC_MSG_NOTICE([***])
  1261. AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
  1262. AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
  1263. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1264. AC_MSG_NOTICE([*** including --without-postgres])
  1265. exit 1
  1266. fi
  1267. else
  1268. AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
  1269. fi
  1270. fi
  1271. if test "${PG_CONFIG}" != No; then
  1272. PGSQL_libdir=`${PG_CONFIG} --libdir`
  1273. PGSQL_includedir=`${PG_CONFIG} --includedir`
  1274. if test "x$?" != "x0" ; then
  1275. if test -n "${PGSQL_MANDATORY}" ; then
  1276. AC_MSG_NOTICE([***])
  1277. AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
  1278. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1279. AC_MSG_NOTICE([*** including --without-postgres])
  1280. exit 1
  1281. fi
  1282. else
  1283. AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
  1284. [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
  1285. if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
  1286. PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
  1287. PGSQL_INCLUDE="-I${PGSQL_includedir}"
  1288. PBX_PGSQL=1
  1289. elif test -n "${PGSQL_MANDATORY}";
  1290. then
  1291. AC_MSG_NOTICE([***])
  1292. AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
  1293. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1294. AC_MSG_NOTICE([*** including --without-postgres])
  1295. exit 1
  1296. fi
  1297. fi
  1298. fi
  1299. AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
  1300. AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
  1301. AST_EXT_LIB_CHECK([PRI], [pri], [pri_new_bri], [libpri.h])
  1302. AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
  1303. AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
  1304. AST_C_COMPILE_CHECK([SPANDSP], [
  1305. #if SPANDSP_RELEASE_DATE < 20080516
  1306. #error "spandsp 0.0.5 or greater is required"
  1307. #endif
  1308. ], [spandsp/version.h], , [minimum version of SpanDSP])
  1309. if test "x${PBX_SPANDSP}" = "x1" ; then
  1310. # We found the correct version in the header, now let's make sure it links
  1311. # properly, and that libtiff is available
  1312. PBX_SPANDSP=0
  1313. AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
  1314. fi
  1315. if test "x${PBX_SPANDSP}" = "x1" ; then
  1316. 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>])
  1317. fi
  1318. AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
  1319. if test "${USE_PWLIB}" != "no"; then
  1320. if test -n "${PWLIB_DIR}"; then
  1321. PWLIBDIR="${PWLIB_DIR}"
  1322. fi
  1323. AST_CHECK_PWLIB()
  1324. AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2], [P[[WT]]LIB_VERSION])
  1325. if test "${HAS_PWLIB:-unset}" != "unset"; then
  1326. AST_CHECK_PWLIB_PLATFORM()
  1327. PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
  1328. AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
  1329. [Define if your system has the PWLib libraries.],
  1330. [#include "ptlib.h"],
  1331. [int q = (int) PTime::IsDaylightSavings();])
  1332. fi
  1333. fi
  1334. if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
  1335. if test -n "${OPENH323_DIR}"; then
  1336. OPENH323DIR="${OPENH323_DIR}"
  1337. fi
  1338. AST_CHECK_OPENH323()
  1339. AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3])
  1340. AST_CHECK_OPENH323_BUILD()
  1341. PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
  1342. AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
  1343. [Define if your system has the OpenH323 libraries.],
  1344. [#include "ptlib.h"
  1345. #include "h323.h"
  1346. #include "h323ep.h"],
  1347. [H323EndPoint ep = H323EndPoint();],
  1348. [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
  1349. fi
  1350. AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm])
  1351. if test "x${PBX_LUA}" = "x1" ; then
  1352. AC_DEFINE_UNQUOTED([LUA51_PREFIX], [1], [Define to 1 if lua is found with a lua5.1 prefix])
  1353. fi
  1354. # Some distributions (like SuSE) remove the 5.1 suffix.
  1355. AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm])
  1356. AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
  1357. AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
  1358. # See if the main speex library contains the preprocess functions
  1359. AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
  1360. if test "${PBX_SPEEX_PREPROCESS}" = 1; then
  1361. PBX_SPEEX_PREPROCESS=1
  1362. fi
  1363. AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
  1364. if test "${PBX_SPEEXDSP}" = 1; then
  1365. PBX_SPEEX_PREPROCESS=1
  1366. fi
  1367. AC_SUBST(PBX_SPEEX_PREPROCESS)
  1368. AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
  1369. AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h])
  1370. AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
  1371. if test "$PBX_CRYPTO" = "1";
  1372. then
  1373. AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto])
  1374. fi
  1375. if test "$PBX_OPENSSL" = "1";
  1376. then
  1377. AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
  1378. fi
  1379. AST_EXT_TOOL_CHECK([GMIME], [gmime])
  1380. if test "$PBX_GMIME" = "1";
  1381. then
  1382. saved_libs="${LIBS}"
  1383. saved_cflags="${CFLAGS}"
  1384. LIBS="${LIBS} ${GMIME_LIB}"
  1385. CFLAGS="${CFLAGS} ${GMIME_INCLUDE}"
  1386. AC_MSG_CHECKING(for g_mime_check_version)
  1387. AC_LINK_IFELSE(
  1388. [
  1389. AC_LANG_PROGRAM(
  1390. [#include <gmime/gmime.h>],
  1391. [gboolean q = g_mime_check_version(0,0,0);])
  1392. ],
  1393. [ AC_MSG_RESULT(yes)
  1394. PBX_GMIME=1
  1395. ],
  1396. [ AC_MSG_RESULT(no)
  1397. AC_MSG_NOTICE([***])
  1398. AC_MSG_NOTICE([*** It appears that you do not have the gmime development package installed.])
  1399. AC_MSG_NOTICE([*** Please install it to include ${GMIME_DESCRIP} support.])
  1400. AC_MSG_NOTICE([***])
  1401. PBX_GMIME=0
  1402. ]
  1403. )
  1404. LIBS="${saved_libs}"
  1405. CFLAGS="${saved_cflags}"
  1406. fi
  1407. AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
  1408. AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
  1409. AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
  1410. AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)
  1411. if test "${tonezone_does_not_need_lm}" = "no" ; then
  1412. tonezone_extra="-lm"
  1413. fi
  1414. AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
  1415. AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
  1416. AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
  1417. AC_LANG_PUSH(C++)
  1418. if test "${USE_VPB}" != "no"; then
  1419. AC_MSG_CHECKING(for vpb_open in -lvpb)
  1420. saved_libs="${LIBS}"
  1421. saved_cppflags="${CPPFLAGS}"
  1422. if test "x${VPB_DIR}" != "x"; then
  1423. if test -d ${VPB_DIR}/lib; then
  1424. vpblibdir=${VPB_DIR}/lib
  1425. else
  1426. vpblibdir=${VPB_DIR}
  1427. fi
  1428. LIBS="${LIBS} -L${vpblibdir}"
  1429. CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
  1430. fi
  1431. LIBS="${PTHREAD_LIBS} ${LIBS} -lvpb"
  1432. CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS}"
  1433. AC_LINK_IFELSE(
  1434. [
  1435. AC_LANG_PROGRAM(
  1436. [#include <vpbapi.h>],
  1437. [int q = vpb_open(0,0);])
  1438. ],
  1439. [ AC_MSG_RESULT(yes)
  1440. ac_cv_lib_vpb_vpb_open="yes"
  1441. ],
  1442. [ AC_MSG_RESULT(no)
  1443. ac_cv_lib_vpb_vpb_open="no"
  1444. ]
  1445. )
  1446. LIBS="${saved_libs}"
  1447. CPPFLAGS="${saved_cppflags}"
  1448. if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
  1449. VPB_LIB="-lvpb"
  1450. if test "${VPB_DIR}" != ""; then
  1451. VPB_LIB="-L${vpblibdir} ${VPB_LIB}"
  1452. VPB_INCLUDE="-I${VPB_DIR}/include"
  1453. fi
  1454. PBX_VPB=1
  1455. AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
  1456. fi
  1457. fi
  1458. AC_LANG_POP
  1459. AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
  1460. EDITLINE_LIB=""
  1461. if test "x$TERMCAP_LIB" != "x" ; then
  1462. EDITLINE_LIB="$TERMCAP_LIB"
  1463. elif test "x$TINFO_LIB" != "x" ; then
  1464. EDITLINE_LIB="$TINFO_LIB"
  1465. elif test "x$CURSES_LIB" != "x" ; then
  1466. EDITLINE_LIB="$CURSES_LIB"
  1467. elif test "x$NCURSES_LIB" != "x" ; then
  1468. EDITLINE_LIB="$NCURSES_LIB"
  1469. else
  1470. AC_MSG_ERROR([*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)])
  1471. fi
  1472. AC_SUBST(EDITLINE_LIB)
  1473. AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
  1474. AC_SUBST(PBX_H323)
  1475. AC_CHECK_HEADER([linux/compiler.h],
  1476. [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
  1477. AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
  1478. #include <linux/version.h>
  1479. #ifdef HAVE_LINUX_COMPILER_H
  1480. #include <linux/compiler.h>
  1481. #endif
  1482. ])
  1483. AC_SUBST(PBX_IXJUSER)
  1484. AST_EXT_TOOL_CHECK([SDL], [sdl])
  1485. AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
  1486. AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [${PTHREAD_LIBS} -lz -lm], [${PTHREAD_CFLAGS}])
  1487. # possible places for video4linux version 1
  1488. AC_CHECK_HEADER([linux/videodev.h],
  1489. [AC_DEFINE_UNQUOTED([HAVE_VIDEODEV_H], 1, [Define to 1 if your system has linux/videodev.h.])])
  1490. # possible places for X11
  1491. AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
  1492. AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
  1493. if test "${cross_compiling}" = "no";
  1494. then
  1495. AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
  1496. fi
  1497. PBX_GTK=0
  1498. AST_EXT_TOOL_CHECK([GTK], [gtk], [--cflags gthread], [--libs gthread])
  1499. PBX_GTK2=0
  1500. AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
  1501. if test ! "x${PKGCONFIG}" = xNo; then
  1502. GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
  1503. GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
  1504. PBX_GTK2=1
  1505. AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
  1506. fi
  1507. AC_SUBST(PBX_GTK2)
  1508. AC_SUBST(GTK2_INCLUDE)
  1509. AC_SUBST(GTK2_LIB)
  1510. AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
  1511. AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
  1512. AST_CHECK_MANDATORY
  1513. AC_OUTPUT
  1514. if test "x${silent}" != "xyes" ; then
  1515. echo
  1516. echo " .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=.. "
  1517. echo " .\$7\$7.. .7\$\$7:. "
  1518. echo " .\$\$:. ,\$7.7 "
  1519. echo " .\$7. 7\$\$\$\$ .\$\$77 "
  1520. echo " ..\$\$. \$\$\$\$\$ .\$\$\$7 "
  1521. echo " ..7\$ .?. \$\$\$\$\$ .?. 7\$\$\$."
  1522. echo " \$.\$. .\$\$\$7. \$\$\$\$7 .7\$\$\$. .\$\$\$."
  1523. echo " .777. .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7. \$\$\$,"
  1524. echo " \$\$\$~ .7\$\$\$\$\$\$\$\$\$\$\$\$\$7. .\$\$\$."
  1525. echo ".\$\$7 .7\$\$\$\$\$\$\$7: ?\$\$\$."
  1526. echo "\$\$\$ ?7\$\$\$\$\$\$\$\$\$\$I .\$\$\$7 "
  1527. echo "\$\$\$ .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ :\$\$\$. "
  1528. echo "\$\$\$ \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$ .\$\$\$. "
  1529. echo "\$\$\$ \$\$\$ 7\$\$\$7 .\$\$\$ .\$\$\$. "
  1530. echo "\$\$\$\$ \$\$\$\$7 .\$\$\$. "
  1531. echo "7\$\$\$7 7\$\$\$\$ 7\$\$\$ "
  1532. echo " \$\$\$\$\$ \$\$\$ "
  1533. echo " \$\$\$\$7. \$\$ (TM) "
  1534. echo " \$\$\$\$\$\$\$. .7\$\$\$\$\$\$ \$\$ "
  1535. echo " \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$ "
  1536. echo " \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$. "
  1537. echo
  1538. fi
  1539. AC_MSG_NOTICE(Package configured for: )
  1540. AC_MSG_NOTICE( OS type : $host_os)
  1541. AC_MSG_NOTICE( Host CPU : $host_cpu)
  1542. AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :)
  1543. AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :)
  1544. if test "${cross_compiling}" = "yes"; then
  1545. AC_MSG_NOTICE( Cross Compilation = YES)
  1546. fi