configure.ac 94 KB

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