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