configure.ac 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. dnl Copyright (C) 2005-2006 Nokia Corporation
  2. dnl Contact: Pekka Pessi <pekka.pessi@nokia.com>
  3. dnl Licensed under LGPL. See file COPYING.
  4. dnl
  5. dnl ref: http://www.gnu.org/software/autoconf/manual/autoconf.info.gz
  6. dnl
  7. AC_PREREQ(2.57)
  8. dnl information on the package
  9. dnl ---------------------------
  10. dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
  11. AC_INIT([sofia-sip], [1.12.10devel])
  12. CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
  13. CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
  14. LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
  15. AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
  16. AC_CONFIG_MACRO_DIR([m4])
  17. AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
  18. dnl Includedir specific to this sofia version
  19. AC_SUBST(include_sofiadir, '${includedir}/sofia-sip-1.12')
  20. AC_SUBST(LIBVER_SOFIA_SIP_UA_CUR, [6])
  21. AC_SUBST(LIBVER_SOFIA_SIP_UA_REV, [0])
  22. AC_SUBST(LIBVER_SOFIA_SIP_UA_AGE, [6])
  23. AC_SUBST(LIBVER_SOFIA_SIP_UA_SOVER, [0]) # CUR-AGE
  24. AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_CUR, [3])
  25. AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_REV, [0])
  26. AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_AGE, [0])
  27. AC_SUBST(LIBVER_SOFIA_SIP_UA_GLIB_SOVER, [3]) # CUR-AGE
  28. # dnl calls AC_CANONICAL_ macros that are required by AM_INIT_AUTOMAKE
  29. SAC_CANONICAL_SYSTEM_CACHE_CHECK
  30. AM_INIT_AUTOMAKE
  31. AC_CONFIG_HEADERS([config.h])
  32. AC_GNU_SOURCE
  33. CFLAGS="$CFLAGS -DSU_DEBUG=0 $DEBUG_CFLAGS"
  34. ### checks for programs
  35. ### -------------------
  36. AC_LANG([C])
  37. AC_CHECK_COMPILATION_ENVIRONMENT
  38. SAC_TOOL_CC
  39. AC_PROG_INSTALL
  40. AC_PROG_CPP
  41. AC_CHECK_PROG(ETAGS, etags, etags, echo)
  42. AC_CHECK_TOOL(AR, ar, ar)
  43. AC_CHECK_TOOL(LD, ld, ld)
  44. AC_PROG_LIBTOOL
  45. AM_PROG_CC_C_O
  46. SAC_ENABLE_NDEBUG
  47. SAC_ENABLE_EXPENSIVE_CHECKS
  48. dnl Add parameters for aclocal
  49. AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
  50. AC_ARG_WITH(doxygen,
  51. [ --with-doxygen[[=CMD]] use doxygen command CMD [[doxygen]]],[
  52. case $enable_doxygen in
  53. yes ) doxygen=doxygen ;;
  54. no ) doxygen=echo ;;
  55. esac], doxygen=doxygen)
  56. AC_CHECK_PROG([DOXYGEN], [doxygen], [$doxygen], [echo])
  57. AM_CONDITIONAL([HAVE_DOXYGEN], [test $DOXYGEN != echo])
  58. AC_DEFUN([AX_COMPILER_VENDOR],
  59. [
  60. AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
  61. [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
  62. # note: don't check for gcc first since some other compilers define __GNUC__
  63. for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
  64. vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
  65. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
  66. #if !($vencpp)
  67. thisisanerror;
  68. #endif
  69. ])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
  70. done
  71. ])
  72. ])
  73. AX_COMPILER_VENDOR
  74. # Enable 64 bit build
  75. AC_ARG_ENABLE(64,
  76. [AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
  77. if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
  78. if test "${enable_64}" = "yes"; then
  79. SOFIA_CFLAGS="$SOFIA_CFLAGS -m64"
  80. LDFLAGS="-m64 -Wl,-64"
  81. export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig
  82. fi
  83. fi
  84. SOFIA_PLAT_CFLAGS=
  85. # openbsd seems to not define NULL as a void pointer, I blame standards by committee for this.
  86. # This is a dirty hack, but shuts up all the warnings
  87. case "$host" in
  88. *-openbsd*) SOFIA_PLAT_CFLAGS="-DNULL='(void *) 0L'";;
  89. *) ;;
  90. esac
  91. AC_SUBST(SOFIA_PLAT_CFLAGS, $SOFIA_PLAT_CFLAGS)
  92. ### checks for header files
  93. ### -----------------------
  94. AC_HEADER_STDC
  95. ### checks for declarations
  96. ### -----------------------
  97. ### checks for types
  98. ### ----------------
  99. AC_TYPE_SIGNAL
  100. AC_TYPE_LONGLONG
  101. dnl
  102. dnl Define HAVE_C99_FORMAT to 1 if the formatted IO functions (printf/scanf
  103. dnl et.al.) support the C99 'size specifiers', namely ll, hh, j, z, t
  104. dnl (representing long long int, char, intmax_t, size_t, ptrdiff_t). Some C
  105. dnl compilers supported these specifiers prior to C99 as an extension.
  106. dnl
  107. AC_CACHE_CHECK([whether IO functions support C99 size specifiers],
  108. [ac_cv_c_c99_format],[
  109. ac_cv_c_c99_format=yes
  110. AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  111. [[char buf[64];
  112. if (sprintf(buf, "%lld%hhd%jd%zd%td", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5)
  113. exit(1);
  114. else if (strcmp(buf, "12345"))
  115. exit(2);]])],
  116. [ac_cv_c_c99_format=yes],
  117. [ac_cv_c_c99_format=no],
  118. [ac_cv_c_c99_format=yes])
  119. ])
  120. if test $ac_cv_c_c99_format = yes; then
  121. AC_DEFINE([HAVE_C99_FORMAT], [1], [Define to 1 if printf supports C99 size specifiers])dnl
  122. AC_DEFINE([LLU], ["%llu"], [Format (%llu) for unsigned long long])dnl
  123. AC_DEFINE([LLI], ["%lli"], [Format (%lli) for long long])dnl
  124. AC_DEFINE([LLX], ["%llx"], [Format (%llx) for long long hex])dnl
  125. AC_DEFINE([MOD_ZD], ["%zd"], [Define printf() modifier for ssize_t])dnl
  126. AC_DEFINE([MOD_ZU], ["%zu"], [Define printf() modifier for size_t])dnl
  127. else
  128. AC_CACHE_CHECK([whether IO functions support size specifier for long long],
  129. [ac_cv_c_ll_format],[
  130. ac_cv_c_ll_format=yes
  131. AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  132. [[char buf[64];
  133. if (sprintf(buf, "%lld", (long long int)1) != 1)
  134. exit(1);
  135. else if (strcmp(buf, "1"))
  136. exit(2);]])],
  137. [ac_cv_c_ll_format=yes],
  138. [ac_cv_c_ll_format=no],
  139. [ac_cv_c_ll_format=yes])
  140. ])
  141. if test $ac_cv_c_ll_format = yes; then
  142. AC_DEFINE([LLU], ["%llu"], [Format (%llu) for unsigned long long])dnl
  143. AC_DEFINE([LLI], ["%lli"], [Format (%lli) for long long])dnl
  144. AC_DEFINE([LLX], ["%llx"], [Format (%llx) for long long hex])dnl
  145. else
  146. AC_MSG_ERROR("printf cannot handle 64-bit integers")
  147. fi
  148. AC_CACHE_CHECK([whether IO functions support size specifier for size_t],
  149. [ac_cv_c_z_format],[
  150. ac_cv_c_z_format=yes
  151. AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  152. [[char buf[64];
  153. if (sprintf(buf, "%zd", (size_t)1) != 1)
  154. exit(1);
  155. else if (strcmp(buf, "1"))
  156. exit(2);]])],
  157. [ac_cv_c_z_format=yes],
  158. [ac_cv_c_z_format=no],
  159. [ac_cv_c_z_format=yes])
  160. ])
  161. if test $ac_cv_c_z_format = yes; then
  162. AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
  163. AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
  164. else
  165. dnl Cross fingers
  166. AC_MSG_WARN("printf cannot handle size_t, using long instead")
  167. AC_DEFINE([MOD_ZD], ["%ld"], [Define printf() modifier for ssize_t])dnl
  168. AC_DEFINE([MOD_ZU], ["%lu"], [Define printf() modifier for size_t])dnl
  169. fi
  170. fi
  171. ### checks for structures
  172. ### ---------------------
  173. ### checks for typedefs, structures, and compiler characteristics.
  174. ### --------------------------------------------------------------
  175. AC_C_CONST
  176. AC_C_INLINE
  177. AC_C_INLINE_DEFINE
  178. AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
  179. AC_C_VAR_FUNC
  180. AC_C_MACRO_FUNCTION
  181. AC_C_KEYWORD_STRUCT
  182. AC_HEADER_TIME
  183. AC_TYPE_SIZE_T
  184. AC_SYS_SA_LEN
  185. ### checks for library functions
  186. ### ----------------------------
  187. ### checks for system services
  188. ### --------------------------
  189. AC_DEV_URANDOM
  190. ### checks for libraries
  191. ### --------------------
  192. SAC_SOFIA_SU
  193. SAC_OPENSSL
  194. SAC_TPORT
  195. dnl Check is used for testing
  196. PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no")
  197. AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
  198. if test x"$have_check" = "xyes"; then
  199. AC_DEFINE([HAVE_CHECK], 1, [Define to 1 if check library is available])
  200. fi
  201. AC_CHECK_HEADERS([fnmatch.h])
  202. AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])])
  203. AC_CHECK_LIB(z, compress, [have_zlib=yes],[have_zlib=no])
  204. if test x"$have_zlib" = "xyes"; then
  205. AC_DEFINE(HAVE_ZLIB_COMPRESS, 1, [Define if you have zlib compress])
  206. fi
  207. AM_CONDITIONAL([HAVE_ZLIB], [test "x$have_zlib" = xyes])
  208. dnl dl is currently used only in testing
  209. AC_CHECK_LIB([dl], [dlopen], [
  210. dnl Note: -ldl is not added to LIBS
  211. AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dl library is available])
  212. ])
  213. ### internal modules
  214. ### ----------------
  215. AC_DEFINE([HAVE_SOFIA_SIP], 1, [Define to 1 always])
  216. AC_DEFINE([HAVE_SOFIA_SRESOLV], 1, [Define to 1 if we use DNS library])
  217. AC_DEFINE([HAVE_SOFIA_SMIME], 0, [Define to 1 if we use S/MIME library])
  218. AC_ARG_ENABLE(stun,
  219. [ --disable-stun disable stun module (enabled)],
  220. , enable_stun=yes)
  221. if test x$enable_stun = xno ; then
  222. AC_MSG_WARN([** STUN support disabled **])
  223. elif test x${HAVE_OPENSSL} != x1 ; then
  224. dnl compile STUN only if OPENSSL is available
  225. AC_MSG_WARN([** TLS support for STUN disabled as OpenSSL headers and/or libraries were not found **])
  226. AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
  227. else
  228. AC_DEFINE([HAVE_SOFIA_STUN], 1, [Define to 1 if we use STUN library])
  229. fi
  230. AM_CONDITIONAL([HAVE_STUN], [test "x$enable_stun" = xyes])
  231. AC_ARG_ENABLE(nth,
  232. [ --disable-nth disable HTTP-related modules nth and http (enabled)],
  233. , enable_nth=yes)
  234. AM_CONDITIONAL([HAVE_NTH], [test "x$enable_nth" = xyes])
  235. if test x$enable_nth = xyes ; then
  236. AC_DEFINE([HAVE_SOFIA_NTH], 1, [Define to 1 if we use NTH library])
  237. AC_DEFINE([HAVE_SOFIA_HTTP], 1, [Define to 1 if we use HTTP parser library])
  238. fi
  239. dnl Disable NTLM support by default
  240. AC_ARG_ENABLE(ntlm,
  241. [ --enable-ntlm enable NTLM support [[disabled]]],
  242. , enable_ntlm=no)
  243. if test x$enable_ntlm = xyes ; then
  244. AC_DEFINE([HAVE_SOFIA_NTLM], 1, [Define to 1 if we use NTLM library])
  245. fi
  246. AM_CONDITIONAL([HAVE_NTLM], [test "x$enable_ntlm" = xyes])
  247. AC_DEFINE([HAVE_SRTP], 0, [Define to 1 if we use SRTP])
  248. AC_DEFINE([HAVE_UPNP], 0, [Define to 1 if we use UPnP])
  249. AC_ARG_ENABLE(memleak_log,
  250. [ --enable-memleak-log enable logging of possible memory leaks [[disabled]]],
  251. , enable_memleak_log=no)
  252. if test x$enable_memleak_log = xyes ; then
  253. AC_DEFINE([HAVE_MEMLEAK_LOG], 1, [Define to 1 for memory-leak-related logging])
  254. fi
  255. ### output
  256. ### ------
  257. AC_CONFIG_FILES([
  258. Makefile
  259. packages/Makefile
  260. packages/sofia-sip-ua.pc
  261. packages/sofia-sip-ua-glib.pc
  262. libsofia-sip-ua/Makefile
  263. libsofia-sip-ua/bnf/Makefile
  264. libsofia-sip-ua/bnf/Doxyfile
  265. libsofia-sip-ua/docs/Makefile
  266. libsofia-sip-ua/docs/Doxyfile
  267. libsofia-sip-ua/docs/Doxyfile.version
  268. libsofia-sip-ua/docs/sofia-footer.html
  269. libsofia-sip-ua/features/Doxyfile
  270. libsofia-sip-ua/features/Makefile
  271. libsofia-sip-ua/http/Doxyfile
  272. libsofia-sip-ua/http/Makefile
  273. libsofia-sip-ua/ipt/Doxyfile
  274. libsofia-sip-ua/ipt/Makefile
  275. libsofia-sip-ua/iptsec/Doxyfile
  276. libsofia-sip-ua/iptsec/Makefile
  277. libsofia-sip-ua/msg/Doxyfile
  278. libsofia-sip-ua/msg/Makefile
  279. libsofia-sip-ua/nea/Doxyfile
  280. libsofia-sip-ua/nea/Makefile
  281. libsofia-sip-ua/nta/Doxyfile
  282. libsofia-sip-ua/nta/Makefile
  283. libsofia-sip-ua/nth/Doxyfile
  284. libsofia-sip-ua/nth/Makefile
  285. libsofia-sip-ua/nua/Doxyfile
  286. libsofia-sip-ua/nua/Makefile
  287. libsofia-sip-ua/sdp/Doxyfile
  288. libsofia-sip-ua/sdp/Makefile
  289. libsofia-sip-ua/sip/Doxyfile
  290. libsofia-sip-ua/sip/Makefile
  291. libsofia-sip-ua/soa/Doxyfile
  292. libsofia-sip-ua/soa/Makefile
  293. libsofia-sip-ua/sresolv/Doxyfile
  294. libsofia-sip-ua/sresolv/Makefile
  295. libsofia-sip-ua/stun/Doxyfile
  296. libsofia-sip-ua/stun/Makefile
  297. libsofia-sip-ua/su/Doxyfile
  298. libsofia-sip-ua/su/Makefile
  299. libsofia-sip-ua/tport/Doxyfile
  300. libsofia-sip-ua/tport/Makefile
  301. libsofia-sip-ua/url/Doxyfile
  302. libsofia-sip-ua/url/Makefile
  303. libsofia-sip-ua/features/sofia-sip/sofia_features.h
  304. s2check/Makefile
  305. libsofia-sip-ua-glib/Makefile
  306. libsofia-sip-ua-glib/su-glib/Makefile
  307. libsofia-sip-ua-glib/su-glib/Doxyfile
  308. utils/Makefile
  309. utils/Doxyfile
  310. tests/Makefile
  311. win32/Makefile
  312. win32/config.h
  313. open_c/Makefile
  314. open_c/config.h
  315. ])
  316. AC_CONFIG_COMMANDS([version],,[PACKAGE_VERSION=${PACKAGE_VERSION}])
  317. AC_CONFIG_FILES([packages/sofia-sip-${PACKAGE_VERSION}.spec:packages/sofia-sip.spec.in])
  318. AC_OUTPUT