configure.ac 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486
  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], [trunk], [https://issues.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. # Note: AC_PROG_CC *must* be specified before AC_USE_SYSTEM_EXTENSIONS or any
  32. # other macro that uses the C compiler, or the default order will be used.
  33. AC_PROG_CC([gcc cc])
  34. AC_USE_SYSTEM_EXTENSIONS dnl note- does not work on FreeBSD
  35. # System default paths
  36. AC_SUBST([astsbindir], ['${sbindir}'])dnl
  37. AC_SUBST([astetcdir], ['${sysconfdir}/asterisk'])dnl
  38. AC_SUBST([astheaderdir], ['${includedir}/asterisk'])dnl
  39. AC_SUBST([astlibdir], ['${libdir}'])dnl
  40. AC_SUBST([astmoddir], ['${libdir}/asterisk/modules'])dnl
  41. AC_SUBST([astmandir], ['${mandir}'])dnl
  42. AC_SUBST([astvarlibdir], ['${localstatedir}/lib/asterisk'])dnl
  43. AC_SUBST([astdatadir], ['${astvarlibdir}'])dnl
  44. AC_SUBST([astdbdir], ['${astvarlibdir}'])dnl
  45. AC_SUBST([astkeydir], ['${astvarlibdir}'])dnl
  46. AC_SUBST([astspooldir], ['${localstatedir}/spool/asterisk'])dnl
  47. AC_SUBST([astlogdir], ['${localstatedir}/log/asterisk'])dnl
  48. AC_SUBST([astvarrundir], ['${localstatedir}/run/asterisk'])dnl
  49. case "${host_os}" in
  50. *bsd*)
  51. if test ${prefix} = 'NONE'; then
  52. astvarlibdir='${prefix}/share/asterisk'
  53. astdbdir='${localstatedir}/db/asterisk'
  54. fi
  55. ;;
  56. darwin*)
  57. if test ${prefix} = 'NONE'; then
  58. astvarrundir='/Library/Application Support/Asterisk/Run'
  59. fi
  60. ;;
  61. esac
  62. case "${host_os}" in
  63. freebsd*)
  64. ac_default_prefix=/usr/local
  65. CPPFLAGS=-I/usr/local/include
  66. LDFLAGS=-L/usr/local/lib
  67. ;;
  68. openbsd*)
  69. ac_default_prefix=/usr/local
  70. if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
  71. if test ${sysconfdir} = '${prefix}/etc'; then
  72. astetcdir=/etc/asterisk
  73. fi
  74. if test ${mandir} = '${prefix}/man'; then
  75. astmandir=/usr/share/man
  76. fi
  77. fi
  78. CPPFLAGS=-I/usr/local/include
  79. LDFLAGS=-L/usr/local/lib
  80. ;;
  81. darwin*)
  82. ac_default_prefix=/usr/local
  83. if test ${prefix} = 'NONE'; then
  84. astmoddir='/Library/Application Support/Asterisk/Modules'
  85. astvarlibdir='/Library/Application Support/Asterisk'
  86. astlogdir=/Library/Logs/Asterisk
  87. astvarrundir='/Library/Application Support/Asterisk/Run'
  88. fi
  89. AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])
  90. AC_DEFINE([_DARWIN_UNLIMITED_SELECT], 1, [Define to 1 if running on Darwin.])
  91. ;;
  92. solaris*)
  93. if test ${prefix} = 'NONE'; then
  94. astetcdir=/var/etc/asterisk
  95. astsbindir=/opt/asterisk/sbin
  96. astlibdir=/opt/asterisk/lib
  97. astmoddir=/opt/asterisk/lib/modules
  98. astheaderdir=/opt/asterisk/include
  99. astmandir=/opt/asterisk/man
  100. astvarlibdir=/var/opt/asterisk
  101. astspooldir=/var/spool/asterisk
  102. astlogdir=/var/log/asterisk
  103. astvarrundir=/var/run/asterisk
  104. fi
  105. ;;
  106. *)
  107. ac_default_prefix=/usr
  108. if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
  109. if test ${sysconfdir} = '${prefix}/etc'; then
  110. sysconfdir=/etc
  111. fi
  112. if test ${mandir} = '${prefix}/man'; then
  113. mandir=/usr/share/man
  114. fi
  115. fi
  116. ;;
  117. esac
  118. if test ${prefix} = ${ac_default_prefix} || test ${prefix} = 'NONE'; then
  119. if test ${localstatedir} = '${prefix}/var'; then
  120. localstatedir=/var
  121. fi
  122. fi
  123. BUILD_PLATFORM=${build}
  124. BUILD_CPU=${build_cpu}
  125. BUILD_VENDOR=${build_vendor}
  126. BUILD_OS=${build_os}
  127. AC_SUBST(BUILD_PLATFORM)
  128. AC_SUBST(BUILD_CPU)
  129. AC_SUBST(BUILD_VENDOR)
  130. AC_SUBST(BUILD_OS)
  131. HOST_PLATFORM=${host}
  132. HOST_CPU=${host_cpu}
  133. HOST_VENDOR=${host_vendor}
  134. HOST_OS=${host_os}
  135. AC_SUBST(HOST_PLATFORM)
  136. AC_SUBST(HOST_CPU)
  137. AC_SUBST(HOST_VENDOR)
  138. AC_SUBST(HOST_OS)
  139. PBX_WINARCH=0
  140. case "${host_os}" in
  141. freebsd*)
  142. OSARCH=FreeBSD
  143. ;;
  144. netbsd*)
  145. OSARCH=NetBSD
  146. ;;
  147. openbsd*)
  148. OSARCH=OpenBSD
  149. ;;
  150. solaris*)
  151. OSARCH=SunOS
  152. ;;
  153. mingw32)
  154. OSARCH=mingw32
  155. PBX_WINARCH=1
  156. ;;
  157. cygwin)
  158. OSARCH=cygwin
  159. PBX_WINARCH=1
  160. ;;
  161. linux-gnueabi* | linux-gnuspe)
  162. OSARCH=linux-gnu
  163. ;;
  164. kfreebsd*-gnu)
  165. OSARCH=kfreebsd-gnu
  166. ;;
  167. *)
  168. OSARCH=${host_os}
  169. ;;
  170. esac
  171. AC_SUBST(OSARCH)
  172. AC_SUBST(PBX_WINARCH)
  173. # check for uname
  174. AC_PATH_TOOL([UNAME], [uname], No)
  175. if test ! x"${UNAME}" = xNo; then
  176. PBX_OSREV=$(${UNAME} -r)
  177. fi
  178. AC_SUBST(PBX_OSREV)
  179. AH_TOP(
  180. #ifndef ASTERISK_AUTOCONFIG_H
  181. #define ASTERISK_AUTOCONFIG_H
  182. #include "asterisk/buildopts.h"
  183. )
  184. AH_BOTTOM(
  185. #endif
  186. )
  187. # cross-compile checks
  188. if test "${cross_compiling}" = "yes";
  189. then
  190. AC_CHECK_TOOL(CC, gcc, :)
  191. AC_CHECK_TOOL(CXX, g++, :)
  192. AC_CHECK_TOOL(LD, ld, :)
  193. AC_CHECK_TOOL(RANLIB, ranlib, :)
  194. fi
  195. # Checks for programs.
  196. AC_PROG_CXX
  197. AC_PROG_CPP
  198. AC_PROG_CXXCPP
  199. # This macro is just copied into our local acinclude.m4 from libtool.m4 so that
  200. # the developers regenerating the configure script don't have to install libtool.
  201. AST_PROG_LD # note, does not work on FreeBSD
  202. AC_PROG_AWK
  203. AC_PROG_INSTALL
  204. AC_PROG_LN_S
  205. AC_PROG_RANLIB
  206. AST_CHECK_GNU_MAKE
  207. AC_PROG_EGREP
  208. AC_CHECK_TOOLS([STRIP], [strip gstrip], :)
  209. AC_CHECK_TOOLS([AR], [ar gar], :)
  210. GNU_LD=0
  211. if test "x$with_gnu_ld" = "xyes" ; then
  212. GNU_LD=1
  213. fi
  214. AC_SUBST(GNU_LD)
  215. AC_PATH_PROG([BISON], [bison], :)
  216. AC_PATH_PROG([CMP], [cmp], :)
  217. AC_PATH_PROG([FLEX], [flex], :)
  218. AC_PATH_PROG([GREP], [grep], :)
  219. AC_PATH_PROG([PYTHON], [python], :)
  220. AC_PATH_PROG([FIND], [find], :)
  221. AC_PATH_PROG([COMPRESS], [compress], :)
  222. AC_PATH_PROG([BASENAME], [basename], :)
  223. AC_PATH_PROG([DIRNAME], [dirname], :)
  224. AC_PATH_PROG([SHELL], [sh], :)
  225. AC_PATH_PROG([LN], [ln], :)
  226. AC_PATH_PROG([DOT], [dot], :)
  227. AC_PATH_PROG([WGET], [wget], :)
  228. AC_PATH_PROG([CURL], [curl], :)
  229. AC_PATH_PROG([RUBBER], [rubber], :)
  230. AC_PATH_PROG([CATDVI], [catdvi], :)
  231. AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
  232. AC_PATH_PROG([XMLLINT], [xmllint], :)
  233. AC_PATH_PROG([XMLSTARLET], [xmlstarlet], :)
  234. AC_PATH_PROG([GIT], [git], :)
  235. if test "${WGET}" != ":" ; then
  236. DOWNLOAD=${WGET}
  237. else if test "${CURL}" != ":" ; then
  238. DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
  239. else
  240. AC_PATH_PROG([FETCH], [fetch], [:])
  241. DOWNLOAD=${FETCH}
  242. fi
  243. fi
  244. AC_SUBST(DOWNLOAD)
  245. AC_PATH_PROG([LDCONFIG], [ldconfig], :)
  246. AC_PATH_PROG([SHA1SUM], [sha1sum], $ac_aux_dir/build_tools/sha1sum-sh)
  247. AC_PATH_PROG([OPENSSL], [openssl], :)
  248. AC_CACHE_CHECK([for bison that supports parse-param], [ac_cv_path_BISON2], [
  249. if test "x$BISON" != "x:" ; then
  250. # Create a temporary directory $tmp in $TMPDIR (default /tmp).
  251. # Use mktemp if possible; otherwise fall back on mkdir,
  252. # with $RANDOM to make collisions less likely.
  253. : ${TMPDIR=/tmp}
  254. {
  255. tmp=`
  256. (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
  257. ` &&
  258. test -n "$tmp" && test -d "$tmp"
  259. } || {
  260. tmp=$TMPDIR/foo$$-$RANDOM
  261. (umask 077 && mkdir "$tmp")
  262. } || exit $?
  263. cat >$tmp/test.y <<__EOL__
  264. %parse-param {struct parse_io *parseio}
  265. %%
  266. file : { \$\$ = parseio->pval = 1; }
  267. ;
  268. %%
  269. __EOL__
  270. ${BISON} -o ${tmp}/test.tab.c ${tmp}/test.y >/dev/null 2>&1
  271. if test -e "${tmp}/test.tab.c"; then
  272. ac_cv_path_BISON2=${BISON}
  273. fi
  274. rm -rf ${tmp}
  275. fi
  276. ])
  277. if test "x${ac_cv_path_BISON2}" = "x" ; then
  278. BISON=:
  279. PBX_BISON=0
  280. else
  281. PBX_BISON=1
  282. fi
  283. AC_SUBST(PBX_BISON)
  284. if test "x${FLEX}" = "x:" ; then
  285. PBX_FLEX=0
  286. else
  287. PBX_FLEX=1
  288. fi
  289. AC_SUBST(PBX_FLEX)
  290. AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
  291. if test "${SOXMIX}" != ":" ; then
  292. AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
  293. fi
  294. AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])
  295. if test "${MD5}" = "digest" ; then
  296. MD5="${MD5} -a md5"
  297. fi
  298. ACX_PTHREAD
  299. AC_LANG(C)
  300. AC_ARG_ENABLE([dev-mode],
  301. [AS_HELP_STRING([--enable-dev-mode],
  302. [Turn on developer mode])],
  303. [case "${enableval}" in
  304. y|ye|yes) AST_DEVMODE=yes ;;
  305. n|no) AST_DEVMODE=no ;;
  306. noisy)
  307. AST_DEVMODE=yes
  308. NOISY_BUILD=yes
  309. ;;
  310. strict)
  311. AST_DEVMODE=yes
  312. AST_DEVMODE_STRICT=yes
  313. ;;
  314. *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode) ;;
  315. esac])
  316. AC_SUBST(NOISY_BUILD)
  317. AC_SUBST(AST_DEVMODE)
  318. AC_SUBST(AST_DEVMODE_STRICT)
  319. AST_CODE_COVERAGE=no
  320. AC_ARG_ENABLE([coverage],
  321. [AS_HELP_STRING([--enable-coverage],
  322. [Turn on code coverage tracking (for gcov)])],
  323. [case "${enableval}" in
  324. y|ye|yes) AST_CODE_COVERAGE=yes ;;
  325. n|no) AST_CODE_COVERAGE=no ;;
  326. *) AC_MSG_ERROR(bad value ${enableval} for --enable-coverage) ;;
  327. esac])
  328. AC_SUBST(AST_CODE_COVERAGE)
  329. # AST_EXT_LIB_SETUP is used to tell configure to handle variables for
  330. # various packages.
  331. # $1 is the prefix for the variables in makeopts and autoconfig.h
  332. # $2 is the short comment, $4 is the long comment
  333. # $3 is the name used in --with- or --without- flags for configure.
  334. #
  335. # Package option names should be in alphabetical order
  336. # by the --with option name (the third field),
  337. # to make things easier for the users.
  338. AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
  339. AST_EXT_LIB_SETUP([BFD], [Debug symbol decoding], [bfd])
  340. # BKTR is used for backtrace support on platforms that do not
  341. # have it natively.
  342. AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
  343. AST_EXT_LIB_SETUP([BLUETOOTH], [Bluetooth], [bluetooth])
  344. AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
  345. AST_EXT_LIB_SETUP([COROSYNC], [Corosync], [cpg])
  346. AST_EXT_LIB_SETUP_OPTIONAL([COROSYNC_CFG_STATE_TRACK], [A callback only in corosync 1.x], [COROSYNC], [cfg])
  347. AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
  348. AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
  349. AST_EXT_LIB_SETUP_OPTIONAL([OPENSSL_SRTP], [OpenSSL SRTP Extension Support], [CRYPTO], [crypto])
  350. AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
  351. AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec], [avcodec])
  352. AST_EXT_LIB_SETUP([GSM], [External GSM], [gsm], [, use 'internal' GSM otherwise])
  353. AST_EXT_LIB_SETUP([ILBC], [System iLBC], [ilbc], [, use 'internal' iLBC otherwise])
  354. AST_EXT_LIB_SETUP([GTK2], [gtk2], [gtk2])
  355. AST_EXT_LIB_SETUP([GMIME], [GMime], [gmime])
  356. AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323])
  357. AST_EXT_LIB_SETUP([HOARD], [Hoard Memory Allocator], [hoard])
  358. AST_EXT_LIB_SETUP([ICAL], [iCal], [ical])
  359. AST_EXT_LIB_SETUP([ICONV], [Iconv], [iconv])
  360. AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber], [iksemel])
  361. AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
  362. AST_EXT_LIB_SETUP([INOTIFY], [inotify support], [inotify])
  363. AST_EXT_LIB_SETUP([IODBC], [iODBC], [iodbc])
  364. AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux], [isdnnet])
  365. AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
  366. AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue])
  367. AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
  368. AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
  369. AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit], [, use 'internal' Editline otherwise])
  370. AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
  371. AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
  372. AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
  373. AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn])
  374. AST_EXT_LIB_SETUP([MYSQLCLIENT], [MySQL client], [mysqlclient])
  375. AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
  376. AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
  377. AST_EXT_LIB_SETUP([NEON], [neon], [neon])
  378. AST_EXT_LIB_SETUP([NEON29], [neon29], [neon29])
  379. AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
  380. AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
  381. AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
  382. AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2])
  383. AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
  384. AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
  385. AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
  386. AST_EXT_LIB_SETUP([POPT], [popt], [popt])
  387. AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
  388. AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
  389. AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_ACK_INBAND], [ISDN PRI progress inband ie in SETUP ACK], [PRI], [pri])
  390. AST_EXT_LIB_SETUP_OPTIONAL([PRI_L2_PERSISTENCE], [ISDN Layer 2 persistence option], [PRI], [pri])
  391. AST_EXT_LIB_SETUP_OPTIONAL([PRI_DATETIME_SEND], [ISDN PRI Date/time ie send policy], [PRI], [pri])
  392. AST_EXT_LIB_SETUP_OPTIONAL([PRI_MWI_V2], [ISDN PRI Message Waiting Indication (Fixed)], [PRI], [pri])
  393. AST_EXT_LIB_SETUP_OPTIONAL([PRI_DISPLAY_TEXT], [ISDN PRI user display text IE contents during call], [PRI], [pri])
  394. AST_EXT_LIB_SETUP_OPTIONAL([PRI_MWI], [ISDN PRI Message Waiting Indication], [PRI], [pri])
  395. AST_EXT_LIB_SETUP_OPTIONAL([PRI_MCID], [ISDN PRI Malicious Call ID], [PRI], [pri])
  396. AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_WAITING], [ISDN PRI call waiting supplementary service], [PRI], [pri])
  397. AST_EXT_LIB_SETUP_OPTIONAL([PRI_AOC_EVENTS], [ISDN PRI advice of charge supplementary service events], [PRI], [pri])
  398. AST_EXT_LIB_SETUP_OPTIONAL([PRI_TRANSFER], [ISDN PRI call transfer supplementary service], [PRI], [pri])
  399. AST_EXT_LIB_SETUP_OPTIONAL([PRI_CCSS], [ISDN PRI call completion supplementary service], [PRI], [pri])
  400. AST_EXT_LIB_SETUP_OPTIONAL([PRI_HANGUP_FIX], [ISDN PRI hangup fix], [PRI], [pri])
  401. AST_EXT_LIB_SETUP_OPTIONAL([PRI_SUBADDR], [ISDN PRI subaddressing], [PRI], [pri])
  402. AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_HOLD], [ISDN PRI call hold], [PRI], [pri])
  403. AST_EXT_LIB_SETUP_OPTIONAL([PRI_CALL_REROUTING], [ISDN PRI call rerouting and call deflection], [PRI], [pri])
  404. AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_KEYPAD], [ISDN PRI keypad facility in SETUP], [PRI], [pri])
  405. # ------------------------------------v
  406. # TODO: The code can be changed to always include these features now.
  407. # These features will always be present if pri_connected_line_update is available.
  408. AST_EXT_LIB_SETUP_OPTIONAL([PRI_INBANDDISCONNECT], [ISDN PRI set_inbanddisconnect], [PRI], [pri])
  409. AST_EXT_LIB_SETUP_OPTIONAL([PRI_PROG_W_CAUSE], [ISDN progress with cause], [PRI], [pri])
  410. AST_EXT_LIB_SETUP_OPTIONAL([PRI_SERVICE_MESSAGES], [ISDN service messages], [PRI], [pri])
  411. AST_EXT_LIB_SETUP_OPTIONAL([PRI_REVERSE_CHARGE], [ISDN reverse charge], [PRI], [pri])
  412. # ------------------------------------^
  413. AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
  414. AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
  415. AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
  416. AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
  417. AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
  418. AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [])
  419. AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
  420. AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
  421. AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
  422. AST_EXT_LIB_SETUP([SPEEX_PREPROCESS], [Speex preprocess routines], [speex])
  423. AST_EXT_LIB_SETUP([SPEEXDSP], [SpeexDSP], [speexdsp])
  424. AST_EXT_LIB_SETUP_DEPENDENT([SPEEX_PREPROCESS], [speex_preprocess_ctl], [], [speex])
  425. AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
  426. AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
  427. AST_EXT_LIB_SETUP([SRTP], [Secure RTP], [srtp])
  428. AST_EXT_LIB_SETUP_OPTIONAL([SRTP_SHUTDOWN], [SRTP Library Shutdown Function], [SRTP], [srtp])
  429. AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
  430. AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
  431. AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
  432. AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
  433. AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
  434. AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
  435. AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
  436. AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
  437. AST_EXT_LIB_SETUP([UUID], [UUID], [uuid])
  438. AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
  439. AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
  440. AST_EXT_LIB_SETUP([X11], [X11], [x11])
  441. AST_EXT_LIB_SETUP([ZLIB], [zlib compression], [z])
  442. # check for basic system features and functionality before
  443. # checking for package libraries
  444. AC_FUNC_ALLOCA
  445. AC_HEADER_DIRENT
  446. AC_HEADER_STDC
  447. AC_HEADER_SYS_WAIT
  448. 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/event.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])
  449. # Any one of these 4 packages support a mandatory requirement, so we want to check on them as early as possible.
  450. AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
  451. AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
  452. AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
  453. AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
  454. EDITLINE_LIB=""
  455. if test "x$TERMCAP_LIB" != "x" ; then
  456. EDITLINE_LIB="$TERMCAP_LIB"
  457. elif test "x$TINFO_LIB" != "x" ; then
  458. EDITLINE_LIB="$TINFO_LIB"
  459. elif test "x$CURSES_LIB" != "x" ; then
  460. EDITLINE_LIB="$CURSES_LIB"
  461. elif test "x$NCURSES_LIB" != "x" ; then
  462. EDITLINE_LIB="$NCURSES_LIB"
  463. else
  464. AC_MSG_ERROR([*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)])
  465. fi
  466. AC_SUBST(EDITLINE_LIB)
  467. # Another mandatory item (unless it's explicitly disabled)
  468. AC_ARG_ENABLE([xmldoc],
  469. [AS_HELP_STRING([--disable-xmldoc],
  470. [Explicitly disable XML documentation])],
  471. [case "${enableval}" in
  472. y|ye|yes) disable_xmldoc=no ;;
  473. n|no) disable_xmldoc=yes ;;
  474. *) AC_MSG_ERROR(bad value ${enableval} for --disable-xmldoc) ;;
  475. esac], [disable_xmldoc=no])
  476. if test "${disable_xmldoc}" != "yes"; then
  477. AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
  478. [#include <libxml/tree.h>
  479. #include <libxml/parser.h>],
  480. [LIBXML_TEST_VERSION])
  481. if test "${PBX_LIBXML2}" != 1; then
  482. AC_MSG_NOTICE(*** XML documentation will not be available because the 'libxml2' development package is missing.)
  483. AC_MSG_NOTICE(*** Please run the 'configure' script with the '--disable-xmldoc' parameter option)
  484. AC_MSG_NOTICE(*** or install the 'libxml2' development package.)
  485. exit 1
  486. fi
  487. fi
  488. # some embedded systems omit internationalization (locale) support
  489. AC_CHECK_HEADERS([xlocale.h])
  490. AC_CHECK_HEADERS([winsock.h winsock2.h])
  491. AC_CHECK_HEADER([sys/poll.h],
  492. [],
  493. AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.]))
  494. AC_SYS_LARGEFILE
  495. # Checks for typedefs, structures, and compiler characteristics.
  496. AC_HEADER_STDBOOL
  497. AC_C_CONST
  498. AC_TYPE_UID_T
  499. AC_C_INLINE
  500. AC_TYPE_LONG_DOUBLE_WIDER
  501. AC_TYPE_MODE_T
  502. AC_TYPE_OFF_T
  503. AC_TYPE_PID_T
  504. AC_TYPE_SIZE_T
  505. AC_CHECK_MEMBERS([struct stat.st_blksize])
  506. AC_CHECK_MEMBERS([struct ucred.uid, struct ucred.cr_uid, struct sockpeercred.uid], [], [], [#include <sys/types.h>
  507. #include <sys/socket.h> ])
  508. AC_CHECK_MEMBERS([struct ifreq.ifr_ifru.ifru_hwaddr], [], [], [#include <net/if.h>])
  509. AC_HEADER_TIME
  510. AC_STRUCT_TM
  511. AC_C_VOLATILE
  512. AC_CHECK_TYPES([ptrdiff_t])
  513. stat_nsec_found=no
  514. AC_CHECK_MEMBERS([struct stat.st_mtim, struct stat.st_mtimensec, struct stat.st_mtimespec], [stat_nsec_found=yes], [], [[#include <sys/stat.h>]])
  515. if test "${stat_nsec_found}" != yes; then
  516. AC_MSG_WARN(Cannot determine nanosecond field of struct stat)
  517. fi
  518. # Checks for library functions.
  519. AC_FUNC_CHOWN
  520. AC_FUNC_CLOSEDIR_VOID
  521. AC_FUNC_ERROR_AT_LINE
  522. AST_FUNC_FORK
  523. AC_FUNC_FSEEKO
  524. AC_PROG_GCC_TRADITIONAL
  525. # XXX: these are commented out until we determine whether it matters if our malloc()
  526. # acts exactly like glibc's or not
  527. # AC_FUNC_MALLOC
  528. # AC_FUNC_REALLOC
  529. AC_FUNC_MEMCMP
  530. AC_FUNC_MMAP
  531. AC_FUNC_SELECT_ARGTYPES
  532. AC_FUNC_SETVBUF_REVERSED
  533. AC_TYPE_SIGNAL
  534. AC_FUNC_STAT
  535. AC_FUNC_STRCOLL
  536. AC_FUNC_STRFTIME
  537. AC_FUNC_STRNLEN
  538. AC_FUNC_STRTOD
  539. AC_FUNC_UTIME_NULL
  540. AC_FUNC_VPRINTF
  541. AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap ntohll newlocale ppoll 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 getpeereid sysctl swapctl])
  542. # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
  543. # so that AC_CHECK_FUNCS can detect functions in that library.
  544. AC_CHECK_LIB([m], [sqrt])
  545. # BSD might not have exp2, and/or log2
  546. AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil])
  547. # Certain architectures don't really have long double, even though
  548. # AC_CHECK_FUNCS would otherwise find the following functions.
  549. if test "x${ac_cv_type_long_double_wider}" = "xyes" ; then
  550. 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])
  551. fi
  552. AC_MSG_CHECKING(for LLONG_MAX in limits.h)
  553. AC_LINK_IFELSE(
  554. [AC_LANG_PROGRAM([#include <limits.h>],
  555. [long long foo = LLONG_MAX])],
  556. AC_MSG_RESULT(yes)
  557. AC_DEFINE([HAVE_LLONG_MAX], 1, [Define to 1 if limits.h includes a LLONG_MAX definition.]),
  558. AC_MSG_RESULT(no)
  559. )
  560. AC_MSG_CHECKING(for timersub in time.h)
  561. AC_LINK_IFELSE(
  562. [AC_LANG_PROGRAM([#include <sys/time.h>],
  563. [struct timeval *a; timersub(a, a, a);])],
  564. AC_MSG_RESULT(yes)
  565. AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system defines timersub.]),
  566. AC_MSG_RESULT(no)
  567. )
  568. AC_MSG_CHECKING(for a version of GNU ld that supports the --dynamic-list flag)
  569. old_LDFLAGS=${LDFLAGS}
  570. cat >conftest.dynamics <<_ACEOF
  571. {
  572. *ast_*;
  573. };
  574. _ACEOF
  575. LDFLAGS="${LDFLAGS} -Wl,--dynamic-list,conftest.dynamics"
  576. PBX_DYNAMIC_LIST=0
  577. AC_LINK_IFELSE(
  578. [AC_LANG_PROGRAM([], [])],
  579. PBX_DYNAMIC_LIST=1
  580. AC_MSG_RESULT(yes),
  581. AC_MSG_RESULT(no)
  582. )
  583. AC_SUBST(PBX_DYNAMIC_LIST)
  584. LDFLAGS=${old_LDFLAGS}
  585. rm -f conftest.dynamics
  586. AC_CHECK_HEADER([sys/poll.h],
  587. [HAS_POLL=1]
  588. AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
  589. )
  590. AC_ARG_ENABLE([internal-poll],
  591. [AS_HELP_STRING([--enable-internal-poll],
  592. [Use Asterisk's poll implementation])],
  593. [case "${enableval}" in
  594. y|ye|yes) HAS_POLL="";;
  595. n|no) HAS_POLL="${HAS_POLL}" ;;
  596. *) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
  597. esac])
  598. AC_SUBST(HAS_POLL)
  599. AC_ARG_ENABLE([asteriskssl],
  600. [AS_HELP_STRING([--disable-asteriskssl],
  601. [Disable Asterisk's SSL wrapper library])],
  602. [case "${enableval}" in
  603. y|ye|yes) AST_ASTERISKSSL=yes ;;
  604. n|no) AST_ASTERISKSSL=no ;;
  605. *) AC_MSG_ERROR(bad value ${enableval} for --disable-asteriskssl) ;;
  606. esac], [AST_ASTERISKSSL=yes])
  607. AC_SUBST(AST_ASTERISKSSL)
  608. # https support (in main/http.c) uses funopen on BSD systems,
  609. # fopencookie on linux
  610. AC_CHECK_FUNCS([funopen fopencookie])
  611. AC_CHECK_FUNCS([inet_aton])
  612. # check if we have IP_PKTINFO constant defined
  613. AC_MSG_CHECKING(for IP_PKTINFO)
  614. AC_LINK_IFELSE(
  615. [AC_LANG_PROGRAM([#include <netinet/in.h>],
  616. [int pi = IP_PKTINFO;])],
  617. AC_MSG_RESULT(yes)
  618. AC_DEFINE([HAVE_PKTINFO], 1, [Define to 1 if your system defines IP_PKTINFO.]),
  619. AC_MSG_RESULT(no)
  620. )
  621. # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
  622. AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
  623. AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)
  624. AC_LINK_IFELSE(
  625. [AC_LANG_PROGRAM([#include <stdlib.h>
  626. #include <netdb.h>],
  627. [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);])],
  628. AC_MSG_RESULT(yes)
  629. AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),
  630. AC_MSG_RESULT(no)
  631. )
  632. AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)
  633. AC_LINK_IFELSE(
  634. [AC_LANG_PROGRAM([#include <stdlib.h>
  635. #include <netdb.h>],
  636. [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);])],
  637. AC_MSG_RESULT(yes)
  638. AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),
  639. AC_MSG_RESULT(no)
  640. )
  641. AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])
  642. AC_MSG_CHECKING(for __swap16 variant of <sys/endian.h> byteswapping macros)
  643. AC_LINK_IFELSE(
  644. [AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = __swap16(a);])],
  645. AC_MSG_RESULT(yes)
  646. AC_DEFINE([HAVE_SYS_ENDIAN_SWAP16], 1, [Define to 1 if your sys/endian.h header file provides the __swap16 macro.]),
  647. AC_MSG_RESULT(no)
  648. )
  649. AC_MSG_CHECKING(for bswap16 variant of <sys/endian.h> byteswapping macros)
  650. AC_LINK_IFELSE(
  651. [AC_LANG_PROGRAM([#include <sys/endian.h>], [int a = 1; int b = bswap16(a);])],
  652. AC_MSG_RESULT(yes)
  653. AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header file provides the bswap16 macro.]),
  654. AC_MSG_RESULT(no)
  655. )
  656. if test "${cross_compiling}" = "no";
  657. then
  658. AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
  659. fi
  660. AC_MSG_CHECKING(for locale_t in locale.h)
  661. AC_LINK_IFELSE(
  662. [AC_LANG_PROGRAM([#include <locale.h>], [locale_t lt = NULL])],
  663. AC_MSG_RESULT(yes)
  664. AC_DEFINE([HAVE_LOCALE_T_IN_LOCALE_H], 1, [Define to 1 if your system defines the locale_t type in locale.h]),
  665. AC_MSG_RESULT(no)
  666. AC_MSG_CHECKING(for locale_t in xlocale.h)
  667. AC_LINK_IFELSE(
  668. [AC_LANG_PROGRAM([#include <xlocale.h>], [locale_t lt = NULL])],
  669. AC_MSG_RESULT(yes)
  670. AC_DEFINE([HAVE_LOCALE_T_IN_XLOCALE_H], 1, [Define to 1 if your system defines the locale_t type in xlocale.h]),
  671. AC_MSG_RESULT(no)
  672. )
  673. )
  674. AC_MSG_CHECKING(for O_EVTONLY in fcntl.h)
  675. AC_LINK_IFELSE(
  676. [AC_LANG_PROGRAM([#include <fcntl.h>], [int a = O_EVTONLY;])],
  677. AC_MSG_RESULT(yes)
  678. AC_DEFINE([HAVE_O_EVTONLY], 1, [Define to 1 if your system defines the file flag O_EVTONLY in fcntl.h]),
  679. AC_MSG_RESULT(no)
  680. )
  681. AC_MSG_CHECKING(for O_SYMLINK in fcntl.h)
  682. AC_LINK_IFELSE(
  683. [AC_LANG_PROGRAM([#include <fcntl.h>], [int a = O_SYMLINK;])],
  684. AC_MSG_RESULT(yes)
  685. AC_DEFINE([HAVE_O_SYMLINK], 1, [Define to 1 if your system defines the file flag O_SYMLINK in fcntl.h]),
  686. AC_MSG_RESULT(no)
  687. )
  688. AST_C_DEFINE_CHECK([PTHREAD_RWLOCK_INITIALIZER], [PTHREAD_RWLOCK_INITIALIZER], [pthread.h])
  689. AC_MSG_CHECKING(for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h)
  690. AC_LINK_IFELSE(
  691. [AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;])],
  692. AC_MSG_RESULT(yes)
  693. AC_DEFINE([HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP], 1, [Define to 1 if your system defines PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h]),
  694. AC_MSG_RESULT(no)
  695. )
  696. AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h)
  697. AC_LINK_IFELSE(
  698. [AC_LANG_PROGRAM([#include <pthread.h>], [int a = PTHREAD_MUTEX_RECURSIVE_NP;])],
  699. AC_MSG_RESULT(yes)
  700. AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1, [Define to 1 if your system defines PTHREAD_MUTEX_RECURSIVE_NP in pthread.h]),
  701. AC_MSG_RESULT(no)
  702. )
  703. AC_MSG_CHECKING(for pthread_rwlock_timedwrlock() in pthread.h)
  704. save_LIBS="$LIBS"
  705. save_CFLAGS="$CFLAGS"
  706. LIBS="$PTHREAD_LIBS $LIBS"
  707. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  708. AC_LINK_IFELSE(
  709. [AC_LANG_PROGRAM(
  710. [#include <pthread.h>
  711. #include <time.h>],
  712. [pthread_rwlock_t foo; struct timespec bar; pthread_rwlock_timedwrlock(&foo, &bar)])
  713. ],[
  714. AC_MSG_RESULT(yes)
  715. ac_cv_pthread_rwlock_timedwrlock="yes"
  716. ],[
  717. AC_MSG_RESULT(no)
  718. ac_cv_pthread_rwlock_timedwrlock="no"
  719. ]
  720. )
  721. LIBS="$save_LIBS"
  722. CFLAGS="$save_CFLAGS"
  723. if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
  724. AC_DEFINE([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK], 1, [Define if your system has pthread_rwlock_timedwrlock()])
  725. fi
  726. AC_MSG_CHECKING(if PTHREAD_ONCE_INIT needs braces)
  727. saved_CFLAGS="${CFLAGS}"
  728. CFLAGS="${CFLAGS} -Werror -Wmissing-braces"
  729. AC_COMPILE_IFELSE(
  730. [AC_LANG_PROGRAM(
  731. [#include <pthread.h>
  732. void empty(){}],
  733. [pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, empty);])
  734. ],[
  735. AC_MSG_RESULT(no)
  736. ac_cv_pthread_once_needsbraces="no"
  737. ],[
  738. AC_MSG_RESULT(yes)
  739. ac_cv_pthread_once_needsbraces="yes"
  740. ]
  741. )
  742. CFLAGS="${saved_CFLAGS}"
  743. if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
  744. AC_DEFINE([PTHREAD_ONCE_INIT_NEEDS_BRACES], 1, [Define if your system needs braces around PTHREAD_ONCE_INIT])
  745. fi
  746. AST_C_DEFINE_CHECK([PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], [pthread.h])
  747. # Can we compare a mutex to its initial value?
  748. # Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
  749. AC_MSG_CHECKING(whether we can compare a mutex to its initial value)
  750. AC_LINK_IFELSE(
  751. [AC_LANG_PROGRAM([#include <pthread.h>], [pthread_mutex_t lock;
  752. if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
  753. return 0;
  754. }
  755. return 0])],
  756. AC_MSG_RESULT(yes)
  757. 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.]),
  758. AC_MSG_RESULT(no)
  759. )
  760. #if test "${cross_compiling}" = "no";
  761. #then
  762. #AC_MSG_CHECKING(for working epoll support)
  763. #AC_LINK_IFELSE(
  764. #AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
  765. # if (res < 0)
  766. # return 1;
  767. # close (res);
  768. # return 0;]),
  769. #AC_MSG_RESULT(yes)
  770. #AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
  771. #AC_MSG_RESULT(no)
  772. #)
  773. #fi
  774. # for FreeBSD thr_self
  775. AC_CHECK_HEADERS([sys/thr.h])
  776. AC_MSG_CHECKING(for compiler atomic operations)
  777. AC_LINK_IFELSE(
  778. [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
  779. AC_MSG_RESULT(yes)
  780. AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
  781. AC_MSG_RESULT(no)
  782. )
  783. # glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
  784. AC_MSG_CHECKING([if your system printf is NULL-safe.])
  785. AC_RUN_IFELSE(
  786. [AC_LANG_PROGRAM([#include <stdio.h>],
  787. [printf("%s", NULL)])],
  788. AC_DEFINE([HAVE_NULLSAFE_PRINTF], 1, [Define to 1 if your C library can safely print NULL to string formats.])
  789. AC_MSG_RESULT(yes),
  790. AC_MSG_RESULT(no),
  791. # It's unlikely an embedded system will have this.
  792. AC_MSG_RESULT(unknown)
  793. )
  794. AC_MSG_CHECKING(if we can increase the maximum select-able file descriptor)
  795. AC_RUN_IFELSE(
  796. [AC_LANG_PROGRAM([
  797. #include <stdio.h>
  798. #include <sys/select.h>
  799. #include <sys/time.h>
  800. #include <sys/resource.h>
  801. #include <string.h>
  802. #include <errno.h>
  803. #include <stdlib.h>
  804. #include <sys/types.h>
  805. #include <sys/stat.h>
  806. #include <fcntl.h>
  807. #include <unistd.h>
  808. ], [[
  809. struct rlimit rlim = { FD_SETSIZE * 2, FD_SETSIZE * 2 };
  810. int fd0, fd1;
  811. struct timeval tv = { 0, };
  812. struct ast_fdset { long fds_bits[[1024]]; } fds = { { 0, } };
  813. if (setrlimit(RLIMIT_NOFILE, &rlim)) { exit(1); }
  814. if ((fd0 = open("/dev/null", O_RDONLY)) < 0) { exit(1); }
  815. if (dup2(fd0, (fd1 = FD_SETSIZE + 1)) < 0) { exit(1); }
  816. FD_SET(fd0, (fd_set *) &fds);
  817. FD_SET(fd1, (fd_set *) &fds);
  818. if (select(FD_SETSIZE + 2, (fd_set *) &fds, NULL, NULL, &tv) < 0) { exit(1); }
  819. exit(0)]])],
  820. AC_MSG_RESULT(yes)
  821. AC_DEFINE([HAVE_VARIABLE_FDSET], 1, [Define to 1 if your system can support larger than default select bitmasks.]),
  822. AC_MSG_RESULT(no),
  823. AC_MSG_RESULT(cross-compile)
  824. )
  825. if test "${ac_cv_have_variable_fdset}x" = "0x"; then
  826. AC_RUN_IFELSE(
  827. [AC_LANG_PROGRAM([
  828. #include <unistd.h>
  829. #include <sys/types.h>
  830. #include <stdlib.h>
  831. ], [if (getuid() != 0) { exit(1); }])],
  832. AC_DEFINE([CONFIGURE_RAN_AS_ROOT], 1, [Some configure tests will unexpectedly fail if configure is run by a non-root user. These may be able to be tested at runtime.]))
  833. fi
  834. AST_GCC_ATTRIBUTE(pure)
  835. AST_GCC_ATTRIBUTE(malloc)
  836. AST_GCC_ATTRIBUTE(const)
  837. AST_GCC_ATTRIBUTE(unused)
  838. AST_GCC_ATTRIBUTE(always_inline)
  839. AST_GCC_ATTRIBUTE(deprecated)
  840. AST_GCC_ATTRIBUTE(sentinel)
  841. AST_GCC_ATTRIBUTE(warn_unused_result)
  842. # Support weak symbols on a platform specific basis. The Mac OS X
  843. # (Darwin) support must be isolated from the other platforms because
  844. # it has caused other platforms to fail.
  845. #
  846. case "${OSARCH}" in
  847. darwin*)
  848. # Allow weak symbol support on Darwin platforms only because there
  849. # is active community support for it.
  850. # However, Darwin seems to break weak symbols for each new version.
  851. #
  852. AST_GCC_ATTRIBUTE(weak_import, [], [], PBX_WEAKREF)
  853. # Several other platforms including Linux have GCC versions that
  854. # define the weak attribute. However, this attribute is only
  855. # setup for use in the code by Darwin.
  856. AST_GCC_ATTRIBUTE(weak, [], [], PBX_WEAKREF)
  857. ;;
  858. linux-gnu)
  859. # Primarily support weak symbols on Linux platforms.
  860. #
  861. AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
  862. ;;
  863. *)
  864. # Allow weak symbols on other platforms. However, any problems
  865. # with this feature on other platforms must be fixed by the
  866. # community.
  867. #
  868. AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
  869. ;;
  870. esac
  871. AC_MSG_CHECKING(for -ffunction-sections support)
  872. saved_CFLAGS="${CFLAGS}"
  873. CFLAGS="${CFLAGS} -ffunction-sections"
  874. AC_COMPILE_IFELSE(
  875. [AC_LANG_PROGRAM([], [int x = 1;])],
  876. AC_MSG_RESULT(yes)
  877. [saved_LDFLAGS="${LDFLAGS}"]
  878. [LDFLAGS="${LDFLAGS} -Wl,--gc-sections"]
  879. AC_MSG_CHECKING(for --gc-sections support)
  880. AC_LINK_IFELSE(
  881. [AC_LANG_PROGRAM([], [int x = 1;])],
  882. AC_MSG_RESULT(yes)
  883. [GC_CFLAGS="-ffunction-sections"]
  884. [[GC_LDFLAGS="-Wl,--gc-sections"]],
  885. AC_MSG_RESULT(no)
  886. )
  887. [LDFLAGS="${saved_LDFLAGS}"],
  888. AC_MSG_RESULT(no)
  889. )
  890. CFLAGS="${saved_CFLAGS}"
  891. AC_SUBST(GC_CFLAGS)
  892. AC_SUBST(GC_LDFLAGS)
  893. AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
  894. if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  895. AC_MSG_RESULT(yes)
  896. AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
  897. else
  898. AC_MSG_RESULT(no)
  899. AST_DECLARATION_AFTER_STATEMENT=
  900. fi
  901. AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
  902. AC_MSG_CHECKING(for -Wtrampolines support)
  903. if $(${CC} -Wtrampolines -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  904. AC_MSG_RESULT(yes)
  905. AST_TRAMPOLINES=-Wtrampolines
  906. else
  907. AC_MSG_RESULT(no)
  908. AST_TRAMPOLINES=
  909. fi
  910. AC_SUBST(AST_TRAMPOLINES)
  911. AC_MSG_CHECKING(for _FORTIFY_SOURCE support)
  912. if $(${CC} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  913. AC_MSG_RESULT(yes)
  914. AST_FORTIFY_SOURCE="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
  915. else
  916. AC_MSG_RESULT(no)
  917. AST_FORTIFY_SOURCE=
  918. fi
  919. AC_SUBST(AST_FORTIFY_SOURCE)
  920. AC_MSG_CHECKING(for -fno-strict-overflow)
  921. if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  922. AC_MSG_RESULT(yes)
  923. AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
  924. else
  925. AC_MSG_RESULT(no)
  926. AST_NO_STRICT_OVERFLOW=
  927. fi
  928. AC_SUBST(AST_NO_STRICT_OVERFLOW)
  929. AC_MSG_CHECKING(for -Wshadow)
  930. if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  931. AC_MSG_RESULT(yes)
  932. AST_SHADOW_WARNINGS=-Wshadow
  933. else
  934. AC_MSG_RESULT(no)
  935. AST_SHADOW_WARNINGS=
  936. fi
  937. AC_SUBST(AST_SHADOW_WARNINGS)
  938. AC_MSG_CHECKING(for -march=native support)
  939. if $(${CC} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
  940. if test "${CONFIG_CFLAGS}" = ""; then
  941. AC_MSG_RESULT(yes)
  942. AST_NATIVE_ARCH=1
  943. else
  944. AC_MSG_RESULT(user CFLAGS present)
  945. AST_NATIVE_ARCH=
  946. fi
  947. else
  948. AC_MSG_RESULT(no)
  949. AST_NATIVE_ARCH=
  950. fi
  951. AC_SUBST(AST_NATIVE_ARCH)
  952. dnl Nested functions required for RAII implementation
  953. AC_LINK_IFELSE(
  954. [AC_LANG_PROGRAM([], [
  955. #if defined(__clang__)
  956. choke
  957. #endif
  958. ])
  959. ],[
  960. dnl Nested functions required for RAII implementation
  961. AC_MSG_CHECKING(for gcc -fnested-functions)
  962. AC_COMPILE_IFELSE(
  963. dnl Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774
  964. [AC_LANG_PROGRAM([], [auto void foo(void); void foo(void) {}])],
  965. AC_MSG_RESULT(no)
  966. [AST_NESTED_FUNCTIONS=],
  967. AC_MSG_RESULT(yes)
  968. [AST_NESTED_FUNCTIONS=-fnested-functions]
  969. )
  970. AC_SUBST(AST_NESTED_FUNCTIONS)
  971. ],[
  972. AC_MSG_CHECKING(for clang -fblocks)
  973. if test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c - 2>&1`" = ""; then
  974. [AST_CLANG_BLOCKS_LIBS=""]
  975. [AST_CLANG_BLOCKS="-Wno-unknown-warning-option -fblocks"]
  976. AC_MSG_RESULT(yes)
  977. elif test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c -lBlocksRuntime - 2>&1`" = ""; then
  978. [AST_CLANG_BLOCKS_LIBS="-lBlocksRuntime"]
  979. [AST_CLANG_BLOCKS="-fblocks"]
  980. AC_MSG_RESULT(yes)
  981. else
  982. AC_MSG_ERROR("BlocksRuntime is required for clang")
  983. fi
  984. AC_SUBST(AST_CLANG_BLOCKS_LIBS)
  985. AC_SUBST(AST_CLANG_BLOCKS)
  986. ]
  987. )
  988. dnl Check to see if rpath should be set in LDFLAGS
  989. AC_ARG_ENABLE(rpath,
  990. [AC_HELP_STRING([--disable-rpath],
  991. [Disables rpath linker option checking])],
  992. [case "${enableval}" in
  993. y|ye|yes) check_rpath=yes ;;
  994. n|no) check_rpath=no ;;
  995. *) AC_MSG_ERROR(bad value ${enableval} for --disable-rpath) ;;
  996. esac], [check_rpath=yes])
  997. AC_MSG_CHECKING(whether to use rpath)
  998. AST_RPATH=
  999. if test "${check_rpath}" != yes; then
  1000. AC_MSG_RESULT(skipped)
  1001. elif test "${prefix}" = /usr || test "${prefix}" = NONE; then
  1002. AC_MSG_RESULT(not needed)
  1003. else
  1004. case "${host_os}" in
  1005. darwin*)
  1006. AC_MSG_RESULT(not supported)
  1007. # We set macosx_version_min to 10.4, which doesn't
  1008. # support rpath. However, we set install_name on our
  1009. # dylibs, so it's not strictly necessary.
  1010. ;;
  1011. *)
  1012. AC_MSG_RESULT(required)
  1013. AST_RPATH="-Wl,-rpath,${libdir}"
  1014. ;;
  1015. esac
  1016. fi
  1017. AC_SUBST(AST_RPATH)
  1018. AC_MSG_CHECKING(for sysinfo)
  1019. AC_LINK_IFELSE(
  1020. [AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
  1021. [struct sysinfo sys_info; int uptime = sys_info.uptime])],
  1022. AC_MSG_RESULT(yes)
  1023. AC_DEFINE([HAVE_SYSINFO], 1, [Define to 1 if your system has sysinfo support]),
  1024. AC_MSG_RESULT(no)
  1025. )
  1026. AC_SEARCH_LIBS(res_9_ninit, resolv)
  1027. AC_MSG_CHECKING(for res_ninit)
  1028. AC_LINK_IFELSE(
  1029. [AC_LANG_PROGRAM([
  1030. #ifdef HAVE_SYS_SOCKET_H
  1031. #include <sys/socket.h>
  1032. #endif
  1033. #ifdef HAVE_NETINET_IN_H
  1034. #include <netinet/in.h>
  1035. #endif
  1036. #ifdef HAVE_ARPA_NAMESER_H
  1037. #include <arpa/nameser.h>
  1038. #endif
  1039. #include <resolv.h>],
  1040. [int foo = res_ninit(NULL);])],
  1041. AC_MSG_RESULT(yes)
  1042. AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
  1043. AC_SEARCH_LIBS(res_9_ndestroy, resolv)
  1044. AC_MSG_CHECKING(for res_ndestroy)
  1045. AC_LINK_IFELSE(
  1046. [AC_LANG_PROGRAM([
  1047. #ifdef HAVE_SYS_SOCKET_H
  1048. #include <sys/socket.h>
  1049. #endif
  1050. #ifdef HAVE_NETINET_IN_H
  1051. #include <netinet/in.h>
  1052. #endif
  1053. #ifdef HAVE_ARPA_NAMESER_H
  1054. #include <arpa/nameser.h>
  1055. #endif
  1056. #include <resolv.h>],
  1057. [res_ndestroy(NULL);])],
  1058. AC_MSG_RESULT(yes)
  1059. AC_DEFINE([HAVE_RES_NDESTROY], 1, [Define to 1 if your system has the ndestroy resolver function.]),
  1060. AC_MSG_RESULT(no)
  1061. )
  1062. AC_SEARCH_LIBS(res_9_close, resolv)
  1063. AC_MSG_CHECKING(for res_close)
  1064. AC_LINK_IFELSE(
  1065. [AC_LANG_PROGRAM([
  1066. #ifdef HAVE_SYS_SOCKET_H
  1067. #include <sys/socket.h>
  1068. #endif
  1069. #ifdef HAVE_NETINET_IN_H
  1070. #include <netinet/in.h>
  1071. #endif
  1072. #ifdef HAVE_ARPA_NAMESER_H
  1073. #include <arpa/nameser.h>
  1074. #endif
  1075. #include <resolv.h>],
  1076. [res_close();])],
  1077. AC_MSG_RESULT(yes)
  1078. AC_DEFINE([HAVE_RES_CLOSE], 1, [Define to 1 if your system has the close resolver function.]),
  1079. AC_MSG_RESULT(no)
  1080. ),
  1081. AC_MSG_RESULT(no)
  1082. )
  1083. AST_C_DEFINE_CHECK([GLOB_NOMAGIC], [GLOB_NOMAGIC], [glob.h])
  1084. AST_C_DEFINE_CHECK([GLOB_BRACE], [GLOB_BRACE], [glob.h])
  1085. AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [IP_MTU_DISCOVER], [netinet/in.h])
  1086. AC_CHECK_HEADER([libkern/OSAtomic.h],
  1087. [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
  1088. AC_CHECK_SIZEOF([int])
  1089. AC_CHECK_SIZEOF([long])
  1090. AC_CHECK_SIZEOF([long long])
  1091. AC_CHECK_SIZEOF([char *])
  1092. AC_CHECK_SIZEOF(long)
  1093. AC_CHECK_SIZEOF(long long)
  1094. AC_COMPUTE_INT([ac_cv_sizeof_fd_set_fds_bits], [sizeof(foo.fds_bits[[0]])], [$ac_includes_default
  1095. fd_set foo;])
  1096. # This doesn't actually work; what it does is to use the variable set in the
  1097. # previous test as a cached value to set the right output variables.
  1098. AC_CHECK_SIZEOF(fd_set.fds_bits)
  1099. # Set a type compatible with the previous. We cannot just use a generic type
  1100. # for these bits, because on big-endian systems, the bits won't match up
  1101. # correctly if the size is wrong.
  1102. if test $ac_cv_sizeof_int = $ac_cv_sizeof_fd_set_fds_bits; then
  1103. AC_DEFINE([TYPEOF_FD_SET_FDS_BITS], [int], [Define to a type of the same size as fd_set.fds_bits[[0]]])
  1104. else if test $ac_cv_sizeof_long = $ac_cv_sizeof_fd_set_fds_bits; then
  1105. AC_DEFINE([TYPEOF_FD_SET_FDS_BITS], [long], [Define to a type of the same size as fd_set.fds_bits[[0]]])
  1106. else if test $ac_cv_sizeof_long_long = $ac_cv_sizeof_fd_set_fds_bits; then
  1107. AC_DEFINE([TYPEOF_FD_SET_FDS_BITS], [long long], [Define to a type of the same size as fd_set.fds_bits[[0]]])
  1108. fi ; fi ; fi
  1109. AC_MSG_CHECKING(for dladdr in dlfcn.h)
  1110. PBX_DLADDR=0
  1111. old_LIBS=${LIBS}
  1112. LIBS="${LIBS} -ldl"
  1113. AC_LINK_IFELSE(
  1114. [AC_LANG_PROGRAM([#define _GNU_SOURCE 1
  1115. #include <dlfcn.h>],
  1116. [dladdr((void *)0, (void *)0)]
  1117. )],
  1118. AC_MSG_RESULT(yes)
  1119. PBX_DLADDR=1
  1120. AC_SUBST([PBX_DLADDR])
  1121. AC_DEFINE([HAVE_DLADDR], 1, [Define to 1 if your system has the dladdr() GNU extension]),
  1122. AC_MSG_RESULT(no)
  1123. )
  1124. LIBS=${old_LIBS}
  1125. # PKGCONFIG is used in later tests
  1126. PKG_PROG_PKG_CONFIG()
  1127. # do the package library checks now
  1128. AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
  1129. AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
  1130. if test "${PBX_BFD}" = "0"; then
  1131. # Fedora/RedHat/CentOS require extra libraries
  1132. AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_check_format], [bfd.h], [-ldl -liberty])
  1133. fi
  1134. if test "${PBX_BFD}" = "0"; then
  1135. # openSUSE requires -lz
  1136. AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_check_format], [bfd.h], [-ldl -liberty -lz])
  1137. fi
  1138. if test "x${OSARCH}" = "xlinux-gnu" ; then
  1139. AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
  1140. fi
  1141. AST_C_DEFINE_CHECK([DAHDI], [DAHDI_RESET_COUNTERS], [dahdi/user.h], [230])
  1142. AST_C_DEFINE_CHECK([DAHDI], [DAHDI_DEFAULT_MTU_MRU], [dahdi/user.h], [220])
  1143. AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h], [200])
  1144. AST_C_DEFINE_CHECK([DAHDI_HALF_FULL], [DAHDI_POLICY_HALF_FULL], [dahdi/user.h])
  1145. AST_C_COMPILE_CHECK([DAHDI_LINEREVERSE_VMWI], [struct dahdi_vmwi_info booger], [dahdi/user.h], , [enhanced dahdi vmwi support])
  1146. AST_C_COMPILE_CHECK([DAHDI_ECHOCANCEL_FAX_MODE], [int foo = DAHDI_ECHOCANCEL_FAX_MODE], [dahdi/user.h])
  1147. AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
  1148. AST_C_COMPILE_CHECK([TIMERFD], [timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);], [sys/timerfd.h], , [timerfd support])
  1149. GSM_INTERNAL="yes"
  1150. AC_SUBST(GSM_INTERNAL)
  1151. GSM_SYSTEM="yes"
  1152. if test "${USE_GSM}" != "no"; then
  1153. if test "${GSM_DIR}" = "internal"; then
  1154. GSM_SYSTEM="no"
  1155. elif test "${GSM_DIR}" != ""; then
  1156. GSM_INTERNAL="no"
  1157. fi
  1158. if test "${GSM_SYSTEM}" = "yes"; then
  1159. gsmlibdir=""
  1160. if test "x${GSM_DIR}" != "x"; then
  1161. if test -d ${GSM_DIR}/lib; then
  1162. gsmlibdir="-L${GSM_DIR}/lib"
  1163. else
  1164. gsmlibdir="-L${GSM_DIR}"
  1165. fi
  1166. fi
  1167. AC_CHECK_LIB([gsm], [gsm_create], AC_DEFINE_UNQUOTED([HAVE_GSM], 1,
  1168. [Define to indicate the GSM library]), [], ${gsmlibdir})
  1169. if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
  1170. if test "x${GSM_DIR}" != "x" ; then
  1171. AC_CHECK_HEADER([${GSM_DIR}/include/gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
  1172. AC_CHECK_HEADER([${GSM_DIR}/include/gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
  1173. else
  1174. AC_CHECK_HEADER([gsm.h], [GSM_HEADER_FOUND=1], [GSM_HEADER_FOUND=0])
  1175. AC_CHECK_HEADER([gsm/gsm.h], [GSM_GSM_HEADER_FOUND=1], [GSM_GSM_HEADER_FOUND=0])
  1176. fi
  1177. if test "${GSM_HEADER_FOUND}" = "0" ; then
  1178. if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
  1179. if test "x${GSM_MANDATORY}" = "xyes" ; then
  1180. AC_MSG_NOTICE([***])
  1181. AC_MSG_NOTICE([*** It appears that you do not have the gsm development package installed.])
  1182. AC_MSG_NOTICE([*** Please install it to include ${GSM_DESCRIP} support, or re-run configure])
  1183. AC_MSG_NOTICE([*** without explicitly specifying --with-${GSM_OPTION}])
  1184. exit 1
  1185. fi
  1186. fi
  1187. fi
  1188. GSM_OK=0
  1189. if test "${GSM_HEADER_FOUND}" = "1" ; then
  1190. AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
  1191. GSM_OK=1
  1192. else
  1193. if test "${GSM_GSM_HEADER_FOUND}" = "1" ; then
  1194. AC_DEFINE_UNQUOTED([HAVE_GSM_GSM_HEADER], 1, [Define to indicate that gsm.h is in gsm/gsm.h])
  1195. GSM_OK=1
  1196. fi
  1197. fi
  1198. if test "${GSM_OK}" = "1" ; then
  1199. GSM_LIB="-lgsm"
  1200. if test "x${GSM_DIR}" != "x"; then
  1201. GSM_LIB="${gsmlibdir} ${GSM_LIB}"
  1202. GSM_INCLUDE="-I${GSM_DIR}/include"
  1203. fi
  1204. PBX_GSM=1
  1205. GSM_INTERNAL="no"
  1206. fi
  1207. fi
  1208. fi
  1209. if test "${GSM_INTERNAL}" = "yes"; then
  1210. PBX_GSM=1
  1211. AC_DEFINE_UNQUOTED([HAVE_GSM_HEADER], 1, [Define to indicate that gsm.h has no prefix for its location])
  1212. fi
  1213. fi
  1214. ILBC_INTERNAL="yes"
  1215. AC_SUBST(ILBC_INTERNAL)
  1216. ILBC_SYSTEM="yes"
  1217. if test "${USE_ILBC}" != "no"; then
  1218. if test "${ILBC_DIR}" = "internal"; then
  1219. ILBC_SYSTEM="no"
  1220. elif test "${ILBC_DIR}" != ""; then
  1221. ILBC_INTERNAL="no"
  1222. fi
  1223. if test "${ILBC_SYSTEM}" = "yes"; then
  1224. AST_PKG_CONFIG_CHECK(ILBC, libilbc)
  1225. if test "$PBX_ILBC" = "1"; then
  1226. ILBC_INTERNAL="no"
  1227. fi
  1228. fi
  1229. if test "${ILBC_INTERNAL}" = "yes"; then
  1230. PBX_ILBC=1
  1231. fi
  1232. fi
  1233. LIBEDIT_INTERNAL="yes"
  1234. AC_SUBST(LIBEDIT_INTERNAL)
  1235. LIBEDIT_SYSTEM="yes"
  1236. if test "${USE_LIBEDIT}" != "no"; then
  1237. if test "${LIBEDIT_DIR}" = "internal"; then
  1238. LIBEDIT_SYSTEM="no"
  1239. elif test "${LIBEDIT_DIR}" != ""; then
  1240. LIBEDIT_INTERNAL="no"
  1241. fi
  1242. if test "${LIBEDIT_SYSTEM}" = "yes"; then
  1243. AST_PKG_CONFIG_CHECK(LIBEDIT, libedit)
  1244. if test "$PBX_LIBEDIT" = "1"; then
  1245. LIBEDIT_INTERNAL="no"
  1246. fi
  1247. fi
  1248. if test "${LIBEDIT_INTERNAL}" = "yes"; then
  1249. PBX_LIBEDIT=1
  1250. fi
  1251. fi
  1252. AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h])
  1253. # GNU libiconv #define's iconv_open to libiconv_open, so we need to search for that symbol
  1254. AST_EXT_LIB_CHECK([ICONV], [iconv], [libiconv_open], [iconv.h])
  1255. # Some versions of Linux package iconv in glibc
  1256. AST_EXT_LIB_CHECK([ICONV], [c], [iconv_close], [iconv.h])
  1257. # If ical.h is NOT in the libical directory, then it is of a version insufficient for us.
  1258. AST_EXT_LIB_CHECK([ICAL], [ical], [icaltimezone_get_utc_timezone], [libical/ical.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
  1259. AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
  1260. if test "${USE_IMAP_TK}" != "no"; then
  1261. saved_cppflags="${CPPFLAGS}"
  1262. saved_libs="${LIBS}"
  1263. switch_to_system_on_failure="no"
  1264. if test "${IMAP_TK_DIR}" = ""; then
  1265. IMAP_TK_DIR=`pwd`"/../imap-2004g"
  1266. switch_to_system_on_failure="yes"
  1267. fi
  1268. if test "${IMAP_TK_DIR}" != "system"; then
  1269. AC_MSG_CHECKING(for UW IMAP Toolkit c-client library)
  1270. if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
  1271. imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
  1272. fi
  1273. imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
  1274. imap_include="-I${IMAP_TK_DIR}/c-client"
  1275. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  1276. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  1277. AC_LINK_IFELSE(
  1278. [AC_LANG_PROGRAM(
  1279. [#include "c-client.h"
  1280. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1281. {
  1282. }
  1283. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1284. {
  1285. }
  1286. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1287. {
  1288. }
  1289. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1290. {
  1291. }
  1292. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1293. {
  1294. }
  1295. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1296. {
  1297. }
  1298. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1299. {
  1300. }
  1301. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1302. {
  1303. }
  1304. void mm_log (char *string,long errflg)
  1305. {
  1306. }
  1307. void mm_dlog (char *string)
  1308. {
  1309. }
  1310. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1311. {
  1312. }
  1313. void mm_critical (MAILSTREAM *stream)
  1314. {
  1315. }
  1316. void mm_nocritical (MAILSTREAM *stream)
  1317. {
  1318. }
  1319. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1320. {
  1321. }
  1322. void mm_fatal (char *string)
  1323. {
  1324. }],
  1325. [
  1326. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1327. ]
  1328. )],
  1329. [ac_cv_imap_tk="yes"],
  1330. [ac_cv_imap_tk="no"]
  1331. )
  1332. if test "${ac_cv_imap_tk}" = "yes"; then
  1333. AC_LINK_IFELSE(
  1334. [AC_LANG_PROGRAM(
  1335. [#include "c-client.h"
  1336. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1337. {
  1338. }
  1339. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1340. {
  1341. }
  1342. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1343. {
  1344. }
  1345. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1346. {
  1347. }
  1348. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1349. {
  1350. }
  1351. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1352. {
  1353. }
  1354. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1355. {
  1356. }
  1357. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1358. {
  1359. }
  1360. void mm_log (char *string,long errflg)
  1361. {
  1362. }
  1363. void mm_dlog (char *string)
  1364. {
  1365. }
  1366. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1367. {
  1368. }
  1369. void mm_critical (MAILSTREAM *stream)
  1370. {
  1371. }
  1372. void mm_nocritical (MAILSTREAM *stream)
  1373. {
  1374. }
  1375. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1376. {
  1377. }
  1378. void mm_fatal (char *string)
  1379. {
  1380. }],
  1381. [
  1382. long check = mail_expunge_full(NULL, "", 0);
  1383. ]
  1384. )],
  1385. [ac_cv_imap_tk2006="yes"],
  1386. [ac_cv_imap_tk2006="no"]
  1387. )
  1388. fi
  1389. CPPFLAGS="${saved_cppflags}"
  1390. LIBS="${saved_libs}"
  1391. if test "${ac_cv_imap_tk}" = "no"; then
  1392. AC_MSG_RESULT(no)
  1393. if test "${switch_to_system_on_failure}" = "yes"; then
  1394. IMAP_TK_DIR="system"
  1395. else #This means they specified a directory. Search for a package installation there too
  1396. AC_MSG_CHECKING([for system c-client library...])
  1397. CPPFLAGS="${saved_cppflags}"
  1398. LIBS="${saved_libs}"
  1399. imap_include="-I${IMAP_TK_DIR}/include"
  1400. imap_ldflags="-L${IMAP_TK_DIR}/lib"
  1401. imap_libs="-lc-client"
  1402. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  1403. LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
  1404. AC_LINK_IFELSE(
  1405. [AC_LANG_PROGRAM(
  1406. [#include "c-client.h"
  1407. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1408. {
  1409. }
  1410. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1411. {
  1412. }
  1413. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1414. {
  1415. }
  1416. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1417. {
  1418. }
  1419. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1420. {
  1421. }
  1422. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1423. {
  1424. }
  1425. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1426. {
  1427. }
  1428. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1429. {
  1430. }
  1431. void mm_log (char *string,long errflg)
  1432. {
  1433. }
  1434. void mm_dlog (char *string)
  1435. {
  1436. }
  1437. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1438. {
  1439. }
  1440. void mm_critical (MAILSTREAM *stream)
  1441. {
  1442. }
  1443. void mm_nocritical (MAILSTREAM *stream)
  1444. {
  1445. }
  1446. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1447. {
  1448. }
  1449. void mm_fatal (char *string)
  1450. {
  1451. }],
  1452. [
  1453. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1454. ]
  1455. )],
  1456. [ac_cv_imap_tk="yes"],
  1457. [ac_cv_imap_tk="no"]
  1458. )
  1459. if test "${ac_cv_imap_tk}" = "yes"; then
  1460. AC_LINK_IFELSE(
  1461. [AC_LANG_PROGRAM(
  1462. [#include "c-client.h"
  1463. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1464. {
  1465. }
  1466. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1467. {
  1468. }
  1469. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1470. {
  1471. }
  1472. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1473. {
  1474. }
  1475. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1476. {
  1477. }
  1478. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1479. {
  1480. }
  1481. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1482. {
  1483. }
  1484. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1485. {
  1486. }
  1487. void mm_log (char *string,long errflg)
  1488. {
  1489. }
  1490. void mm_dlog (char *string)
  1491. {
  1492. }
  1493. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1494. {
  1495. }
  1496. void mm_critical (MAILSTREAM *stream)
  1497. {
  1498. }
  1499. void mm_nocritical (MAILSTREAM *stream)
  1500. {
  1501. }
  1502. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1503. {
  1504. }
  1505. void mm_fatal (char *string)
  1506. {
  1507. }],
  1508. [
  1509. long check = mail_expunge_full(NULL, "", 0);
  1510. ]
  1511. )],
  1512. [ac_cv_imap_tk2006="yes"],
  1513. [ac_cv_imap_tk2006="no"]
  1514. )
  1515. fi
  1516. fi
  1517. fi
  1518. fi
  1519. if test "${IMAP_TK_DIR}" = "system"; then
  1520. #We will enter here if user specified "system" or if any of above checks failed
  1521. AC_MSG_CHECKING([for system c-client library...])
  1522. CPPFLAGS="${saved_cppflags}"
  1523. LIBS="${saved_libs}"
  1524. imap_ldflags=""
  1525. imap_libs="-lc-client"
  1526. imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
  1527. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  1528. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  1529. AC_LINK_IFELSE(
  1530. [AC_LANG_PROGRAM(
  1531. [#include <stdio.h>
  1532. #include <imap/c-client.h>
  1533. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1534. {
  1535. }
  1536. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1537. {
  1538. }
  1539. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1540. {
  1541. }
  1542. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1543. {
  1544. }
  1545. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1546. {
  1547. }
  1548. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1549. {
  1550. }
  1551. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1552. {
  1553. }
  1554. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1555. {
  1556. }
  1557. void mm_log (char *string,long errflg)
  1558. {
  1559. }
  1560. void mm_dlog (char *string)
  1561. {
  1562. }
  1563. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1564. {
  1565. }
  1566. void mm_critical (MAILSTREAM *stream)
  1567. {
  1568. }
  1569. void mm_nocritical (MAILSTREAM *stream)
  1570. {
  1571. }
  1572. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1573. {
  1574. }
  1575. void mm_fatal (char *string)
  1576. {
  1577. }],
  1578. [
  1579. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1580. ]
  1581. )],
  1582. [ac_cv_imap_tk="yes"],
  1583. [ac_cv_imap_tk="no"]
  1584. )
  1585. if test "${ac_cv_imap_tk}" = "yes"; then
  1586. AC_LINK_IFELSE(
  1587. [AC_LANG_PROGRAM(
  1588. [#include <stdio.h>
  1589. #include <imap/c-client.h>
  1590. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1591. {
  1592. }
  1593. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1594. {
  1595. }
  1596. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1597. {
  1598. }
  1599. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1600. {
  1601. }
  1602. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1603. {
  1604. }
  1605. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1606. {
  1607. }
  1608. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1609. {
  1610. }
  1611. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1612. {
  1613. }
  1614. void mm_log (char *string,long errflg)
  1615. {
  1616. }
  1617. void mm_dlog (char *string)
  1618. {
  1619. }
  1620. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1621. {
  1622. }
  1623. void mm_critical (MAILSTREAM *stream)
  1624. {
  1625. }
  1626. void mm_nocritical (MAILSTREAM *stream)
  1627. {
  1628. }
  1629. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1630. {
  1631. }
  1632. void mm_fatal (char *string)
  1633. {
  1634. }],
  1635. [
  1636. long check = mail_expunge_full(NULL, "", 0);
  1637. ]
  1638. )],
  1639. [ac_cv_imap_tk2006="yes"],
  1640. [ac_cv_imap_tk2006="no"]
  1641. )
  1642. else #looking in imap directory didn't work, try c-client
  1643. imap_ldflags=""
  1644. imap_libs="-lc-client"
  1645. imap_include="-DUSE_SYSTEM_CCLIENT"
  1646. CPPFLAGS="${saved_cppflags}"
  1647. LIBS="${saved_libs}"
  1648. CPPFLAGS="${CPPFLAGS} ${imap_include}"
  1649. LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
  1650. AC_LINK_IFELSE(
  1651. [AC_LANG_PROGRAM(
  1652. [#include <stdio.h>
  1653. #include <c-client/c-client.h>
  1654. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1655. {
  1656. }
  1657. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1658. {
  1659. }
  1660. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1661. {
  1662. }
  1663. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1664. {
  1665. }
  1666. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1667. {
  1668. }
  1669. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1670. {
  1671. }
  1672. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1673. {
  1674. }
  1675. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1676. {
  1677. }
  1678. void mm_log (char *string,long errflg)
  1679. {
  1680. }
  1681. void mm_dlog (char *string)
  1682. {
  1683. }
  1684. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1685. {
  1686. }
  1687. void mm_critical (MAILSTREAM *stream)
  1688. {
  1689. }
  1690. void mm_nocritical (MAILSTREAM *stream)
  1691. {
  1692. }
  1693. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1694. {
  1695. }
  1696. void mm_fatal (char *string)
  1697. {
  1698. }],
  1699. [
  1700. MAILSTREAM *foo = mail_open(NULL, "", 0);
  1701. ]
  1702. )],
  1703. [ac_cv_imap_tk="yes"],
  1704. [ac_cv_imap_tk="no"]
  1705. )
  1706. if test "${ac_cv_imap_tk}" = "yes"; then
  1707. AC_LINK_IFELSE(
  1708. [AC_LANG_PROGRAM(
  1709. [#include <stdio.h>
  1710. #include <c-client/c-client.h>
  1711. void mm_searched (MAILSTREAM *stream,unsigned long number)
  1712. {
  1713. }
  1714. void mm_exists (MAILSTREAM *stream,unsigned long number)
  1715. {
  1716. }
  1717. void mm_expunged (MAILSTREAM *stream,unsigned long number)
  1718. {
  1719. }
  1720. void mm_flags (MAILSTREAM *stream,unsigned long number)
  1721. {
  1722. }
  1723. void mm_notify (MAILSTREAM *stream,char *string,long errflg)
  1724. {
  1725. }
  1726. void mm_list (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1727. {
  1728. }
  1729. void mm_lsub (MAILSTREAM *stream,int delimiter,char *mailbox,long attributes)
  1730. {
  1731. }
  1732. void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status)
  1733. {
  1734. }
  1735. void mm_log (char *string,long errflg)
  1736. {
  1737. }
  1738. void mm_dlog (char *string)
  1739. {
  1740. }
  1741. void mm_login (NETMBX *mb,char *user,char *pwd,long trial)
  1742. {
  1743. }
  1744. void mm_critical (MAILSTREAM *stream)
  1745. {
  1746. }
  1747. void mm_nocritical (MAILSTREAM *stream)
  1748. {
  1749. }
  1750. long mm_diskerror (MAILSTREAM *stream,long errcode,long serious)
  1751. {
  1752. }
  1753. void mm_fatal (char *string)
  1754. {
  1755. }],
  1756. [
  1757. long check = mail_expunge_full(NULL, "", 0);
  1758. ]
  1759. )],
  1760. [ac_cv_imap_tk2006="yes"],
  1761. [ac_cv_imap_tk2006="no"]
  1762. )
  1763. fi
  1764. fi
  1765. fi
  1766. if test "${ac_cv_imap_tk}" = "yes"; then
  1767. AC_MSG_RESULT(yes)
  1768. IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
  1769. IMAP_TK_INCLUDE="${imap_include}"
  1770. PBX_IMAP_TK=1
  1771. AC_DEFINE([HAVE_IMAP_TK], 1, [Define if your system has the UW IMAP Toolkit c-client library.])
  1772. if test "${ac_cv_imap_tk2006}" = "yes"; then
  1773. AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
  1774. fi
  1775. else
  1776. AC_MSG_RESULT(no)
  1777. fi
  1778. CPPFLAGS="${saved_cppflags}"
  1779. LIBS="${saved_libs}"
  1780. fi
  1781. AST_EXT_LIB_CHECK([IODBC], [iodbc], [SQLConnect], [sql.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
  1782. AST_EXT_LIB_CHECK([INOTIFY], [c], [inotify_init], [sys/inotify.h])
  1783. AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
  1784. # BSD (and OS X) equivalent of inotify
  1785. AST_EXT_LIB_CHECK([KQUEUE], [c], [kqueue], [sys/event.h])
  1786. # 64-bit version of kevent (from kqueue) on OS X
  1787. AC_CHECK_FUNCS([kevent64])
  1788. # Needed by unixodbc
  1789. AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
  1790. AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
  1791. AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
  1792. if test "${PBX_MISDN}" = 1; then
  1793. AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
  1794. AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
  1795. AST_C_DEFINE_CHECK([MISDN_FAC_RESULT], [Fac_RESULT], [mISDNuser/suppserv.h])
  1796. AST_C_DEFINE_CHECK([MISDN_FAC_ERROR], [Fac_ERROR], [mISDNuser/suppserv.h])
  1797. AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
  1798. AC_CHECK_MEMBER([Q931_info_t.redirect_dn], [], [PBX_MISDN=0], [#include <mISDNuser/mISDNlib.h>])
  1799. fi
  1800. AST_EXT_TOOL_CHECK([MYSQLCLIENT], [mysql_config])
  1801. AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
  1802. AST_EXT_TOOL_CHECK([NEON], [neon-config])
  1803. AST_EXT_TOOL_CHECK([NEON29], [neon-config], , [--libs],
  1804. [#include <ne_auth.h>],
  1805. [#ifndef NE_AUTH_NTLM
  1806. #error Need libneon >= 0.29.0
  1807. #endif])
  1808. AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp-config], , [--agent-libs],
  1809. [#include <net-snmp/net-snmp-config.h>
  1810. #include <net-snmp/net-snmp-includes.h>
  1811. #include <net-snmp/agent/net-snmp-agent-includes.h>],
  1812. [int callback = snmp_register_callback(0, 0, NULL, NULL)])
  1813. AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
  1814. AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
  1815. AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
  1816. # Non-glibc platforms require libexecinfo for backtrace support
  1817. AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
  1818. # Linux, however, has backtrace directly in glibc
  1819. AST_EXT_LIB_CHECK([BKTR], [c], [backtrace], [execinfo.h])
  1820. AST_EXT_LIB_CHECK([BLUETOOTH], [bluetooth], [ba2str], [bluetooth/bluetooth.h])
  1821. # possible places for oss definitions
  1822. AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
  1823. AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
  1824. AST_EXT_LIB_CHECK([OSS], [ossaudio], [oss_ioctl_mixer], [soundcard.h])
  1825. PG_CONFIG=No
  1826. if test "${USE_PGSQL}" != "no"; then
  1827. if test "x${PGSQL_DIR}" != "x"; then
  1828. AC_PATH_TOOL([PG_CONFIG], [pg_config], No, [${PGSQL_DIR}/bin])
  1829. if test x"${PG_CONFIG}" = xNo; then
  1830. AC_MSG_NOTICE([***])
  1831. AC_MSG_NOTICE([*** pg_config was not found in the path you specified:])
  1832. AC_MSG_NOTICE([*** ${PGSQL_DIR}/bin])
  1833. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1834. AC_MSG_NOTICE([*** including --without-postgres])
  1835. exit 1
  1836. fi
  1837. else
  1838. AC_PATH_TOOL([PG_CONFIG], [pg_config], No)
  1839. fi
  1840. fi
  1841. if test "${PG_CONFIG}" != No; then
  1842. PGSQL_libdir=`${PG_CONFIG} --libdir`
  1843. PGSQL_includedir=`${PG_CONFIG} --includedir`
  1844. if test "x$?" != "x0" ; then
  1845. if test -n "${PGSQL_MANDATORY}" ; then
  1846. AC_MSG_NOTICE([***])
  1847. AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
  1848. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1849. AC_MSG_NOTICE([*** including --without-postgres])
  1850. exit 1
  1851. fi
  1852. else
  1853. AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
  1854. [Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
  1855. AC_MSG_CHECKING(for pg_encoding_to_char within Postgres headers)
  1856. old_CFLAGS=${CFLAGS}
  1857. CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
  1858. old_LDFLAGS=${LDFLAGS}
  1859. LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
  1860. AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libpq-fe.h>],
  1861. [const char *foo = pg_encoding_to_char(1)])],
  1862. [AC_MSG_RESULT(yes)
  1863. AC_DEFINE_UNQUOTED([HAVE_PGSQL_pg_encoding_to_char], 1, [Define to indicate presence of the pg_encoding_to_char API.])],
  1864. [AC_MSG_RESULT(no)])
  1865. CFLAGS=${old_CFLAGS}
  1866. LDFLAGS=${old_LDFLAGS}
  1867. if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
  1868. PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
  1869. PGSQL_INCLUDE="-I${PGSQL_includedir}"
  1870. PBX_PGSQL=1
  1871. elif test -n "${PGSQL_MANDATORY}";
  1872. then
  1873. AC_MSG_NOTICE([***])
  1874. AC_MSG_NOTICE([*** The PostgreSQL installation on this system appears to be broken.])
  1875. AC_MSG_NOTICE([*** Either correct the installation, or run configure])
  1876. AC_MSG_NOTICE([*** including --without-postgres])
  1877. exit 1
  1878. fi
  1879. fi
  1880. fi
  1881. AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
  1882. AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
  1883. AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
  1884. AST_EXT_LIB_CHECK([PRI_SETUP_ACK_INBAND], [pri], [pri_setup_ack], [libpri.h])
  1885. AST_EXT_LIB_CHECK([PRI_L2_PERSISTENCE], [pri], [pri_persistent_layer2_option], [libpri.h])
  1886. AST_EXT_LIB_CHECK([PRI_DATETIME_SEND], [pri], [pri_date_time_send_option], [libpri.h])
  1887. AST_EXT_LIB_CHECK([PRI_MWI_V2], [pri], [pri_mwi_indicate_v2], [libpri.h])
  1888. AST_EXT_LIB_CHECK([PRI_DISPLAY_TEXT], [pri], [pri_display_text], [libpri.h])
  1889. AST_EXT_LIB_CHECK([PRI_MWI], [pri], [pri_mwi_indicate], [libpri.h])
  1890. AST_EXT_LIB_CHECK([PRI_MCID], [pri], [pri_mcid_enable], [libpri.h])
  1891. AST_EXT_LIB_CHECK([PRI_CALL_WAITING], [pri], [pri_connect_ack_enable], [libpri.h])
  1892. AST_EXT_LIB_CHECK([PRI_AOC_EVENTS], [pri], [pri_aoc_events_enable], [libpri.h])
  1893. AST_EXT_LIB_CHECK([PRI_TRANSFER], [pri], [pri_transfer_enable], [libpri.h])
  1894. AST_EXT_LIB_CHECK([PRI_CCSS], [pri], [pri_cc_enable], [libpri.h])
  1895. AST_EXT_LIB_CHECK([PRI_HANGUP_FIX], [pri], [pri_hangup_fix_enable], [libpri.h])
  1896. AST_EXT_LIB_CHECK([PRI_SUBADDR], [pri], [pri_sr_set_called_subaddress], [libpri.h])
  1897. AST_EXT_LIB_CHECK([PRI_CALL_HOLD], [pri], [pri_hold_enable], [libpri.h])
  1898. AST_EXT_LIB_CHECK([PRI_CALL_REROUTING], [pri], [pri_reroute_enable], [libpri.h])
  1899. AST_EXT_LIB_CHECK([PRI_SETUP_KEYPAD], [pri], [pri_sr_set_keypad_digits], [libpri.h])
  1900. # ------------------------------------v
  1901. # TODO: The code can be changed to always include these features now.
  1902. # These features will always be present if pri_connected_line_update is available.
  1903. AST_EXT_LIB_CHECK([PRI_PROG_W_CAUSE], [pri], [pri_progress_with_cause], [libpri.h])
  1904. AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
  1905. AST_EXT_LIB_CHECK([PRI_SERVICE_MESSAGES], [pri], [pri_maintenance_service], [libpri.h])
  1906. AST_EXT_LIB_CHECK([PRI_REVERSE_CHARGE], [pri], [pri_sr_set_reversecharge], [libpri.h])
  1907. # ------------------------------------^
  1908. AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
  1909. AST_C_COMPILE_CHECK([SPANDSP], [
  1910. #if SPANDSP_RELEASE_DATE < 20080516
  1911. #error "spandsp 0.0.5 or greater is required"
  1912. #endif
  1913. ], [spandsp/version.h], , [minimum version of SpanDSP])
  1914. if test "x${PBX_SPANDSP}" = "x1" ; then
  1915. # We found the correct version in the header, now let's make sure it links
  1916. # properly, and that libtiff is available
  1917. PBX_SPANDSP=0
  1918. AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
  1919. fi
  1920. if test "x${PBX_SPANDSP}" = "x1" ; then
  1921. # We also need t38_terminal_init()
  1922. PBX_SPANDSP=0
  1923. AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [t38_terminal_init], [spandsp.h], [-ltiff])
  1924. fi
  1925. # Check for libss7 v1.0 branch compatible version.
  1926. AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_set_adjpc], [libss7.h])
  1927. AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
  1928. if test "${USE_PWLIB}" != "no"; then
  1929. if test -n "${PWLIB_DIR}"; then
  1930. PWLIBDIR="${PWLIB_DIR}"
  1931. fi
  1932. AST_CHECK_PWLIB()
  1933. AST_CHECK_PWLIB_VERSION([PWLib], [PWLIB], [ptbuildopts.h], [1], [9], [2], [P[[WT]]LIB_VERSION])
  1934. if test "${HAS_PWLIB:-unset}" != "unset"; then
  1935. AST_CHECK_PWLIB_PLATFORM()
  1936. PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
  1937. AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB],
  1938. [Define if your system has the PWLib libraries.],
  1939. [#include "ptlib.h"],
  1940. [int q = (int) PTime::IsDaylightSavings();])
  1941. fi
  1942. fi
  1943. if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
  1944. if test -n "${OPENH323_DIR}"; then
  1945. OPENH323DIR="${OPENH323_DIR}"
  1946. fi
  1947. AST_CHECK_OPENH323()
  1948. AST_CHECK_PWLIB_VERSION([OpenH323], [OPENH323], [openh323buildopts.h], [1], [17], [3], [], [1], [19], [0])
  1949. AST_CHECK_OPENH323_BUILD()
  1950. PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
  1951. AST_CHECK_PWLIB_BUILD([OpenH323], [OPENH323],
  1952. [Define if your system has the OpenH323 libraries.],
  1953. [#include "ptlib.h"
  1954. #include "h323.h"
  1955. #include "h323ep.h"],
  1956. [H323EndPoint ep = H323EndPoint();],
  1957. [${PWLIB_INCLUDE}], [${PWLIB_LIB}])
  1958. fi
  1959. AST_EXT_LIB_CHECK([LUA], [lua5.2], [luaL_newstate], [lua5.2/lua.h], [-lm])
  1960. if test "x${PBX_LUA}" = "x1" ; then
  1961. if test x"${LUA_DIR}" = x; then
  1962. LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.2"
  1963. else
  1964. LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.2"
  1965. fi
  1966. fi
  1967. AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm])
  1968. if test "x${PBX_LUA}" = "x1" ; then
  1969. if test x"${LUA_DIR}" = x; then
  1970. LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
  1971. else
  1972. LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
  1973. fi
  1974. fi
  1975. # Some distributions (like SuSE) remove the 5.1 suffix.
  1976. AST_EXT_LIB_CHECK([LUA], [lua], [luaL_openlib], [lua.h], [-lm])
  1977. # Accept either RADIUS client library, their APIs are fully compatible,
  1978. # just different header filenames and different SONAMEs
  1979. AST_EXT_LIB_CHECK([RADIUS], [freeradius-client], [rc_read_config], [freeradius-client.h])
  1980. if test "x${PBX_RADIUS}" = "x1"; then
  1981. AC_DEFINE(FREERADIUS_CLIENT, [], [Use the FreeRADIUS-client library])
  1982. else
  1983. AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
  1984. fi
  1985. AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcfg])
  1986. AST_EXT_LIB_CHECK([COROSYNC_CFG_STATE_TRACK], [cfg], [corosync_cfg_state_track], [corosync/cfg.h], [-lcfg])
  1987. AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
  1988. # See if the main speex library contains the preprocess functions
  1989. AST_EXT_LIB_CHECK([SPEEX_PREPROCESS], [speex], [speex_preprocess_ctl], [speex/speex.h], [-lm])
  1990. if test "${PBX_SPEEX_PREPROCESS}" = 1; then
  1991. PBX_SPEEX_PREPROCESS=1
  1992. fi
  1993. AST_EXT_LIB_CHECK([SPEEXDSP], [speexdsp], [speex_preprocess_ctl], [speex/speex.h], [-lm])
  1994. if test "${PBX_SPEEXDSP}" = 1; then
  1995. PBX_SPEEX_PREPROCESS=1
  1996. fi
  1997. AC_SUBST(PBX_SPEEX_PREPROCESS)
  1998. AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h])
  1999. AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
  2000. if test "${PBX_SQLITE3}" != 1; then
  2001. AC_MSG_ERROR(*** Asterisk now uses SQLite3 for the internal Asterisk database.)
  2002. AC_MSG_ERROR(*** Please install the SQLite3 development package.)
  2003. exit 1
  2004. fi
  2005. AST_EXT_LIB_CHECK([CRYPTO], [crypto], [AES_encrypt], [openssl/aes.h])
  2006. if test "$PBX_CRYPTO" = "1";
  2007. then
  2008. AST_EXT_LIB_CHECK([OPENSSL], [ssl], [SSL_connect], [openssl/ssl.h], [-lcrypto])
  2009. fi
  2010. if test "$PBX_OPENSSL" = "1";
  2011. then
  2012. AST_CHECK_OSPTK([4], [0], [0])
  2013. AST_EXT_LIB_CHECK([OPENSSL_SRTP], [ssl], [SSL_CTX_set_tlsext_use_srtp], [openssl/ssl.h], [-lcrypto])
  2014. fi
  2015. AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h])
  2016. if test "$PBX_SRTP" = "1";
  2017. then
  2018. saved_libs="${LIBS}"
  2019. saved_ldflags="${LDFLAGS}"
  2020. saved_cflags="${CFLAGS}"
  2021. LIBS="${LIBS} ${SRTP_LIB}"
  2022. LDFLAGS="${LDFLAGS} -shared -fPIC"
  2023. CFLAGS="${CFLAGS} ${SRTP_INCLUDE}"
  2024. AC_MSG_CHECKING(for the ability of -lsrtp to be linked in a shared object)
  2025. AC_LINK_IFELSE(
  2026. [
  2027. AC_LANG_PROGRAM(
  2028. [#include <srtp/srtp.h>],
  2029. [srtp_init();]
  2030. )
  2031. ],
  2032. [ AC_MSG_RESULT(yes) ],
  2033. [
  2034. AC_MSG_RESULT(no)
  2035. AC_MSG_WARN(***)
  2036. AC_MSG_WARN(*** libsrtp could not be linked as a shared object.)
  2037. AC_MSG_WARN(*** Try compiling libsrtp manually. Configure libsrtp)
  2038. AC_MSG_WARN(*** with ./configure CFLAGS=-fPIC --prefix=/usr)
  2039. AC_MSG_WARN(*** replacing /usr with the prefix of your choice.)
  2040. AC_MSG_WARN(*** After re-installing libsrtp, re-run the Asterisk)
  2041. AC_MSG_WARN(*** configure script.)
  2042. AC_MSG_WARN(***)
  2043. AC_MSG_WARN(*** If you do not need SRTP support re-run configure)
  2044. AC_MSG_WARN(*** with the --without-srtp option.)
  2045. exit 1
  2046. ]
  2047. )
  2048. LIBS="${saved_libs}"
  2049. LDFLAGS="${saved_ldflags}"
  2050. CFLAGS="${saved_cflags}"
  2051. fi
  2052. AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp], [srtp_shutdown], [srtp/srtp.h])
  2053. for ver in 2.0 2.2 2.4 2.6; do
  2054. AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver)
  2055. if test "$PBX_GMIME" = 1; then
  2056. break;
  2057. fi
  2058. done
  2059. AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
  2060. AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
  2061. AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)
  2062. if test "${tonezone_does_not_need_lm}" = "no" ; then
  2063. tonezone_extra="-lm"
  2064. fi
  2065. AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
  2066. AST_EXT_LIB_CHECK([UUID], [uuid], [uuid_generate_random], [uuid/uuid.h])
  2067. if test "${OSARCH}" = "OpenBSD";
  2068. then
  2069. AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile -logg])
  2070. else
  2071. AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile])
  2072. fi
  2073. AST_C_DECLARE_CHECK([VORBIS_OPEN_CALLBACKS], [OV_CALLBACKS_NOCLOSE], [vorbis/vorbisfile.h])
  2074. AC_LANG_PUSH(C++)
  2075. if test "${USE_VPB}" != "no"; then
  2076. AC_MSG_CHECKING(for vpb_open in -lvpb)
  2077. saved_libs="${LIBS}"
  2078. saved_cppflags="${CPPFLAGS}"
  2079. if test "x${VPB_DIR}" != "x"; then
  2080. if test -d ${VPB_DIR}/lib; then
  2081. vpblibdir=${VPB_DIR}/lib
  2082. else
  2083. vpblibdir=${VPB_DIR}
  2084. fi
  2085. LIBS="${LIBS} -L${vpblibdir}"
  2086. CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
  2087. fi
  2088. LIBS="${PTHREAD_LIBS} ${LIBS} -lvpb"
  2089. CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS}"
  2090. AC_LINK_IFELSE(
  2091. [
  2092. AC_LANG_PROGRAM(
  2093. [#include <vpbapi.h>],
  2094. [int q = vpb_open(0,0);])
  2095. ],
  2096. [ AC_MSG_RESULT(yes)
  2097. ac_cv_lib_vpb_vpb_open="yes"
  2098. ],
  2099. [ AC_MSG_RESULT(no)
  2100. ac_cv_lib_vpb_vpb_open="no"
  2101. ]
  2102. )
  2103. LIBS="${saved_libs}"
  2104. CPPFLAGS="${saved_cppflags}"
  2105. if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
  2106. VPB_LIB="-lvpb"
  2107. if test "${VPB_DIR}" != ""; then
  2108. VPB_LIB="-L${vpblibdir} ${VPB_LIB}"
  2109. VPB_INCLUDE="-I${VPB_DIR}/include"
  2110. fi
  2111. PBX_VPB=1
  2112. AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
  2113. fi
  2114. fi
  2115. AC_LANG_POP
  2116. AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
  2117. if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
  2118. # Does ODBC support wide characters?
  2119. AC_MSG_CHECKING(whether ODBC has support for Unicode types)
  2120. AC_LINK_IFELSE(
  2121. [AC_LANG_PROGRAM(
  2122. [#include <sql.h>
  2123. #include <sqlext.h>],
  2124. [int foo = SQL_WCHAR])],
  2125. AC_MSG_RESULT(yes)
  2126. AC_DEFINE([HAVE_ODBC_WCHAR], [1], [Define to 1 if your ODBC library has wide (Unicode) types.]),
  2127. AC_MSG_RESULT(no)
  2128. )
  2129. fi
  2130. AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
  2131. AC_SUBST(PBX_H323)
  2132. AC_CHECK_HEADER([linux/compiler.h],
  2133. [AC_DEFINE_UNQUOTED([HAVE_LINUX_COMPILER_H], 1, [Define to 1 if your system has linux/compiler.h.])])
  2134. AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
  2135. #include <linux/version.h>
  2136. #ifdef HAVE_LINUX_COMPILER_H
  2137. #include <linux/compiler.h>
  2138. #endif
  2139. ])
  2140. AC_SUBST(PBX_IXJUSER)
  2141. # Used in res/res_pktccops
  2142. AST_C_DEFINE_CHECK([MSG_NOSIGNAL], [MSG_NOSIGNAL], [sys/socket.h])
  2143. AST_C_DEFINE_CHECK([SO_NOSIGPIPE], [SO_NOSIGPIPE], [sys/socket.h])
  2144. AST_EXT_TOOL_CHECK([SDL], [sdl-config])
  2145. AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
  2146. AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [${PTHREAD_LIBS} -lz -lm], [${PTHREAD_CFLAGS}])
  2147. # possible places for video4linux version 1
  2148. AC_CHECK_HEADER([linux/videodev.h],
  2149. [AC_DEFINE_UNQUOTED([HAVE_VIDEODEV_H], 1, [Define to 1 if your system has linux/videodev.h.])])
  2150. # possible places for X11
  2151. AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],,, [standard_path])
  2152. AST_EXT_LIB_CHECK([X11], [X11], [XOpenDisplay], [X11/Xlib.h],, [-I/usr/X11R6/include], [X11R6])
  2153. PBX_LAUNCHD=0
  2154. if test "${cross_compiling}" = "no";
  2155. then
  2156. AC_CHECK_FILE(/sbin/launchd, AC_DEFINE([HAVE_SBIN_LAUNCHD], 1, [Define to 1 if your system has /sbin/launchd.]))
  2157. if test "${HAVE_SBIN_LAUNCHD}" = 1; then
  2158. PBX_LAUNCHD=1
  2159. fi
  2160. fi
  2161. AC_SUBST(PBX_LAUNCHD)
  2162. AST_PKG_CONFIG_CHECK([GTK2], [gtk+-2.0])
  2163. # build a GENERIC_ODBC result based on the presence of either UnixODBC (preferred)
  2164. # or iODBC
  2165. PBX_GENERIC_ODBC=0
  2166. if test "${PBX_UNIXODBC}" = 1; then
  2167. PBX_GENERIC_ODBC=1
  2168. GENERIC_ODBC_LIB="${UNIXODBC_LIB}"
  2169. GENERIC_ODBC_INCLUDE="${UNIXODBC_INCLUDE}"
  2170. elif test "${PBX_IODBC}" = 1; then
  2171. PBX_GENERIC_ODBC=1
  2172. GENERIC_ODBC_LIB="${IODBC_LIB}"
  2173. GENERIC_ODBC_INCLUDE="${IODBC_INCLUDE}"
  2174. fi
  2175. AC_SUBST([GENERIC_ODBC_LIB])
  2176. AC_SUBST([GENERIC_ODBC_INCLUDE])
  2177. AC_SUBST([PBX_GENERIC_ODBC])
  2178. PBX_SYSLOG=0
  2179. if test "${ac_cv_header_syslog_h}" = "yes"; then
  2180. # syslog facilities
  2181. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTH], [LOG_AUTH], [syslog.h])
  2182. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_AUTHPRIV], [LOG_AUTHPRIV], [syslog.h])
  2183. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_CRON], [LOG_CRON], [syslog.h])
  2184. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_DAEMON], [LOG_DAEMON], [syslog.h])
  2185. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_FTP], [LOG_FTP], [syslog.h])
  2186. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_KERN], [LOG_KERN], [syslog.h])
  2187. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LPR], [LOG_LPR], [syslog.h])
  2188. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_MAIL], [LOG_MAIL], [syslog.h])
  2189. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_NEWS], [LOG_NEWS], [syslog.h])
  2190. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_SYSLOG], [LOG_SYSLOG], [syslog.h])
  2191. AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_UUCP], [LOG_UUCP], [syslog.h])
  2192. PBX_SYSLOG=1
  2193. fi
  2194. AC_SUBST([PBX_SYSLOG])
  2195. if test -f makeopts; then
  2196. ${ac_cv_path_EGREP} 'CURSES|GTK2|OSARCH|NEWT' makeopts > makeopts.acbak
  2197. else
  2198. touch makeopts.acbak
  2199. fi
  2200. AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
  2201. AST_CHECK_MANDATORY
  2202. if test -f build_tools/menuselect-deps; then
  2203. # extract old values of all PBX_ variables from menuselect-deps
  2204. # and preserve them so that menuselect can determine whether
  2205. # any previously-met dependencies are no longer met and warn
  2206. # the user appropriately
  2207. while IFS="=:" read var val old_val; do
  2208. eval "PBX_${var}=\${PBX_${var}}:${val}"
  2209. done < build_tools/menuselect-deps
  2210. fi
  2211. AC_OUTPUT
  2212. ${ac_cv_path_EGREP} 'CURSES|GTK2|OSARCH|NEWT' makeopts > makeopts.acbak2
  2213. if test "x${ac_cv_path_CMP}" = "x:"; then
  2214. ( cd `pwd`/menuselect && ./configure )
  2215. else if ${ac_cv_path_CMP} -s makeopts.acbak makeopts.acbak2; then : ; else
  2216. ( cd `pwd`/menuselect && ./configure )
  2217. fi ; fi
  2218. rm makeopts.acbak makeopts.acbak2
  2219. if test "x${silent}" != "xyes" ; then
  2220. echo
  2221. echo " .\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$=.. "
  2222. echo " .\$7\$7.. .7\$\$7:. "
  2223. echo " .\$\$:. ,\$7.7 "
  2224. echo " .\$7. 7\$\$\$\$ .\$\$77 "
  2225. echo " ..\$\$. \$\$\$\$\$ .\$\$\$7 "
  2226. echo " ..7\$ .?. \$\$\$\$\$ .?. 7\$\$\$."
  2227. echo " \$.\$. .\$\$\$7. \$\$\$\$7 .7\$\$\$. .\$\$\$."
  2228. echo " .777. .\$\$\$\$\$\$77\$\$\$77\$\$\$\$\$7. \$\$\$,"
  2229. echo " \$\$\$~ .7\$\$\$\$\$\$\$\$\$\$\$\$\$7. .\$\$\$."
  2230. echo ".\$\$7 .7\$\$\$\$\$\$\$7: ?\$\$\$."
  2231. echo "\$\$\$ ?7\$\$\$\$\$\$\$\$\$\$I .\$\$\$7 "
  2232. echo "\$\$\$ .7\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ :\$\$\$. "
  2233. echo "\$\$\$ \$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$\$\$\$ .\$\$\$. "
  2234. echo "\$\$\$ \$\$\$ 7\$\$\$7 .\$\$\$ .\$\$\$. "
  2235. echo "\$\$\$\$ \$\$\$\$7 .\$\$\$. "
  2236. echo "7\$\$\$7 7\$\$\$\$ 7\$\$\$ "
  2237. echo " \$\$\$\$\$ \$\$\$ "
  2238. echo " \$\$\$\$7. \$\$ (TM) "
  2239. echo " \$\$\$\$\$\$\$. .7\$\$\$\$\$\$ \$\$ "
  2240. echo " \$\$\$\$\$\$\$\$\$\$\$\$7\$\$\$\$\$\$\$\$\$.\$\$\$\$\$\$ "
  2241. echo " \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$. "
  2242. echo
  2243. fi
  2244. if test "x${AST_IODBC_FOUND}" = "xyes"; then
  2245. echo "WARNING: iodbc libs/headers found!"
  2246. echo
  2247. echo " If you plan to use ODBC functionality, you should consider"
  2248. echo " switching to unixodbc instead."
  2249. echo " See: https://issues.asterisk.org/jira/browse/ASTERISK-22459"
  2250. echo
  2251. fi
  2252. AC_MSG_NOTICE(Package configured for: )
  2253. AC_MSG_NOTICE( OS type : $host_os)
  2254. AC_MSG_NOTICE( Host CPU : $host_cpu)
  2255. AC_MSG_NOTICE( build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :)
  2256. AC_MSG_NOTICE( host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :)
  2257. if test "${cross_compiling}" = "yes"; then
  2258. AC_MSG_NOTICE( Cross Compilation = YES)
  2259. fi