2012-10-29 21:07:53 +00:00
#
# Use "autoreconf --force --install" to update depedent files after changing
# this configure.ac or any of the Makefile.am files.
#
2022-12-22 20:22:59 +00:00
AC_COPYRIGHT([Copyright (C) 2019-2023 Kevin Larke])
2020-03-24 01:27:10 +00:00
AC_INIT([cwtest],[1.0],[cwtest@larke.org])
2020-10-31 18:13:15 +00:00
AC_CONFIG_SRCDIR([src/cwtest/main.cpp])
2012-10-29 21:07:53 +00:00
AC_CONFIG_AUX_DIR([build-aux]) # put aux files in build-aux
AM_INIT_AUTOMAKE([1.9 -Wall foreign subdir-objects]) # subdir-objects needed for non-recursive make
AC_CONFIG_HEADERS([config.h])
2020-03-24 01:27:10 +00:00
AC_CONFIG_MACRO_DIRS([m4])
2012-10-29 21:07:53 +00:00
2014-01-23 17:04:06 +00:00
AM_PROG_AR
2012-10-29 21:07:53 +00:00
LT_INIT
# Check for programs
AC_PROG_CC
AC_PROG_CXX
# AC_PROG_RANLIB # required for static librarires
2014-01-23 17:04:06 +00:00
AM_PROG_CC_C_O
2012-10-29 21:07:53 +00:00
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h mach/mach.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termios.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT64_T
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_FSEEKO
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([clock_gettime floor memmove memset mkdir pow rint select socket sqrt strcasecmp strchr strcspn strerror strspn strstr strtol])
2020-10-11 19:35:12 +00:00
# Checks for libraries.
fftw=false
AC_CHECK_LIB([fftw3],[fftw_malloc],[fftw=true],[])
AM_CONDITIONAL([cwFFTW],[test x"${fftw}" = xtrue])
if test x"$fftw" = xtrue; then
AC_DEFINE([cwFFTW], 1,[Use libfftw3.])
fi
echo "fftw='${fftw}'"
2012-10-29 21:07:53 +00:00
# The following is a custom macro in ./m4/os_type.m4
# be sure to also set "ACLOCAL_AMFLAGS = -I m4" in ./Makefile.am
# Defines the config.h variable OS_LINUX or OS_OSX
AX_FUNC_OS_TYPE
AX_FUNC_OS_64
# ac_cv_os_type is set by AX_FUNC_OS_TYPE
2020-10-31 18:13:15 +00:00
AM_CONDITIONAL([OS_LINUX],[test x"${ax_cv_os_type}" == xLinux])
AM_CONDITIONAL([OS_OSX],[test x"${ax_cv_os_type}" == xDarwin])
2012-10-29 21:07:53 +00:00
echo "OS='${ax_cv_os_type}'"
AM_CONDITIONAL([OS_64],[test x"${ax_cv_os_64}" == xx86_64])
echo "ptr width='${ax_cv_os_64}'"
2020-09-22 17:31:29 +00:00
#
# Enable Debug
#
2012-10-29 21:07:53 +00:00
AC_ARG_ENABLE([debug],
[ --enable-debug Turn on debugging],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug=false])
echo "debug=${debug}"
2020-10-31 18:13:15 +00:00
AM_CONDITIONAL([DEBUG], [test x$debug == xtrue])
2012-10-29 21:07:53 +00:00
if test x$debug = xfalse; then
AC_DEFINE([NDEBUG], 1,[Debugging off.])
fi
2020-09-22 17:31:29 +00:00
#
# Enable libwebsock
#
2020-09-22 15:31:33 +00:00
AC_ARG_ENABLE([websock],
[ --enable-websock Include websock dependencies],
[case "${enableval}" in
yes) websock=true ;;
no) websock=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-websock]) ;;
esac],[websock=false])
if test x"$websock" = xtrue; then
2020-10-04 17:03:26 +00:00
AC_CHECK_LIB([websockets],[lws_get_library_version],[AC_MSG_RESULT([The 'websockets' library was found.])],[AC_MSG_ERROR([The 'websockets' library was not found.])])
AC_DEFINE([cwWEBSOCK], 1,[Use libwebsock.])
2020-09-22 15:31:33 +00:00
fi
2020-10-31 18:13:15 +00:00
AM_CONDITIONAL([cwWEBSOCK], [test x$websock == xtrue])
2020-10-04 17:03:26 +00:00
echo "websock=${websock}"
2020-09-22 15:31:33 +00:00
2020-09-22 17:31:29 +00:00
#
# Enable ALSA
#
AC_ARG_ENABLE([alsa],
[ --enable-alsa Include ALSA dependencies],
[case "${enableval}" in
yes) alsa=true ;;
no) alsa=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-alsa]) ;;
esac],[alsa=false])
2020-10-04 17:03:26 +00:00
2020-09-22 17:31:29 +00:00
if test x"$alsa" = xtrue; then
2020-10-04 17:03:26 +00:00
AC_CHECK_LIB([asound],[snd_asoundlib_version],[AC_MSG_RESULT([The 'ALSA' library was found.])],[AC_MSG_ERROR([The 'ALSA' library was not found.])])
2020-09-22 17:31:29 +00:00
AC_DEFINE([cwALSA], 1,[Use libalsa.])
fi
2020-10-31 18:13:15 +00:00
AM_CONDITIONAL([cwALSA], [test x$alsa == xtrue])
2020-10-04 17:03:26 +00:00
echo "alsa=${alsa}"
# check for C++17
2020-10-04 18:47:51 +00:00
# hasCpp17=true
# AX_CHECK_COMPILE_FLAG(-std=c++17, [CXXFLAGS="$CXXFLAGS -std=c++17"],[hasCpp17=false])
# if test x"$hasCpp17" = xtrue; then
# AC_DEFINE([cwCPP17], 1,[C++ 17 is available.])
# else
2020-10-04 17:03:26 +00:00
# C++17 is not available check for C++11
2020-10-04 18:47:51 +00:00
# hasCpp11=true
# AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXFLAGS="$CXXFLAGS -std=c++11"], [hasCpp11=false])
# if test x"$hasCpp11" = xtrue; then
# AC_DEFINE([cwCPP11], 1,[C++ 11 is available.])
# fi
# echo "c++11=${hasCpp11}"
#fi
#echo "c++17=${hasCpp17}"
2020-10-04 17:03:26 +00:00
2020-10-04 18:47:51 +00:00
#
2022-08-13 13:36:31 +00:00
# Enable Web
2020-10-04 18:47:51 +00:00
#
AC_ARG_ENABLE([web],
[ --enable-web Include WEB dependencies],
[case "${enableval}" in
yes) web=true ;;
no) web=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-web]) ;;
esac],[web=false])
if test x"$web" = xtrue; then
AC_DEFINE([cwWEB], 1,[Use libweb.])
2020-10-04 17:03:26 +00:00
fi
2020-10-31 18:13:15 +00:00
AM_CONDITIONAL([cwWEB], [test x$web == xtrue])
2020-10-04 17:03:26 +00:00
2020-10-04 18:47:51 +00:00
echo "web=${web}"
2020-09-22 15:31:33 +00:00
2012-10-29 21:07:53 +00:00
# AC_ARG_ENABLE([add_lib],
# [ --enable-add_lib Append some additional libs to the end of the library link list.],
# [add_lib="${enableval}"],
# [add_lib=""])
#
# echo "add_lib=${add_lib}"
#
# AC_SUBST([ADD_LIB], [$add_lib])
2020-03-24 01:27:10 +00:00
#ldir = src/libcw
#AC_SUBST([ldir])
2012-10-29 21:07:53 +00:00
AC_CONFIG_FILES([ Makefile ])
AC_OUTPUT