configure.ac 83 KB

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