configure.ac 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. AC_PREREQ([2.69])
  2. AC_INIT([libosip2],[5.2.1])
  3. AC_CONFIG_SRCDIR([include/osip2/osip.h])
  4. AC_MSG_NOTICE([libosip2 The GNU Open SIP library.])
  5. AC_MSG_NOTICE([Copyright (C) 2001-2021 Aymeric MOIZARD - <amoizard@antisip.com>])
  6. #‘current[:revision[:age]]’. So, passing -version-info 3:12:1 sets current to 3, revision to 12, and age to 1
  7. # 1/ increase revision for every source code change [release]
  8. # 2/ increase current for every API/ABI change and revert revision to 0
  9. # 3/ always set age to 0 (for public release)
  10. AC_SUBST(LIBOSIP_SO_VERSION, 14:1:0)
  11. AC_SUBST(OSIP_VERSION, $VERSION)
  12. AC_MSG_RESULT([Configuring ${PACKAGE} ${VERSION}])
  13. OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
  14. AC_MSG_RESULT([Building Package on ${OS}])
  15. dnl *********************************************************************
  16. dnl Initialize automake stuff
  17. AC_CONFIG_AUX_DIR(scripts)
  18. AC_CONFIG_HEADERS(osip-config.h)
  19. AM_INIT_AUTOMAKE
  20. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],)
  21. AC_CONFIG_MACRO_DIR([scripts])
  22. AC_CANONICAL_HOST
  23. dnl Checks for programs.
  24. AC_PROG_CC
  25. AC_PROG_CPP
  26. AC_PROG_INSTALL
  27. dnl Initialize libtool
  28. AC_PROG_SED
  29. LT_INIT
  30. dnl declare --enable-* args and collect ac_help strings
  31. AC_ARG_ENABLE(mpatrol,
  32. [AS_HELP_STRING([--enable-mpatrol],
  33. [turn on memory leak detection with patrol @<:@default=no@:>@])],
  34. enable_mpatrol=$enableval,enable_mpatrol="no")
  35. AC_ARG_ENABLE(gprof,
  36. [AS_HELP_STRING([--enable-gprof],
  37. [turn on profiling support @<:@default=no@:>@])],
  38. enable_gprof=$enableval,enable_gprof="no")
  39. AC_ARG_ENABLE(trace,
  40. [AS_HELP_STRING([--enable-trace],
  41. [turn on trace @<:@default=yes@:>@])],
  42. enable_trace=$enableval,enable_trace="yes")
  43. dnl minimize size of code.
  44. AC_ARG_ENABLE(minisize,
  45. [AS_HELP_STRING([--enable-minisize],
  46. [only compile minimal voip related code @<:@default=no@:>@])],
  47. enable_minisize=$enableval,enable_minisize="no")
  48. dnl support for linux-thread or posix thread (pthread.h)
  49. AC_ARG_ENABLE(pthread,
  50. [AS_HELP_STRING([--enable-pthread=@<:@autodetect|force@:>@],
  51. [autodetect POSIX threads or force -DHAVE_PTHREAD @<:@default=autodetect@:>@])],
  52. enable_pthread=$enableval,enable_pthread="autodetect")
  53. dnl support for semaphore.h (linux/sun...)
  54. dnl support for sysV semaphore in sys/sem.h (BSD/linux...)
  55. AC_ARG_ENABLE(semaphore,
  56. [AS_HELP_STRING([--enable-semaphore=@<:@autodetect|semaphore|sysv@:>@],
  57. [select your prefered semaphore @<:@default=autodetect@:>@.])],
  58. enable_semaphore=$enableval,enable_semaphore="autodetect")
  59. dnl support for gperf.
  60. AC_ARG_ENABLE(gperf,
  61. [AS_HELP_STRING([--enable-gperf],
  62. [enable support for gperf (improve the parser speed) @<:@default=no@:>@])],
  63. enable_gperf=$enableval,enable_gperf="no")
  64. dnl libdict support.
  65. AC_ARG_ENABLE(hashtable,
  66. [AS_HELP_STRING([--enable-hashtable],
  67. [compile with hashtable (libdict) support @<:@default=no@:>@])],
  68. enable_hashtable=$enableval,enable_hashtable="no")
  69. dnl build with multithreaded support (need semaphore).
  70. AC_ARG_ENABLE(mt,
  71. [AS_HELP_STRING([--enable-mt],
  72. [compile with multi-thread support @<:@default=yes@:>@])],
  73. enable_mt=$enableval,enable_mt="yes")
  74. dnl support for test suite.
  75. AC_ARG_ENABLE(test,
  76. [AS_HELP_STRING([--enable-test],
  77. [enable building test programs @<:@default=no@:>@])],
  78. enable_test=$enableval,enable_test="no")
  79. dnl compile with mt support
  80. if test "x$enable_mt" = "xyes"; then
  81. if test "x$enable_pthread" = "xforce"; then
  82. AC_DEFINE(HAVE_PTHREAD)
  83. else
  84. AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthreads support -use --enable-mt=no to disable or --enable-pthread=force to define HAVE_PTHREAD])])
  85. LIBS="$PTHREAD_LIBS $LIBS"
  86. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  87. CC="$PTHREAD_CC"
  88. fi
  89. else
  90. SIP_FSM_FLAGS="-DOSIP_MONOTHREAD"
  91. fi
  92. AM_CONDITIONAL(BUILD_MT, test x$enable_mt = xyes)
  93. if test "x$enable_gperf" = "xyes"; then
  94. SIP_PARSER_FLAGS="$SIP_PARSER_FLAGS -DUSE_GPERF"
  95. fi
  96. AM_CONDITIONAL(COMPILE_TESTS, test "x$enable_test" != "xno")
  97. if test "x$enable_semaphore" = "xsemaphore"; then
  98. AC_DEFINE(HAVE_SEMAPHORE_H)
  99. elif test "x$enable_semaphore" = "xsysv"; then
  100. AC_DEFINE(HAVE_SYS_SEM_H)
  101. else
  102. AC_CHECK_HEADERS(semaphore.h)
  103. AC_CHECK_HEADERS(sys/sem.h)
  104. fi
  105. if test "x$host_cpu" = "x$build_cpu"; then
  106. case $OS in
  107. linux*)
  108. SIP_EXTRA_FLAGS="$SIP_EXTRA_FLAGS"
  109. ;;
  110. irix*)
  111. ;;
  112. hpux* | hp-ux*)
  113. ;;
  114. aix*)
  115. ;;
  116. osf*)
  117. ;;
  118. sunos*)
  119. ;;
  120. darwin*)
  121. ;;
  122. *)
  123. ;;
  124. esac
  125. else
  126. AC_MSG_NOTICE([Cross compiling osip.])
  127. fi
  128. case $host_cpu in
  129. arc*)
  130. ;;
  131. *)
  132. ;;
  133. esac
  134. if test "x$enable_hashtable" = "xyes"; then
  135. AC_CHECK_HEADERS([dict/dict.h],
  136. [AC_DEFINE([HAVE_DICT_DICT_H], [], [Define to 1 if you have <dict/dict.h> header file])],
  137. [AC_MSG_ERROR([libdict library not installed. Please install or use --disable-hashtable])])
  138. EXTRA_LIB="$EXTRA_LIB -ldict"
  139. fi
  140. if test "x$enable_trace" = "xyes"; then
  141. SIP_EXTRA_FLAGS="$SIP_EXTRA_FLAGS -DENABLE_TRACE"
  142. fi
  143. if test "x$enable_mpatrol" = "xyes"; then
  144. SIP_EXTRA_FLAGS="$SIP_EXTRA_FLAGS -DENABLE_MPATROL"
  145. EXTRA_LIB="$EXTRA_LIB -lmpatrolmt -lelf -lpthread"
  146. fi
  147. if test "x$enable_gprof" = "xyes"; then
  148. SIP_EXTRA_FLAGS="$SIP_EXTRA_FLAGS -pg"
  149. EXTRA_LIB="$EXTRA_LIB -lc_p"
  150. fi
  151. if test "x$enable_minisize" = "xyes"; then
  152. SIP_EXTRA_FLAGS="$SIP_EXTRA_FLAGS -DMINISIZE"
  153. fi
  154. AM_CONDITIONAL(BUILD_MAXSIZE, test x$enable_minisize = xno)
  155. dnl Checks for libraries. (those one are needed for sun)
  156. AC_CHECK_LIB(posix4,sem_open,[FSM_LIB="$FSM_LIB -lposix4 -mt"])
  157. AC_CHECK_LIB(nsl,nis_add,[FSM_LIB="$FSM_LIB -lnsl"])
  158. AC_CHECK_LIB(socket,sendto,[FSM_LIB="$FSM_LIB -lsocket"])
  159. AC_CHECK_LIB(c, lrand48, AC_DEFINE([HAVE_LRAND48], [], [Defined if you have lrand48]))
  160. AC_CHECK_LIB(rt,clock_gettime,[FSM_LIB="$FSM_LIB -lrt"])
  161. AC_CHECK_FUNCS([localtime])
  162. AC_CACHE_CHECK([whether -Wall works], Wall_cv_flag, [
  163. saved_CPPFLAGS=$CPPFLAGS
  164. CPPFLAGS="-Wall"
  165. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wall_cv_flag=yes],[Wall_cv_flag=no])
  166. CPPFLAGS=$saved_CPPFLAGS
  167. ])
  168. if test "x$Wall_cv_flag" = xyes; then
  169. CPPFLAGS="$CPPFLAGS -Wall"
  170. fi
  171. AC_CACHE_CHECK([whether -Wcast-align works], Wcast_align_cv_flag, [
  172. saved_CPPFLAGS=$CPPFLAGS
  173. CPPFLAGS="-Wcast-align"
  174. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wcast_align_cv_flag=yes],[Wcast_align_cv_flag=no])
  175. CPPFLAGS=$saved_CPPFLAGS
  176. ])
  177. if test "x$Wcast_align_cv_flag" = xyes; then
  178. CPPFLAGS="$CPPFLAGS -Wcast-align"
  179. fi
  180. AC_CACHE_CHECK([whether -Wchar-subscripts works], Wchar_subscripts_cv_flag, [
  181. saved_CPPFLAGS=$CPPFLAGS
  182. CPPFLAGS="-Wchar-subscripts"
  183. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wchar_subscripts_cv_flag=yes],[Wchar_subscripts_cv_flag=no])
  184. CPPFLAGS=$saved_CPPFLAGS
  185. ])
  186. if test "x$Wchar_subscripts_cv_flag" = xyes; then
  187. CPPFLAGS="$CPPFLAGS -Wchar-subscripts"
  188. fi
  189. AC_CACHE_CHECK([whether -Wformat works], Wformat_cv_flag, [
  190. saved_CPPFLAGS=$CPPFLAGS
  191. CPPFLAGS="-Wformat"
  192. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wformat_cv_flag=yes],[Wformat_cv_flag=no])
  193. CPPFLAGS=$saved_CPPFLAGS
  194. ])
  195. if test "x$Wformat_cv_flag" = xyes; then
  196. CPPFLAGS="$CPPFLAGS -Wformat"
  197. fi
  198. AC_CACHE_CHECK([whether -Winline works], Winline_cv_flag, [
  199. saved_CPPFLAGS=$CPPFLAGS
  200. CPPFLAGS="-Winline"
  201. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Winline_cv_flag=yes],[Winline_cv_flag=no])
  202. CPPFLAGS=$saved_CPPFLAGS
  203. ])
  204. if test "x$Winline_cv_flag" = xyes; then
  205. CPPFLAGS="$CPPFLAGS -Winline"
  206. fi
  207. AC_CACHE_CHECK([whether -Wmissing-declarations works], Wmissing_declarations_cv_flag, [
  208. saved_CPPFLAGS=$CPPFLAGS
  209. CPPFLAGS="-Wmissing-declarations"
  210. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wmissing_declarations_cv_flag=yes],[Wmissing_declarations_cv_flag=no])
  211. CPPFLAGS=$saved_CPPFLAGS
  212. ])
  213. if test "x$Wmissing_declarations_cv_flag" = xyes; then
  214. CPPFLAGS="$CPPFLAGS -Wmissing-declarations"
  215. fi
  216. AC_CACHE_CHECK([whether -Wmissing-prototypes works], Wmissing_prototypes_cv_flag, [
  217. saved_CPPFLAGS=$CPPFLAGS
  218. CPPFLAGS="-Wmissing-prototypes"
  219. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wmissing_prototypes_cv_flag=yes],[Wmissing_prototypes_cv_flag=no])
  220. CPPFLAGS=$saved_CPPFLAGS
  221. ])
  222. if test "x$Wmissing_prototypes_cv_flag" = xyes; then
  223. CPPFLAGS="$CPPFLAGS -Wmissing-prototypes"
  224. fi
  225. AC_CACHE_CHECK([whether -Wnested-externs works], Wnested_externs_cv_flag, [
  226. saved_CPPFLAGS=$CPPFLAGS
  227. CPPFLAGS="-Wnested-externs"
  228. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wnested_externs_cv_flag=yes],[Wnested_externs_cv_flag=no])
  229. CPPFLAGS=$saved_CPPFLAGS
  230. ])
  231. if test "x$Wnested_externs_cv_flag" = xyes; then
  232. CPPFLAGS="$CPPFLAGS -Wnested-externs"
  233. fi
  234. AC_CACHE_CHECK([whether -Wpointer-arith works], Wpointer_arith_cv_flag, [
  235. saved_CPPFLAGS=$CPPFLAGS
  236. CPPFLAGS="-Wpointer-arith"
  237. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[Wpointer_arith_cv_flag=yes],[Wpointer_arith_cv_flag=no])
  238. CPPFLAGS=$saved_CPPFLAGS
  239. ])
  240. if test "x$Wpointer_arith_cv_flag" = xyes; then
  241. CPPFLAGS="$CPPFLAGS -Wpointer-arith"
  242. fi
  243. dnl SIP_CFLAGS="$SIP_CFLAGS $CFLAGS"
  244. AC_SUBST(SIP_CFLAGS)
  245. AC_SUBST(SIP_EXTRA_FLAGS)
  246. AC_SUBST(SIP_PARSER_FLAGS)
  247. AC_SUBST(SIP_FSM_FLAGS)
  248. AC_SUBST(EXTRA_LIB)
  249. AC_SUBST(PARSER_LIB)
  250. AC_SUBST(FSM_LIB)
  251. dnl Checks for header files.
  252. dnl This is to be removed for autoconf2.50
  253. AC_HEADER_STDC
  254. AC_CHECK_HEADERS(string.h)
  255. AC_CHECK_HEADERS(strings.h)
  256. AC_CHECK_HEADERS(stdlib.h)
  257. AC_CHECK_HEADERS(unistd.h)
  258. AC_CHECK_HEADERS(sys/types.h)
  259. dnl !This is to be removed for autoconf2.50
  260. AC_CHECK_HEADERS(sys/unistd.h)
  261. AC_CHECK_HEADERS(syslog.h)
  262. AC_CHECK_HEADERS(ctype.h)
  263. AC_CHECK_HEADERS(stdio.h)
  264. AC_CHECK_HEADERS(stdarg.h)
  265. AC_CHECK_HEADERS(varargs.h)
  266. AC_CHECK_HEADERS(fcntl.h)
  267. AC_CHECK_HEADERS(time.h)
  268. AC_CHECK_HEADERS(sys/time.h)
  269. AC_CHECK_HEADERS(sys/select.h)
  270. AC_CHECK_HEADERS(assert.h)
  271. AC_CHECK_HEADERS(signal.h)
  272. AC_CHECK_HEADERS(sys/signal.h)
  273. AC_CHECK_HEADERS(malloc.h)
  274. AC_CHECK_TYPES([struct timeval],,,[
  275. #if TIME_WITH_SYS_TIME
  276. # include <sys/time.h>
  277. # include <time.h>
  278. #else
  279. # if HAVE_SYS_TIME_H
  280. # include <sys/time.h>
  281. # else
  282. # include <time.h>
  283. # endif
  284. #endif
  285. ])
  286. AC_CONFIG_FILES([libosip2.pc
  287. Makefile
  288. scripts/Makefile
  289. src/Makefile
  290. src/osipparser2/Makefile
  291. src/osip2/Makefile
  292. src/test/Makefile
  293. include/Makefile
  294. include/osip2/Makefile
  295. include/osipparser2/Makefile
  296. include/osipparser2/headers/Makefile
  297. help/Makefile
  298. help/man/Makefile
  299. help/doxygen/Makefile
  300. platform/Makefile
  301. platform/rpm/Makefile
  302. platform/vsnet/Makefile
  303. include/osip2/doxygen.dox])
  304. AC_OUTPUT