configure: new opts --without-{pulseaudio,sndfile}

./configure --without-pulseaudio or --without-sndfile (but not both)
to preclude those dependencies.

Sources use config.h defines USE_PULSEAUDIO and USE_SNDFILE.
This commit is contained in:
Kamal Mostafa 2012-08-06 13:14:26 -07:00
parent 03396e7027
commit 7d8c62cf5e
6 changed files with 156 additions and 50 deletions

View File

@ -21,5 +21,11 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 to enable pulseaudio support */
#undef USE_PULSEAUDIO
/* Define to 1 to enable sndfile support */
#undef USE_SNDFILE
/* Version number of package */
#undef VERSION

122
configure vendored
View File

@ -656,6 +656,8 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_dependency_tracking
with_pulseaudio
with_sndfile
'
ac_precious_vars='build_alias
host_alias
@ -1289,6 +1291,12 @@ Optional Features:
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--without-pulseaudio build without pulseaudio support
--without-sndfile build without sndfile support
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
@ -3276,6 +3284,54 @@ fi
# AC_PROG_RANLIB
# Configure dependency libs
# fftw3f
deps_packages+=" fftw3f"
# pulseaudio
# Check whether --with-pulseaudio was given.
if test "${with_pulseaudio+set}" = set; then :
withval=$with_pulseaudio;
fi
if test "x$with_pulseaudio" == "xno"; then :
# then
use_pulseaudio=0
else
# else
use_pulseaudio=1
deps_packages+=" libpulse-simple"
fi
cat >>confdefs.h <<_ACEOF
#define USE_PULSEAUDIO $use_pulseaudio
_ACEOF
# sndfile
# Check whether --with-sndfile was given.
if test "${with_sndfile+set}" = set; then :
withval=$with_sndfile;
fi
if test "x$with_sndfile" == "xno"; then :
# then
use_sndfile=0
else
# else
use_sndfile=1
deps_packages+=" sndfile"
fi
cat >>confdefs.h <<_ACEOF
#define USE_SNDFILE $use_sndfile
_ACEOF
# Checks for libraries.
@ -3406,24 +3462,12 @@ if test -n "$DEPS_CFLAGS"; then
pkg_cv_DEPS_CFLAGS="$DEPS_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
libpulse-simple
sndfile
fftw3f
\""; } >&5
($PKG_CONFIG --exists --print-errors "
libpulse-simple
sndfile
fftw3f
") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" \$deps_packages \""; } >&5
($PKG_CONFIG --exists --print-errors " $deps_packages ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags "
libpulse-simple
sndfile
fftw3f
" 2>/dev/null`
pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags " $deps_packages " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -3435,24 +3479,12 @@ if test -n "$DEPS_LIBS"; then
pkg_cv_DEPS_LIBS="$DEPS_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
libpulse-simple
sndfile
fftw3f
\""; } >&5
($PKG_CONFIG --exists --print-errors "
libpulse-simple
sndfile
fftw3f
") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" \$deps_packages \""; } >&5
($PKG_CONFIG --exists --print-errors " $deps_packages ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs "
libpulse-simple
sndfile
fftw3f
" 2>/dev/null`
pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs " $deps_packages " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -3473,26 +3505,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "
libpulse-simple
sndfile
fftw3f
" 2>&1`
DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " $deps_packages " 2>&1`
else
DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "
libpulse-simple
sndfile
fftw3f
" 2>&1`
DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " $deps_packages " 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$DEPS_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (
libpulse-simple
sndfile
fftw3f
) were not met:
as_fn_error $? "Package requirements ( $deps_packages ) were not met:
$DEPS_PKG_ERRORS
@ -3527,6 +3547,7 @@ fi
# Checks for header files.
# AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
@ -5002,3 +5023,14 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: minimodem 0.8.1 configuration summary:
--with-pulseaudio $with_pulseaudio ($use_pulseaudio)
--with-sndfile $with_sndfile ($use_sndfile)
deps_packages: $deps_packages
" >&5
$as_echo "minimodem 0.8.1 configuration summary:
--with-pulseaudio $with_pulseaudio ($use_pulseaudio)
--with-sndfile $with_sndfile ($use_sndfile)
deps_packages: $deps_packages
" >&6; }

View File

@ -27,12 +27,39 @@ AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
# AC_PROG_RANLIB
# Configure dependency libs
# fftw3f
deps_packages+=" fftw3f"
# pulseaudio
AC_ARG_WITH([pulseaudio],
AS_HELP_STRING([--without-pulseaudio], [build without pulseaudio support]))
AS_IF([test "x$with_pulseaudio" == "xno"],
# then
use_pulseaudio=0,
# else
use_pulseaudio=1
deps_packages+=" libpulse-simple")
AC_DEFINE_UNQUOTED(USE_PULSEAUDIO, $use_pulseaudio,
[Define to 1 to enable pulseaudio support])
# sndfile
AC_ARG_WITH([sndfile],
AS_HELP_STRING([--without-sndfile], [build without sndfile support]))
AS_IF([test "x$with_sndfile" == "xno"],
# then
use_sndfile=0,
# else
use_sndfile=1
deps_packages+=" sndfile")
AC_DEFINE_UNQUOTED(USE_SNDFILE, $use_sndfile,
[Define to 1 to enable sndfile support])
# Checks for libraries.
PKG_CHECK_MODULES(DEPS, [
libpulse-simple
sndfile
fftw3f
])
PKG_CHECK_MODULES(DEPS, [ $deps_packages ])
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)
@ -53,3 +80,9 @@ AC_CONFIG_FILES([
])
# testdata/Makefile
AC_OUTPUT
AC_MSG_RESULT([PKG_NAME PKG_VERSION configuration summary:
--with-pulseaudio $with_pulseaudio ($use_pulseaudio)
--with-sndfile $with_sndfile ($use_sndfile)
deps_packages: $deps_packages
])

View File

@ -372,6 +372,21 @@ main( int argc, char*argv[] )
if ( TX_mode == -1 )
TX_mode = 0;
#if !(USE_PULSEAUDIO || USE_SNDFILE)
#error At least one of {USE_PULSEAUDIO,USE_SNDFILE} must be enabled
#endif
if ( filename ) {
#if !USE_SNDFILE
fprintf(stderr, "E: This build of minimodem was configured without sndfile,\nE: so the --file flag is not supported.\n");
exit(1);
#endif
} else {
#if !USE_PULSEAUDIO
fprintf(stderr, "E: this build of minimodem was configured without pulseaudio,\nE: so only the --file mode is supported.\n");
exit(1);
#endif
}
#if 0
if (optind < argc) {
printf("non-option ARGV-elements: ");
@ -474,14 +489,18 @@ main( int argc, char*argv[] )
if ( filename ) {
tx_interactive = 0;
#if USE_SNDFILE
sa_out = simpleaudio_open_stream_sndfile(SA_STREAM_PLAYBACK,
filename);
#endif
if ( ! sa_out )
return 1;
}
#if USE_PULSEAUDIO
if ( ! sa_out )
sa_out = simpleaudio_open_stream_pulseaudio(SA_STREAM_PLAYBACK,
program_name, "output audio");
#endif
if ( ! sa_out )
return 1;
@ -501,13 +520,17 @@ main( int argc, char*argv[] )
*/
simpleaudio *sa = NULL;
if ( filename ) {
#if USE_SNDFILE
sa = simpleaudio_open_stream_sndfile(SA_STREAM_RECORD, filename);
#endif
if ( ! sa )
return 1;
}
#if USE_PULSEAUDIO
if ( ! sa )
sa = simpleaudio_open_stream_pulseaudio(SA_STREAM_RECORD,
program_name, "input audio");
#endif
if ( !sa )
return 1;

View File

@ -17,6 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if USE_PULSEAUDIO
#include <stdio.h>
#include <malloc.h>
@ -142,3 +147,4 @@ simpleaudio_open_stream_pulseaudio(
return sa;
}
#endif /* USE_PULSEAUDIO */

View File

@ -17,6 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if USE_SNDFILE
#include <stdio.h>
#include <malloc.h>
@ -168,3 +173,4 @@ simpleaudio_open_stream_sndfile(
return sa;
}
#endif /* USE_SNDFILE */