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. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #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 */ /* Version number of package */
#undef VERSION #undef VERSION

122
configure vendored
View File

@ -656,6 +656,8 @@ ac_subst_files=''
ac_user_opts=' ac_user_opts='
enable_option_checking enable_option_checking
enable_dependency_tracking enable_dependency_tracking
with_pulseaudio
with_sndfile
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@ -1289,6 +1291,12 @@ Optional Features:
--disable-dependency-tracking speeds up one-time build --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors --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: Some influential environment variables:
CC C compiler command CC C compiler command
CFLAGS C compiler flags CFLAGS C compiler flags
@ -3276,6 +3284,54 @@ fi
# AC_PROG_RANLIB # 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. # Checks for libraries.
@ -3406,24 +3462,12 @@ if test -n "$DEPS_CFLAGS"; then
pkg_cv_DEPS_CFLAGS="$DEPS_CFLAGS" pkg_cv_DEPS_CFLAGS="$DEPS_CFLAGS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" \$deps_packages \""; } >&5
libpulse-simple ($PKG_CONFIG --exists --print-errors " $deps_packages ") 2>&5
sndfile
fftw3f
\""; } >&5
($PKG_CONFIG --exists --print-errors "
libpulse-simple
sndfile
fftw3f
") 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags " pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags " $deps_packages " 2>/dev/null`
libpulse-simple
sndfile
fftw3f
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes pkg_failed=yes
@ -3435,24 +3479,12 @@ if test -n "$DEPS_LIBS"; then
pkg_cv_DEPS_LIBS="$DEPS_LIBS" pkg_cv_DEPS_LIBS="$DEPS_LIBS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" \$deps_packages \""; } >&5
libpulse-simple ($PKG_CONFIG --exists --print-errors " $deps_packages ") 2>&5
sndfile
fftw3f
\""; } >&5
($PKG_CONFIG --exists --print-errors "
libpulse-simple
sndfile
fftw3f
") 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs " pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs " $deps_packages " 2>/dev/null`
libpulse-simple
sndfile
fftw3f
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes pkg_failed=yes
@ -3473,26 +3505,14 @@ else
_pkg_short_errors_supported=no _pkg_short_errors_supported=no
fi fi
if test $_pkg_short_errors_supported = yes; then if test $_pkg_short_errors_supported = yes; then
DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " $deps_packages " 2>&1`
libpulse-simple
sndfile
fftw3f
" 2>&1`
else else
DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " $deps_packages " 2>&1`
libpulse-simple
sndfile
fftw3f
" 2>&1`
fi fi
# Put the nasty error message in config.log where it belongs # Put the nasty error message in config.log where it belongs
echo "$DEPS_PKG_ERRORS" >&5 echo "$DEPS_PKG_ERRORS" >&5
as_fn_error $? "Package requirements ( as_fn_error $? "Package requirements ( $deps_packages ) were not met:
libpulse-simple
sndfile
fftw3f
) were not met:
$DEPS_PKG_ERRORS $DEPS_PKG_ERRORS
@ -3527,6 +3547,7 @@ fi
# Checks for header files. # Checks for header files.
# AC_CHECK_HEADERS([stdlib.h string.h unistd.h]) # 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;} $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi 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_CC
# AC_PROG_RANLIB # 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. # Checks for libraries.
PKG_CHECK_MODULES(DEPS, [ PKG_CHECK_MODULES(DEPS, [ $deps_packages ])
libpulse-simple
sndfile
fftw3f
])
AC_SUBST(DEPS_CFLAGS) AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS) AC_SUBST(DEPS_LIBS)
@ -53,3 +80,9 @@ AC_CONFIG_FILES([
]) ])
# testdata/Makefile # testdata/Makefile
AC_OUTPUT 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 ) if ( TX_mode == -1 )
TX_mode = 0; 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 0
if (optind < argc) { if (optind < argc) {
printf("non-option ARGV-elements: "); printf("non-option ARGV-elements: ");
@ -474,14 +489,18 @@ main( int argc, char*argv[] )
if ( filename ) { if ( filename ) {
tx_interactive = 0; tx_interactive = 0;
#if USE_SNDFILE
sa_out = simpleaudio_open_stream_sndfile(SA_STREAM_PLAYBACK, sa_out = simpleaudio_open_stream_sndfile(SA_STREAM_PLAYBACK,
filename); filename);
#endif
if ( ! sa_out ) if ( ! sa_out )
return 1; return 1;
} }
#if USE_PULSEAUDIO
if ( ! sa_out ) if ( ! sa_out )
sa_out = simpleaudio_open_stream_pulseaudio(SA_STREAM_PLAYBACK, sa_out = simpleaudio_open_stream_pulseaudio(SA_STREAM_PLAYBACK,
program_name, "output audio"); program_name, "output audio");
#endif
if ( ! sa_out ) if ( ! sa_out )
return 1; return 1;
@ -501,13 +520,17 @@ main( int argc, char*argv[] )
*/ */
simpleaudio *sa = NULL; simpleaudio *sa = NULL;
if ( filename ) { if ( filename ) {
#if USE_SNDFILE
sa = simpleaudio_open_stream_sndfile(SA_STREAM_RECORD, filename); sa = simpleaudio_open_stream_sndfile(SA_STREAM_RECORD, filename);
#endif
if ( ! sa ) if ( ! sa )
return 1; return 1;
} }
#if USE_PULSEAUDIO
if ( ! sa ) if ( ! sa )
sa = simpleaudio_open_stream_pulseaudio(SA_STREAM_RECORD, sa = simpleaudio_open_stream_pulseaudio(SA_STREAM_RECORD,
program_name, "input audio"); program_name, "input audio");
#endif
if ( !sa ) if ( !sa )
return 1; return 1;

View File

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

View File

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