2
0

configure.ac 86 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. # Must change all of the below together
  4. # For a release, set revision for that tagged release as well and uncomment
  5. AC_INIT([freeswitch], [1.10.8-dev], bugs@freeswitch.org)
  6. AC_SUBST(SWITCH_VERSION_MAJOR, [1])
  7. AC_SUBST(SWITCH_VERSION_MINOR, [10])
  8. AC_SUBST(SWITCH_VERSION_MICRO, [8-dev])
  9. AC_SUBST(SWITCH_VERSION_REVISION, [])
  10. AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
  11. AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
  12. AC_CONFIG_AUX_DIR(build/config)
  13. AM_INIT_AUTOMAKE
  14. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  15. AC_CONFIG_SRCDIR([src/switch.c])
  16. AC_CONFIG_HEADER([src/include/switch_private.h])
  17. AC_CONFIG_HEADER([libs/esl/src/include/esl_config_auto.h])
  18. AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
  19. AC_CANONICAL_HOST
  20. # Absolute source/build directory
  21. switch_srcdir=`(cd $srcdir && pwd)`
  22. switch_builddir=`pwd`
  23. AC_SUBST(switch_srcdir)
  24. AC_SUBST(switch_builddir)
  25. #
  26. # --enable-64 has been moved up higher prior to AC_PROG_CC so that we can tuck in the -m64 flag
  27. # so devs on with Solaris wanting to build 64bit can not bother with adding any additional
  28. # flags on the ./configure line. User friendly.
  29. #
  30. # Enable 64 bit build
  31. AC_ARG_ENABLE(64,
  32. [AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
  33. if test "${enable_64}" = "yes"; then
  34. case "$host" in
  35. *-solaris2*)
  36. # All three have to have -m64 for AC_PROG_CC to pick the right libtool
  37. CFLAGS="$CFLAGS -m64"
  38. LDFLAGS="$LDFLAGS -m64"
  39. CXXFLAGS="$CXXFLAGS -m64"
  40. ;;
  41. *)
  42. ;;
  43. esac
  44. fi
  45. # use mtmalloc on Solaris SPARC if available
  46. AS_CASE([$host], [sparc-*-solaris2*], [AC_CHECK_LIB(mtmalloc, malloc)])
  47. # Whether to follow FHS
  48. AC_ARG_ENABLE([fhs],[AS_HELP_STRING([--disable-fhs],
  49. [Do Not follow the FHS when placing files and directories (default only when not specifying prefix])],[enable_fhs="$enableval"],[enable_fhs="yes"])
  50. AC_PREFIX_DEFAULT(/usr/local/freeswitch)
  51. # AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
  52. if test "x$prefix" = "xNONE" ; then
  53. enable_fhs=no
  54. prefix='/usr/local/freeswitch'
  55. fi
  56. if test "x${exec_prefix}" = "xNONE" ; then
  57. exec_prefix="$prefix"
  58. fi
  59. default_scriptdir="$prefix/scripts"
  60. default_grammardir="$prefix/grammar"
  61. default_soundsdir="$prefix/sounds"
  62. default_htdocsdir="$prefix/htdocs"
  63. default_modulesdir="$prefix/mod"
  64. default_dbdir="$prefix/db"
  65. default_storagedir="$prefix/storage"
  66. default_cachedir="$prefix/cache"
  67. default_recordingsdir="$prefix/recordings"
  68. rundir="$prefix/run"
  69. logdir="${prefix}/log"
  70. confdir="$prefix/conf"
  71. default_certsdir="$prefix/certs"
  72. default_fontsdir="$prefix/fonts"
  73. default_imagesdir="$prefix/images"
  74. if test "${enable_fhs}" = "yes"; then
  75. eval full_datadir="${datadir}/freeswitch"
  76. eval datadir=$full_datadir
  77. eval full_localstatedir="${localstatedir}"
  78. eval localstatedir=$full_localstatedir
  79. eval libdir=$libdir
  80. default_cachedir="${localstatedir}/cache/freeswitch"
  81. rundir="${localstatedir}/run/freeswitch"
  82. logdir="${localstatedir}/log/freeswitch"
  83. localstatedir="${localstatedir}/lib/freeswitch"
  84. default_scriptdir="${datadir}/scripts"
  85. default_grammardir="${datadir}/grammar"
  86. default_soundsdir="${datadir}/sounds"
  87. default_htdocsdir="${datadir}/htdocs"
  88. default_fontsdir="${datadir}/fonts"
  89. default_modulesdir="${libdir}/freeswitch/mod"
  90. default_dbdir="${localstatedir}/db"
  91. default_storagedir="${localstatedir}/storage"
  92. default_recordingsdir="${localstatedir}/recordings"
  93. default_imagesdir="${localstatedir}/images"
  94. eval confdir="${sysconfdir}/freeswitch"
  95. eval default_certsdir="${confdir}/tls"
  96. else
  97. if test "$datadir" = "\${datarootdir}" ; then
  98. datadir="${prefix}"
  99. fi
  100. if test "$localstatedir" = "\${prefix}/var" ; then
  101. localstatedir="${prefix}"
  102. fi
  103. fi
  104. if test "$includedir" = "\${prefix}/include" ; then
  105. includedir="${prefix}/include/freeswitch"
  106. fi
  107. default_pkgconfigdir="$libdir/pkgconfig"
  108. default_runtimedir="$rundir"
  109. default_logfiledir="$logdir"
  110. AC_SUBST(libdir)
  111. # Where to install the modules
  112. AC_ARG_WITH([modinstdir],
  113. [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modulesdir="$withval"], [modulesdir="${default_modulesdir}"])
  114. eval modulesdir="${modulesdir}"
  115. AC_SUBST(modulesdir)
  116. AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modulesdir}",[where to install the modules to])
  117. # Where to put pidfile
  118. AC_ARG_WITH([rundir],
  119. [AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/run)])], [runtimedir="$withval"], [runtimedir="${default_runtimedir}"])
  120. AC_SUBST(runtimedir)
  121. AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${runtimedir}",[where to put pidfile to])
  122. AC_ARG_WITH([logfiledir],
  123. [AS_HELP_STRING([--with-logfiledir=DIR], [Put logfiles into this location (default: $localstatedir/log)])], [logfiledir="$withval"], [logfiledir="${default_logfiledir}"])
  124. AC_SUBST(logfiledir)
  125. AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],"${logfiledir}",[where to put log files])
  126. AC_ARG_WITH([dbdir],
  127. [AS_HELP_STRING([--with-dbdir=DIR], [Put database files into this location (default: $prefix/db)])], [dbdir="$withval"], [dbdir="${default_dbdir}"])
  128. AC_SUBST(dbdir)
  129. AC_DEFINE_UNQUOTED([SWITCH_DB_DIR],"${dbdir}",[where to put db files])
  130. AC_ARG_WITH([htdocsdir],
  131. [AS_HELP_STRING([--with-htdocsdir=DIR], [Put html files into this location (default: $prefix/htdocs)])], [htdocsdir="$withval"], [htdocsdir="${default_htdocsdir}"])
  132. AC_SUBST(htdocsdir)
  133. AC_DEFINE_UNQUOTED([SWITCH_HTDOCS_DIR],"${htdocsdir}",[where to put htdocs files])
  134. AC_ARG_WITH([fontsdir],
  135. [AS_HELP_STRING([--with-fontsdir=DIR], [Put font files into this location (default: $prefix/fonts)])], [fontsdir="$withval"], [fontsdir="${default_fontsdir}"])
  136. AC_SUBST(fontsdir)
  137. AC_DEFINE_UNQUOTED([SWITCH_FONTS_DIR],"${fontsdir}",[where to put font files])
  138. AC_ARG_WITH([soundsdir],
  139. [AS_HELP_STRING([--with-soundsdir=DIR], [Put sound files into this location (default: $prefix/sounds)])], [soundsdir="$withval"], [soundsdir="${default_soundsdir}"])
  140. AC_SUBST(soundsdir)
  141. AC_DEFINE_UNQUOTED([SWITCH_SOUNDS_DIR],"${soundsdir}",[where to put sounds files])
  142. AC_ARG_WITH([grammardir],
  143. [AS_HELP_STRING([--with-grammardir=DIR], [Put grammar files into this location (default: $prefix/grammar)])], [grammardir="$withval"], [grammardir="${default_grammardir}"])
  144. AC_SUBST(grammardir)
  145. AC_DEFINE_UNQUOTED([SWITCH_GRAMMAR_DIR],"${grammardir}",[where to put grammar files])
  146. AC_ARG_WITH([certsdir],
  147. [AS_HELP_STRING([--with-certsdir=DIR], [Put certs files into this location (default: $prefix/certs)])], [certsdir="$withval"], [certsdir="${default_certsdir}"])
  148. AC_SUBST(certsdir)
  149. AC_DEFINE_UNQUOTED([SWITCH_CERTS_DIR],"${certsdir}",[where to put certs files])
  150. AC_ARG_WITH([scriptdir],
  151. [AS_HELP_STRING([--with-scriptdir=DIR], [Put script files into this location (default: $prefix/scripts)])], [scriptdir="$withval"], [scriptdir="${default_scriptdir}"])
  152. AC_SUBST(scriptdir)
  153. AC_DEFINE_UNQUOTED([SWITCH_SCRIPT_DIR],"${scriptdir}",[where to put script files])
  154. AC_ARG_WITH([recordingsdir],
  155. [AS_HELP_STRING([--with-recordingsdir=DIR], [Put recordings files into this location (default: $prefix/recordings)])], [recordingsdir="$withval"], [recordingsdir="${default_recordingsdir}"])
  156. AC_SUBST(recordingsdir)
  157. AC_DEFINE_UNQUOTED([SWITCH_RECORDINGS_DIR],"${recordingsdir}",[where to put recording files])
  158. AC_ARG_WITH([imagesdir],
  159. [AS_HELP_STRING([--with-imagesdir=DIR], [Put images files into this location (default: $prefix/images)])], [imagesdir="$withval"], [imagesdir="${default_imagesdir}"])
  160. AC_SUBST(imagesdir)
  161. AC_DEFINE_UNQUOTED([SWITCH_IMAGES_DIR],"${imagesdir}",[where to put image files])
  162. AC_ARG_WITH([storagedir],
  163. [AS_HELP_STRING([--with-storagedir=DIR], [Put storage files into this location (default: $prefix/storage)])], [storagedir="$withval"], [storagedir="${default_storagedir}"])
  164. AC_SUBST(storagedir)
  165. AC_DEFINE_UNQUOTED([SWITCH_STORAGE_DIR],"${storagedir}",[where to put storage files])
  166. AC_ARG_WITH([cachedir],
  167. [AS_HELP_STRING([--with-cachedir=DIR], [Put cache files into this location (default: $prefix/cache)])], [cachedir="$withval"], [cachedir="${default_cachedir}"])
  168. AC_SUBST(cachedir)
  169. AC_DEFINE_UNQUOTED([SWITCH_CACHE_DIR],"${cachedir}",[where to put cache files])
  170. AC_SUBST(confdir)
  171. AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR],"${confdir}",[directory for configuration files])
  172. AC_SUBST(datadir)
  173. AC_DEFINE_UNQUOTED([SWITCH_DATA_DIR],"${datadir}",[directory for data files])
  174. AC_SUBST(localstatedir)
  175. AC_DEFINE_UNQUOTED([SWITCH_LOCALSTATE_DIR],"${localstatedir}",[directory for local state files])
  176. AC_SUBST(bindir)
  177. AC_SUBST(includedir)
  178. AC_ARG_WITH([pkgconfigdir],
  179. [AS_HELP_STRING([--with-pkgconfigdir=DIR], [Installation directory for pkgconfig file (default: ${libdir}/pkgconfig)])],
  180. [case "${withval}" in
  181. yes|no) AC_MSG_ERROR([Invalid value ${withval} for option --with-pkgconfigdir]) ;;
  182. *) pkgconfigdir="${withval}" ;;
  183. esac
  184. ],
  185. [pkgconfigdir="${default_pkgconfigdir}"]
  186. )
  187. AC_SUBST([pkgconfigdir])
  188. #Set default language
  189. AC_LANG_C
  190. # Checks for programs.
  191. AC_PROG_CC
  192. AC_PROG_CXX
  193. #check if the g++ compiler works
  194. AC_CACHE_CHECK([whether the C++ compiler works], [ac_cv_sys_cxx_works], [
  195. AC_LANG_PUSH([C++])
  196. AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { }])], [ac_cv_sys_cxx_works=yes],
  197. [ac_cv_sys_cxx_works=no])
  198. AC_LANG_POP([C++])
  199. ])
  200. [ if [ "x$ac_cv_sys_cxx_works" = "xno" ]; then ]
  201. AC_MSG_FAILURE([The C++ compiler does not work. Please (re)install the C++ compiler])
  202. [ fi ]
  203. AC_PROG_AWK
  204. AC_PROG_MAKE_SET
  205. AC_PROG_INSTALL
  206. #override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
  207. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  208. m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
  209. m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
  210. AM_PROG_CC_C_O
  211. AC_PROG_LIBTOOL
  212. #Check for compiler vendor
  213. AX_COMPILER_VENDOR
  214. # Set CC_FOR_BUILD
  215. if test "x${cross_compiling}" = "xyes"; then
  216. CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
  217. case "$host" in
  218. arm*-linux-gnueabi*|arm*-*-linux-gnueabi*)
  219. # spandsp modem
  220. ac_cv_file__dev_ptmx=yes
  221. # libjs
  222. export ac_cv_va_copy=yes
  223. # srtp
  224. export ac_cv_file__dev_urandom=yes
  225. # rpl_malloc
  226. export ac_cv_func_realloc_0_nonnull=yes
  227. export ac_cv_func_malloc_0_nonnull=yes
  228. # apr
  229. export ac_cv_func_setpgrp_void=yes
  230. export ac_cv_file__dev_zero=yes
  231. export apr_cv_tcp_nodelay_with_cork=yes
  232. export ac_cv_file_dbd_apr_dbd_mysql_c=no
  233. export ac_cv_sizeof_ssize_t=4
  234. export apr_cv_mutex_recursive=yes
  235. export ac_cv_func_pthread_rwlock_init=yes
  236. export apr_cv_type_rwlock_t=yes
  237. export apr_cv_process_shared_works=yes
  238. export apr_cv_mutex_robust_shared=yes
  239. ;;
  240. esac
  241. else
  242. CC_FOR_BUILD='$(CC)'
  243. fi
  244. AC_SUBST(CC_FOR_BUILD)
  245. if test -n "$lt_sysroot" ; then
  246. APR_ADDTO(CFLAGS, --sysroot=$lt_sysroot)
  247. APR_ADDTO(CXXFLAGS, --sysroot=$lt_sysroot)
  248. APR_ADDTO(CPPFLAGS, --sysroot=$lt_sysroot)
  249. APR_ADDTO(LDFLAGS, --sysroot=$lt_sysroot)
  250. PKG_CONFIG_SYSROOT_DIR=$lt_sysroot
  251. fi
  252. # Optimize
  253. AC_ARG_ENABLE(optimization,
  254. [AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
  255. if test "${enable_optimizer}" = "yes" ; then
  256. AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
  257. AX_CC_MAXOPT
  258. fi
  259. # set defaults for use on all platforms
  260. SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
  261. SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
  262. SWITCH_AM_CPPFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
  263. SWITCH_AM_LDFLAGS="-lm"
  264. #set SOLINK variable based on compiler and host
  265. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  266. SOLINK="-Bdynamic -dy -G"
  267. elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
  268. case "$host" in
  269. *darwin*)
  270. SOLINK="-dynamic -force-flat-namespace"
  271. ;;
  272. *)
  273. SOLINK="-shared -Xlinker -x"
  274. ;;
  275. esac
  276. elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
  277. case "$host" in
  278. # older Xcode test for darwin, Xcode 4/5 use clang above
  279. *darwin*)
  280. SOLINK="-dynamic -bundle -force-flat-namespace"
  281. ;;
  282. *-solaris2*)
  283. SOLINK="-shared -Xlinker"
  284. ;;
  285. *)
  286. SOLINK="-shared -Xlinker -x"
  287. ;;
  288. esac
  289. elif test "x${ax_cv_c_compiler_vendor}" = "xintel" ; then
  290. case "$host" in
  291. *)
  292. SOLINK="-shared -Xlinker -x"
  293. ;;
  294. esac
  295. else
  296. AC_ERROR([Please update configure.in with SOLINK values for your compiler])
  297. fi
  298. ##
  299. # detect libtool major version,
  300. # set libtool library extension based on this
  301. # to work around some brokeness when using 'la' with libtool-1.5
  302. #
  303. AC_MSG_CHECKING([libtool major version])
  304. libtool="${switch_builddir}/libtool"
  305. LIBTOOL_MAJOR_VERSION="`$libtool --version 2>/dev/null| sed -e 's/([[^)]]*)//g;s/^[[^0-9]]*//;s/[[- ]].*//g;q'| awk 'BEGIN { FS = "." } { print $1 }' `"
  306. if test -z "$LIBTOOL_MAJOR_VERSION" ; then
  307. LIBTOOL_MAJOR_VERSION="`sed -n -e '/^VERSION/{s/^.*=\"\{0,1\}\([[0-9]]\{1,\}\)\..*/\1/;p;}' ${switch_srcdir}/build/config/ltmain.sh`"
  308. fi
  309. if test -z "$LIBTOOL_MAJOR_VERSION" ; then
  310. AC_MSG_ERROR([Failed to detect your libtool version, please open a bug report on https://freeswitch.org/jira])
  311. fi
  312. AC_MSG_RESULT([${LIBTOOL_MAJOR_VERSION}])
  313. LIBTOOL_LIB_EXTEN=so
  314. if test "${LIBTOOL_MAJOR_VERSION}" = "2" ; then
  315. LIBTOOL_LIB_EXTEN="la"
  316. fi
  317. AC_MSG_RESULT([using libtool library extension... ${LIBTOOL_LIB_EXTEN}])
  318. if test "$ax_cv_c_compiler_vendor" = "gnu"; then
  319. saved_CFLAGS="$CFLAGS"
  320. AC_CACHE_CHECK([whether compiler supports -Wno-unused-result],
  321. [ac_cv_gcc_supports_w_no_unused_result], [
  322. CFLAGS="$CFLAGS -Wno-unused-result -Wno-error=unused-result"
  323. AC_TRY_COMPILE([],[return 0;],
  324. [ac_cv_gcc_supports_w_no_unused_result=yes],
  325. [ac_cv_gcc_supports_w_no_unused_result=no])])
  326. CFLAGS="$saved_CFLAGS"
  327. AC_MSG_RESULT($ac_cv_gcc_supports_w_no_unused_result)
  328. saved_CFLAGS="$CFLAGS"
  329. AC_CACHE_CHECK([whether compiler supports -Wno-misleading-indentation],
  330. [ac_cv_gcc_supports_w_no_misleading_indentation], [
  331. CFLAGS="$CFLAGS -Wno-misleading-indentation -Wno-error=misleading-indentation"
  332. AC_TRY_COMPILE([],[return 0;],
  333. [ac_cv_gcc_supports_w_no_misleading_indentation=yes],
  334. [ac_cv_gcc_supports_w_no_misleading_indentation=no])])
  335. CFLAGS="$saved_CFLAGS"
  336. AC_MSG_RESULT($ac_cv_gcc_supports_w_no_misleading_indentation)
  337. fi
  338. # tweak compiler specific flags
  339. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  340. APR_ADDTO(SWITCH_AM_CFLAGS, -KPIC)
  341. APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC)
  342. APR_ADDTO(SWITCH_AM_CFLAGS, -erroff=E_END_OF_LOOP_CODE_NOT_REACHED)
  343. APR_ADDTO(SWITCH_AM_CFLAGS, -errtags=yes)
  344. APR_ADDTO(SWITCH_AM_CFLAGS, -D__FUNCTION__=__func__ )
  345. APR_ADDTO(SWITCH_AM_CFLAGS, -mt)
  346. APR_ADDTO(SWITCH_AM_CXXFLAGS, -errtags=yes)
  347. APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC)
  348. APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC)
  349. APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions")
  350. APR_ADDTO(SWITCH_AM_CXXFLAGS, -D__FUNCTION__=__func__)
  351. APR_ADDTO(SWITCH_AM_CXXFLAGS, -mt)
  352. APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib)
  353. if test "${enable_64}" = "yes"; then
  354. APR_ADDTO(SWITCH_AM_CFLAGS, -m64)
  355. APR_ADDTO(SWITCH_AM_CXXFLAGS, -m64)
  356. APR_ADDTO(SWITCH_AM_LDFLAGS, -m64)
  357. LIBS="$LIBS -m64"
  358. fi
  359. elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
  360. APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC -ffast-math)
  361. APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC -ffast-math)
  362. APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
  363. elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
  364. APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC -ffast-math)
  365. APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC -ffast-math)
  366. AC_SUBST([AM_MOD_AVMD_CXXFLAGS], [-std=gnu99]) # FS-8809, needed for MAP_POPULATE
  367. if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then
  368. APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
  369. APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result)
  370. fi
  371. if test "$ac_cv_gcc_supports_w_no_misleading_indentation" = yes; then
  372. APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-misleading-indentation)
  373. fi
  374. if test "${enable_64}" = "yes"; then
  375. case "$host" in
  376. *darwin*)
  377. osxvrm=`sw_vers -productVersion` # Get version.release.modlevel
  378. osxrel=`echo $osxvrm | cut -d. -f2` # Get release only
  379. if test "$osxrel" -ge 4; then # 10.4 and up are x64
  380. APR_ADDTO(CFLAGS, -arch x86_64)
  381. APR_ADDTO(LDFLAGS, -arch x86_64)
  382. APR_ADDTO(CXXFLAGS, -arch x86_64)
  383. fi
  384. ;;
  385. *-solaris2*)
  386. APR_ADDTO(CFLAGS, -m64)
  387. APR_ADDTO(LDFLAGS, -m64)
  388. APR_ADDTO(CXXFLAGS, -m64)
  389. ;;
  390. *)
  391. LIBS="$LIBS -m64"
  392. ;;
  393. esac
  394. fi
  395. fi
  396. case "${ax_cv_c_compiler_vendor}" in
  397. sun)
  398. VISIBILITY_FLAG=-xldscope=hidden
  399. ;;
  400. *)
  401. VISIBILITY_FLAG=-fvisibility=hidden
  402. ;;
  403. esac
  404. AC_SUBST(VISIBILITY_FLAG)
  405. #
  406. # gcc visibility cflag checks
  407. #
  408. AC_ARG_ENABLE([visibility],
  409. [AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
  410. [enable_visibility="${enableval}"],
  411. [enable_visibility="detect"]
  412. )
  413. HAVE_VISIBILITY="no"
  414. if test "x${enable_visibility}" != "xno" ; then
  415. case "${ax_cv_c_compiler_vendor}" in
  416. gnu)
  417. save_CFLAGS="${CFLAGS}"
  418. CFLAGS="${CFLAGS} -fvisibility=hidden"
  419. AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
  420. AC_COMPILE_IFELSE(
  421. [AC_LANG_PROGRAM(
  422. [int foo __attribute__ ((visibility("default")));],
  423. [;]
  424. )],
  425. [AC_MSG_RESULT([yes])
  426. APR_ADDTO([SWITCH_AM_CFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DCJSON_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
  427. APR_ADDTO([SWITCH_AM_CXXFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DCJSON_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
  428. HAVE_VISIBILITY="yes"],
  429. [AC_MSG_RESULT([no])]
  430. )
  431. CFLAGS="${save_CFLAGS}"
  432. ;;
  433. sun)
  434. # save_CFLAGS="${CFLAGS}"
  435. # CFLAGS="${CFLAGS} -xldscope=hidden"
  436. # AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
  437. # AC_COMPILE_IFELSE(
  438. # [AC_LANG_PROGRAM(
  439. # [int foo __attribute__ ((visibility("default")));],
  440. # [;]
  441. # )],
  442. #
  443. # [AC_MSG_RESULT([yes])
  444. # APR_ADDTO([SWITCH_AM_CFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
  445. # APR_ADDTO([SWITCH_AM_CXXFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
  446. # HAVE_VISIBILITY="yes"],
  447. #
  448. # [AC_MSG_RESULT([no])]
  449. # )
  450. # CFLAGS="${save_CFLAGS}"
  451. ;;
  452. *)
  453. if test "x${enable_visibility}" = "xyes" ; then
  454. AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
  455. else
  456. AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
  457. fi
  458. ;;
  459. esac
  460. #
  461. # visibility explicitly requested but not supported by this compiler => error
  462. #
  463. if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
  464. AC_MSG_ERROR([API visibility not supported by this compiler])
  465. fi
  466. fi
  467. # Enable debugging (default: on)
  468. # (rename option if the default is changed)
  469. AC_ARG_ENABLE(debug,
  470. [AC_HELP_STRING([--disable-debug],[build without debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
  471. if test "${enable_debug}" = "yes"; then
  472. AC_DEFINE([DEBUG],[],[Enable extra debugging.])
  473. saved_CFLAGS="$CFLAGS"
  474. CFLAGS=
  475. AX_CFLAGS_WARN_ALL_ANSI
  476. SWITCH_ANSI_CFLAGS=$CFLAGS
  477. CFLAGS="$saved_CFLAGS"
  478. if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
  479. if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then
  480. APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result)
  481. fi
  482. APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
  483. export DEBUG_CFLAGS="-g -ggdb"
  484. fi
  485. fi
  486. AC_ARG_ENABLE(libyuv,
  487. [AC_HELP_STRING([--disable-libyuv],[build without libyuv])],[enable_libyuv="$enableval"],[enable_libyuv="yes"])
  488. AM_CONDITIONAL([ENABLE_LIBYUV],[test "${enable_libyuv}" = "yes"])
  489. AC_ARG_ENABLE(libvpx,
  490. [AC_HELP_STRING([--disable-libvpx],[build without libvpx])],[enable_libvpx="$enableval"],[enable_libvpx="yes"])
  491. AM_CONDITIONAL([ENABLE_LIBVPX],[test "${enable_libvpx}" = "yes"])
  492. AC_ARG_ENABLE(cpp,
  493. [AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"])
  494. AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"])
  495. AM_CONDITIONAL([DISABLE_CC],[test "${disable_cc}" = "yes"])
  496. AC_ARG_ENABLE([system-xmlrpc-c],
  497. [AS_HELP_STRING([--enable-system-xmlrpc-c],
  498. [use system lib for xmlrpc-c])],,
  499. [enable_xmlrpcc="no"])
  500. if test "${enable_xmlrpcc}" = "yes" ; then
  501. SYS_XMLRPC_CFLAGS=`xmlrpc-c-config --cflags`
  502. SYS_XMLRPC_LDFLAGS=`xmlrpc-c-config --libs`
  503. fi
  504. AC_SUBST(SYS_XMLRPC_CFLAGS)
  505. AC_SUBST(SYS_XMLRPC_LDFLAGS)
  506. AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"])
  507. for luaversion in luajit lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do
  508. PKG_CHECK_MODULES([LUA],[${luaversion}],[have_lua=yes],[have_lua=no])
  509. if test ${have_lua} = yes; then
  510. break
  511. fi
  512. done
  513. if test x"${LUA_LIBS}" = x"" ; then
  514. LUA_LIBS="-llua"
  515. fi
  516. AC_ARG_ENABLE(srtp,
  517. [AC_HELP_STRING([--disable-srtp],[build without srtp support])],[enable_srtp="$enableval"],[enable_srtp="yes"])
  518. AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"])
  519. have_openal=no
  520. AC_CHECK_LIB(openal, alcLoopbackOpenDeviceSOFT, [have_openal="yes"])
  521. AM_CONDITIONAL([HAVE_OPENAL],[test "${have_openal}" = "yes"])
  522. AC_ARG_ENABLE(zrtp,
  523. [AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
  524. if test "x$enable_zrtp" = "xyes" ; then
  525. LIBS="-lpthread $LIBS"
  526. APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP)
  527. fi
  528. PA_LIBS=
  529. PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
  530. if test "x$have_jack" = "xyes" ; then
  531. PA_LIBS+=$JACK_LIBS
  532. fi
  533. AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
  534. if test "x$have_alsa" = "xyes" ; then
  535. PA_LIBS+=-lasound
  536. fi
  537. AC_SUBST(PA_LIBS)
  538. AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"])
  539. AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
  540. AC_ARG_ENABLE(core-odbc-support,
  541. [AS_HELP_STRING([--enable-core-odbc-support], [Compile with ODBC Support (default is optional)])],,[enable_core_odbc_support="optional"])
  542. if ! test "$enable_core_odbc_support" = "no"; then
  543. AX_LIB_ODBC
  544. if test "$ac_cv_found_odbc" = "yes" ; then
  545. enable_core_odbc_support="yes"
  546. elif test "$enable_core_odbc_support" = "yes"; then
  547. AC_MSG_ERROR([no usable libodbc; please install unixodbc devel package or equivalent])
  548. else
  549. enable_core_odbc_support="no"
  550. fi
  551. fi
  552. CHECK_LIBUUID
  553. SWITCH_AM_LDFLAGS="$LIBUUID_LIBS $SWITCH_AM_LDFLAGS"
  554. SWITCH_AM_CFLAGS="$LIBUUID_CFLAGS $SWITCH_AM_CFLAGS"
  555. AC_ARG_ENABLE(core-pgsql-pkgconfig,
  556. [AS_HELP_STRING([--disable-core-pgsql-pkgconfig], [Use pg_config to get PGQSL build options])],[enable_core_pgsql_pkgconfig="$enableval"],[enable_core_pgsql_pkgconfig="yes"])
  557. path_remove () {
  558. echo "$1" | tr ':' '\n' | grep -Fxv "$2" | tr '\n' ':' | sed 's/:$//'
  559. }
  560. path_push_unique () {
  561. x="$(eval echo \$$1)"
  562. x="$(path_remove "$x" "$2")"
  563. if test -z "$x"; then
  564. eval export $1="$2"
  565. else
  566. eval export $1="$2:$x"
  567. fi
  568. }
  569. AC_PATH_PROG([PG_CONFIG], [pg_config], [no])
  570. AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
  571. case $host in
  572. *-darwin*)
  573. path_push_unique PKG_CONFIG_PATH /usr/local/opt/libpq/lib/pkgconfig
  574. ;;
  575. esac
  576. if test "$PKG_CONFIG" = "no" \
  577. || test x"$enable_core_pgsql_pkgconfig" = x"no" \
  578. || ! pkg-config libpq; then
  579. if test "$PG_CONFIG" != "no"; then
  580. AC_MSG_CHECKING([for PostgreSQL libraries via pg_config])
  581. POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
  582. POSTGRESQL_LIBDIR="-L`$PG_CONFIG --libdir`"
  583. POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
  584. POSTGRESQL_VERSION=`$PG_CONFIG --version | awk '{ print $NF }'`
  585. POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $1 }'`
  586. POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $2 }'`
  587. POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $3 }'`
  588. fi
  589. else
  590. AC_MSG_CHECKING([for PostgreSQL libraries via pkg_config])
  591. POSTGRESQL_CFLAGS="`$PKG_CONFIG --cflags libpq`"
  592. POSTGRESQL_LIBDIR="`$PKG_CONFIG libpq --libs-only-L`"
  593. POSTGRESQL_LDFLAGS="`$PKG_CONFIG --libs libpq`"
  594. POSTGRESQL_VERSION="`$PKG_CONFIG --modversion libpq`"
  595. POSTGRESQL_MAJOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f1 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
  596. POSTGRESQL_MINOR_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f2 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
  597. POSTGRESQL_PATCH_VERSION="`echo $POSTGRESQL_VERSION | cut -d. -f3 | sed 's/^\([[0-9]]*\)[[^0-9]].*/\1/'`"
  598. test -n "$POSTGRESQL_PATCH_VERSION" || POSTGRESQL_PATCH_VERSION=0
  599. fi
  600. AC_MSG_RESULT([$POSTGRESQL_LIBDIR])
  601. AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against])
  602. AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
  603. AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
  604. AC_DEFINE_UNQUOTED([POSTGRESQL_PATCH_VERSION], ${POSTGRESQL_PATCH_VERSION}, [Specifies the version of PostgreSQL we are linking against])
  605. have_libpq=no
  606. save_LIBS="${LIBS}"
  607. save_CPPFLAGS="${CPPFLAGS}"
  608. LIBS="${POSTGRESQL_LDFLAGS}"
  609. CPPFLAGS="${POSTGRESQL_CFLAGS}"
  610. AC_CHECK_LIB([pq], [PQgetvalue], [have_libpq="yes"])
  611. LIBS="${save_LIBS}"
  612. CPPFLAGS="${save_CPPFLAGS}"
  613. AM_CONDITIONAL([HAVE_PGSQL],[test "${have_libpq}" = "yes"])
  614. AC_SUBST([POSTGRESQL_CFLAGS], [$POSTGRESQL_CFLAGS])
  615. AC_SUBST([POSTGRESQL_LDFLAGS], [$POSTGRESQL_LDFLAGS])
  616. AC_SUBST([POSTGRESQL_LIBDIR], [$POSTGRESQL_LIBDIR])
  617. PKG_CHECK_MODULES([MARIADB], [libmariadb >= 3.0.9],[
  618. AM_CONDITIONAL([HAVE_MARIADB],[true])],[
  619. PKG_CHECK_MODULES([MARIADB], [mariadb >= 3.0.9],[
  620. AM_CONDITIONAL([HAVE_MARIADB],[true])],[
  621. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MARIADB],[false])
  622. ])
  623. ])
  624. PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[
  625. AM_CONDITIONAL([HAVE_SPANDSP],[true])],[
  626. AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent])
  627. ])
  628. PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.6],[
  629. AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[
  630. AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent])
  631. ])
  632. AC_ARG_ENABLE(deprecated-core-db-events,
  633. [AS_HELP_STRING([--enable-deprecated-core-db-events], [Keep deprecated core db events])],,[enable_deprecated_core_db_events="no"])
  634. if test x"$enable_deprecated_core_db_events" = x"yes" ; then
  635. AC_DEFINE([SWITCH_DEPRECATED_CORE_DB], [1], [Define to 1 to enable deprecated core db events])
  636. fi
  637. ESL_LDFLAGS=
  638. PLATFORM_CORE_LDFLAGS=
  639. PLATFORM_CORE_LIBS=
  640. # tweak platform specific flags
  641. case "$host" in
  642. *darwin*)
  643. # Common Apple Darwin settings
  644. APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
  645. APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
  646. APR_ADDTO(CPPFLAGS, -I/usr/local/opt/openssl/include)
  647. APR_ADDTO(LDFLAGS, -L/usr/local/opt/openssl/lib)
  648. if test "x$enable_core_odbc_support" != "xno"; then
  649. APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
  650. fi
  651. APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
  652. # Get OSX and clang version
  653. osxvrm=`sw_vers -productVersion` # Get version.release.modlevel
  654. osxrel=`echo $osxvrm | cut -d. -f2` # Get release only
  655. clangvers="`clang -v 2>&1 >/dev/null | grep version | sed -e 's/.*version \([[0-9]]*\).*$/\1/'`"
  656. if test "$clangvers" -ge 6; then # Xcode 6 drops std lib search, add it to clang
  657. APR_ADDTO(LDFLAGS, -L/usr/local/lib)
  658. APR_ADDTO(CPPFLAGS, -I/usr/local/include)
  659. fi
  660. if test "$clangvers" -ge 4; then # Xcode 4 / 10.7 and up
  661. APR_ADDTO(CFLAGS, -Wno-deprecated-declarations)
  662. fi
  663. if test "$osxrel" -ge 6; then # 10.6 and up
  664. APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)
  665. APR_ADDTO(LDFLAGS, -pipe -bind_at_load)
  666. APR_ADDTO(CXXFLAGS, -pipe)
  667. fi
  668. ;;
  669. *-solaris2*)
  670. if test "${enable_64}" = "yes"; then
  671. APR_ADDTO(CPPFLAGS, [-I/opt/64/include])
  672. APR_ADDTO(LDFLAGS, [-L/opt/64/lib -Wl,-rpath,/opt/64/lib])
  673. APR_ADDTO(SWITCH_AM_CFLAGS, [-I/opt/64/include])
  674. APR_ADDTO(SWITCH_AM_LDFLAGS, [-L/opt/64/lib -Wl,-rpath,/opt/64/lib])
  675. else
  676. APR_ADDTO(CPPFLAGS, [-I/opt/include])
  677. APR_ADDTO(LDFLAGS, [-L/opt/lib -Wl,-rpath,/opt/lib])
  678. APR_ADDTO(SWITCH_AM_CFLAGS, [-I/opt/include])
  679. APR_ADDTO(SWITCH_AM_LDFLAGS, [-L/opt/lib -Wl,-rpath,/opt/lib])
  680. fi
  681. APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048 -D__EXTENSIONS__)
  682. APR_ADDTO(SWITCH_AM_LDFLAGS, -lsendfile -lresolv -lsocket -lnsl -luuid)
  683. APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
  684. APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt -lsendfile -lresolv -lsocket -lnsl -luuid])
  685. ;;
  686. *dragonfly*)
  687. APR_ADDTO(CPPFLAGS, -I/usr/local/include)
  688. APR_ADDTO(LDFLAGS, -L/usr/local/lib)
  689. APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
  690. ;;
  691. *openbsd*)
  692. APR_ADDTO(CPPFLAGS, -I/usr/local/include)
  693. APR_ADDTO(LDFLAGS, -L/usr/local/lib -ltermcap)
  694. APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
  695. ;;
  696. *netbsd*)
  697. APR_ADDTO(CPPFLAGS, -I/usr/pkg/include)
  698. APR_ADDTO(LDFLAGS, [-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib])
  699. APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/pkg/include)
  700. ;;
  701. *bsd*)
  702. APR_ADDTO(CPPFLAGS, -I/usr/local/include)
  703. APR_ADDTO(LDFLAGS, -L/usr/local/lib)
  704. APR_ADDTO(SWITCH_AM_CFLAGS, -I/usr/local/include)
  705. APR_ADDTO([PLATFORM_CORE_LIBS], [-lcrypt -lrt])
  706. ;;
  707. *linux*)
  708. APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
  709. ;;
  710. esac
  711. APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
  712. # check for usable system MD5 library
  713. AS_CASE([$host],
  714. [*-solaris2*], [AC_CHECK_LIB(md5, MD5Init)],
  715. [*-freebsd*], [AC_CHECK_LIB(md, MD5Init)],
  716. [*-openbsd*|*-netbsd*], [AC_CHECK_FUNCS([MD5Init])])
  717. AC_CHECK_LIB(z, inflateReset, have_libz=yes, AC_MSG_ERROR([no usable zlib; please install zlib devel package or equivalent]))
  718. if test "x$have_libz" = "xyes" ; then
  719. APR_ADDTO([PLATFORM_CORE_LIBS], [-lz])
  720. fi
  721. PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.16.0],[
  722. AM_CONDITIONAL([HAVE_MPG123],[true])],[
  723. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])])
  724. PKG_CHECK_MODULES([AMR], [opencore-amrnb >= 0.1.0],[
  725. AM_CONDITIONAL([HAVE_AMR],[true])],[
  726. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMR],[false])])
  727. PKG_CHECK_MODULES([AMRWB], [opencore-amrwb >= 0.1.0 vo-amrwbenc >= 0.1.0],[
  728. AM_CONDITIONAL([HAVE_AMRWB],[true])],[
  729. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMRWB],[false])])
  730. PKG_CHECK_MODULES([STIRSHAKEN], [stirshaken],[
  731. AM_CONDITIONAL([HAVE_STIRSHAKEN],[true])],[
  732. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_STIRSHAKEN],[false])])
  733. AC_CHECK_LIB(apr-1, apr_pool_mutex_set, use_system_apr=yes, use_system_apr=no)
  734. AM_CONDITIONAL([SYSTEM_APR],[test "${use_system_apr}" = "yes"])
  735. AC_CHECK_LIB(aprutil-1, apr_queue_pop_timeout, use_system_aprutil=yes, use_system_aprutil=no)
  736. AM_CONDITIONAL([SYSTEM_APRUTIL],[test "${use_system_aprutil}" = "yes"])
  737. save_LIBS="$LIBS"
  738. LIBS=
  739. AC_CHECK_LIB(jpeg, jpeg_std_error,, AC_MSG_ERROR([no usable libjpeg; please install libjpeg devel package or equivalent]))
  740. AC_CHECK_LIB(jbig, jbg_enc_out, have_libjbig=yes, have_libjbig=no)
  741. if test "x$have_libjbig" = "xyes" ; then
  742. SPANDSP_LA_JBIG="-ljbig $LIBS"
  743. AC_SUBST(SPANDSP_LA_JBIG)
  744. fi
  745. LIBS="$save_LIBS"
  746. AC_CHECK_LIB(lzma, lzma_code, have_liblzma=yes, have_liblzma=no)
  747. if test "x$have_liblzma" = "xyes" ; then
  748. SPANDSP_LA_LZMA="-llzma"
  749. AC_SUBST(SPANDSP_LA_LZMA)
  750. fi
  751. AC_CHECK_LIB(resolv, res_init, have_libresolv=yes, have_libresolv=no)
  752. if test "x$have_libresolv" = "xyes" ; then
  753. APR_ADDTO(SWITCH_AM_LDFLAGS, -lresolv)
  754. fi
  755. AC_SUBST(SWITCH_AM_CFLAGS)
  756. AC_SUBST(SWITCH_ANSI_CFLAGS)
  757. AC_SUBST(SWITCH_AM_CXXFLAGS)
  758. AC_SUBST(SWITCH_AM_CPPFLAGS)
  759. AC_SUBST(SWITCH_AM_LDFLAGS)
  760. AC_SUBST(ESL_LDFLAGS)
  761. AC_SUBST(PLATFORM_CORE_LDFLAGS)
  762. AC_SUBST(PLATFORM_CORE_LIBS)
  763. AC_SUBST(SOLINK)
  764. AC_SUBST(LIBTOOL_LIB_EXTEN)
  765. # Checks for header files.
  766. AC_HEADER_DIRENT
  767. AC_HEADER_STDC
  768. AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/prctl.h sys/select.h netdb.h execinfo.h sys/time.h])
  769. # Solaris 11 privilege management
  770. AS_CASE([$host],
  771. [*-*-solaris2.11], [AC_CHECK_HEADER([priv.h], [AC_DEFINE([SOLARIS_PRIVILEGES],[1],[Solaris 11 privilege management])])]
  772. )
  773. if test x"$ac_cv_header_wchar_h" = xyes; then
  774. HAVE_WCHAR_H_DEFINE=1
  775. else
  776. HAVE_WCHAR_H_DEFINE=0
  777. fi
  778. AC_SUBST(HAVE_WCHAR_H_DEFINE)
  779. # Needed by Abyss on Solaris:
  780. if test x"$ac_cv_header_sys_filio_h" = xyes; then
  781. HAVE_SYS_FILIO_H_DEFINE=1
  782. else
  783. HAVE_SYS_FILIO_H_DEFINE=0
  784. fi
  785. AC_SUBST(HAVE_SYS_FILIO_H_DEFINE)
  786. # Needed by Abyss on Solaris:
  787. if test x"$ac_cv_header_sys_ioctl_h" = xyes; then
  788. HAVE_SYS_IOCTL_H_DEFINE=1
  789. else
  790. HAVE_SYS_IOCTL_H_DEFINE=0
  791. fi
  792. AC_SUBST(HAVE_SYS_IOCTL_H_DEFINE)
  793. if test x"$ac_cv_header_sys_select_h" = xyes; then
  794. HAVE_SYS_SELECT_H_DEFINE=1
  795. else
  796. HAVE_SYS_SELECT_H_DEFINE=0
  797. fi
  798. AC_SUBST(HAVE_SYS_SELECT_H_DEFINE)
  799. # Checks for typedefs, structures, and compiler characteristics.
  800. AC_C_CONST
  801. AC_C_INLINE
  802. AC_TYPE_SIZE_T
  803. AC_HEADER_TIME
  804. AC_STRUCT_TM
  805. # Checks for library functions.
  806. AC_PROG_GCC_TRADITIONAL
  807. AC_FUNC_MALLOC
  808. AC_TYPE_SIGNAL
  809. AC_FUNC_STRFTIME
  810. AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs timerfd_create getdtablesize posix_openpt poll])
  811. AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups getrusage])
  812. AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
  813. # Check availability and return type of strerror_r
  814. # (NOTE: apr-1-config sets -D_GNU_SOURCE at build-time, need to run the check with it too)
  815. save_CPPFLAGS="$CPPFLAGS"
  816. CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  817. AC_FUNC_STRERROR_R
  818. CPPFLAGS="$save_CPPFLAGS"
  819. AX_HAVE_CPU_SET
  820. AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
  821. AC_CHECK_LIB(rt, clock_getres, [AC_DEFINE(HAVE_CLOCK_GETRES, 1, [Define if you have clock_getres()])])
  822. AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
  823. AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])])
  824. AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
  825. AC_CHECK_FILE(/dev/ptmx, [AC_DEFINE(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx])])
  826. AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty()])])
  827. AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
  828. #include <sys/types.h>
  829. #include <time.h>])
  830. AC_CHECK_MEMBERS([struct tm.tm_zone],,,[
  831. #include <sys/types.h>
  832. #include <time.h>])
  833. AC_CHECK_DECL([RLIMIT_MEMLOCK],
  834. [AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
  835. [#ifdef HAVE_SYS_RESOURCE_H
  836. #include <sys/resource.h>
  837. #endif])
  838. AC_CHECK_DECL([SCHED_RR],
  839. [AC_DEFINE([HAVE_SCHED_RR],[1],[SCHED_RR constant for sched_setscheduler])],,
  840. [#ifdef HAVE_SCHED_H
  841. #include <sched.h>
  842. #endif])
  843. AC_CHECK_DECL([SCHED_FIFO],
  844. [AC_DEFINE([HAVE_SCHED_FIFO],[1],[SCHED_FIFO constant for sched_setscheduler])],,
  845. [#ifdef HAVE_SCHED_H
  846. #include <sched.h>
  847. #endif])
  848. #
  849. # use mlockall only on linux (for now; if available)
  850. #
  851. if test "x${ac_cv_func_mlockall}" = "xyes"; then
  852. AC_MSG_CHECKING([whether to use mlockall])
  853. case "$host" in
  854. *-linux-*)
  855. AC_DEFINE([USE_MLOCKALL],[1],[Enable mlockall support])
  856. AC_MSG_RESULT([yes])
  857. USE_MLOCKALL=yes
  858. ;;
  859. *-freebsd*)
  860. APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
  861. APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
  862. AC_MSG_RESULT([no, broken for non-root users])
  863. ;;
  864. *)
  865. AC_MSG_RESULT([no])
  866. ;;
  867. esac
  868. #
  869. # setrlimit prerequisites
  870. #
  871. if test "x${USE_MLOCKALL}" = "xyes" -a \
  872. "x${ac_cv_func_setrlimit}" = "xyes" -a \
  873. "x${ac_cv_have_decl_RLIMIT_MEMLOCK}" = "xyes"
  874. then
  875. AC_DEFINE([USE_SETRLIMIT],[1],[Use setrlimit to disable mlock limit for non-root users])
  876. fi
  877. fi
  878. #
  879. # sched_setcheduler + round-robin scheduler prerequisites
  880. #
  881. if test "x${ac_cv_func_sched_setscheduler}" = "xyes" -a \
  882. "x${ac_cv_have_decl_SCHED_RR}" = "xyes"
  883. then
  884. AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler])
  885. fi
  886. #
  887. # xmlrpc-c checks
  888. #
  889. AC_CHECK_FUNCS(setenv strtoll strtoull strtoq strtouq __strtoll __strtoull)
  890. HAVE_LIBWWW_SSL_DEFINE=0
  891. AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)
  892. DIRECTORY_SEPARATOR="/"
  893. AC_SUBST(DIRECTORY_SEPARATOR)
  894. va_list_is_array=no
  895. AC_MSG_CHECKING(whether va_list is an array)
  896. AC_TRY_COMPILE([
  897. #include <stdarg.h>
  898. ], [va_list list1, list2; list1 = list2;], ,
  899. va_list_is_array=yes)
  900. AC_MSG_RESULT($va_list_is_array)
  901. if test x"$va_list_is_array" = xyes; then
  902. VA_LIST_IS_ARRAY_DEFINE=1
  903. else
  904. VA_LIST_IS_ARRAY_DEFINE=0
  905. fi
  906. AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
  907. AC_MSG_CHECKING(whether compiler has __attribute__)
  908. AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
  909. compiler_has_attribute=yes,
  910. compiler_has_attribute=no)
  911. AC_MSG_RESULT($compiler_has_attribute)
  912. if test x"$compiler_has_attribute" = xyes; then
  913. ATTR_UNUSED="__attribute__((__unused__))"
  914. else
  915. ATTR_UNUSED=
  916. fi
  917. AC_SUBST(ATTR_UNUSED)
  918. saved_CFLAGS="$CFLAGS"
  919. AC_CACHE_CHECK([whether compiler supports -Wdeclaration-after-statement], [ac_cv_gcc_declaration_after_statement], [
  920. CFLAGS="$CFLAGS -Wdeclaration-after-statement"
  921. AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_declaration_after_statement=yes],[ac_cv_gcc_declaration_after_statement=no])
  922. ])
  923. AC_MSG_RESULT($ac_cv_gcc_declaration_after_statement)
  924. if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then
  925. APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wdeclaration-after-statement)
  926. fi
  927. CFLAGS="$saved_CFLAGS"
  928. if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
  929. saved_CFLAGS="$CFLAGS"
  930. # Next check added for Xcode 5 and systems with clang 5 llvm 3.3 or above, extended offset must be off
  931. AC_CACHE_CHECK([whether compiler supports -Wextended-offsetof], [ac_cv_clang_extended_offsetof], [
  932. CFLAGS="$CFLAGS -Wno-extended-offsetof"
  933. AC_TRY_COMPILE([],[return 0;],[ac_cv_clang_extended_offsetof=yes],[ac_cv_clang_extended_offsetof=no])
  934. ])
  935. AC_MSG_RESULT($ac_cv_clang_extended_offsetof)
  936. if test x"$ac_cv_clang_extended_offsetof" = xyes; then
  937. APR_ADDTO(CFLAGS, -Wno-extended-offsetof)
  938. fi
  939. CFLAGS="$saved_CFLAGS"
  940. fi
  941. # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready
  942. # Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_h323 mod_khomp
  943. # mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed
  944. #
  945. #saved_CFLAGS="$CFLAGS"
  946. #AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
  947. #CFLAGS="$CFLAGS -Wunused-but-set-variable"
  948. #AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no])
  949. #])
  950. #AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable)
  951. #if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then
  952. # APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wunused-but-set-variable)
  953. #fi
  954. #CFLAGS="$saved_CFLAGS"
  955. AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
  956. # Checks for integer size
  957. AC_CHECK_SIZEOF(char, 1)
  958. AC_CHECK_SIZEOF(int, 4)
  959. AC_CHECK_SIZEOF(long, 4)
  960. AC_CHECK_SIZEOF(short, 2)
  961. AC_CHECK_SIZEOF(long long, 8)
  962. AC_TYPE_SIZE_T
  963. AC_CHECK_TYPE(ssize_t, int)
  964. # Checks for pointer size
  965. AC_CHECK_SIZEOF(void*, 4)
  966. if test "x$ac_cv_sizeof_voidp" != "x"; then
  967. voidp_size=$ac_cv_sizeof_voidp
  968. else
  969. AC_ERROR([Cannot determine size of void*])
  970. fi
  971. if test "$ac_cv_sizeof_short" = "2"; then
  972. short_value=short
  973. fi
  974. if test "$ac_cv_sizeof_int" = "4"; then
  975. int_value=int
  976. fi
  977. if test "$ac_cv_sizeof_int" = "8"; then
  978. int64_t_fmt='#define SWITCH_INT64_T_FMT "d"'
  979. uint64_t_fmt='#define SWITCH_UINT64_T_FMT "u"'
  980. int64_value="int"
  981. long_value=int
  982. elif test "$ac_cv_sizeof_long" = "8"; then
  983. int64_t_fmt='#define SWITCH_INT64_T_FMT "ld"'
  984. uint64_t_fmt='#define SWITCH_UINT64_T_FMT "lu"'
  985. int64_value="long"
  986. long_value=long
  987. case "$host" in
  988. *pc-solaris2*)
  989. ;;
  990. sparc-*-solaris2*)
  991. ;;
  992. *-solaris2*|*apple-darwin*|*-openbsd*)
  993. if test "$ac_cv_sizeof_long_long" = "8"; then
  994. int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
  995. uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
  996. int64_value="long long"
  997. long_value="long long"
  998. fi
  999. ;;
  1000. esac
  1001. elif test "$ac_cv_sizeof_long_long" = "8"; then
  1002. int64_t_fmt='#define SWITCH_INT64_T_FMT "lld"'
  1003. uint64_t_fmt='#define SWITCH_UINT64_T_FMT "llu"'
  1004. int64_value="long long"
  1005. long_value="long long"
  1006. elif test "$ac_cv_sizeof_longlong" = "8"; then
  1007. int64_t_fmt='#define SWITCH_INT64_T_FMT "qd"'
  1008. uint64_t_fmt='#define SWITCH_UINT64_T_FMT "qu"'
  1009. int64_value="__int64"
  1010. long_value="__int64"
  1011. else
  1012. AC_ERROR([could not detect a 64-bit integer type])
  1013. fi
  1014. if test "$ac_cv_type_size_t" = "yes"; then
  1015. size_t_value="size_t"
  1016. else
  1017. size_t_value="switch_int32_t"
  1018. fi
  1019. if test "$ac_cv_type_ssize_t" = "yes"; then
  1020. ssize_t_value="ssize_t"
  1021. else
  1022. ssize_t_value="switch_int32_t"
  1023. fi
  1024. APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
  1025. if test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_int"; then
  1026. ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
  1027. elif test "$ac_cv_sizeof_ssize_t" = "$ac_cv_sizeof_long"; then
  1028. ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
  1029. else
  1030. ssize_t_fmt='#error Can not determine the proper size for ssize_t'
  1031. fi
  1032. APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
  1033. if test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_int"; then
  1034. size_t_fmt='#define SWITCH_SIZE_T_FMT "d"'
  1035. elif test "$ac_cv_sizeof_size_t" = "$ac_cv_sizeof_long"; then
  1036. size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
  1037. else
  1038. size_t_fmt='#define SWITCH_SIZE_T_FMT "zu"'
  1039. fi
  1040. # Basically, we have tried to figure out the correct format strings
  1041. # for SWITCH types which vary between platforms, but we don't always get
  1042. # it right. If you find that we don't get it right for your platform,
  1043. # you can override our decision below.
  1044. # NOTE: borrowed much of this logic from apr.
  1045. case $host in
  1046. s390*linux*)
  1047. # uniquely, the 31-bit Linux/s390 uses "unsigned long int"
  1048. # for size_t rather than "unsigned int":
  1049. size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
  1050. ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
  1051. ;;
  1052. *-os2*)
  1053. size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
  1054. ;;
  1055. *-openbsd*)
  1056. size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
  1057. ;;
  1058. *aix4*|*aix5*)
  1059. ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
  1060. size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
  1061. ;;
  1062. *beos*)
  1063. ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
  1064. size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
  1065. ;;
  1066. *apple-darwin*)
  1067. ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
  1068. size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
  1069. ;;
  1070. esac
  1071. AC_SUBST(voidp_size)
  1072. AC_SUBST(short_value)
  1073. AC_SUBST(int_value)
  1074. AC_SUBST(long_value)
  1075. AC_SUBST(int64_value)
  1076. AC_SUBST(size_t_value)
  1077. AC_SUBST(ssize_t_value)
  1078. AC_SUBST(int64_t_fmt)
  1079. AC_SUBST(uint64_t_fmt)
  1080. AC_SUBST(ssize_t_fmt)
  1081. AC_SUBST(size_t_fmt)
  1082. case $host in
  1083. *-openbsd*)
  1084. # OpenBSD's gunzip and friends don't like -d because its redundant, only gzip does
  1085. AC_PATH_PROGS(ZCAT, gzip)
  1086. ;;
  1087. *)
  1088. AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
  1089. ;;
  1090. esac
  1091. AC_PATH_PROGS(BZIP, bzip2)
  1092. AC_PATH_PROGS(XZ, xz)
  1093. AC_PATH_PROGS(TAR, gtar tar)
  1094. AC_PATH_PROGS(WGET, wget)
  1095. AC_PATH_PROGS(CURL, curl)
  1096. GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getlib.sh"
  1097. AC_SUBST(GETLIB)
  1098. GETG729="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getg729.sh"
  1099. AC_SUBST(GETG729)
  1100. GETSOUNDS="${SHELL} $switch_builddir/build/getsounds.sh"
  1101. AC_SUBST(GETSOUNDS)
  1102. case $host in
  1103. *-darwin*)
  1104. path_push_unique PKG_CONFIG_PATH /usr/local/opt/curl/lib/pkgconfig
  1105. path_push_unique PKG_CONFIG_PATH /usr/local/opt/sqlite/lib/pkgconfig/
  1106. path_push_unique PKG_CONFIG_PATH /usr/local/opt/ldns/lib/pkgconfig/
  1107. path_push_unique PKG_CONFIG_PATH /usr/local/opt/portaudio/lib/pkgconfig/
  1108. path_push_unique PKG_CONFIG_PATH /usr/local/opt/ffmpeg/lib/pkgconfig/
  1109. ;;
  1110. esac
  1111. if ! (test -x "$PKG_CONFIG" || test -x "$(which pkg-config)"); then
  1112. AC_MSG_ERROR([You need to install pkg-config to configure FreeSWITCH.])
  1113. fi
  1114. # temporary workaround for Debian libldns-dev package bug
  1115. if test "$cross_compiling" != "yes" && test -f /usr/lib/pkg-config/libldns.pc; then
  1116. path_push_unique PKG_CONFIG_PATH /usr/lib/pkg-config
  1117. fi
  1118. module_enabled() {
  1119. grep -v -e "\#" -e "^\$" modules.conf | sed 's/|.*//' | sed -e "s|^.*/||" | grep "^${1}\$" >/dev/null
  1120. }
  1121. AC_ARG_WITH(png,
  1122. [AS_HELP_STRING([--without-png],
  1123. [disable support for libpng])],
  1124. [with_png="$withval"],
  1125. [with_png="yes"])
  1126. if test "$with_png" = "yes"; then
  1127. PKG_CHECK_MODULES([LIBPNG], [libpng >= 1.6.16],[
  1128. AM_CONDITIONAL([HAVE_PNG],[true])],[
  1129. PKG_CHECK_MODULES([LIBPNG], [libpng16 >= 1.6.16],[
  1130. AM_CONDITIONAL([HAVE_PNG],[true])],[
  1131. PKG_CHECK_MODULES([LIBPNG], [libpng >= 1.2.49],[
  1132. AM_CONDITIONAL([HAVE_PNG],[true])],[
  1133. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_PNG],[false])])])])
  1134. else
  1135. AM_CONDITIONAL([HAVE_PNG],[false])
  1136. fi
  1137. AC_ARG_WITH(freetype,
  1138. [AS_HELP_STRING([--without-freetype],
  1139. [disable support for freetype])],
  1140. [with_freetype="$withval"],
  1141. [with_freetype="yes"])
  1142. if test "$with_freetype" = "yes"; then
  1143. PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 2.4.9],[
  1144. AM_CONDITIONAL([HAVE_FREETYPE],[true])],[
  1145. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_FREETYPE],[false])])
  1146. else
  1147. AM_CONDITIONAL([HAVE_FREETYPE],[false])
  1148. fi
  1149. PKG_CHECK_MODULES([GUMBO], [gumbo >= 0.10.1],[
  1150. AM_CONDITIONAL([HAVE_GUMBO],[true])],[
  1151. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_GUMBO],[false])])
  1152. PKG_CHECK_MODULES([FVAD], [libfvad >= 1.0],[
  1153. AM_CONDITIONAL([HAVE_FVAD],[true])],[
  1154. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_FVAD],[false])])
  1155. PKG_CHECK_MODULES([TPL], [libtpl >= 1.5],[
  1156. AC_DEFINE([HAVE_LIBTPL],[1],[Define to 1 if you have libtpl])],[
  1157. AC_MSG_RESULT([no])])
  1158. PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.6.20])
  1159. PKG_CHECK_MODULES([CURL], [libcurl >= 7.19])
  1160. PKG_CHECK_MODULES([PCRE], [libpcre >= 7.8])
  1161. PKG_CHECK_MODULES([SPEEX], [speex >= 1.2rc1 speexdsp >= 1.2rc1])
  1162. PKG_CHECK_MODULES([YAML], [yaml-0.1 >= 0.1.4],[
  1163. AM_CONDITIONAL([HAVE_YAML],[true])],[
  1164. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_YAML],[false])])
  1165. PKG_CHECK_MODULES([PORTAUDIO], [portaudio-2.0 >= 19],[
  1166. AM_CONDITIONAL([HAVE_PORTAUDIO],[true])],[
  1167. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_PORTAUDIO],[false])])
  1168. PKG_CHECK_MODULES([LDNS], [libldns-fs >= 1.6.6],[
  1169. AM_CONDITIONAL([HAVE_LDNS],[true])],[
  1170. PKG_CHECK_MODULES([LDNS], [libldns >= 1.6.6],[
  1171. AM_CONDITIONAL([HAVE_LDNS],[true])],[
  1172. AC_CHECK_LIB([ldns], [ldns_str2rdf_a], [LDNS_LIBS=-lldns])
  1173. AS_IF([test -z "$LDNS_LIBS"],[
  1174. if module_enabled mod_enum; then
  1175. AC_MSG_ERROR([You need to either install libldns-dev or disable mod_enum in modules.conf])
  1176. else
  1177. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_LDNS],[false])
  1178. fi],[
  1179. AM_CONDITIONAL([HAVE_LDNS],[true])])])])
  1180. PKG_CHECK_MODULES([SNDFILE], [sndfile >= 1.0.20],[
  1181. AM_CONDITIONAL([HAVE_SNDFILE],[true])],[
  1182. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SNDFILE],[false])])
  1183. PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.16.0],[
  1184. AM_CONDITIONAL([HAVE_MPG123],[true])],[
  1185. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])])
  1186. PKG_CHECK_MODULES([SHOUT], [shout >= 2.2.2],[
  1187. AM_CONDITIONAL([HAVE_SHOUT],[true])],[
  1188. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SHOUT],[false])])
  1189. mp3lame=false
  1190. AC_CHECK_LIB([mp3lame], [lame_init],[
  1191. AC_CHECK_HEADER([lame/lame.h],[
  1192. mp3lame=true
  1193. AC_SUBST([MP3LAME_LIBS], [-lmp3lame])
  1194. AC_SUBST([MP3LAME_CFLAGS], [$CPPFLAGS])])])
  1195. AM_CONDITIONAL([HAVE_MP3LAME],[$mp3lame])
  1196. PKG_CHECK_MODULES([AVCODEC], [libavcodec >= 53.35.0],[
  1197. AM_CONDITIONAL([HAVE_AVCODEC],[true])],[
  1198. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AVCODEC],[false])])
  1199. PKG_CHECK_MODULES([X264], [x264 >= 0.142.2431],[
  1200. AM_CONDITIONAL([HAVE_X264],[true])],[
  1201. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_X264],[false])])
  1202. PKG_CHECK_MODULES([AVFORMAT], [libavformat >= 53.21.1],[
  1203. AM_CONDITIONAL([HAVE_AVFORMAT],[true])],[
  1204. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AVFORMAT],[false])])
  1205. PKG_CHECK_MODULES([AVUTIL], [libavutil >= 54.3.0],[
  1206. AM_CONDITIONAL([HAVE_AVUTIL],[true])],[
  1207. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AVUTIL],[false])])
  1208. PKG_CHECK_MODULES([AVRESAMPLE], [libavresample >= 2.1.0],[
  1209. AM_CONDITIONAL([HAVE_AVRESAMPLE],[true])],[
  1210. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AVRESAMPLE],[false])])
  1211. PKG_CHECK_MODULES([SWRESAMPLE], [libswresample >= 2.1.0],[
  1212. AM_CONDITIONAL([HAVE_SWRESAMPLE],[true])],[
  1213. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SWRESAMPLE],[false])])
  1214. PKG_CHECK_MODULES([SWSCALE], [libswscale >= 3.0.0],[
  1215. AM_CONDITIONAL([HAVE_SWSCALE],[true])],[
  1216. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SWSCALE],[false])])
  1217. PKG_CHECK_MODULES([VLC], [libvlc >= 2.1.0],[
  1218. AM_CONDITIONAL([HAVE_VLC],[true])],[
  1219. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_VLC],[false])])
  1220. PKG_CHECK_MODULES([OPENCV], [opencv >= 2.4.5],[
  1221. AM_CONDITIONAL([HAVE_OPENCV],[true])],[
  1222. PKG_CHECK_MODULES([OPENCV], [opencv4 >= 2.4.5],[
  1223. AM_CONDITIONAL([HAVE_OPENCV],[true])],[
  1224. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPENCV],[false])])])
  1225. PKG_CHECK_MODULES([OPUSFILE_DECODE], [opusfile >= 0.5],[
  1226. AM_CONDITIONAL([HAVE_OPUSFILE_DECODE],[true])],[
  1227. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPUSFILE_DECODE],[false])])
  1228. PKG_CHECK_MODULES([OPUSFILE_ENCODE], [libopusenc >= 0.1],[
  1229. AM_CONDITIONAL([HAVE_OPUSFILE_ENCODE],[true])],[
  1230. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPUSFILE_ENCODE],[false])])
  1231. PKG_CHECK_MODULES([MAGICK], [ImageMagick >= 6.0.0],[
  1232. AM_CONDITIONAL([HAVE_MAGICK],[true])],[
  1233. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MAGICK],[false])])
  1234. PKG_CHECK_MODULES([MAGICK7], [ImageMagick >= 7.0.0],[
  1235. AM_CONDITIONAL([HAVE_MAGICK7],[true])],[
  1236. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MAGICK7],[false])])
  1237. PKG_CHECK_MODULES([SILK], [silk >= 1.0.8],[
  1238. AM_CONDITIONAL([HAVE_SILK],[true])],[
  1239. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SILK],[false])])
  1240. PKG_CHECK_MODULES([BROADVOICE], [broadvoice >= 0.1.0],[
  1241. AM_CONDITIONAL([HAVE_BROADVOICE],[true])],[
  1242. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_BROADVOICE],[false])])
  1243. PKG_CHECK_MODULES([ILBC], [ilbc2 >= 0.0.1],[
  1244. AM_CONDITIONAL([HAVE_ILBC],[true])],[
  1245. PKG_CHECK_MODULES([ILBC], [ilbc >= 0.0.1],[
  1246. AM_CONDITIONAL([HAVE_ILBC],[true])],[
  1247. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_ILBC],[false])])])
  1248. PKG_CHECK_MODULES([G7221], [g722_1 >= 0.2.0],[
  1249. AM_CONDITIONAL([HAVE_G7221],[true])],[
  1250. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_G7221],[false])])
  1251. codec2="true"
  1252. PKG_CHECK_MODULES([CODEC2], [codec2 >= 0.5],[],[
  1253. AC_CHECK_LIB([codec2], [codec2_create],[
  1254. AC_CHECK_HEADERS([codec2/codec2.h],[
  1255. CODEC2_LIBS="-lcodec2"
  1256. CODEC2_CFLAGS=""
  1257. ], [
  1258. codec2="false"
  1259. if module_enabled mod_codec2; then
  1260. AC_MSG_ERROR([You must install libcodec2-dev to build mod_codec2])
  1261. else
  1262. AC_MSG_RESULT([no])
  1263. fi
  1264. ])
  1265. ])
  1266. ])
  1267. AM_CONDITIONAL([HAVE_CODEC2],[$codec2])
  1268. PKG_CHECK_MODULES([OPUS], [opus >= 1.1],[
  1269. AM_CONDITIONAL([HAVE_OPUS],[true])],[
  1270. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPUS],[false])])
  1271. PKG_CHECK_MODULES([SOUNDTOUCH], [soundtouch >= 1.7.0],[
  1272. AM_CONDITIONAL([HAVE_SOUNDTOUCH],[true])],[
  1273. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SOUNDTOUCH],[false])])
  1274. flite="true"
  1275. PKG_CHECK_MODULES([FLITE], [flite >= 2],[],[
  1276. AC_CHECK_LIB([flite], [flite_init],[
  1277. AC_CHECK_HEADERS([flite/flite.h],[
  1278. FLITE_LIBS="-lflite -lflite_cmu_grapheme_lang -lflite_cmu_grapheme_lex -lflite_cmu_indic_lang -lflite_cmu_indic_lex -lflite_cmulex -lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal16 -lflite_cmu_us_kal -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish"
  1279. FLITE_CFLAGS=""
  1280. ], [
  1281. flite="false"
  1282. if module_enabled mod_flite; then
  1283. AC_MSG_ERROR([You must install libflite-dev to build mod_flite])
  1284. else
  1285. AC_MSG_RESULT([no])
  1286. fi
  1287. ])
  1288. ])
  1289. ])
  1290. AM_CONDITIONAL([HAVE_FLITE],[$flite])
  1291. PKG_CHECK_MODULES([MONGOC], [libmongoc-1.0 >= 1.0.8],[
  1292. AM_CONDITIONAL([HAVE_MONGOC],[true])],[
  1293. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MONGOC],[false])])
  1294. PKG_CHECK_MODULES([MEMCACHED], [libmemcached >= 0.31],[
  1295. AM_CONDITIONAL([HAVE_MEMCACHED],[true])
  1296. MEMCACHED_LIBS="${MEMCACHED_LIBS} -lpthread"
  1297. save_LIBS="${LIBS}"
  1298. save_CPPFLAGS="${CPPFLAGS}"
  1299. LIBS="${MEMCACHED_LIBS}"
  1300. CPPFLAGS="${MEMCACHED_CFLAGS}"
  1301. AC_CHECK_FUNCS([memcached_server_name memcached_stat_execute])
  1302. AC_CHECK_TYPES([memcached_instance_st*],,, [[#include <libmemcached/memcached.h>]])
  1303. LIBS="${save_LIBS}"
  1304. CPPFLAGS="${save_CPPFLAGS}"
  1305. ],[
  1306. AC_MSG_RESULT([no])
  1307. AM_CONDITIONAL([HAVE_MEMCACHED],[false])
  1308. ])
  1309. PKG_CHECK_MODULES([V8FS_STATIC], [v8-6.1_static >= 6.1.298],[
  1310. AM_CONDITIONAL([HAVE_V8FS],[true])],[
  1311. PKG_CHECK_MODULES([V8FS_STATIC], [v8fs_static >= 6.1.298],[
  1312. AM_CONDITIONAL([HAVE_V8FS],[true])],[
  1313. PKG_CHECK_MODULES([V8FS_STATIC], [v8 >= 6.1.298],[
  1314. AM_CONDITIONAL([HAVE_V8FS],[true])],[
  1315. if module_enabled mod_v8; then
  1316. AC_MSG_ERROR([You need to either install libv8-6.1-dev (>= 6.1.298), libv8fs-dev (>= 6.1.298) or disable mod_v8 in modules.conf])
  1317. else
  1318. AC_MSG_RESULT([no])
  1319. AM_CONDITIONAL([HAVE_V8FS],[false])
  1320. fi
  1321. ])
  1322. ])
  1323. ])
  1324. PKG_CHECK_MODULES([KS], [libks >= 1.1.0],[
  1325. AM_CONDITIONAL([HAVE_KS],[true])],[
  1326. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false])])
  1327. PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client >= 1.0.0],[
  1328. AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[true])],[
  1329. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false])])
  1330. PKG_CHECK_MODULES([AMQP], [librabbitmq >= 0.5.2],[
  1331. AM_CONDITIONAL([HAVE_AMQP],[true])],[
  1332. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMQP],[false])])
  1333. PKG_CHECK_MODULES([H2O], [libh2o-evloop >= 0.11.0],[
  1334. AM_CONDITIONAL([HAVE_H2O],[true])],[
  1335. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_H2O],[false])])
  1336. PKG_CHECK_MODULES([BROTLIENC], [libbrotlienc >= 0.1.0],[
  1337. AM_CONDITIONAL([HAVE_BROTLIENC],[true])],[
  1338. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_BROTLIENC],[false])])
  1339. PKG_CHECK_MODULES([BROTLIDEC], [libbrotlidec >= 0.1.0],[
  1340. AM_CONDITIONAL([HAVE_BROTLIDEC],[true])],[
  1341. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_BROTLIDEC],[false])])
  1342. PKG_CHECK_MODULES([TAP], [tap >= 0.1.0],[
  1343. AM_CONDITIONAL([HAVE_TAP],[true])],[
  1344. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_TAP],[false])])
  1345. PKG_CHECK_MODULES([SMPP34], [libsmpp34 >= 1.10],[
  1346. AM_CONDITIONAL([HAVE_SMPP34],[true])],[
  1347. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SMPP34],[false])])
  1348. PKG_CHECK_MODULES([HIREDIS], [hiredis >= 0.10.0],[
  1349. AM_CONDITIONAL([HAVE_HIREDIS],[true])],[
  1350. AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_HIREDIS],[false])])
  1351. AC_ARG_ENABLE(core-libedit-support,
  1352. [AS_HELP_STRING([--disable-core-libedit-support], [Compile without libedit Support])])
  1353. AS_IF([test "x$enable_core_libedit_support" != "xno"],[
  1354. PKG_CHECK_MODULES([LIBEDIT], [libedit >= 2.11],,[
  1355. AC_MSG_RESULT([no])
  1356. AC_CHECK_LIB([edit], [el_line], [LIBEDIT_LIBS=-ledit])
  1357. AC_CHECK_LIB([edit], [el_cursor], [ac_cv_has_el_cursor=yes])
  1358. AC_CHECK_HEADER([histedit.h], [], [unset LIBEDIT_LIBS])
  1359. AS_IF([test "x$LIBEDIT_LIBS" = "x"], [
  1360. AC_MSG_ERROR([You need to either install libedit-dev (>= 2.11) or configure with --disable-core-libedit-support])
  1361. ])])])
  1362. AC_ARG_ENABLE(systemd,
  1363. [AS_HELP_STRING([--enable-systemd], [Compile with systemd notify support])])
  1364. AS_IF([test "x$enable_systemd" = "xyes"],[
  1365. PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 219], [
  1366. AC_DEFINE([HAVE_SYSTEMD], [1], [Define to 1 if systemd is available])])
  1367. ])
  1368. AC_SUBST(SYSTEMD_LIBS)
  1369. dnl ---------------------------------------------------------------------------
  1370. dnl - OpenLDAP SDK
  1371. dnl ---------------------------------------------------------------------------
  1372. AC_CHECK_LIB(ldap, ldap_search, with_ldap=yes)
  1373. dnl Check for other libraries we need to link with to get the main routines.
  1374. test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes], , -llber) }
  1375. test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes], , -llber -lkrb) }
  1376. test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes with_ldap_des=yes], , -llber -lkrb -ldes) }
  1377. test "$with_ldap_lber" != "yes" && { AC_CHECK_LIB(lber, ber_pvt_opt_on, with_ldap_lber=yes) }
  1378. if test "$with_ldap" = "yes"; then
  1379. if test "$with_ldap_des" = "yes" ; then
  1380. OPENLDAP_LIBS="${OPENLDAP_LIBS} -ldes"
  1381. fi
  1382. if test "$with_ldap_krb" = "yes" ; then
  1383. OPENLDAP_LIBS="${OPENLDAP_LIBS} -lkrb"
  1384. fi
  1385. if test "$with_ldap_lber" = "yes" ; then
  1386. OPENLDAP_LIBS="${OPENLDAP_LIBS} -llber"
  1387. fi
  1388. OPENLDAP_LIBS="${OPENLDAP_LIBS} -lldap"
  1389. fi
  1390. AM_CONDITIONAL([HAVE_LDAP],[test "x$with_ldap" = "xyes"])
  1391. AC_SUBST(OPENLDAP_LIBS)
  1392. AS_IF([test "x$enable_core_libedit_support" != "xno"], [
  1393. # If making changes here, don't forget to run autoheader and
  1394. # update libs/esl/src/include/esl_config_auto.h.in manually.
  1395. AC_DEFINE([HAVE_LIBEDIT], [1], [Define to 1 if you have libedit is available])
  1396. if test x$ac_cv_has_el_cursor = xyes; then
  1397. AC_DEFINE([HAVE_EL_CURSOR], [1], [Define to 1 if you have libedit el_cursor support])
  1398. fi
  1399. save_LIBS="${LIBS}"
  1400. save_CPPFLAGS="${CPPFLAGS}"
  1401. LIBS="${LIBEDIT_LIBS}"
  1402. CPPFLAGS="${LIBEDIT_CFLAGS}"
  1403. AC_CHECK_DECLS([EL_PROMPT_ESC, EL_REFRESH],,, [[#include <histedit.h>]])
  1404. AC_CHECK_FUNCS([el_wset])
  1405. LIBS="${save_LIBS}"
  1406. CPPFLAGS="${save_CPPFLAGS}"
  1407. ])
  1408. SAC_OPENSSL
  1409. if test x$HAVE_OPENSSL = x1; then
  1410. openssl_CFLAGS="$openssl_CFLAGS -DHAVE_OPENSSL";
  1411. APR_ADDTO(SWITCH_AM_CFLAGS, -DHAVE_OPENSSL)
  1412. AC_CHECK_LIB(ssl, SSL_CTX_set_tlsext_use_srtp, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS_SRTP, 1, HAVE_OPENSSL_DTLS_SRTP), AC_MSG_ERROR([OpenSSL >= 1.0.1e and associated developement headers required]))
  1413. AC_CHECK_LIB(ssl, DTLSv1_method, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS, 1, HAVE_OPENSSL_DTLS), AC_MSG_ERROR([OpenSSL >= 1.0.1e and associaed developement headers required]))
  1414. AC_CHECK_LIB(ssl, DTLSv1_2_method, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLSv1_2_method, 1, [DTLS version 1.2 is available]))
  1415. else
  1416. AC_MSG_ERROR([OpenSSL >= 1.0.1e and associated developement headers required])
  1417. fi
  1418. AX_CHECK_JAVA
  1419. AM_CONDITIONAL([HAVE_ODBC],[test "x$enable_core_odbc_support" != "xno"])
  1420. AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
  1421. #
  1422. # perl checks
  1423. #
  1424. AC_CHECK_PROG(PERL,perl,[ac_cv_have_perl=yes],[ac_cv_have_perl=no])
  1425. # -a "x$ac_cv_have_EXTERN_h" != "xno"
  1426. if test "x$ac_cv_have_perl" != "xno"; then
  1427. PERL=perl
  1428. PERL_SITEDIR="`$PERL -MConfig -e 'print $Config{archlib}'`"
  1429. PERL_LIBDIR="-L`$PERL -MConfig -e 'print $Config{archlib}'`/CORE"
  1430. PERL_LIBS="`$PERL -MConfig -e 'print $Config{libs}'`"
  1431. PERL_CFLAGS="-w -DMULTIPLICITY `$PERL -MExtUtils::Embed -e ccopts | sed -e 's|-arch x86_64 -arch i386||'` -DEMBED_PERL"
  1432. PERL_LDFLAGS="`$PERL -MExtUtils::Embed -e ldopts| sed -e 's|-arch x86_64 -arch i386||'`"
  1433. PERL_INC="`$PERL -MExtUtils::Embed -e perl_inc`"
  1434. save_CFLAGS="$CFLAGS"
  1435. CFLAGS="$PERL_CFLAGS"
  1436. AC_CHECK_HEADER([EXTERN.h], [ac_cv_have_EXTERN_h=yes], [ac_cv_have_EXTERN_h=no], [[#include <EXTERN.h>
  1437. # include <perl.h>]])
  1438. CFLAGS="$save_CFLAGS"
  1439. save_LDFLAGS="$LDFLAGS"
  1440. LDFLAGS="$PERL_LDFLAGS"
  1441. AC_CHECK_LIB([perl], [perl_alloc], ac_cv_use_libperl=yes, ac_cv_use_libperl=no)
  1442. LDFLAGS="$save_LDFLAGS"
  1443. AC_SUBST(PERL_SITEDIR)
  1444. AC_SUBST(PERL_LIBDIR)
  1445. AC_SUBST(PERL_LIBS)
  1446. AC_SUBST(PERL_CFLAGS)
  1447. AC_SUBST(PERL_LDFLAGS)
  1448. AC_SUBST(PERL_INC)
  1449. fi
  1450. AM_CONDITIONAL([HAVE_PERL],[test "x$ac_cv_have_perl" != "xno" -a "x$ac_cv_have_EXTERN_h" != "xno" -a "x$ac_cv_use_libperl" != "xno"])
  1451. #
  1452. # php checks
  1453. #
  1454. AC_CHECK_PROG(PHP,php,[ac_cv_have_php=yes],[ac_cv_have_php=no])
  1455. AC_CHECK_PROG(PHP_CONFIG,php-config,[ac_cv_have_php_config=yes],[ac_cv_have_php_config=no])
  1456. AM_CONDITIONAL([HAVE_PHP],[test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"])
  1457. if test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"; then
  1458. PHP=php
  1459. PHP_CONFIG=php-config
  1460. PHP_LDFLAGS="`$PHP_CONFIG --ldflags`"
  1461. PHP_LIBS="`$PHP_CONFIG --libs | sed -r 's/ ?-l(bz2|pcre2-8|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto|argon2|sodium)//g'`"
  1462. PHP_EXT_DIR="`$PHP_CONFIG --extension-dir`"
  1463. PHP_INC_DIR="`$PHP -r 'echo ini_get("include_path");' | cut -d: -f2`"
  1464. PHP_INI_DIR="`$PHP_CONFIG --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=`"
  1465. PHP_CFLAGS="`$PHP_CONFIG --includes`"
  1466. AC_SUBST(PHP_LDFLAGS)
  1467. AC_SUBST(PHP_LIBS)
  1468. AC_SUBST(PHP_EXT_DIR)
  1469. AC_SUBST(PHP_INC_DIR)
  1470. AC_SUBST(PHP_INI_DIR)
  1471. AC_SUBST(PHP_CFLAGS)
  1472. fi
  1473. #
  1474. # Python checks for mod_python (scroll down to see python3 checks for mod_python3)
  1475. #
  1476. AC_ARG_WITH(
  1477. [python],
  1478. [AS_HELP_STRING([--with-python], [Use system provided version of python (default: try)])],
  1479. [with_python="$withval"],
  1480. [with_python="try"]
  1481. )
  1482. if test "$with_python" != "no"
  1483. then
  1484. save_CFLAGS="$CFLAGS"
  1485. save_LIBS="$LIBS"
  1486. if test "$with_python" != "yes" -a "$with_python" != "try" ; then
  1487. AC_MSG_CHECKING([for python])
  1488. if test ! -x "$with_python" ; then
  1489. AC_MSG_ERROR([Specified python does not exist or is not executable: $with_python])
  1490. fi
  1491. AC_MSG_RESULT([$with_python])
  1492. AC_SUBST([PYTHON], ["$with_python"])
  1493. else
  1494. AC_PATH_PROG([PYTHON], ["python"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
  1495. fi
  1496. if test "$PYTHON" != "no" ; then
  1497. AC_MSG_CHECKING([python version])
  1498. PYTHON_VER="`$PYTHON -V 2>&1 | cut -d' ' -f2`"
  1499. if test -z "$PYTHON_VER" ; then
  1500. AC_MSG_ERROR([Unable to detect python version])
  1501. fi
  1502. AC_MSG_RESULT([$PYTHON_VER])
  1503. AC_MSG_CHECKING([for python distutils])
  1504. python_result="`$PYTHON -c 'import distutils;' 2>&1`"
  1505. if test -z "$python_result" ; then
  1506. python_has_distutils="yes"
  1507. else
  1508. python_has_distutils="no"
  1509. fi
  1510. AC_MSG_RESULT([$python_has_distutils])
  1511. if test "$python_has_distutils" != "no" ; then
  1512. AC_MSG_CHECKING([location of site-packages])
  1513. PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
  1514. if test -z "$PYTHON_SITE_DIR" ; then
  1515. AC_MSG_ERROR([Unable to detect python site-packages path])
  1516. elif test ! -d "$PYTHON_SITE_DIR" ; then
  1517. AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
  1518. fi
  1519. AC_MSG_RESULT([$PYTHON_SITE_DIR])
  1520. AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
  1521. #
  1522. # python distutils found, get settings from python directly
  1523. #
  1524. PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`"
  1525. PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print(\" \".join(libs));'`"
  1526. PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print(\"python\" + sysconfig.get_config_var(\"VERSION\"));'`"
  1527. PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
  1528. # handle python being installed into /usr/local
  1529. AC_MSG_CHECKING([python libdir])
  1530. if test -z "`echo $PYTHON_LIBDIR | grep "/usr/lib"`" ; then
  1531. PYTHON_LDFLAGS="-L$PYTHON_LIBDIR $PYTHON_LDFLAGS"
  1532. LIBS="-L$PYTHON_LIBDIR $LIBS"
  1533. fi
  1534. AC_MSG_RESULT([$PYTHON_LIBDIR])
  1535. # check libpython
  1536. AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"])
  1537. if test "$has_libpython" = "no" ; then
  1538. AS_IF([test "$with_python" = "try"],
  1539. [AC_MSG_WARN([$PYTHON_LIB is unusable])],
  1540. [AC_MSG_ERROR([$PYTHON_LIB is unusable])]
  1541. )
  1542. fi
  1543. # check whether system libpython is usable and has threads support
  1544. CFLAGS="$PYTHON_CFLAGS"
  1545. LIBS="$PYTHON_LDFLAGS"
  1546. AC_CHECK_FUNC([PyThread_init_thread], [python_has_threads="yes"], [python_has_threads="no"])
  1547. if test "$python_has_threads" = "no"; then
  1548. AS_IF([test "$with_python" = "try"],
  1549. [AC_MSG_WARN([Your python lacks threads support, can not build mod_python])],
  1550. [AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])]
  1551. )
  1552. else
  1553. AC_MSG_NOTICE([Your python seems OK, do not forget to enable mod_python in modules.conf])
  1554. AC_SUBST([PYTHON_CFLAGS], [$PYTHON_CFLAGS])
  1555. AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS])
  1556. fi
  1557. else
  1558. AS_IF([test "$with_python" = "try"],
  1559. [AC_MSG_WARN([Could not find or use python distutils module: $python_result])],
  1560. [AC_MSG_ERROR([Could not find or use python distutils module: $python_result])]
  1561. )
  1562. fi
  1563. LIBS="$save_LIBS"
  1564. CFLAGS="$save_CFLAGS"
  1565. unset python_has_threads
  1566. unset python_has_distutils
  1567. unset python_result
  1568. else
  1569. AS_IF([test "$with_python" = "try"],
  1570. [AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])],
  1571. [AC_MSG_ERROR([Could not find python, use --with-python to specify the location])]
  1572. )
  1573. fi
  1574. else
  1575. AC_MSG_WARN([python support disabled, building mod_python will fail!])
  1576. fi
  1577. #
  1578. # Python3 checks for mod_python3
  1579. #
  1580. AC_ARG_WITH(
  1581. [python3],
  1582. [AS_HELP_STRING([--with-python3], [Use system provided version of python3 (default: try)])],
  1583. [with_python3="$withval"],
  1584. [with_python3="try"]
  1585. )
  1586. if test "$with_python3" != "no"
  1587. then
  1588. save_CFLAGS="$CFLAGS"
  1589. save_LIBS="$LIBS"
  1590. if test "$with_python3" != "yes" -a "$with_python3" != "try" ; then
  1591. AC_MSG_CHECKING([for python3])
  1592. if test ! -x "$with_python3" ; then
  1593. AC_MSG_ERROR([Specified python3 does not exist or is not executable: $with_python3])
  1594. fi
  1595. AC_MSG_RESULT([$with_python3])
  1596. AC_SUBST([PYTHON3], ["$with_python3"])
  1597. else
  1598. AC_PATH_PROG([PYTHON3], ["python3"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
  1599. fi
  1600. if test "$PYTHON3" != "no" ; then
  1601. AC_MSG_CHECKING([python3 version])
  1602. PYTHON3_VER="`$PYTHON3 -V 2>&1 | cut -d' ' -f2`"
  1603. if test -z "$PYTHON3_VER" ; then
  1604. AC_MSG_ERROR([Unable to detect python3 version])
  1605. fi
  1606. AC_MSG_RESULT([$PYTHON3_VER])
  1607. AC_MSG_CHECKING([for python3 distutils])
  1608. python3_result="`$PYTHON3 -c 'import distutils;' 2>&1`"
  1609. if test -z "$python3_result" ; then
  1610. python3_has_distutils="yes"
  1611. else
  1612. python3_has_distutils="no"
  1613. fi
  1614. AC_MSG_RESULT([$python3_has_distutils])
  1615. if test "$python3_has_distutils" != "no" ; then
  1616. AC_MSG_CHECKING([location of python3 site-packages])
  1617. PYTHON3_SITE_DIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
  1618. if test -z "$PYTHON3_SITE_DIR" ; then
  1619. AC_MSG_ERROR([Unable to detect python3 site-packages path])
  1620. elif test ! -d "$PYTHON3_SITE_DIR" ; then
  1621. AC_MSG_ERROR([Path $PYTHON3_SITE_DIR returned by python3 does not exist!])
  1622. fi
  1623. AC_MSG_RESULT([$PYTHON3_SITE_DIR])
  1624. AC_SUBST([PYTHON3_SITE_DIR], [$PYTHON3_SITE_DIR])
  1625. #
  1626. # python3 distutils found, get settings from python3 directly
  1627. #
  1628. PYTHON3_CFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`"
  1629. PYTHON3_LDFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]); print(\" \".join(libs));'`"
  1630. PYTHON3_LIB="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); print(\"python\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]);'`"
  1631. PYTHON3_LIBDIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
  1632. # handle python3 being installed into /usr/local
  1633. AC_MSG_CHECKING([python3 libdir])
  1634. if test -z "`echo $PYTHON3_LIBDIR | grep "/usr/lib"`" ; then
  1635. PYTHON3_LDFLAGS="-L$PYTHON3_LIBDIR $PYTHON3_LDFLAGS"
  1636. LIBS="-L$PYTHON3_LIBDIR $LIBS"
  1637. fi
  1638. AC_MSG_RESULT([$PYTHON3_LIBDIR])
  1639. # check libpython3
  1640. AC_CHECK_LIB([$PYTHON3_LIB], [main], [has_libpython3="yes"], [has_libpython3="no"])
  1641. if test "$has_libpython3" = "no" ; then
  1642. AS_IF([test "$with_python3" = "try"],
  1643. [AC_MSG_WARN([$PYTHON3_LIB is unusable])],
  1644. [AC_MSG_ERROR([$PYTHON3_LIB is unusable])]
  1645. )
  1646. fi
  1647. # check whether system libpython3 is usable and has threads support
  1648. CFLAGS="$PYTHON3_CFLAGS"
  1649. LIBS="$PYTHON3_LDFLAGS"
  1650. AC_CHECK_FUNC([PyThread_init_thread], [python3_has_threads="yes"], [python3_has_threads="no"])
  1651. if test "$python3_has_threads" = "no"; then
  1652. AS_IF([test "$with_python3" = "try"],
  1653. [AC_MSG_WARN([Your python3 lacks threads support, can not build mod_python3])],
  1654. [AC_MSG_ERROR([Your python3 lacks threads support, can not build mod_python3])]
  1655. )
  1656. else
  1657. AC_MSG_NOTICE([Your python3 seems OK, do not forget to enable mod_python3 in modules.conf])
  1658. AC_SUBST([PYTHON3_CFLAGS], [$PYTHON3_CFLAGS])
  1659. AC_SUBST([PYTHON3_LDFLAGS], [$PYTHON3_LDFLAGS])
  1660. fi
  1661. else
  1662. AS_IF([test "$with_python3" = "try"],
  1663. [AC_MSG_WARN([Could not find or use python3 distutils module: $python3_result])],
  1664. [AC_MSG_ERROR([Could not find or use python3 distutils module: $python3_result])]
  1665. )
  1666. fi
  1667. LIBS="$save_LIBS"
  1668. CFLAGS="$save_CFLAGS"
  1669. unset python3_has_threads
  1670. unset python3_has_distutils
  1671. unset python3_result
  1672. else
  1673. AS_IF([test "$with_python3" = "try"],
  1674. [AC_MSG_WARN([Could not find python3, mod_python3 will not build, use --with-python3 to specify the location])],
  1675. [AC_MSG_ERROR([Could not find python3, use --with-python3 to specify the location])]
  1676. )
  1677. fi
  1678. else
  1679. AC_MSG_WARN([python3 support disabled, building mod_python3 will fail!])
  1680. fi
  1681. #
  1682. # SNMP checks for mod_snmp
  1683. #
  1684. AC_PATH_PROG([NET_SNMP_CONFIG], [net-snmp-config], [no])
  1685. if test "$NET_SNMP_CONFIG" != "no"; then
  1686. AC_MSG_CHECKING([for Net-SNMP libraries via net-snmp-config])
  1687. SNMP_LIBS="`$NET_SNMP_CONFIG --base-agent-libs`"
  1688. else
  1689. # net-snmp-config not in path, fallback to sensible defaults
  1690. SNMP_LIBS="-lnetsnmpmibs -lnetsnmpagent -lnetsnmp"
  1691. fi
  1692. # fix linking error on Solaris patched Net-SNMP
  1693. AS_CASE([$host], [*-solaris2*], [AC_CHECK_LIB([dladm], [dladm_open], [SNMP_LIBS="$SNMP_LIBS -ldladm"])])
  1694. AC_SUBST(SNMP_LIBS)
  1695. CHECK_ERLANG
  1696. # Enable clang address sanitizer bit build
  1697. AC_ARG_ENABLE(address_sanitizer,
  1698. [AC_HELP_STRING([--enable-address-sanitizer],[build with address sanitizer])],
  1699. [enable_address_sanitizer="$enable_address_sanitizer"],
  1700. [enable_address_sanitizer="no"])
  1701. if test "${enable_address_sanitizer}" = "yes"; then
  1702. APR_ADDTO(CFLAGS, -fsanitize=address -fno-omit-frame-pointer -fstack-protector-strong)
  1703. APR_ADDTO(CXXFLAGS, -fsanitize=address -fno-omit-frame-pointer -fstack-protector-strong)
  1704. APR_ADDTO(LDFLAGS, -fsanitize=address)
  1705. fi
  1706. # Enable HEAP profiler (requires libgoogle-perftools-dev package)
  1707. AC_ARG_ENABLE(heap_profiler,
  1708. [AC_HELP_STRING([--enable-heap-profiler],[build with google heap profiler])],
  1709. [enable_heap_profiler="$enable_heap_profiler"],
  1710. [enable_heap_profiler="no"])
  1711. # Enable CPU profiler (requires libgoogle-perftools-dev package)
  1712. AC_ARG_ENABLE(cpu_profiler,
  1713. [AC_HELP_STRING([--enable-cpu-profiler],[build with google cpu profiler])],
  1714. [enable_cpu_profiler="$enable_cpu_profiler"],
  1715. [enable_cpu_profiler="no"])
  1716. PKG_CHECK_MODULES([TCMALLOC], [libtcmalloc], [have_tcmalloc=yes], [have_tcmalloc=no])
  1717. if test "${enable_heap_profiler}" = "yes" || test "${enable_cpu_profiler}" = "yes"; then
  1718. if test "x$have_tcmalloc" != "xyes" ; then
  1719. AC_MSG_ERROR([You must install libgoogle-perftools-dev in order to use heap or cpu profiler])
  1720. fi
  1721. fi
  1722. # WARNING: When both enabled you can NOT link them statically and MUST use the special library
  1723. if test "${enable_heap_profiler}" = "yes" && test "${enable_cpu_profiler}" = "yes"; then
  1724. APR_ADDTO(CFLAGS, -ltcmalloc_and_profiler)
  1725. APR_ADDTO(CXXFLAGS, -ltcmalloc_and_profiler)
  1726. APR_ADDTO(LDFLAGS, -ltcmalloc_and_profiler)
  1727. else
  1728. if test "${enable_heap_profiler}" = "yes"; then
  1729. APR_ADDTO(CFLAGS, -ltcmalloc)
  1730. APR_ADDTO(CXXFLAGS, -ltcmalloc)
  1731. APR_ADDTO(LDFLAGS, -ltcmalloc)
  1732. fi
  1733. if test "${enable_cpu_profiler}" = "yes"; then
  1734. APR_ADDTO(CFLAGS, -lprofiler)
  1735. APR_ADDTO(CXXFLAGS, -lprofiler)
  1736. APR_ADDTO(LDFLAGS, -lprofiler)
  1737. fi
  1738. fi
  1739. # Enable fake dlclose
  1740. AC_ARG_ENABLE(fake_dlclose,
  1741. [AC_HELP_STRING([--enable-fake-dlclose],[Do not unload dynamic libraries])],
  1742. [enable_fake_dlclose="$enable_fake_dlclose"],
  1743. [enable_fake_dlclose="no"])
  1744. if test "${enable_fake_dlclose}" = "yes"; then
  1745. APR_ADDTO(SWITCH_AM_CFLAGS, -DHAVE_FAKE_DLCLOSE)
  1746. fi
  1747. AC_ARG_ENABLE(,
  1748. [AC_HELP_STRING([--enable-pool-sanitizer],[build with sanitizer friendly pool behavior])],
  1749. [enable_pool_sanitizer="$enable_pool_sanitizer"],
  1750. [enable_pool_sanitizer="no"])
  1751. if test "${enable_pool_sanitizer}" = "yes"; then
  1752. APR_ADDTO(CFLAGS, -DDESTROY_POOLS)
  1753. ac_configure_args="$ac_configure_args --enable-pool-debug=yes"
  1754. fi
  1755. # we never use this, and hard setting it will make cross compile work better
  1756. ac_cv_file_dbd_apr_dbd_mysql_c=no
  1757. AC_CONFIG_FILES([Makefile
  1758. build/Makefile
  1759. tests/unit/Makefile
  1760. src/Makefile
  1761. src/mod/Makefile
  1762. src/mod/applications/mod_abstraction/Makefile
  1763. src/mod/applications/mod_avmd/Makefile
  1764. src/mod/applications/mod_bert/Makefile
  1765. src/mod/applications/mod_blacklist/Makefile
  1766. src/mod/applications/mod_callcenter/Makefile
  1767. src/mod/applications/mod_cidlookup/Makefile
  1768. src/mod/applications/mod_cluechoo/Makefile
  1769. src/mod/applications/mod_commands/Makefile
  1770. src/mod/applications/mod_conference/Makefile
  1771. src/mod/applications/mod_curl/Makefile
  1772. src/mod/applications/mod_cv/Makefile
  1773. src/mod/applications/mod_db/Makefile
  1774. src/mod/applications/mod_directory/Makefile
  1775. src/mod/applications/mod_distributor/Makefile
  1776. src/mod/applications/mod_dptools/Makefile
  1777. src/mod/applications/mod_easyroute/Makefile
  1778. src/mod/applications/mod_enum/Makefile
  1779. src/mod/applications/mod_esf/Makefile
  1780. src/mod/applications/mod_esl/Makefile
  1781. src/mod/applications/mod_expr/Makefile
  1782. src/mod/applications/mod_fifo/Makefile
  1783. src/mod/applications/mod_fsk/Makefile
  1784. src/mod/applications/mod_fsv/Makefile
  1785. src/mod/applications/mod_hash/Makefile
  1786. src/mod/applications/mod_hiredis/Makefile
  1787. src/mod/applications/mod_httapi/Makefile
  1788. src/mod/applications/mod_http_cache/Makefile
  1789. src/mod/applications/mod_ladspa/Makefile
  1790. src/mod/applications/mod_lcr/Makefile
  1791. src/mod/applications/mod_limit/Makefile
  1792. src/mod/applications/mod_memcache/Makefile
  1793. src/mod/applications/mod_mongo/Makefile
  1794. src/mod/applications/mod_mp4/Makefile
  1795. src/mod/applications/mod_mp4v2/Makefile
  1796. src/mod/applications/mod_nibblebill/Makefile
  1797. src/mod/applications/mod_oreka/Makefile
  1798. src/mod/applications/mod_osp/Makefile
  1799. src/mod/applications/mod_prefix/Makefile
  1800. src/mod/applications/mod_rad_auth/Makefile
  1801. src/mod/applications/mod_random/Makefile
  1802. src/mod/applications/mod_redis/Makefile
  1803. src/mod/applications/mod_rss/Makefile
  1804. src/mod/applications/mod_skel/Makefile
  1805. src/mod/applications/mod_signalwire/Makefile
  1806. src/mod/applications/mod_sms/Makefile
  1807. src/mod/applications/mod_sms_flowroute/Makefile
  1808. src/mod/applications/mod_snapshot/Makefile
  1809. src/mod/applications/mod_snom/Makefile
  1810. src/mod/applications/mod_sonar/Makefile
  1811. src/mod/applications/mod_soundtouch/Makefile
  1812. src/mod/applications/mod_spandsp/Makefile
  1813. src/mod/applications/mod_spy/Makefile
  1814. src/mod/applications/mod_stress/Makefile
  1815. src/mod/applications/mod_test/Makefile
  1816. src/mod/applications/mod_translate/Makefile
  1817. src/mod/applications/mod_valet_parking/Makefile
  1818. src/mod/applications/mod_vmd/Makefile
  1819. src/mod/applications/mod_voicemail/Makefile
  1820. src/mod/applications/mod_voicemail_ivr/Makefile
  1821. src/mod/asr_tts/mod_cepstral/Makefile
  1822. src/mod/asr_tts/mod_flite/Makefile
  1823. src/mod/asr_tts/mod_pocketsphinx/Makefile
  1824. src/mod/asr_tts/mod_tts_commandline/Makefile
  1825. src/mod/asr_tts/mod_unimrcp/Makefile
  1826. src/mod/codecs/mod_amr/Makefile
  1827. src/mod/codecs/mod_amrwb/Makefile
  1828. src/mod/codecs/mod_b64/Makefile
  1829. src/mod/codecs/mod_bv/Makefile
  1830. src/mod/codecs/mod_clearmode/Makefile
  1831. src/mod/codecs/mod_codec2/Makefile
  1832. src/mod/codecs/mod_com_g729/Makefile
  1833. src/mod/codecs/mod_dahdi_codec/Makefile
  1834. src/mod/codecs/mod_g723_1/Makefile
  1835. src/mod/codecs/mod_g729/Makefile
  1836. src/mod/codecs/mod_h26x/Makefile
  1837. src/mod/codecs/mod_ilbc/Makefile
  1838. src/mod/codecs/mod_isac/Makefile
  1839. src/mod/codecs/mod_mp4v/Makefile
  1840. src/mod/codecs/mod_opus/Makefile
  1841. src/mod/codecs/mod_openh264/Makefile
  1842. src/mod/codecs/mod_sangoma_codec/Makefile
  1843. src/mod/codecs/mod_silk/Makefile
  1844. src/mod/codecs/mod_siren/Makefile
  1845. src/mod/codecs/mod_skel_codec/Makefile
  1846. src/mod/codecs/mod_theora/Makefile
  1847. src/mod/databases/mod_mariadb/Makefile
  1848. src/mod/databases/mod_pgsql/Makefile
  1849. src/mod/dialplans/mod_dialplan_asterisk/Makefile
  1850. src/mod/dialplans/mod_dialplan_directory/Makefile
  1851. src/mod/dialplans/mod_dialplan_xml/Makefile
  1852. src/mod/directories/mod_ldap/Makefile
  1853. src/mod/endpoints/mod_alsa/Makefile
  1854. src/mod/endpoints/mod_dingaling/Makefile
  1855. src/mod/endpoints/mod_gsmopen/Makefile
  1856. src/mod/endpoints/mod_h323/Makefile
  1857. src/mod/endpoints/mod_khomp/Makefile
  1858. src/mod/endpoints/mod_loopback/Makefile
  1859. src/mod/endpoints/mod_opal/Makefile
  1860. src/mod/endpoints/mod_portaudio/Makefile
  1861. src/mod/endpoints/mod_reference/Makefile
  1862. src/mod/endpoints/mod_rtmp/Makefile
  1863. src/mod/endpoints/mod_skinny/Makefile
  1864. src/mod/endpoints/mod_sofia/Makefile
  1865. src/mod/endpoints/mod_unicall/Makefile
  1866. src/mod/endpoints/mod_rtc/Makefile
  1867. src/mod/endpoints/mod_verto/Makefile
  1868. src/mod/event_handlers/mod_amqp/Makefile
  1869. src/mod/event_handlers/mod_cdr_csv/Makefile
  1870. src/mod/event_handlers/mod_cdr_mongodb/Makefile
  1871. src/mod/event_handlers/mod_cdr_pg_csv/Makefile
  1872. src/mod/event_handlers/mod_cdr_sqlite/Makefile
  1873. src/mod/event_handlers/mod_erlang_event/Makefile
  1874. src/mod/event_handlers/mod_event_multicast/Makefile
  1875. src/mod/event_handlers/mod_event_socket/Makefile
  1876. src/mod/event_handlers/mod_event_test/Makefile
  1877. src/mod/event_handlers/mod_fail2ban/Makefile
  1878. src/mod/event_handlers/mod_format_cdr/Makefile
  1879. src/mod/event_handlers/mod_json_cdr/Makefile
  1880. src/mod/event_handlers/mod_kazoo/Makefile
  1881. src/mod/event_handlers/mod_radius_cdr/Makefile
  1882. src/mod/event_handlers/mod_odbc_cdr/Makefile
  1883. src/mod/event_handlers/mod_rayo/Makefile
  1884. src/mod/event_handlers/mod_smpp/Makefile
  1885. src/mod/event_handlers/mod_snmp/Makefile
  1886. src/mod/event_handlers/mod_event_zmq/Makefile
  1887. src/mod/formats/mod_imagick/Makefile
  1888. src/mod/formats/mod_local_stream/Makefile
  1889. src/mod/formats/mod_native_file/Makefile
  1890. src/mod/formats/mod_opusfile/Makefile
  1891. src/mod/formats/mod_png/Makefile
  1892. src/mod/formats/mod_shell_stream/Makefile
  1893. src/mod/formats/mod_shout/Makefile
  1894. src/mod/formats/mod_sndfile/Makefile
  1895. src/mod/formats/mod_ssml/Makefile
  1896. src/mod/formats/mod_tone_stream/Makefile
  1897. src/mod/formats/mod_vlc/Makefile
  1898. src/mod/formats/mod_portaudio_stream/Makefile
  1899. src/mod/languages/mod_java/Makefile
  1900. src/mod/languages/mod_lua/Makefile
  1901. src/mod/languages/mod_managed/Makefile
  1902. src/mod/languages/mod_perl/Makefile
  1903. src/mod/languages/mod_python/Makefile
  1904. src/mod/languages/mod_python3/Makefile
  1905. src/mod/languages/mod_v8/Makefile
  1906. src/mod/languages/mod_yaml/Makefile
  1907. src/mod/languages/mod_basic/Makefile
  1908. src/mod/loggers/mod_console/Makefile
  1909. src/mod/loggers/mod_graylog2/Makefile
  1910. src/mod/loggers/mod_logfile/Makefile
  1911. src/mod/loggers/mod_syslog/Makefile
  1912. src/mod/loggers/mod_raven/Makefile
  1913. src/mod/say/mod_say_de/Makefile
  1914. src/mod/say/mod_say_en/Makefile
  1915. src/mod/say/mod_say_es/Makefile
  1916. src/mod/say/mod_say_es_ar/Makefile
  1917. src/mod/say/mod_say_fa/Makefile
  1918. src/mod/say/mod_say_fr/Makefile
  1919. src/mod/say/mod_say_he/Makefile
  1920. src/mod/say/mod_say_hr/Makefile
  1921. src/mod/say/mod_say_hu/Makefile
  1922. src/mod/say/mod_say_it/Makefile
  1923. src/mod/say/mod_say_ja/Makefile
  1924. src/mod/say/mod_say_nl/Makefile
  1925. src/mod/say/mod_say_pl/Makefile
  1926. src/mod/say/mod_say_pt/Makefile
  1927. src/mod/say/mod_say_ru/Makefile
  1928. src/mod/say/mod_say_sv/Makefile
  1929. src/mod/say/mod_say_th/Makefile
  1930. src/mod/say/mod_say_zh/Makefile
  1931. src/mod/timers/mod_posix_timer/Makefile
  1932. src/mod/timers/mod_timerfd/Makefile
  1933. src/mod/xml_int/mod_xml_cdr/Makefile
  1934. src/mod/xml_int/mod_xml_curl/Makefile
  1935. src/mod/xml_int/mod_xml_ldap/Makefile
  1936. src/mod/xml_int/mod_xml_radius/Makefile
  1937. src/mod/xml_int/mod_xml_rpc/Makefile
  1938. src/mod/xml_int/mod_xml_scgi/Makefile
  1939. src/mod/applications/mod_av/Makefile
  1940. src/mod/applications/mod_video_filter/Makefile
  1941. src/include/switch_am_config.h
  1942. build/getsounds.sh
  1943. build/getlib.sh
  1944. build/getg729.sh
  1945. build/freeswitch.pc
  1946. build/standalone_module/freeswitch.pc
  1947. build/modmake.rules
  1948. libs/esl/Makefile
  1949. libs/esl/perl/Makefile
  1950. libs/esl/php/Makefile
  1951. libs/xmlrpc-c/include/xmlrpc-c/config.h
  1952. libs/xmlrpc-c/xmlrpc_config.h
  1953. libs/xmlrpc-c/config.mk
  1954. libs/xmlrpc-c/srcdir.mk
  1955. libs/xmlrpc-c/stamp-h
  1956. scripts/gentls_cert])
  1957. AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
  1958. AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
  1959. AM_CONDITIONAL(ISFREEBSD, [test `uname -s` = FreeBSD])
  1960. AM_CONDITIONAL(IS64BITLINUX, [test `uname -m` = x86_64])
  1961. AM_CONDITIONAL(HAVE_G723_1, [ test -d ${switch_srcdir}/libs/libg723_1 ])
  1962. AM_CONDITIONAL(HAVE_G729, [ test -d ${switch_srcdir}/libs/libg729 ])
  1963. #some vars to sub into the Makefile.am's
  1964. #LIBS+=> core.log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat core.log;fi;if test "$$error" = "yes";then exit 1;fi
  1965. LIBTOOL='$(SHELL) $(switch_builddir)/libtool'
  1966. TOUCH_TARGET='if test -f "$@";then touch "$@";fi;'
  1967. CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed "s/|.*//" | sed -e "s|^.*/||" | sort | uniq )'
  1968. CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed "s/|.*//" | sed "s/\#/\#\//"| sed -e "s|^.*/||" | sort | uniq )'
  1969. OUR_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
  1970. OUR_CLEAN_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
  1971. OUR_INSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
  1972. OUR_UNINSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
  1973. OUR_TEST_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-print_tests ; done )"; echo $$mods )'
  1974. OUR_CHECK_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-check ; done )"; echo $$mods )'
  1975. OUR_DISABLED_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )'
  1976. OUR_DISABLED_CLEAN_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )'
  1977. OUR_DISABLED_INSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )'
  1978. OUR_DISABLED_UNINSTALL_MODS='$$(tmp_mods="$(CONF_DISABLED_MODULES)"; mods="$$(for i in $$tmp_mods ; do echo $$i-uninstall ; done)"; echo $$mods )'
  1979. #AM_MAKEFLAGS='"OUR_MODULES=$(OUR_MODS)" "OUR_CLEAN_MODULES=$(OUR_CLEAN_MODS)" "OUR_INSTALL_MODULES=$(OUR_INSTALL_MODS)" "OUR_UNINSTALL_MODULES=$(OUR_UNINSTALL_MODS)" "OUR_DISABLED_MODULES=$(OUR_DISABLED_MODS)" "OUR_DISABLED_CLEAN_MODULES=$(OUR_DISABLED_CLEAN_MODS)" "OUR_DISABLED_INSTALL_MODULES=$(OUR_DISABLED_INSTALL_MODS)" "OUR_DISABLED_UNINSTALL_MODULES=$(OUR_DISABLED_UNINSTALL_MODS)" `test -n "$(VERBOSE)" || echo -s`'
  1980. #AM_MAKEFLAGS='`test -n "$(VERBOSE)" || echo -s`'
  1981. AC_SUBST(LIBTOOL)
  1982. AC_SUBST(TOUCH_TARGET)
  1983. AC_SUBST(CONF_DISABLED_MODULES)
  1984. AC_SUBST(CONF_MODULES)
  1985. AC_SUBST(OUR_MODS)
  1986. AC_SUBST(OUR_CLEAN_MODS)
  1987. AC_SUBST(OUR_TEST_MODS)
  1988. AC_SUBST(OUR_CHECK_MODS)
  1989. AC_SUBST(OUR_INSTALL_MODS)
  1990. AC_SUBST(OUR_UNINSTALL_MODS)
  1991. AC_SUBST(OUR_DISABLED_MODS)
  1992. AC_SUBST(OUR_DISABLED_CLEAN_MODS)
  1993. AC_SUBST(OUR_DISABLED_INSTALL_MODS)
  1994. AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
  1995. AC_SUBST(AM_MAKEFLAGS)
  1996. ac_configure_args="$ac_configure_args --with-modinstdir=${modulesdir} CONFIGURE_CFLAGS='$CFLAGS $CPPFLAGS' CONFIGURE_CXXFLAGS='$CXXFLAGS $CPPFLAGS' CONFIGURE_LDFLAGS='$LDFLAGS' "
  1997. # --prefix='$prefix' --exec_prefix='$exec_prefix' --libdir='$libdir' --libexecdir='$libexecdir' --bindir='$bindir' --sbindir='$sbindir' \
  1998. # --localstatedir='$localstatedir' --datadir='$datadir'"
  1999. # Run configure in all the subdirs
  2000. AC_CONFIG_SUBDIRS([libs/srtp])
  2001. if test "$use_system_apr" != "yes"; then
  2002. AC_CONFIG_SUBDIRS([libs/apr])
  2003. fi
  2004. if test "$use_system_aprutil" != "yes"; then
  2005. AC_CONFIG_SUBDIRS([libs/apr-util])
  2006. fi
  2007. AC_CONFIG_SUBDIRS([libs/iksemel])
  2008. AC_CONFIG_SUBDIRS([libs/libdingaling])
  2009. AC_CONFIG_SUBDIRS([libs/unimrcp])
  2010. if test "x${enable_zrtp}" = "xyes"; then
  2011. AC_CONFIG_SUBDIRS([libs/libzrtp])
  2012. fi
  2013. case $host in
  2014. *-openbsd*|*-netbsd*)
  2015. # libtool won't link static libs against shared ones on NetBSD/OpenBSD unless we tell it not to be stupid
  2016. AC_CONFIG_COMMANDS([hacklibtool], [cp libtool libtool.orig && sed -e "s/deplibs_check_method=.*/deplibs_check_method=pass_all/g" libtool.orig > libtool])
  2017. ;;
  2018. esac
  2019. AC_OUTPUT
  2020. ##
  2021. ## Configuration summary
  2022. ##
  2023. echo
  2024. echo "-------------------------- FreeSWITCH configuration --------------------------"
  2025. echo ""
  2026. echo " Locations:"
  2027. echo ""
  2028. echo " prefix: ${prefix}"
  2029. echo " exec_prefix: ${exec_prefix}"
  2030. echo " bindir: ${bindir}"
  2031. echo " confdir: ${confdir}"
  2032. echo " libdir: ${libdir}"
  2033. echo " datadir: ${datadir}"
  2034. echo " localstatedir: ${localstatedir}"
  2035. echo " includedir: ${includedir}"
  2036. echo ""
  2037. echo " certsdir: ${certsdir}"
  2038. echo " dbdir: ${dbdir}"
  2039. echo " grammardir: ${grammardir}"
  2040. echo " htdocsdir: ${htdocsdir}"
  2041. echo " fontsdir: ${fontsdir}"
  2042. echo " logfiledir: ${logfiledir}"
  2043. echo " modulesdir: ${modulesdir}"
  2044. echo " pkgconfigdir: ${pkgconfigdir}"
  2045. echo " recordingsdir: ${recordingsdir}"
  2046. echo " imagesdir: ${imagesdir}"
  2047. echo " runtimedir: ${runtimedir}"
  2048. echo " scriptdir: ${scriptdir}"
  2049. echo " soundsdir: ${soundsdir}"
  2050. echo " storagedir: ${storagedir}"
  2051. echo " cachedir: ${cachedir}"
  2052. echo ""
  2053. echo "------------------------------------------------------------------------------"