2
0

configure.ac 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. #
  2. # SpanDSP - a series of DSP components for telephony
  3. #
  4. # configure.ac - Process this file with autoconf to produce configure
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License version 2.1,
  8. # as published by the Free Software Foundation.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Lesser General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Lesser General Public
  16. # License along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. # @start 1
  19. AC_PREREQ([2.59])
  20. AC_INIT([spandsp], [1.99.0])
  21. CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
  22. CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
  23. LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
  24. SPANDSP_LT_CURRENT=3
  25. SPANDSP_LT_REVISION=0
  26. SPANDSP_LT_AGE=0
  27. m4_include(m4/ax_compiler_vendor.m4)
  28. m4_include(m4/ax_check_real_file.m4)
  29. m4_include(m4/ax_fixed_point_machine.m4)
  30. m4_include(m4/ax_misaligned_access_fails.m4)
  31. m4_include(m4/ax_c99_features.m4)
  32. m4_include(m4/ax_check_export_capability.m4)
  33. m4_include(m4/ax_check_arm_neon.m4)
  34. m4_include(m4/ax_func_aligned_alloc.m4)
  35. m4_include(m4/memmove.m4)
  36. AC_CONFIG_SRCDIR([src/tone_generate.c])
  37. AC_CONFIG_AUX_DIR([config])
  38. AC_CONFIG_MACRO_DIR([m4])
  39. AC_CONFIG_HEADERS([src/config.h:config-h.in])
  40. AM_INIT_AUTOMAKE([1.9.5])
  41. AC_CANONICAL_HOST
  42. #AC_CANONICAL_BUILD
  43. AC_PROG_CC
  44. AC_PROG_CXX
  45. AC_PROG_GCC_TRADITIONAL
  46. AC_PROG_LIBTOOL
  47. AC_LANG([C])
  48. AX_COMPILER_VENDOR
  49. if test "${build}" != "${host}"
  50. then
  51. # If we are doing a Canadian Cross, in which the host and build systems
  52. # are not the same, we set reasonable default values for the tools.
  53. CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
  54. CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
  55. CC=${CC-${host_alias}-gcc}
  56. CFLAGS=${CFLAGS-"-g -O2"}
  57. CXX=${CXX-${host_alias}-c++}
  58. CXXFLAGS=${CXXFLAGS-"-g -O2"}
  59. else
  60. # Set reasonable default values for some tools even if not Canadian.
  61. # Of course, these are different reasonable default values, originally
  62. # specified directly in the Makefile.
  63. # We don't export, so that autoconf can do its job.
  64. # Note that all these settings are above the fragment inclusion point
  65. # in Makefile.in, so can still be overridden by fragments.
  66. # This is all going to change when we autoconfiscate...
  67. CC_FOR_BUILD="\$(CC)"
  68. CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
  69. AC_PROG_CC
  70. # We must set the default linker to the linker used by gcc for the correct
  71. # operation of libtool. If LD is not defined and we are using gcc, try to
  72. # set the LD default to the ld used by gcc.
  73. if test -z "$LD"
  74. then
  75. if test "$GCC" = yes
  76. then
  77. case $build in
  78. *-*-mingw*)
  79. gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
  80. *)
  81. gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
  82. esac
  83. case $gcc_prog_ld in
  84. # Accept absolute paths.
  85. [[\\/]* | [A-Za-z]:[\\/]*)]
  86. LD="$gcc_prog_ld" ;;
  87. esac
  88. fi
  89. fi
  90. CXX=${CXX-"c++"}
  91. CFLAGS=${CFLAGS-"-g -O2"}
  92. CXXFLAGS=${CXXFLAGS-"-g -O2"}
  93. fi
  94. AC_DEFUN([REMOVE_FROM_VAR],[
  95. new_val=""
  96. removed=0
  97. for i in $$1; do
  98. if test "x$i" != "x$2"; then
  99. new_val="$new_val $i"
  100. else
  101. removed=1
  102. fi
  103. done
  104. if test $removed = "1"; then
  105. echo " removed \"$2\" from $1"
  106. $1=$new_val
  107. fi
  108. ])
  109. AC_C_CONST
  110. AC_C_INLINE
  111. AC_C_VOLATILE
  112. AC_CHECK_TYPES(long long)
  113. AC_CHECK_TYPES(long double)
  114. AC_TYPE_SIGNAL
  115. AC_ARG_ENABLE(doc, [ --enable-doc Build the documentation])
  116. AC_ARG_ENABLE(tests, [ --enable-tests Build the test programs])
  117. AC_ARG_ENABLE(mmx, [ --enable-mmx Enable MMX support])
  118. AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support])
  119. AC_ARG_ENABLE(sse2, [ --enable-sse2 Enable SSE2 support])
  120. AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support])
  121. AC_ARG_ENABLE(ssse3, [ --enable-ssse3 Enable SSSE3 support])
  122. AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support])
  123. AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support])
  124. AC_ARG_ENABLE(avx, [ --enable-avx Enable AVX support])
  125. AC_ARG_ENABLE(avx2, [ --enable-avx2 Enable AVX2 support])
  126. AC_ARG_ENABLE(neon, [ --enable-neon Enable NEON support])
  127. AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
  128. AC_ARG_ENABLE(v32bis, [ --enable-v32bis Enable V.32bis support])
  129. AC_ARG_ENABLE(v34, [ --enable-v34 Enable V.34 support])
  130. # The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
  131. AC_ARG_ENABLE(builtin_tiff,
  132. [AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"])
  133. AC_FUNC_ERROR_AT_LINE
  134. AC_FUNC_VPRINTF
  135. AC_FUNC_MEMCMP
  136. AC_FUNC_MEMMOVE
  137. if test "${ax_cv_c_compiler_vendor}" = "gnu"
  138. then
  139. AC_FUNC_REALLOC
  140. AC_FUNC_MALLOC
  141. fi
  142. AC_FUNC_SELECT_ARGTYPES
  143. AX_C99_FUNC_LRINT
  144. AX_C99_FUNC_LRINTF
  145. AX_C99_FUNC_LLRINT
  146. AX_C99_FUNC_LLRINTF
  147. if test "x$ac_cv_c99_lrint" = "xno" ; then
  148. if test "x$ac_cv_c99_lrintf" = "xno" ; then
  149. AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
  150. AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
  151. fi
  152. fi
  153. AX_C99_FLEXIBLE_ARRAY
  154. AX_FUNC_ALIGNED_ALLOC
  155. AC_CHECK_FUNCS([memalign])
  156. AC_CHECK_FUNCS([posix_memalign])
  157. AC_CHECK_FUNCS([memmove])
  158. AC_CHECK_FUNCS([memset])
  159. AC_CHECK_FUNCS([select])
  160. AC_CHECK_FUNCS([strcasecmp])
  161. AC_CHECK_FUNCS([strchr])
  162. AC_CHECK_FUNCS([strdup])
  163. AC_CHECK_FUNCS([strerror])
  164. AC_CHECK_FUNCS([strstr])
  165. AC_CHECK_FUNCS([strtol])
  166. AC_CHECK_FUNCS([gettimeofday])
  167. AC_CHECK_FUNCS([drand48])
  168. AC_HEADER_STDC
  169. AC_HEADER_SYS_WAIT
  170. AC_HEADER_TIME
  171. # Check for header files.
  172. AC_CHECK_HEADERS([socket.h])
  173. AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
  174. AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
  175. AC_CHECK_HEADERS([stdatomic.h])
  176. AC_CHECK_HEADERS([stdbool.h], [INSERT_STDBOOL_HEADER="#include <stdbool.h>"], [INSERT_STDBOOL_HEADER="#include <spandsp/stdbool.h>"])
  177. AC_CHECK_HEADERS([stdfix.h])
  178. AC_CHECK_HEADERS([unistd.h])
  179. AC_CHECK_HEADERS([stdlib.h])
  180. AC_CHECK_HEADERS([string.h])
  181. AC_CHECK_HEADERS([strings.h])
  182. AC_CHECK_HEADERS([malloc.h])
  183. AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
  184. AC_CHECK_HEADERS([float.h])
  185. AC_CHECK_HEADERS([fcntl.h])
  186. AC_CHECK_HEADERS([sys/time.h])
  187. AC_CHECK_HEADERS([sys/select.h])
  188. AC_CHECK_HEADERS([sys/ioctl.h])
  189. AC_CHECK_HEADERS([sys/fcntl.h])
  190. AC_CHECK_HEADERS([sndfile.h])
  191. AC_CHECK_HEADERS([fenv.h])
  192. AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])])
  193. AC_CHECK_HEADERS([pcap.h])
  194. AC_CHECK_HEADERS([pthread.h])
  195. case "$host" in
  196. *dragonfly*)
  197. ;;
  198. *freebsd*)
  199. ;;
  200. *netbsd*)
  201. ;;
  202. *)
  203. AC_CHECK_HEADERS([tgmath.h], [INSERT_TGMATH_HEADER="#include <tgmath.h>"])
  204. ;;
  205. esac
  206. if test "${build}" == "${host}"
  207. then
  208. AC_CHECK_HEADERS([X11/X.h])
  209. fi
  210. # Determine XML2 include path
  211. AC_MSG_CHECKING(for libxml/xmlmemory.h)
  212. # Can we include headers using system include dirs?
  213. AC_TRY_COMPILE([#include <libxml/xmlmemory.h>], [int a = 1;],
  214. XML2_INCLUDE=" ",
  215. XML2_INCLUDE=
  216. )
  217. # Hunt through several possible directories to find the includes for libxml2
  218. if test "x$XML2_INCLUDE" = "x"; then
  219. old_CPPFLAGS="$CPPFLAGS"
  220. for i in $xml2_include_dir /usr/include /usr/local/include /usr/include/libxml2 /usr/local/include/libxml2 ; do
  221. CPPFLAGS="$old_CPPFLAGS -I$i"
  222. AC_TRY_COMPILE([#include <libxml/xmlmemory.h>], [int a = 1;],
  223. XML2_INCLUDE="-I$i",
  224. XML2_INCLUDE=
  225. )
  226. if test "x$XML2_INCLUDE" != "x"; then
  227. break;
  228. fi
  229. done
  230. CPPFLAGS="$old_CPPFLAGS $XML2_INCLUDE"
  231. fi
  232. AC_CHECK_HEADERS([libxml/xmlmemory.h])
  233. AC_CHECK_HEADERS([libxml/parser.h])
  234. AC_CHECK_HEADERS([libxml/xinclude.h])
  235. AC_LANG([C++])
  236. AC_CHECK_HEADERS([FL/Fl.H])
  237. AC_CHECK_HEADERS([FL/Fl_Overlay_Window.H])
  238. AC_CHECK_HEADERS([FL/Fl_Light_Button.H])
  239. AC_CHECK_HEADERS([FL/fl_draw.H])
  240. AC_CHECK_HEADERS([FL/Fl_Cartesian.H])
  241. AC_CHECK_HEADERS([FL/Fl_Audio_Meter.H])
  242. AC_LANG([C])
  243. if test "${build}" == "${host}"
  244. then
  245. case "${host}" in
  246. x86_64-*)
  247. # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set
  248. AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='${exec_prefix}/lib64')
  249. AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"]))
  250. # The very oldest AMD 64 bit chips support SSE2, SSE and MMX
  251. enable_sse2="yes"
  252. ;;
  253. esac
  254. fi
  255. AC_CHECK_LIB([m], [cos])
  256. # Some platforms still seem to lack the basic single precision trig and power related functions.
  257. AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.]))
  258. AC_SEARCH_LIBS([cosf], [m], AC_DEFINE([HAVE_COSF], [1], [Define to 1 if you have the cosf() function.]))
  259. AC_SEARCH_LIBS([tanf], [m], AC_DEFINE([HAVE_TANF], [1], [Define to 1 if you have the tanf() function.]))
  260. AC_SEARCH_LIBS([asinf], [m], AC_DEFINE([HAVE_ASINF], [1], [Define to 1 if you have the asinf() function.]))
  261. AC_SEARCH_LIBS([acosf], [m], AC_DEFINE([HAVE_ACOSF], [1], [Define to 1 if you have the acosf() function.]))
  262. AC_SEARCH_LIBS([atanf], [m], AC_DEFINE([HAVE_ATANF], [1], [Define to 1 if you have the atanf() function.]))
  263. AC_SEARCH_LIBS([atan2f], [m], AC_DEFINE([HAVE_ATAN2F], [1], [Define to 1 if you have the atan2f() function.]))
  264. AC_SEARCH_LIBS([ceilf], [m], AC_DEFINE([HAVE_CEILF], [1], [Define to 1 if you have the ceilf() function.]))
  265. AC_SEARCH_LIBS([floorf], [m], AC_DEFINE([HAVE_FLOORF], [1], [Define to 1 if you have the floorf() function.]))
  266. AC_SEARCH_LIBS([powf], [m], AC_DEFINE([HAVE_POWF], [1], [Define to 1 if you have the powf() function.]))
  267. AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have the expf() function.]))
  268. AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.]))
  269. AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.]))
  270. AC_SEARCH_LIBS([open_memstream], [m], AC_DEFINE([HAVE_OPEN_MEMSTREAM], [1], [Define to 1 if you have the open_memstream() function.]))
  271. if test -n "$enable_tests" ; then
  272. AC_CHECK_PROG([HAVE_SOX], [sox], yes)
  273. if test "x$HAVE_SOX" != "xyes" ; then
  274. AC_MSG_ERROR("Cannot make tests without sox installed")
  275. fi
  276. AC_CHECK_PROG([HAVE_PBMTOG3], [pbmtog3], yes)
  277. if test "x$HAVE_PBMTOG3" != "xyes" ; then
  278. AC_MSG_ERROR("Cannot make tests without pbmtog3 installed (does your system require a netpbm-progs package?)")
  279. fi
  280. AC_CHECK_PROG([HAVE_FAX2TIFF], [fax2tiff], yes)
  281. if test "x$HAVE_FAX2TIFF" != "xyes" ; then
  282. AC_MSG_ERROR("Cannot make tests without fax2tiff installed (does your system require a libtiff-tools package?)")
  283. fi
  284. AC_LANG([C])
  285. # Checks for libraries.
  286. AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Cannot make tests without libsndfile (does your system require a libsndfile-devel package?)"))
  287. AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Cannot make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))])
  288. AC_CHECK_LIB([xml2], [xmlParseFile], TESTLIBS="$TESTLIBS -lxml2", AC_MSG_ERROR("Cannot make tests without libxml2 (does your system require a libxml2-devel package?)"))
  289. AC_CHECK_LIB([pcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lpcap", [AC_CHECK_LIB([wpcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lwpcap", AC_MSG_ERROR("Cannot make tests without libpcap (does your system require an libpcap-devel package?)"))])
  290. AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread")
  291. AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl")
  292. AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS)
  293. AC_CHECK_LIB([Xext], [XextCreateExtension], TESTLIBS="$TESTLIBS -lXext",, $TESTLIBS)
  294. AC_CHECK_LIB([X11], [XOpenDisplay], TESTLIBS="$TESTLIBS -lX11",, $TESTLIBS)
  295. AC_LANG([C++])
  296. AC_CHECK_LIB([fltk], [main], TESTLIBS="$TESTLIBS -lfltk -lsupc++",, $TESTLIBS)
  297. AC_CHECK_LIB([fltk_cartesian], [main], TESTLIBS="-lfltk_cartesian $TESTLIBS",, $TESTLIBS)
  298. AC_CHECK_LIB([fltk_audio_meter], [main], TESTLIBS="-lfltk_audio_meter $TESTLIBS",, $TESTLIBS)
  299. AC_LANG([C])
  300. fi
  301. AX_CHECK_EXPORT_CAPABILITY([$host],
  302. [AC_DEFINE([SPANDSP_USE_EXPORT_CAPABILITY], [1], [Use the library symbol export capability of the compiler])
  303. SPANDSP_USE_EXPORT_CAPABILITY="#define SPANDSP_USE_EXPORT_CAPABILITY 1"],
  304. [SPANDSP_USE_EXPORT_CAPABILITY="#undef SPANDSP_USE_EXPORT_CAPABILITY"])
  305. saved_CFLAGS="$CFLAGS"
  306. AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
  307. # We need to add -Werror here or clang doesn't fail (it just warns), even though it doesn't understand the
  308. # -Wunused-but-set-variable tag
  309. CFLAGS="$CFLAGS -Werror -Wunused-but-set-variable"
  310. AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no])
  311. ])
  312. AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable)
  313. CFLAGS="$saved_CFLAGS"
  314. case "${ax_cv_c_compiler_vendor}" in
  315. gnu)
  316. COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
  317. if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
  318. COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
  319. fi
  320. AX_CHECK_ARM_NEON([$host],
  321. [AC_DEFINE([SPANDSP_USE_ARM_NEON], [1], [Use the ARM NEON instruction set])])
  322. if test "$enable_neon" = "yes" ; then
  323. COMP_VENDOR_CFLAGS="-mfpu=neon $COMP_VENDOR_CFLAGS"
  324. fi
  325. if test "$enable_avx2" = "yes" ; then
  326. COMP_VENDOR_CFLAGS="-mavx2 $COMP_VENDOR_CFLAGS"
  327. fi
  328. if test "$enable_avx" = "yes" ; then
  329. COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
  330. fi
  331. if test "$enable_sse4_2" = "yes" ; then
  332. COMP_VENDOR_CFLAGS="-msse42 $COMP_VENDOR_CFLAGS"
  333. fi
  334. if test "$enable_sse4_1" = "yes" ; then
  335. COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS"
  336. fi
  337. if test "$enable_ssse3" = "yes" ; then
  338. COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS"
  339. fi
  340. if test "$enable_sse3" = "yes" ; then
  341. COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS"
  342. fi
  343. if test "$enable_sse2" = "yes" ; then
  344. COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS"
  345. fi
  346. if test "$enable_sse" = "yes" ; then
  347. COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
  348. fi
  349. if test "$enable_mmx" = "yes" ; then
  350. COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
  351. fi
  352. case $host_os in
  353. cygwin*)
  354. COMP_VENDOR_LDFLAGS="-no-undefined"
  355. ;;
  356. mingw*)
  357. COMP_VENDOR_LDFLAGS="-no-undefined -lws2_32"
  358. ;;
  359. *)
  360. COMP_VENDOR_LDFLAGS=
  361. ;;
  362. esac
  363. ;;
  364. sun)
  365. COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara $COMP_VENDOR_CFLAGS"
  366. if test "$enable_sse3" = "yes" ; then
  367. COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
  368. fi
  369. if test "$enable_sse2" = "yes" ; then
  370. COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
  371. fi
  372. if test "$enable_sse" = "yes" ; then
  373. COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
  374. fi
  375. if test "$enable_mmx" = "yes" ; then
  376. COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
  377. fi
  378. COMP_VENDOR_LDFLAGS=
  379. REMOVE_FROM_VAR(CFLAGS, -Xc)
  380. ;;
  381. intel)
  382. COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
  383. if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
  384. COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
  385. fi
  386. if test "$enable_avx2" = "yes" ; then
  387. COMP_VENDOR_CFLAGS="-mavx2 $COMP_VENDOR_CFLAGS"
  388. fi
  389. if test "$enable_avx" = "yes" ; then
  390. COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
  391. fi
  392. if test "$enable_sse4_2" = "yes" ; then
  393. COMP_VENDOR_CFLAGS="-msse42 $COMP_VENDOR_CFLAGS"
  394. fi
  395. if test "$enable_sse4_1" = "yes" ; then
  396. COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS"
  397. fi
  398. if test "$enable_ssse3" = "yes" ; then
  399. COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS"
  400. fi
  401. if test "$enable_sse3" = "yes" ; then
  402. COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS"
  403. fi
  404. if test "$enable_sse2" = "yes" ; then
  405. COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS"
  406. fi
  407. if test "$enable_sse" = "yes" ; then
  408. COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
  409. fi
  410. if test "$enable_mmx" = "yes" ; then
  411. COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
  412. fi
  413. COMP_VENDOR_LDFLAGS=
  414. ;;
  415. clang*)
  416. COMP_VENDOR_CFLAGS="-D_XOPEN_SOURCE=700 -std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
  417. if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
  418. COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
  419. fi
  420. COMP_VENDOR_LDFLAGS=
  421. ;;
  422. *)
  423. COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
  424. if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
  425. COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
  426. fi
  427. COMP_VENDOR_LDFLAGS=
  428. ;;
  429. esac
  430. COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS"
  431. if test "$enable_fixed_point" = "yes" ; then
  432. AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
  433. SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1"
  434. else
  435. AX_FIXED_POINT_MACHINE([$host],
  436. [AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
  437. SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1"],
  438. [SPANDSP_USE_FIXED_POINT="#undef SPANDSP_USE_FIXED_POINT"])
  439. fi
  440. AX_MISALIGNED_ACCESS_FAILS([$host],
  441. [AC_DEFINE([SPANDSP_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
  442. SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1"],
  443. [SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS"])
  444. case "${host}" in
  445. armv7[bl] | armv7-*)
  446. if test "$enable_neon" = "yes" ; then
  447. AC_DEFINE([SPANDSP_USE_ARM_NEON], [1], [Use the NEON instruction set (ARMV7 only).])
  448. fi
  449. ;;
  450. x86_64-* | i386-* | i686-*)
  451. if test "$enable_avx2" = "yes" ; then
  452. AC_DEFINE([SPANDSP_USE_AVX2], [1], [Use the AVX2 instruction set (i386 and x86_64 only).])
  453. enable_avx="yes"
  454. fi
  455. if test "$enable_avx" = "yes" ; then
  456. AC_DEFINE([SPANDSP_USE_AVX], [1], [Use the AVX instruction set (i386 and x86_64 only).])
  457. enable_sse4_2="yes"
  458. fi
  459. if test "$enable_sse4_2" = "yes" ; then
  460. AC_DEFINE([SPANDSP_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
  461. enable_sse4_1="yes"
  462. fi
  463. if test "$enable_sse4_1" = "yes" ; then
  464. AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
  465. enable_ssse3="yes"
  466. fi
  467. if test "$enable_ssse3" = "yes" ; then
  468. AC_DEFINE([SPANDSP_USE_SSSE3], [1], [Use the SSSE3 instruction set (i386 and x86_64 only).])
  469. enable_sse3="yes"
  470. fi
  471. if test "$enable_sse3" = "yes" ; then
  472. AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
  473. enable_sse2="yes"
  474. fi
  475. if test "$enable_sse2" = "yes" ; then
  476. AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
  477. enable_sse="yes"
  478. fi
  479. if test "$enable_sse" = "yes" ; then
  480. AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
  481. enable_mmx="yes"
  482. fi
  483. if test "$enable_mmx" = "yes" ; then
  484. AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
  485. fi
  486. ;;
  487. esac
  488. case "$host" in
  489. *bsd*)
  490. CFLAGS="$CFLAGS -I/usr/local/include"
  491. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  492. ;;
  493. esac
  494. if test "$enable_builtin_tiff" = "yes" ; then
  495. abs_tiffdir="`cd ../tiff-4.0.2/ && pwd`"
  496. save_CFLAGS=$CFLAGS
  497. CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff"
  498. AC_CHECK_HEADERS([tiffio.h])
  499. AC_CHECK_HEADERS([tif_dir.h], [], [], [#include <tiffio.h>
  500. ])
  501. CFLAGS="$save_CFLAGS"
  502. COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS"
  503. COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS"
  504. TIFF_LIBS="$abs_tiffdir/libtiff/libtiff.la"
  505. AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).])
  506. else
  507. AC_CHECK_HEADERS([tiffio.h])
  508. AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm)
  509. fi
  510. AC_CHECK_LIB([tiff], [TIFFCreateCustomDirectory], [
  511. if test "$ac_cv_header_tif_dir_h" = "yes" ; then
  512. AC_DEFINE([SPANDSP_SUPPORT_TIFF_FX], [1], [Support TIFF/FX in TIFF file handling])
  513. SPANDSP_SUPPORT_TIFF_FX="#define SPANDSP_SUPPORT_TIFF_FX 1"
  514. else
  515. SPANDSP_SUPPORT_TIFF_FX="#undef SPANDSP_SUPPORT_TIFF_FX"
  516. fi
  517. ], [SPANDSP_SUPPORT_TIFF_FX="#undef SPANDSP_SUPPORT_TIFF_FX"], -lm)
  518. AC_CHECK_HEADERS([jpeglib.h])
  519. AC_CHECK_LIB([jpeg], [jpeg_start_compress], [JPEG_LIBS="-ljpeg"], AC_MSG_ERROR("Cannot build without libtiff (does your system require a libjpeg-devel or libjpeg-turbo-devel package?)"))
  520. LIBS="$LIBS $TIFF_LIBS $JPEG_LIBS"
  521. TESTLIBS="$SIMLIBS $TESTLIBS"
  522. if test "$enable_t43" = "yes" ; then
  523. AC_DEFINE([SPANDSP_SUPPORT_T43], [1], [Support T.43 JBIG gray and colour compression])
  524. SPANDSP_SUPPORT_T43="#define SPANDSP_SUPPORT_T43 1"
  525. else
  526. SPANDSP_SUPPORT_T43="#undef SPANDSP_SUPPORT_T43"
  527. fi
  528. if test "$enable_v32bis" = "yes" ; then
  529. AC_DEFINE([SPANDSP_SUPPORT_V32BIS], [1], [Support the V.32bis modem])
  530. SPANDSP_SUPPORT_V32BIS="#define SPANDSP_SUPPORT_V32BIS 1"
  531. else
  532. SPANDSP_SUPPORT_V32BIS="#undef SPANDSP_SUPPORT_V32BIS"
  533. fi
  534. if test "$enable_v34" = "yes" ; then
  535. AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem])
  536. SPANDSP_SUPPORT_V34="#define SPANDSP_SUPPORT_V34 1"
  537. else
  538. SPANDSP_SUPPORT_V34="#undef SPANDSP_SUPPORT_V34"
  539. fi
  540. AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes])
  541. AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes])
  542. AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes])
  543. AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
  544. AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes])
  545. AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes])
  546. AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes])
  547. AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes])
  548. AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
  549. AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes])
  550. AM_CONDITIONAL([COND_AVX2], [test "$enable_avx2" = yes])
  551. AM_CONDITIONAL([COND_NEON], [test "$enable_neon" = yes])
  552. AM_CONDITIONAL([COND_V32BIS], [test yes = xyes])
  553. AM_CONDITIONAL([COND_V34], [test yes = xyes])
  554. AC_SUBST(SPANDSP_LT_CURRENT)
  555. AC_SUBST(SPANDSP_LT_REVISION)
  556. AC_SUBST(SPANDSP_LT_AGE)
  557. AC_SUBST(CC_FOR_BUILD)
  558. AC_SUBST(CPPFLAGS_FOR_BUILD)
  559. AC_SUBST(COMP_VENDOR_CFLAGS)
  560. AC_SUBST(COMP_VENDOR_LDFLAGS)
  561. AC_SUBST(SIMLIBS)
  562. AC_SUBST(TESTLIBS)
  563. AC_SUBST(SPANDSP_USE_FIXED_POINT)
  564. AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS)
  565. AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY)
  566. AC_SUBST(SPANDSP_SUPPORT_T43)
  567. AC_SUBST(SPANDSP_SUPPORT_V32BIS)
  568. AC_SUBST(SPANDSP_SUPPORT_V34)
  569. AC_SUBST(SPANDSP_SUPPORT_TIFF_FX)
  570. AC_SUBST(INSERT_INTTYPES_HEADER)
  571. AC_SUBST(INSERT_STDINT_HEADER)
  572. AC_SUBST(INSERT_TGMATH_HEADER)
  573. AC_SUBST(INSERT_MATH_HEADER)
  574. AC_SUBST(INSERT_STDBOOL_HEADER)
  575. AC_CONFIG_FILES([Makefile
  576. doc/Makefile
  577. doc/doxygen
  578. src/Makefile
  579. src/spandsp.h
  580. spandsp-sim/Makefile
  581. test-data/Makefile
  582. test-data/etsi/Makefile
  583. test-data/etsi/fax/Makefile
  584. test-data/itu/Makefile
  585. test-data/itu/fax/Makefile
  586. test-data/itu/tiff-fx/Makefile
  587. test-data/local/Makefile
  588. tests/Makefile
  589. spandsp.pc
  590. spandsp.spec])
  591. AC_OUTPUT
  592. # @end 1