From e05aaf22db2aa3835852efc581b785224d3c91ac Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 29 Apr 2011 19:48:42 -0400 Subject: Updating the autotools build system (wip) --- Makefile.am | 181 +++++++++++++++++++++++++++++++++++++++++-- autogen.sh | 7 +- configure.ac | 249 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 406 insertions(+), 31 deletions(-) mode change 100644 => 100755 autogen.sh diff --git a/Makefile.am b/Makefile.am index 841ae7c7..bfdc5f40 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,178 @@ -## Process this file with automake to produce Makefile.in. -*-Makefile-*- +lib_LTLIBRARIES = libopus.la -# To disable automatic dependency tracking if using other tools than -# gcc and gmake, add the option 'no-dependencies' -AUTOMAKE_OPTIONS = 1.6 +INCLUDES = -I$(top_srcdir)/libcelt -I$(top_srcdir)/silk -EXTRA_DIST=opus.sln +libopus_la_SOURCES = libcelt/bands.c \ +libcelt/celt.c \ +libcelt/cwrs.c \ +libcelt/entcode.c \ +libcelt/entdec.c \ +libcelt/entenc.c \ +libcelt/kiss_fft.c \ +libcelt/laplace.c \ +libcelt/mathops.c \ +libcelt/mdct.c \ +libcelt/modes.c \ +libcelt/pitch.c \ +libcelt/plc.c \ +libcelt/quant_bands.c \ +libcelt/rate.c \ +libcelt/vq.c -SUBDIRS = celt silk src +libopus_la_SOURCES += src/opus_decoder.c \ +src/opus_encoder.c +libopus_la_SOURCES += \ +silk/SKP_Silk_CNG.c \ +silk/SKP_Silk_code_signs.c \ +silk/SKP_Silk_create_init_destroy.c \ +silk/SKP_Silk_decode_core.c \ +silk/SKP_Silk_decode_frame.c \ +silk/SKP_Silk_decode_parameters.c \ +silk/SKP_Silk_decode_indices.c \ +silk/SKP_Silk_decode_pulses.c \ +silk/SKP_Silk_decoder_set_fs.c \ +silk/SKP_Silk_dec_API.c \ +silk/SKP_Silk_enc_API.c \ +silk/SKP_Silk_encode_indices.c \ +silk/SKP_Silk_encode_pulses.c \ +silk/SKP_Silk_gain_quant.c \ +silk/SKP_Silk_interpolate.c \ +silk/SKP_Silk_LP_variable_cutoff.c \ +silk/SKP_Silk_NLSF2A_stable.c \ +silk/SKP_Silk_NLSF_decode.c \ +silk/SKP_Silk_NSQ.c \ +silk/SKP_Silk_NSQ_del_dec.c \ +silk/SKP_Silk_PLC.c \ +silk/SKP_Silk_shell_coder.c \ +silk/SKP_Silk_tables_gain.c \ +silk/SKP_Silk_tables_LTP.c \ +silk/SKP_Silk_tables_NLSF_CB_NB_MB.c \ +silk/SKP_Silk_tables_NLSF_CB_WB.c \ +silk/SKP_Silk_tables_other.c \ +silk/SKP_Silk_tables_pitch_lag.c \ +silk/SKP_Silk_tables_pulses_per_block.c \ +silk/SKP_Silk_VAD.c \ +silk/SKP_Silk_control_audio_bandwidth.c \ +silk/SKP_Silk_quant_LTP_gains.c \ +silk/SKP_Silk_VQ_WMat_EC.c \ +silk/SKP_Silk_HP_variable_cutoff.c \ +silk/SKP_Silk_NLSF_encode.c \ +silk/SKP_Silk_NLSF_VQ.c \ +silk/SKP_Silk_NLSF_unpack.c \ +silk/SKP_Silk_NLSF_del_dec_quant.c \ +silk/SKP_Silk_process_NLSFs.c \ +silk/SKP_Silk_stereo_LR_to_MS.c \ +silk/SKP_Silk_stereo_MS_to_LR.c \ +silk/SKP_Silk_check_control_input.c \ +silk/SKP_Silk_control_SNR.c \ +silk/SKP_Silk_init_encoder.c \ +silk/SKP_Silk_control_codec.c \ +silk/SKP_Silk_A2NLSF.c \ +silk/SKP_Silk_ana_filt_bank_1.c \ +silk/SKP_Silk_apply_sine_window.c \ +silk/SKP_Silk_array_maxabs.c \ +silk/SKP_Silk_autocorr.c \ +silk/SKP_Silk_biquad_alt.c \ +silk/SKP_Silk_burg_modified.c \ +silk/SKP_Silk_bwexpander_32.c \ +silk/SKP_Silk_bwexpander.c \ +silk/SKP_Silk_debug.c \ +silk/SKP_Silk_decode_pitch.c \ +silk/SKP_Silk_inner_prod_aligned.c \ +silk/SKP_Silk_k2a.c \ +silk/SKP_Silk_k2a_Q16.c \ +silk/SKP_Silk_lin2log.c \ +silk/SKP_Silk_log2lin.c \ +silk/SKP_Silk_LPC_analysis_filter.c \ +silk/SKP_Silk_LPC_inv_pred_gain.c \ +silk/SKP_Silk_LPC_stabilize.c \ +silk/SKP_Silk_LPC_synthesis_filter.c \ +silk/SKP_Silk_LPC_synthesis_order16.c \ +silk/SKP_Silk_LSF_cos_table.c \ +silk/SKP_Silk_NLSF2A.c \ +silk/SKP_Silk_NLSF_stabilize.c \ +silk/SKP_Silk_NLSF_VQ_weights_laroia.c \ +silk/SKP_Silk_pitch_analysis_core.c \ +silk/SKP_Silk_pitch_est_tables.c \ +silk/SKP_Silk_resampler.c \ +silk/SKP_Silk_resampler_down2_3.c \ +silk/SKP_Silk_resampler_down2.c \ +silk/SKP_Silk_resampler_down3.c \ +silk/SKP_Silk_resampler_private_AR2.c \ +silk/SKP_Silk_resampler_private_ARMA4.c \ +silk/SKP_Silk_resampler_private_copy.c \ +silk/SKP_Silk_resampler_private_down4.c \ +silk/SKP_Silk_resampler_private_down_FIR.c \ +silk/SKP_Silk_resampler_private_IIR_FIR.c \ +silk/SKP_Silk_resampler_private_up2_HQ.c \ +silk/SKP_Silk_resampler_private_up4.c \ +silk/SKP_Silk_resampler_rom.c \ +silk/SKP_Silk_resampler_up2.c \ +silk/SKP_Silk_scale_copy_vector16.c \ +silk/SKP_Silk_scale_vector.c \ +silk/SKP_Silk_schur64.c \ +silk/SKP_Silk_schur.c \ +silk/SKP_Silk_sigm_Q15.c \ +silk/SKP_Silk_sort.c \ +silk/SKP_Silk_sum_sqr_shift.c \ +silk/SKP_Silk_autocorrelation_FLP.c \ +silk/SKP_Silk_burg_modified_FLP.c \ +silk/SKP_Silk_bwexpander_FLP.c \ +silk/SKP_Silk_energy_FLP.c \ +silk/SKP_Silk_inner_product_FLP.c \ +silk/SKP_Silk_k2a_FLP.c \ +silk/SKP_Silk_levinsondurbin_FLP.c \ +silk/SKP_Silk_LPC_inv_pred_gain_FLP.c \ +silk/SKP_Silk_pitch_analysis_core_FLP.c \ +silk/SKP_Silk_scale_copy_vector_FLP.c \ +silk/SKP_Silk_scale_vector_FLP.c \ +silk/SKP_Silk_schur_FLP.c \ +silk/SKP_Silk_sort_FLP.c + +if FIXED_POINT +libopus_la_SOURCES += \ +silk/fixed/SKP_Silk_LTP_analysis_filter_FIX.c \ +silk/fixed/SKP_Silk_LTP_scale_ctrl_FIX.c \ +silk/fixed/SKP_Silk_corrMatrix_FIX.c \ +silk/fixed/SKP_Silk_encode_frame_FIX.c \ +silk/fixed/SKP_Silk_find_LPC_FIX.c \ +silk/fixed/SKP_Silk_find_LTP_FIX.c \ +silk/fixed/SKP_Silk_find_pitch_lags_FIX.c \ +silk/fixed/SKP_Silk_find_pred_coefs_FIX.c \ +silk/fixed/SKP_Silk_noise_shape_analysis_FIX.c \ +silk/fixed/SKP_Silk_prefilter_FIX.c \ +silk/fixed/SKP_Silk_process_gains_FIX.c \ +silk/fixed/SKP_Silk_regularize_correlations_FIX.c \ +silk/fixed/SKP_Silk_residual_energy16_FIX.c \ +silk/fixed/SKP_Silk_residual_energy_FIX.c \ +silk/fixed/SKP_Silk_solve_LS_FIX.c \ +silk/fixed/SKP_Silk_warped_autocorrelation_FIX.c +else +libopus_la_SOURCES += \ +silk/float/SKP_Silk_apply_sine_window_FLP.c \ +silk/float/SKP_Silk_corrMatrix_FLP.c \ +silk/float/SKP_Silk_encode_frame_FLP.c \ +silk/float/SKP_Silk_find_LPC_FLP.c \ +silk/float/SKP_Silk_find_LTP_FLP.c \ +silk/float/SKP_Silk_find_pitch_lags_FLP.c \ +silk/float/SKP_Silk_find_pred_coefs_FLP.c \ +silk/float/SKP_Silk_LPC_analysis_filter_FLP.c \ +silk/float/SKP_Silk_LTP_analysis_filter_FLP.c \ +silk/float/SKP_Silk_LTP_scale_ctrl_FLP.c \ +silk/float/SKP_Silk_noise_shape_analysis_FLP.c \ +silk/float/SKP_Silk_prefilter_FLP.c \ +silk/float/SKP_Silk_process_gains_FLP.c \ +silk/float/SKP_Silk_regularize_correlations_FLP.c \ +silk/float/SKP_Silk_residual_energy_FLP.c \ +silk/float/SKP_Silk_solve_LS_FLP.c \ +silk/float/SKP_Silk_warped_autocorrelation_FLP.c \ +silk/float/SKP_Silk_wrappers_FLP.c +endif + +pkginclude_HEADERS = src/opus.h + +noinst_PROGRAMS = test_opus + +test_opus_SOURCES = src/test_opus.c + +test_opus_LDADD = libopus.la -lm diff --git a/autogen.sh b/autogen.sh old mode 100644 new mode 100755 index 32365a53..35cad678 --- a/autogen.sh +++ b/autogen.sh @@ -2,7 +2,7 @@ # Run this to set up the build system: configure, makefiles, etc. # (based on the version in enlightenment's cvs) -package="ietfcodec" +package="opus" olddir=`pwd` srcdir=`dirname $0` @@ -11,11 +11,6 @@ test -z "$srcdir" && srcdir=. cd "$srcdir" DIE=0 -echo "autogeh in celt" -(cd celt; ./autogen.sh) -echo "autogeh in silk" -(cd silk; ./autogen.sh) - echo "checking for autoconf... " (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo diff --git a/configure.ac b/configure.ac index 10084c4e..b6fff896 100644 --- a/configure.ac +++ b/configure.ac @@ -1,31 +1,242 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. +dnl Process this file with autoconf to produce a configure script. -*-m4-*- -AC_PREREQ([2.59]) -AC_INIT(src/opus.h) -AM_INIT_AUTOMAKE(opus,0.9.4) +AC_INIT(src/opus_encoder.c) AM_CONFIG_HEADER([config.h]) -# Checks for programs. -AC_PROG_CC -AC_PROG_LIBTOOL +OPUS_MAJOR_VERSION=0 +OPUS_MINOR_VERSION=9 +OPUS_MICRO_VERSION=4 +OPUS_EXTRA_VERSION= +OPUS_VERSION=$OPUS_MAJOR_VERSION.$OPUS_MINOR_VERSION.$OPUS_MICRO_VERSION$OPUS_EXTRA_VERSION +LIBOPUS_SUFFIX=0 -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([float.h stdint.h stdlib.h string.h]) +OPUS_LT_CURRENT=0 +OPUS_LT_REVISION=0 +OPUS_LT_AGE=0 -# Checks for typedefs, structures, and compiler characteristics. +AC_SUBST(OPUS_LT_CURRENT) +AC_SUBST(OPUS_LT_REVISION) +AC_SUBST(OPUS_LT_AGE) +AC_SUBST(LIBOPUS_SUFFIX) + +# For automake. +VERSION=$OPUS_VERSION +PACKAGE=opus + +AC_SUBST(OPUS_VERSION) + +AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define) +AM_MAINTAINER_MODE + +AC_CANONICAL_HOST +AM_PROG_LIBTOOL + +AC_PROG_CC_C99 +AC_C_BIGENDIAN AC_C_CONST AC_C_INLINE AC_C_RESTRICT -AC_TYPE_SIZE_T -export OPUS_BUILD=true -AC_DEFINE([OPUS_BUILD], [], [This is a build of Opus]) +AC_DEFINE([OPUS_BUILD], [], [This is a build of OPUS]) + +AC_MSG_CHECKING(for C99 variable-size arrays) +AC_TRY_COMPILE( , [ +int foo=10; +int array[foo]; +], +[has_var_arrays=yes;AC_DEFINE([VAR_ARRAYS], [], [Use C99 variable-size arrays]) +], +has_var_arrays=no +) +AC_MSG_RESULT($has_var_arrays) + +AC_CHECK_HEADERS([alloca.h getopt.h]) +AC_MSG_CHECKING(for alloca) +AC_TRY_COMPILE( [#include ], [ +int foo=10; +int *array = alloca(foo); +], +[ +has_alloca=yes; +if test x$has_var_arrays = "xno" ; then +AC_DEFINE([USE_ALLOCA], [], [Make use of alloca]) +fi +], +has_alloca=no +) +AC_MSG_RESULT($has_alloca) + +AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h) + +AS_IF([test "x$with_ogg" != xno], + [XIPH_PATH_OGG([tools="tools"], [tools=""])], + [tools=""]) +AC_SUBST(tools) + +AC_CHECK_LIB(m, sin) + +# Check for getopt_long; if not found, use included source. +AC_CHECK_FUNCS([getopt_long],, +[# FreeBSD has a gnugetopt library. + AC_CHECK_LIB([gnugetopt],[getopt_long], +[AC_DEFINE([HAVE_GETOPT_LONG])], +[# Use the GNU replacement. +AC_LIBOBJ(getopt) +AC_LIBOBJ(getopt1)])]) + +AC_CHECK_LIB(winmm, main) + +AC_DEFINE_UNQUOTED(OPUS_VERSION, "${OPUS_VERSION}", [Complete version string]) +AC_DEFINE_UNQUOTED(OPUS_MAJOR_VERSION, ${OPUS_MAJOR_VERSION}, [Version major]) +AC_DEFINE_UNQUOTED(OPUS_MINOR_VERSION, ${OPUS_MINOR_VERSION}, [Version minor]) +AC_DEFINE_UNQUOTED(OPUS_MICRO_VERSION, ${OPUS_MICRO_VERSION}, [Version micro]) +AC_DEFINE_UNQUOTED(OPUS_EXTRA_VERSION, "${OPUS_EXTRA_VERSION}", [Version extra]) + +has_float_approx=no +#case "$host_cpu" in +#i[[3456]]86 | x86_64 | powerpc64 | powerpc32 | ia64) +# has_float_approx=yes +# ;; +#esac + +ac_enable_fixed="no"; +AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point compile as fixed-point], +[if test "$enableval" = yes; then + ac_enable_fixed="yes"; + AC_DEFINE([FIXED_POINT], , [Compile as fixed-point]) +else + AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]) +fi], +AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])) + +ac_enable_fixed_debug="no" +AC_ARG_ENABLE(fixed-point-debug, [ --enable-fixed-point-debug debug fixed-point implementation], +[if test "$enableval" = yes; then + ac_enable_fixed_debug="yes" + AC_DEFINE([FIXED_DEBUG], , [Debug fixed-point implementation]) +fi]) + +ac_enable_experimental_postfilter="no" +AC_ARG_ENABLE(experimental-postfilter, [ --enable-experimental-postfilter Enable this for testing only if you know what you're doing ], +[if test "$enableval" = yes; then + ac_enable_experimental_postfilter="yes" + AC_DEFINE([ENABLE_POSTFILTER], , [Postfilter]) +fi]) + +ac_enable_custom_modes="no" +AC_ARG_ENABLE(custom-modes, [ --enable-custom-modes Enable non-Opus modes, like 44.1 kHz and powers of two ], +[if test "$enableval" = yes; then + ac_enable_custom_modes="yes" + AC_DEFINE([CUSTOM_MODES], , [Custom modes]) +fi]) + +float_approx=$has_float_approx +AC_ARG_ENABLE(float-approx, [ --enable-float-approx enable fast approximations for floating point], + [ if test "$enableval" = yes; then + AC_WARN([Floating point approximations are not supported on all platforms.]) + float_approx=yes + else + float_approx=no + fi], [ float_approx=$has_float_approx ]) + +if test "x${float_approx}" = "xyes"; then + AC_DEFINE([FLOAT_APPROX], , [Float approximations]) +fi + +ac_enable_assertions="no" +AC_ARG_ENABLE(assertions, [ --enable-assertions enable additional software error checking], +[if test "$enableval" = yes; then + ac_enable_assertions="yes" + AC_DEFINE([ENABLE_ASSERTIONS], , [Assertions]) +fi]) + +if test "$OPUS_BUILD" != "true" ; then +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fvisibility=hidden" +AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden]) +AC_COMPILE_IFELSE([char foo;], + [ AC_MSG_RESULT([yes]) + SYMBOL_VISIBILITY="-fvisibility=hidden" ], + AC_MSG_RESULT([no])) +CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY" +AC_SUBST(SYMBOL_VISIBILITY) +fi + +if test $ac_cv_c_compiler_gnu = yes ; then + CFLAGS="$CFLAGS -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare" +fi + +AC_CHECK_FUNCS([lrintf]) +AC_CHECK_FUNCS([lrint]) + +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) + +if test x$has_char16 = "xyes" ; then + case 1 in + $ac_cv_sizeof_short) SIZE16="short";; + $ac_cv_sizeof_int) SIZE16="int";; + esac +else + case 2 in + $ac_cv_sizeof_short) SIZE16="short";; + $ac_cv_sizeof_int) SIZE16="int";; + esac +fi + +if test x$has_char16 = "xyes" ; then + case 2 in + $ac_cv_sizeof_int) SIZE32="int";; + $ac_cv_sizeof_long) SIZE32="long";; + $ac_cv_sizeof_short) SIZE32="short";; + esac +else + case 4 in + $ac_cv_sizeof_int) SIZE32="int";; + $ac_cv_sizeof_long) SIZE32="long";; + $ac_cv_sizeof_short) SIZE32="short";; + esac +fi + +AC_SUBST(SIZE16) +AC_SUBST(SIZE32) + +if test "$OPUS_BUILD" = "true" ; then +AC_DEFINE(OPUS_BUILD, [], [We're part of Opus]) +fi + +AM_CONDITIONAL([FIXED_POINT], [test x$ac_enable_fixed = xyes]) + +AC_OUTPUT([Makefile]) + +AC_MSG_RESULT([ +------------------------------------------------------------------------ + $PACKAGE $VERSION: Automatic configuration OK. + + Compiler support: + + C99 var arrays: ................ ${has_var_arrays} + C99 lrintf: .................... ${ac_cv_func_lrintf} + Alloca: ........................ ${has_alloca} + + General configuration: + + Fast float approximations: ..... ${float_approx} + Fixed point support: ........... ${ac_enable_fixed} + Fixed point debugging: ......... ${ac_enable_fixed_debug} + Custom modes: .................. ${ac_enable_custom_modes} + Assertion checking: ............ ${ac_enable_assertions} +------------------------------------------------------------------------ +]) -AC_CONFIG_SUBDIRS([celt]) -AC_CONFIG_SUBDIRS([silk]) +if test "x$tools" = "x"; then +echo "**IMPORTANT**" +echo "You don't seem to have the development package for libogg (libogg-devel) available. Only the library will be built (no encoder/decoder executable)" +echo "You can download libogg from http://www.vorbis.com/download.psp" +fi -AC_CONFIG_FILES([Makefile src/Makefile]) -AC_OUTPUT +echo "Type \"make; make install\" to compile and install"; +echo "Type \"make check\" to run the test suite"; -- cgit v1.2.3