You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.4 KiB

  1. AC_INIT([dml], [0.0], [jeroen@vreeken.net], [https://dmlinking.net/])
  2. AM_INIT_AUTOMAKE([foreign dist-xz])
  3. AM_SILENT_RULES([yes])
  4. LT_INIT
  5. AC_PROG_CC
  6. AC_CONFIG_MACRO_DIR([m4])
  7. # Are we using emscripten?
  8. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  9. #ifndef __EMSCRIPTEN__
  10. # error this is not emscripten
  11. #endif
  12. ]])],
  13. [EMSCRIPTEN_FOUND="yes"; CFLAGS+=' -I$(srcdir)/wasm_stubs' ],
  14. [EMSCRIPTEN_FOUND="no" ; LIB_LDFLAGS+=' -lcrypto' ]
  15. )
  16. # Check for codec2 library
  17. dnl Search for libcodec2
  18. AC_SEARCH_LIBS([freedv_set_data_header], [codec2], [], [
  19. AC_MSG_ERROR([unable to find the freedv data channel functions in libcodec2])
  20. ])
  21. AC_CHECK_HEADERS([codec2/codec2.h codec2/freedv_api.h],
  22. [codec2_found_headers=yes; break;])
  23. AS_IF([test "x$codec2_found_headers" != "xyes"],
  24. [AC_MSG_ERROR([Unable to find the codec2 headers])])
  25. # Check for eth_ar library
  26. dnl Search for libeth_ar
  27. AC_SEARCH_LIBS([eth_ar_call2mac], [eth_ar], [], [
  28. AC_MSG_ERROR([unable to find the eth_ar_call2mac function in libeth_ar])
  29. ])
  30. AC_CHECK_HEADERS([eth_ar/eth_ar.h eth_ar/fprs.h],
  31. [eth_ar_found_headers=yes; break;])
  32. AS_IF([test "x$eth_ar_found_headers" != "xyes"],
  33. [AC_MSG_ERROR([Unable to find the eth_ar headers])])
  34. # Check for alsa library (flite depends on it but does not link it itself...)
  35. dnl Search for alsa lib
  36. AC_SEARCH_LIBS([snd_pcm_open], [asound], [], [])
  37. # Check for flite library
  38. dnl Search for flite
  39. AC_SEARCH_LIBS([flite_text_to_wave], [flite],
  40. [libflite_found=1], [libflite_found=0])
  41. AC_SEARCH_LIBS([cmu_lex_init], [flite_cmulex],
  42. [libflite_cmulex_found=1], [libflite_cmulex_found=0])
  43. AC_SEARCH_LIBS([usenglish_init], [flite_usenglish],
  44. [libflite_usenglish_found=1], [libflite_usenglish_found=0])
  45. AC_SEARCH_LIBS([register_cmu_us_slt], [flite_cmu_us_slt],
  46. [libflite_cmu_us_slt_found=1], [libflite_cmu_us_slt_found=0])
  47. AC_CHECK_HEADERS([flite/flite.h],
  48. [flite_headers_found=yes])
  49. dnl Search for libsamplerate
  50. AC_SEARCH_LIBS([src_simple], [samplerate], [libsamplerate_found=1], [libsamplerate_found=0])
  51. AC_CHECK_HEADERS([samplerate.h], [samplerate_headers_found=yes])
  52. AS_IF([ test "x$flite_headers_found" == "xyes" && \
  53. test "$libflite_found" == "1" && \
  54. test "$libflite_cmulex_found" == "1" && \
  55. test "$libflite_usenglish_found" == "1" && \
  56. test "$libflite_cmu_us_slt_found" == "1" && \
  57. test "$libsamplerate_found" == "1" && \
  58. test "x$samplerate_headers_found" == "xyes" ],
  59. [CFLAGS+=" -DHAVE_FLITE"])
  60. dnl Search for libmagic
  61. AC_SEARCH_LIBS([magic_open], [magic], [libmagic_found_lib=yes], [])
  62. AC_CHECK_HEADERS([magic.h],
  63. [libmagic_found_headers=yes; break;])
  64. AS_IF([test "x$libmagic_found_headers" = "xyes" && test "x$libmagic_found_lib" = "xyes"],
  65. [enable_dml_httpd="yes"], [enable_dml_httpd="no"]
  66. )
  67. AS_IF([test "x$EMSCRIPTEN_FOUND" = "xno" ],
  68. [enable_dml_trx="yes"; enable_dml_reflector="yes" ],
  69. [enable_dml_trx="no"; enable_dml_reflector="no" ]
  70. )
  71. AM_CONDITIONAL(ENABLE_DML_HTTPD, test "x$enable_dml_httpd" = "xyes")
  72. AM_CONDITIONAL(ENABLE_DML_REFLECTOR, test "x$enable_dml_reflector" = "xyes")
  73. AM_CONDITIONAL(ENABLE_DML_TRX, test "x$enable_dml_trx" = "xyes")
  74. AC_SUBST([LIB_LDFLAGS])
  75. AC_OUTPUT([Makefile])
  76. echo "Optional parts:"
  77. echo " dml_httpd: " $enable_dml_httpd
  78. echo " dml_reflector: " $enable_dml_reflector
  79. echo " dml_trx: " $enable_dml_trx
  80. echo " wasm: " $EMSCRIPTEN_FOUND