configure.ac 84 KB

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