diff --git a/configure.ac b/configure.ac index 17a5eb12..fcb1c1f7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_COPYRIGHT([Copyright (C) 2007 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)]) +AC_COPYRIGHT([Copyright (C) 2007, 2008 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)]) AC_PREREQ(2.61) AC_INIT([fldigi], [2.10E], [w1hkj AT w1hkj DOT com]) @@ -11,13 +11,14 @@ AC_CONFIG_AUX_DIR([build-aux]) AC_CANONICAL_BUILD # define host, host_cpu, host_vendor, host_os AC_CANONICAL_HOST -#define target, target_cpu, target_vendor, target_os +# define target, target_cpu, target_vendor, target_os AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([-Wall foreign std-options 1.9.6]) AM_MAINTAINER_MODE AC_CONFIG_SRCDIR([src/main.cxx]) AC_CONFIG_HEADER([src/config.h]) +AC_CONFIG_MACRO_DIR([m4]) AC_DEFINE(PACKAGE_HOME, ["http://www.w1hkj.com/Fldigi-2.x.html"], [Home page]) @@ -66,359 +67,87 @@ AC_CHECK_FUNCS([gethostbyname localtime_r memmove memset mkdir select snprintf s AC_PRESERVE_HELP_ORDER -dnl blank line +dnl blank line before our options in configure's help text AC_ARG_WITH([], [], [], []) -########################### -# static flag -########################### -AC_ARG_ENABLE([static], - AC_HELP_STRING([--enable-static], [enable static linking]), - [case "${enableval}" in - yes|no) ac_cv_static="${enableval}" ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;; - esac], - [ac_cv_static=no]) -if test "x$ac_cv_static" = "xyes"; then - AC_CHECK_LIB([rt], [clock_gettime], [RTLIB=-lrt]) -fi -AC_SUBST([RTLIB]) +### static flag +# Set ac_cv_static to yes/no +# Substitute RTLIB in Makefile +AC_FLDIGI_STATIC -########################### -# debug flag -########################### -AC_ARG_ENABLE([debug], - AC_HELP_STRING([--enable-debug], [turn on debugging]), - [case "${enableval}" in - yes|no) ac_cv_debug="${enableval}" ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; - esac], - [ac_cv_debug=no]) -if test "x$ac_cv_debug" = "xyes"; then - if test "x$GXX" = "xyes"; then - CXXFLAGS="-O0 -ggdb3 -Wall" - else - CXXFLAGS="-O0 -g -Wall" - fi +### debug flag +# Set ac_cv_debug to yes/no +# Override CXXFLAGS +# Set ENABLE_DEBUG Makefile conditional +# Substitute RDYNAMIC in Makefile +AC_FLDIGI_DEBUG - # check for -rdynamic support - AC_MSG_CHECKING([whether $CXX supports -rdynamic]) - LDFLAGS_saved="$LDFLAGS" - LDFLAGS="$LDFLAGS -rdynamic" - AC_TRY_LINK([], [], [ac_cv_rdynamic=yes], [ac_cv_rdynamic=no]) - AC_MSG_RESULT([$ac_cv_rdynamic]) - LDFLAGS="$LDFLAGS_saved" +### TLS flag +# Set ac_cv_tls to yes/no +# Define USE_TLS in config.h +AC_FLDIGI_TLS - if test "x$ac_cv_rdynamic" = "xyes"; then - RDYNAMIC=-rdynamic - fi +### std::bind or alternatives +# Set ac_cv_std_bind or ac_cv_std_tr1_bind to yes/no +# Define HAVE_STD_BIND or HAVE_STD_TR1_BIND in config.h +# Substitute BOOST_CPPFLAGS and BOOST_LDFLAGS in Makefile +# if falling back to Boost +AC_FLDIGI_BIND - CFLAGS="$CXXFLAGS" - AC_MSG_NOTICE([debugging enabled; overriding CXXFLAGS]) -fi -AM_CONDITIONAL([ENABLE_DEBUG], [test "x$ac_cv_debug" = "xyes"]) -AC_SUBST([RDYNAMIC]) +### FLTK +# Substitute FLTK_CFLAGS and FLTK_LIBS in Makefile +# Set FLUID variable +# Set HAVE_FLUID Makefile conditional +AC_FLDIGI_FLTK -########################### -# TLS flag -########################### -AC_ARG_ENABLE([tls], - AC_HELP_STRING([--enable-tls], [enable use of TLS @<:@autodetect@:>@]), - [case "${enableval}" in - yes|no) ac_cv_want_tls="${enableval}" ;; - *) AC_MSG_ERROR([bad value "${enableval}" for --enable-tls]) ;; - esac], - [ac_cv_want_tls=check]) +### OSS +# Set ac_cv_oss to yes/no +# Define USE_OSS in config.h +AC_FLDIGI_OSS -if test "x$ac_cv_want_tls" = "xno"; then - AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS]) - ac_cv_have_tls=no -else - CHECK_TLS() - if test "x$ac_cv_want_tls" = "xcheck"; then - if test "x$ac_cv_have_tls" = "xyes"; then - AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS]) - else - AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS]) - fi - else # $ac_cv_want_tls is yes - if test "x$ac_cv_have_tls" = "xno"; then - AC_MSG_FAILURE([--enable-tls was given, but TLS is not supported]) - else - AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS]) - fi - fi +### libsamplerate +# Substitute SAMPLERATE_CFLAGS and SAMPLERATE_LIBS in Makefile +# Set NO_SAMPLERATE Makefile conditional +AC_FLDIGI_SAMPLERATE + +### libsndfile +# Set ac_cv_sndfile to yes/no +# Define USE_SNDFILE in config.h +# Substitute SNDFILE_CFLAGS and SNDFILE_LIBS in Makefile +AC_FLDIGI_PKG_CHECK([sndfile], [sndfile >= 1.0.10], [with], [SNDFILE], + [enable reading/writing of audio files via libsndfile @<:@autodetect@:>@] ) + +### portaudio +# Set ac_cv_portaudio to yes/no +# Define USE_PORTAUDIO in config.h +# Substitute PORTAUDIO_CFLAGS and PORTAUDIO_LIBS in Makefile +AC_FLDIGI_PKG_CHECK([portaudio], [portaudio-2.0 >= 19], [without], [PORTAUDIO], + [enable support for PortAudio @<:@autodetect@:>@] ) + +### pulseaudio +# Set ac_cv_pulseaudio to yes/no +# Define USE_PULSEAUDIO in config.h +# Substitute PULSEAUDIO_CFLAGS and PULSEAUDIO_LIBS in Makefile +AC_FLDIGI_PKG_CHECK([pulseaudio], [libpulse-simple >= 0.9.7], [with], [PULSEAUDIO], + [enable support for PulseAudio @<:@autodetect@:>@] ) + +if test "x$ac_cv_oss" = "xno" && \ + test "x$ac_cv_portaudio" = "xno" && \ + test "x$ac_cv_pulseaudio" = "xno"; then + AC_MSG_FAILURE([$PACKAGE requires OSS, PortAudio, or PulseAudio]) fi -########################### -# bind -########################### -# Look for a working std::bind or std::tr1::bind. If neither is present -# we will need Boost >= 1.32.0, which provides boost::bind. -AC_LANG_PUSH(C++) -AC_MSG_CHECKING([for std::bind in ]) -AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include - void f(void) { }]], - [[std::bind(f)();]])], - [ac_cv_std_bind=yes], [ac_cv_std_bind=no] ) -AC_MSG_RESULT([$ac_cv_std_bind]) -if test "x$ac_cv_std_bind" = "xyes"; then - AC_DEFINE(HAVE_STD_BIND, 1, [Define to 1 if we have std::bind in ]) -else - AC_DEFINE(HAVE_STD_BIND, 0, [Define to 1 if we have std::bind in ]) -fi - -if test "x$ac_cv_std_bind" = "xno"; then - AC_MSG_CHECKING([for std::tr1::bind in ]) - AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include - void f(void) { }]], - [[std::tr1::bind(f)();]])], - [ac_cv_std_tr1_bind=yes], [ac_cv_std_tr1_bind=no] ) - AC_MSG_RESULT([$ac_cv_std_tr1_bind]) - if test "x$ac_cv_std_tr1_bind" = "xyes"; then - AC_DEFINE(HAVE_STD_TR1_BIND, 1, [Define to 1 if we have std::tr1::bind in ]) - else - AC_DEFINE(HAVE_STD_TR1_BIND, 0, [Define to 1 if we have std::tr1::bind in ]) - fi -fi -AC_LANG_POP(C++) - -if test "x$ac_cv_std_bind" = "xno" && test "x$ac_cv_std_tr1_bind" = "xno"; then - AX_BOOST_BASE(1.32.0) - if test "x$want_boost" = "xno"; then - AC_MSG_ERROR([Boost is required]) - fi -fi -AC_SUBST([BOOST_CPPFLAGS]) -AC_SUBST([BOOST_LDFLAGS]) - -########################### -# FLTK -########################### -AC_ARG_VAR([FLTK_CFLAGS], [C compiler flags for FLTK, overriding fltk-config]) -AC_ARG_VAR([FLTK_LIBS], [linker flags for FLTK, overriding fltk-config]) -if test "x$FLTK_CFLAGS" = "x" && test "x$FLTK_LIBS" = "x"; then - AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no]) - if test "$FLTK_CONFIG" = "no"; then - AC_MSG_ERROR([ -*** The fltk-config script could not be found. Please install the development -*** headers and libraries for FLTK 1.1.x, or set PATH to the directory that -*** contains fltk-config. - ]) - fi - HAVE_FLTK_API_VERSION=no - FLTK_API_VERSION=`$FLTK_CONFIG --api-version` - if test "x$FLTK_API_VERSION" = "x1.1" || "x$FLTK_API_VERSION" = "x1.2"; then - HAVE_FLTK_API_VERSION=yes - fi - if test "${HAVE_FLTK_API_VERSION}" = "no"; then - AC_MSG_ERROR([ -*** The version of FLTK found on your system provides API version $FLTK_API_VERSION. -*** To build $PACKAGE you need a FLTK version that provides API 1.1. - ]) - fi - FLTK_CFLAGS=`$FLTK_CONFIG --cxxflags` - if test "x$ac_cv_static" != "xyes"; then - FLTK_LIBS=`$FLTK_CONFIG --ldflags --use-images` - else - FLTK_LIBS=`$FLTK_CONFIG --ldstaticflags --use-images` - fi -else - AC_MSG_NOTICE([not checking for FLTK]) -fi -AC_SUBST([FLTK_CFLAGS]) -AC_SUBST([FLTK_LIBS]) - -AC_ARG_VAR([FLUID], [Fast Light User-Interface Designer]) -AC_CHECK_PROG([FLUID], [fluid], [fluid]) -AM_CONDITIONAL([HAVE_FLUID], [test -n "$FLUID"]) - -########################### -# libsamplerate -########################### -PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.1, ac_cv_samplerate=yes, ac_cv_samplerate=no) -if test "x$ac_cv_samplerate" = "xno"; then - AC_MSG_NOTICE([using bundled libsamplerate]) -fi -AC_SUBST([SAMPLERATE_CFLAGS]) -AC_SUBST([SAMPLERATE_LIBS]) -AM_CONDITIONAL([NO_SAMPLERATE], [test "x$ac_cv_samplerate" = "xno"]) - -########################### -# libsndfile -########################### -AC_ARG_WITH([sndfile], - AC_HELP_STRING([--with-sndfile], - [enable reading/writing of audio files via libsndfile @<:@autodetect@:>@]), - [case "${withval}" in - yes|no) ac_cv_want_sndfile="${withval}" ;; - *) AC_MSG_ERROR([bad value "${withval}" for --with-sndfile]) ;; - esac], - [ac_cv_want_sndfile=check]) -if test "x$ac_cv_want_sndfile" = "xno"; then - AC_DEFINE(USE_SNDFILE, 0, [Define to 1 if we are using sndfile]) - ac_cv_sndfile=no -else - PKG_CHECK_EXISTS(sndfile >= 1.0.10, ac_cv_sndfile=yes, ac_cv_sndfile=no) - if test "x$ac_cv_want_sndfile" = "xcheck"; then - PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.10, [:], [:]) - if test "x$ac_cv_sndfile" = "xyes"; then - AC_DEFINE(USE_SNDFILE, 1, [Define to 1 if we are using sndfile]) - else - AC_DEFINE(USE_SNDFILE, 0, [Define to 1 if we are using sndfile]) - fi - else # $ac_cv_want_sndfile is yes - if test "x$ac_cv_sndfile" = "xno"; then - AC_MSG_NOTICE([--with-sndfile was given, but test for sndfile failed]) - else - AC_DEFINE(USE_SNDFILE, 1, [Define to 1 if we are using sndfile]) - fi - PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.10) # for the error message - fi -fi -AC_SUBST([SNDFILE_CFLAGS]) -AC_SUBST([SNDFILE_LIBS]) - -########################### -# OSS -########################### -AC_ARG_ENABLE([oss], - AC_HELP_STRING([--disable-oss], [disable support for OSS @<:@autodetect@:>@]), - [case "${enableval}" in - yes|no) ac_cv_want_oss="${enableval}" ;; - *) AC_MSG_ERROR([bad value "${enableval}" for --disable-oss]) ;; - esac], - [ac_cv_want_oss=check]) -ac_cv_oss=no -if test "x$ac_cv_want_oss" = "xno"; then - AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS]) -else - AC_CHECK_HEADER( [sys/soundcard.h], [ac_cv_oss=yes], - [AC_CHECK_HEADER([machine/soundcard.h], [ac_cv_oss=yes], [])] ) - if test "x$ac_cv_want_oss" = "xcheck"; then - if test "x$ac_cv_oss" = "xyes"; then - AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS]) - else - AC_MSG_NOTICE([disabling OSS driver]) - AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS]) - fi - else # $ac_cv_want_oss is yes - if test "x$ac_cv_oss" = "xno"; then - AC_MSG_FAILURE([--enable-oss was given, but test for OSS failed]) - else - AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS]) - fi - fi -fi - -########################### -# portaudio -########################### -AC_ARG_WITH([portaudio], - AC_HELP_STRING([--without-portaudio], - [disable support for PortAudio]), - [case "${withval}" in - yes|no) ac_cv_want_portaudio="${withval}" ;; - *) AC_MSG_ERROR([bad value "${withval}" for --without-portaudio]) ;; - esac], - [ac_cv_want_portaudio=yes]) -if test "x$ac_cv_want_portaudio" = "xyes"; then - PKG_CHECK_EXISTS(portaudio-2.0 >= 19, ac_cv_portaudio=yes, ac_cv_portaudio=no) - if test "x$ac_cv_portaudio" = "xyes"; then - AC_DEFINE(USE_PORTAUDIO, 1, [Define to 1 if we are using PortAudio]) - else - AC_MSG_NOTICE([portaudio test failed (use --without-portaudio to disable)]) - fi - PKG_CHECK_MODULES(PORTAUDIO, portaudio-2.0 >= 19) -else - AC_DEFINE(USE_PORTAUDIO, 0, [Define to 1 if we are using PortAudio]) - ac_cv_portaudio=no -fi -AC_SUBST([PORTAUDIO_CFLAGS]) -AC_SUBST([PORTAUDIO_LIBS]) +### hamlib +# Set ac_cv_hamlib to yes/no +# Define USE_HAMLIB in config.h +# Substitute HAMLIB_CFLAGS and HAMLIB_LIBS in Makefile +# Set ENABLE_HAMLIB Makefile conditional +AC_FLDIGI_PKG_CHECK([hamlib], [hamlib >= 1.2.4], [with], [HAMLIB], + [use hamradio control libraries @<:@autodetect@:>@], + [ENABLE_HAMLIB]) -########################### -# pulseaudio -########################### -AC_ARG_WITH([pulseaudio], - AC_HELP_STRING([--with-pulseaudio], - [use hamradio control libraries @<:@autodetect@:>@]), - [case "${withval}" in - yes|no) ac_cv_want_pulseaudio="${withval}" ;; - *) AC_MSG_ERROR([bad value "${withval}" for --with-pulseaudio]) ;; - esac], - [ac_cv_want_pulseaudio=check]) -if test "x$ac_cv_want_pulseaudio" = "xno"; then - AC_DEFINE(USE_PULSEAUDIO, 0) - ac_cv_pulseaudio=no -else - PKG_CHECK_EXISTS(libpulse-simple >= 0.9.9, ac_cv_pulseaudio=yes, ac_cv_pulseaudio=no) - if test "x$ac_cv_want_pulseaudio" = "xcheck"; then - PKG_CHECK_MODULES(PULSEAUDIO, libpulse-simple >= 0.9.9, [:], [:]) - if test "x$ac_cv_pulseaudio" = "xyes"; then - AC_DEFINE(USE_PULSEAUDIO, 1, [Define to 1 if we are using pulseaudio]) - else - AC_DEFINE(USE_PULSEAUDIO, 0, [Define to 1 if we are using pulseaudio]) - fi - else # $ac_cv_want_pulseaudio is yes - if test "x$ac_cv_pulseaudio" = "xno"; then - AC_MSG_NOTICE([--with-pulseaudio was given, but test for pulseaudio failed]) - else - AC_DEFINE(USE_PULSEAUDIO, 1, [Define to 1 if we are using pulseaudio]) - fi - PKG_CHECK_MODULES(PULSEAUDIO, libpulse-simple >= 0.9.9) # for the error message - fi -fi -AC_SUBST([PULSEAUDIO_CFLAGS]) -AC_SUBST([PULSEAUDIO_LIBS]) - -if test "$ac_cv_oss" = "no" && \ - test "$ac_cv_portaudio" = "no" && \ - test "$ac_cv_pulseaudio" = "no"; then - AC_MSG_ERROR([$PACKAGE requires OSS, PortAudio, or PulseAudio]) -fi - - -########################### -# hamlib -########################### -AC_ARG_WITH([hamlib], - AC_HELP_STRING([--with-hamlib], - [use hamradio control libraries @<:@autodetect@:>@]), - [case "${withval}" in - yes|no) ac_cv_want_hamlib="${withval}" ;; - *) AC_MSG_ERROR([bad value "${withval}" for --with-hamlib]) ;; - esac], - [ac_cv_want_hamlib=check]) -if test "x$ac_cv_want_hamlib" = "xno"; then - AC_DEFINE(USE_HAMLIB, 0) - ac_cv_hamlib=no -else - PKG_CHECK_EXISTS(hamlib >= 1.2.4, ac_cv_hamlib=yes, ac_cv_hamlib=no) - if test "x$ac_cv_want_hamlib" = "xcheck"; then - PKG_CHECK_MODULES(HAMLIB, hamlib >= 1.2.4, [:], [:]) - if test "x$ac_cv_hamlib" = "xyes"; then - AC_DEFINE(USE_HAMLIB, 1, [Define to 1 if we are using hamlib]) - else - AC_DEFINE(USE_HAMLIB, 0, [Define to 1 if we are using hamlib]) - fi - else # $ac_cv_want_hamlib is yes - if test "x$ac_cv_hamlib" = "xno"; then - AC_MSG_NOTICE([--with-hamlib was given, but test for hamlib failed]) - else - AC_DEFINE(USE_HAMLIB, 1, [Define to 1 if we are using hamlib]) - fi - PKG_CHECK_MODULES(HAMLIB, hamlib >= 1.2.4) # for the error message - fi -fi -AC_SUBST([HAMLIB_CFLAGS]) -AC_SUBST([HAMLIB_LIBS]) -AM_CONDITIONAL([ENABLE_HAMLIB], [test "x$ac_cv_hamlib" = "xyes"]) - -########################### -# output -########################### +### output AH_TOP([ #ifndef CONFIG_H_ #define CONFIG_H_ @@ -430,9 +159,8 @@ AH_BOTTOM([ AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT -########################### -# summary -########################### + +### summary AC_MSG_RESULT([ Configuration summary: @@ -440,7 +168,6 @@ Configuration summary: Static linking ...................... $ac_cv_static Debugging ........................... $ac_cv_debug - TLS ................................. $ac_cv_have_tls sndfile ............................. $ac_cv_sndfile OSS ................................. $ac_cv_oss diff --git a/m4/bind.m4 b/m4/bind.m4 new file mode 100644 index 00000000..bd19915c --- /dev/null +++ b/m4/bind.m4 @@ -0,0 +1,41 @@ +dnl Look for a working std::bind or std::tr1::bind. If neither is present +dnl we will need Boost >= 1.32.0, which provides boost::bind. + +AC_DEFUN([AC_FLDIGI_BIND], [ + AC_LANG_PUSH(C++) + AC_MSG_CHECKING([for std::bind in ]) + AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include + void f(void) { }]], + [[std::bind(f)();]])], + [ac_cv_std_bind=yes], [ac_cv_std_bind=no] ) + AC_MSG_RESULT([$ac_cv_std_bind]) + if test "x$ac_cv_std_bind" = "xyes"; then + AC_DEFINE(HAVE_STD_BIND, 1, [Define to 1 if we have std::bind in ]) + else + AC_DEFINE(HAVE_STD_BIND, 0, [Define to 1 if we have std::bind in ]) + fi + + if test "x$ac_cv_std_bind" = "xno"; then + AC_MSG_CHECKING([for std::tr1::bind in ]) + AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include + void f(void) { }]], + [[std::tr1::bind(f)();]])], + [ac_cv_std_tr1_bind=yes], [ac_cv_std_tr1_bind=no] ) + AC_MSG_RESULT([$ac_cv_std_tr1_bind]) + if test "x$ac_cv_std_tr1_bind" = "xyes"; then + AC_DEFINE(HAVE_STD_TR1_BIND, 1, [Define to 1 if we have std::tr1::bind in ]) + else + AC_DEFINE(HAVE_STD_TR1_BIND, 0, [Define to 1 if we have std::tr1::bind in ]) + fi + fi + AC_LANG_POP(C++) + + if test "x$ac_cv_std_bind" = "xno" && test "x$ac_cv_std_tr1_bind" = "xno"; then + AX_BOOST_BASE(1.32.0) + if test "x$want_boost" = "xno"; then + AC_MSG_ERROR([Boost is required]) + fi + fi + AC_SUBST([BOOST_CPPFLAGS]) + AC_SUBST([BOOST_LDFLAGS]) +]) diff --git a/m4/debug.m4 b/m4/debug.m4 new file mode 100644 index 00000000..e53de238 --- /dev/null +++ b/m4/debug.m4 @@ -0,0 +1,44 @@ +AC_DEFUN([AC_FLDIGI_RDYNAMIC], [ + LDFLAGS_saved="$LDFLAGS" + LDFLAGS="$LDFLAGS -rdynamic" + + AC_MSG_CHECKING([whether $CC supports -rdynamic]) + AC_TRY_LINK([], [], [ac_cv_rdynamic=yes], [ac_cv_rdynamic=no]) + AC_MSG_RESULT([$ac_cv_rdynamic]) + + AC_LANG_PUSH(C++) + AC_MSG_CHECKING([whether $CXX supports -rdynamic]) + AC_TRY_LINK([], [], [ac_cv_rdynamic=yes], [ac_cv_rdynamic=no]) + AC_MSG_RESULT([$ac_cv_rdynamic]) + AC_LANG_POP(C++) + + LDFLAGS="$LDFLAGS_saved" +]) + + +AC_DEFUN([AC_FLDIGI_DEBUG], [ + AC_ARG_ENABLE([debug], + AC_HELP_STRING([--enable-debug], [turn on debugging]), + [case "${enableval}" in + yes|no) ac_cv_debug="${enableval}" ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; + esac], + [ac_cv_debug=no]) + if test "x$ac_cv_debug" = "xyes"; then + if test "x$GXX" = "xyes"; then + CXXFLAGS="-O0 -ggdb3 -Wall" + else + CXXFLAGS="-O0 -g -Wall" + fi + + AC_FLDIGI_RDYNAMIC() + if test "x$ac_cv_rdynamic" = "xyes"; then + RDYNAMIC=-rdynamic + fi + + CFLAGS="$CXXFLAGS" + AC_MSG_NOTICE([debugging enabled; overriding CXXFLAGS]) + fi + AM_CONDITIONAL([ENABLE_DEBUG], [test "x$ac_cv_debug" = "xyes"]) + AC_SUBST([RDYNAMIC]) +]) diff --git a/m4/fltk.m4 b/m4/fltk.m4 new file mode 100644 index 00000000..ce27fc70 --- /dev/null +++ b/m4/fltk.m4 @@ -0,0 +1,39 @@ +AC_DEFUN([AC_FLDIGI_FLTK], [ + AC_ARG_VAR([FLTK_CFLAGS], [C compiler flags for FLTK, overriding fltk-config]) + AC_ARG_VAR([FLTK_LIBS], [linker flags for FLTK, overriding fltk-config]) + if test "x$FLTK_CFLAGS" = "x" && test "x$FLTK_LIBS" = "x"; then + AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no]) + if test "$FLTK_CONFIG" = "no"; then + AC_MSG_ERROR([ + *** The fltk-config script could not be found. Please install the development + *** headers and libraries for FLTK 1.1.x, or set PATH to the directory that + *** contains fltk-config. + ]) + fi + HAVE_FLTK_API_VERSION=no + FLTK_API_VERSION=`$FLTK_CONFIG --api-version` + if test "x$FLTK_API_VERSION" = "x1.1" || "x$FLTK_API_VERSION" = "x1.2"; then + HAVE_FLTK_API_VERSION=yes + fi + if test "${HAVE_FLTK_API_VERSION}" = "no"; then + AC_MSG_ERROR([ + *** The version of FLTK found on your system provides API version $FLTK_API_VERSION. + *** To build $PACKAGE you need a FLTK version that provides API 1.1. + ]) + fi + FLTK_CFLAGS=`$FLTK_CONFIG --cxxflags` + if test "x$ac_cv_static" != "xyes"; then + FLTK_LIBS=`$FLTK_CONFIG --ldflags --use-images` + else + FLTK_LIBS=`$FLTK_CONFIG --ldstaticflags --use-images` + fi + else + AC_MSG_NOTICE([not checking for FLTK]) + fi + AC_SUBST([FLTK_CFLAGS]) + AC_SUBST([FLTK_LIBS]) + + AC_ARG_VAR([FLUID], [Fast Light User-Interface Designer]) + AC_CHECK_PROG([FLUID], [fluid], [fluid]) + AM_CONDITIONAL([HAVE_FLUID], [test -n "$FLUID"]) +]) diff --git a/m4/oss.m4 b/m4/oss.m4 new file mode 100644 index 00000000..f228e866 --- /dev/null +++ b/m4/oss.m4 @@ -0,0 +1,31 @@ +AC_DEFUN([AC_FLDIGI_OSS], [ + AC_ARG_ENABLE([oss], + AC_HELP_STRING([--disable-oss], [disable support for OSS @<:@autodetect@:>@]), + [case "${enableval}" in + yes|no) ac_cv_want_oss="${enableval}" ;; + *) AC_MSG_ERROR([bad value "${enableval}" for --disable-oss]) ;; + esac], + [ac_cv_want_oss=check]) + ac_cv_oss=no + if test "x$ac_cv_want_oss" = "xno"; then + AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS]) + else + AC_CHECK_HEADER( [sys/soundcard.h], [ac_cv_oss=yes], + [AC_CHECK_HEADER([machine/soundcard.h], [ac_cv_oss=yes], [])] ) + if test "x$ac_cv_want_oss" = "xcheck"; then + if test "x$ac_cv_oss" = "xyes"; then + AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS]) + else + AC_MSG_NOTICE([disabling OSS driver]) + AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS]) + fi + else # $ac_cv_want_oss is yes + if test "x$ac_cv_oss" = "xno"; then + AC_MSG_FAILURE([--enable-oss was given, but test for OSS failed]) + else + AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS]) + fi + fi + fi +]) + diff --git a/m4/pkg-config.m4 b/m4/pkg-config.m4 new file mode 100644 index 00000000..5ff60a4b --- /dev/null +++ b/m4/pkg-config.m4 @@ -0,0 +1,35 @@ +# name, version, opt-prefix, subst-var-prefix, help-text, [am-cond] +AC_DEFUN([AC_FLDIGI_PKG_CHECK], [ + +AC_ARG_WITH($1, AC_HELP_STRING([--[]$3-[]$1], [$5]), + [case "${withval}" in + yes|no) ac_cv_want_[]$1="${withval}" ;; + *) AC_MSG_ERROR([bad value "${withval}" for --[]$3-[]$1]) ;; + esac], + [ac_cv_want_[]$1=check]) +if test "x$ac_cv_want_[]$1" = "xno"; then + AC_DEFINE([USE_][$4], 0) + ac_cv_[]$1=no +else + PKG_CHECK_EXISTS([$2], ac_cv_[]$1=yes, ac_cv_[]$1=no) + if test "x$ac_cv_want_[]$1" = "xcheck"; then + PKG_CHECK_MODULES([$4], [$2], [:], [:]) + if test "x$ac_cv_[]$1" = "xyes"; then + AC_DEFINE([USE_][$4], 1, [Define to 1 if we are using [$1]]) + else + AC_DEFINE([USE_][$4], 0, [Define to 1 if we are using [$1]]) + fi + else # $ac_cv_want_[]$1 is yes + if test "x$ac_cv_[]$1" = "xno"; then + AC_MSG_NOTICE([--[]$3-[]$1 was given, but test for [$1] failed]) + else + AC_DEFINE([USE_][$4], 1, [Define to 1 if we are using [$1]]) + fi + PKG_CHECK_MODULES([$4], [$2]) # for the error message + fi +fi +AC_SUBST([$3][_CFLAGS]) +AC_SUBST([$3][_LIBS]) + +m4_ifval([$6], [ AM_CONDITIONAL([$6], [test "x$ac_cv_[]$1" = "xyes"]) ], [:]) +]) diff --git a/m4/samplerate.m4 b/m4/samplerate.m4 new file mode 100644 index 00000000..eafb285b --- /dev/null +++ b/m4/samplerate.m4 @@ -0,0 +1,9 @@ +AC_DEFUN([AC_FLDIGI_SAMPLERATE], [ + PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.1, ac_cv_samplerate=yes, ac_cv_samplerate=no) + if test "x$ac_cv_samplerate" = "xno"; then + AC_MSG_WARN([using bundled libsamplerate]) + fi + AC_SUBST([SAMPLERATE_CFLAGS]) + AC_SUBST([SAMPLERATE_LIBS]) + AM_CONDITIONAL([NO_SAMPLERATE], [test "x$ac_cv_samplerate" = "xno"]) +]) diff --git a/m4/static.m4 b/m4/static.m4 new file mode 100644 index 00000000..a916437c --- /dev/null +++ b/m4/static.m4 @@ -0,0 +1,13 @@ +AC_DEFUN([AC_FLDIGI_STATIC], [ + AC_ARG_ENABLE([static], + AC_HELP_STRING([--enable-static], [enable static linking]), + [case "${enableval}" in + yes|no) ac_cv_static="${enableval}" ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;; + esac], + [ac_cv_static=no]) + if test "x$ac_cv_static" = "xyes"; then + AC_CHECK_LIB([rt], [clock_gettime], [RTLIB=-lrt]) + fi + AC_SUBST([RTLIB]) +]) diff --git a/m4/tls.m4 b/m4/tls.m4 index b8df7941..116810f5 100644 --- a/m4/tls.m4 +++ b/m4/tls.m4 @@ -40,14 +40,45 @@ AC_DEFUN([CHECK_TLS], [ return 0; return (a_in_other_thread == a_in_main_thread);]] ) ], - [ac_cv_have_tls=yes], [ac_cv_have_tls=no] ) + [ac_cv_tls=yes], [ac_cv_tls=no] ) CXXFLAGS="$chktls_save_CXXFLAGS" fi], - [ac_cv_have_tls=no], + [ac_cv_tls=no], [AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }], - [ac_cv_have_tls=yes], [ac_cv_have_tls=no])] + [ac_cv_tls=yes], [ac_cv_tls=no])] ) AC_LANG_POP(C++) - AC_MSG_RESULT([$ac_cv_have_tls]) + AC_MSG_RESULT([$ac_cv_tls]) +]) + + +AC_DEFUN([AC_FLDIGI_TLS], [ + AC_ARG_ENABLE([tls], + AC_HELP_STRING([--enable-tls], [enable use of TLS @<:@autodetect@:>@]), + [case "${enableval}" in + yes|no) ac_cv_want_tls="${enableval}" ;; + *) AC_MSG_ERROR([bad value "${enableval}" for --enable-tls]) ;; + esac], + [ac_cv_want_tls=check]) + + if test "x$ac_cv_want_tls" = "xno"; then + AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS]) + ac_cv_tls=no + else + CHECK_TLS() + if test "x$ac_cv_want_tls" = "xcheck"; then + if test "x$ac_cv_tls" = "xyes"; then + AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS]) + else + AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS]) + fi + else # $ac_cv_want_tls is yes + if test "x$ac_cv_tls" = "xno"; then + AC_MSG_FAILURE([--enable-tls was given, but TLS is not supported]) + else + AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS]) + fi + fi + fi ])