| AC_CONFIG_SRCDIR([config.h.in]) |
| 7 | AC_CONFIG_HEADERS([config.h]) |
| 8 | AM_INIT_AUTOMAKE([subdir-objects]) |
| 9 | AM_SILENT_RULES([yes]) |
| 10 | LT_INIT |
| 11 |
| 12 | # Checks for programs. |
| 13 | AC_PROG_CXX |
| 14 | AC_PROG_CC |
| 15 | AC_PROG_OBJCXX |
| 16 | AM_PROG_AS |
| 17 | AC_PROG_RANLIB |
| 18 |
| 19 | # Checks for libraries. |
| 20 | AC_CHECK_LIB([crypto], [SHA1], [], [AC_MSG_FAILURE([libssl-dev is required but not found])]) |
| 21 | AC_CHECK_LIB([m], [floorf]) |
| 22 | AC_CHECK_LIB([opus], [opus_decoder_create], [], [AC_MSG_FAILURE([libopus-dev is required but not found])]) |
| 23 | AC_CHECK_LIB([pthread], [pthread_create]) |
| 24 |
| 25 | AC_CANONICAL_HOST |
| 26 |
| 27 | AS_CASE([$host_cpu], |
| 28 | [i?86], [cpu_x86=yes], |
| 29 | [x86_64], [cpu_x86=yes], |
| 30 | [arm*], [cpu_arm=yes], |
| 31 | [AS_ECHO("!! WARNING: libtgvoip wasn't tested with your CPU architecture ($host_cpu)")] |
| 32 | ) |
| 33 | AS_CASE([$host_cpu], |
| 34 | [armv7*], [cpu_armv7=yes] |
| 35 | ) |
| 36 | AS_ECHO("Detected CPU: $host_cpu") |
| 37 | AM_CONDITIONAL(TARGET_CPU_X86, test "x$cpu_x86" == xyes) |
| 38 | AM_CONDITIONAL(TARGET_CPU_ARM, test "x$cpu_arm" == xyes) |
| 39 | AM_CONDITIONAL(TARGET_CPU_ARMV7, test "x$cpu_armv7" == xyes) |
| 40 | AS_ECHO("Detected OS: $host_os") |
| 41 |
| 42 | AS_CASE([$host_os], |
| 43 | [darwin*], [os_osx=yes] |
| 44 | ) |
| 45 | AM_CONDITIONAL(TARGET_OS_OSX, test "x$os_osx" == xyes) |
| 46 |
| 47 | AC_ARG_ENABLE([audio-callback], [AS_HELP_STRING([--enable-audio-callback], [enable callback-based audio I/O])], [], [enable_audio_callback=no]) |
| 48 | AM_CONDITIONAL(ENABLE_AUDIO_CALLBACK, test "x$enable_audio_callback" == xyes) |
| 49 |
| 50 | AS_IF([test "x$os_osx" != xyes && test "x$enable_audio_callback" != xyes], [ # Linux |
| 51 | AC_CHECK_LIB([dl], [dlopen]) |
| 52 |
| 53 | AC_ARG_WITH([pulse], [AS_HELP_STRING([--without-pulse], [disable PulseAudio support])], [], [with_pulse=yes]) |
| 54 | AC_ARG_WITH([alsa], [AS_HELP_STRING([--without-alsa], [disable ALSA support])], [], [with_alsa=yes]) |
| 55 |
| 56 | AS_IF([test "x$with_pulse" == xno && test "x$with_alsa" == xno], [ |
| 57 | AC_MSG_FAILURE([You can only disable either ALSA or PulseAudio, not both]); |
| 58 | ]) |
| 59 |
| 60 | AS_IF([test "x$with_pulse" != xno], [ |
| 61 | AC_CHECK_LIB([pulse], [pa_context_new], [ |
| 62 | AS_ECHO_N( ) # what is the proper way to check for a library without linking it? |
| 63 | ], [ |
| 64 | AC_MSG_FAILURE([libpulse-dev is required during build, but you don't have it installed. Use --without-pulse to disable PulseAudio support.]) |
| 65 | ]) |
| 66 | ], [ |
| 67 | AC_DEFINE([WITHOUT_PULSE], [1], [Define to disable PulseAudio support]) |
| 68 | ]) |
| 69 |
| 70 | AS_IF([test "x$with_alsa" != xno], [ |
| 71 | AC_CHECK_LIB([asound], [snd_pcm_open], [ |
| 72 | AS_ECHO_N( ) # what is the proper way to check for a library without linking it? |
| 73 | ], [ |
| 74 | AC_MSG_FAILURE([libasound-dev is required during build, but you don't have it installed. Use --without-alsa to disable ALSA support.]) |
| 75 | ]) |
| 76 | ], [ |
| 77 | AC_DEFINE([WITHOUT_ALSA], [1], [Define to disable ALSA support]) |
| 78 | ]) |
| 79 | ]); |
| 80 |
| 81 | AM_CONDITIONAL(WITH_PULSE, test "x$with_pulse" == xyes) |
| 82 | AM_CONDITIONAL(WITH_ALSA, test "x$with_alsa" == xyes) |
| 83 |
| 84 | AC_ARG_ENABLE([dsp], [AS_HELP_STRING([--disable-dsp], [disable signal processing (echo cancellation, noise suppression, and automatic gain control)])], [], [enable_dsp=yes]) |
| 85 | AM_CONDITIONAL(ENABLE_DSP, test "x$enable_dsp" == xyes) |
| 86 |
| 87 | # Checks for header files. |
| 88 | AC_FUNC_ALLOCA |
| 89 | AC_CHECK_HEADERS([arpa/inet.h float.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h wchar.h]) |
| 90 |
| 91 | # Checks for typedefs, structures, and compiler characteristics. |
| 92 | AC_CHECK_HEADER_STDBOOL |
| 93 | AC_C_INLINE |
| 94 | AC_TYPE_INT16_T |
| 95 | AC_TYPE_INT32_T |
| 96 | AC_TYPE_INT64_T |
| 97 | AC_TYPE_INT8_T |
| 98 | AC_TYPE_SIZE_T |
| 99 | AC_TYPE_SSIZE_T |
| 100 | AC_TYPE_UINT16_T |
| 101 | AC_TYPE_UINT32_T |
| 102 | AC_TYPE_UINT64_T |
| 103 | AC_TYPE_UINT8_T |
| 104 | AC_CHECK_TYPES([ptrdiff_t]) |
| 105 |
| 106 | # Checks for library functions. |
| 107 | AC_FUNC_ERROR_AT_LINE |
| 108 | AC_FUNC_MALLOC |
| 109 | AC_FUNC_REALLOC |
| 110 | AC_CHECK_FUNCS([clock_gettime floor gettimeofday inet_ntoa memmove memset select socket sqrt strcasecmp strchr strerror strncasecmp strstr strtol strtoul uname]) |
| 111 |
| 112 | AC_CONFIG_FILES([Makefile]) |
| 113 | AC_OUTPUT |
| 114 |