diff --git a/.gitignore b/.gitignore index 6f941365..9fa563d0 100644 --- a/.gitignore +++ b/.gitignore @@ -44,15 +44,15 @@ Build/ CMake/config.h.in CMakeFiles CMakeCache.txt -Cfg +build-aux Hack Hack/sndfile-fuzzbomb INSTALL -M4/libtool.m4 -M4/ltoptions.m4 -M4/ltsugar.m4 -M4/ltversion.m4 -M4/lt~obsolete.m4 +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 Makefile Makefile.in aclocal.m4 @@ -127,6 +127,8 @@ tests/test_wrapper.sh tests/utils.c tests/utils.h tests/write_read_test.c +*.log +*.trs .vs/ packages/ *.vcxproj.user diff --git a/CMakeLists.txt b/CMakeLists.txt index 95f03c3e..a44706e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1074,6 +1074,9 @@ if (BUILD_TESTING) if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) target_link_libraries(stdin_test PRIVATE ${M_LIBRARY}) endif () + set_target_properties(stdin_test + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "tests") set (stdout_test_SOURCES tests/stdout_test.c) add_executable (stdout_test ${stdout_test_SOURCES}) @@ -1081,6 +1084,9 @@ if (BUILD_TESTING) if (BUILD_SHARED_LIBS AND LIBM_REQUIRED) target_link_libraries(stdout_test PRIVATE ${M_LIBRARY}) endif () + set_target_properties(stdout_test + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "tests") set (stdio_test_SOURCES tests/stdio_test.c) add_executable (stdio_test ${stdio_test_SOURCES}) diff --git a/M4/endian.m4 b/M4/endian.m4 deleted file mode 100644 index 5d766ff3..00000000 --- a/M4/endian.m4 +++ /dev/null @@ -1,155 +0,0 @@ -dnl @synopsis MN_C_FIND_ENDIAN -dnl -dnl Determine endian-ness of target processor. -dnl @version 1.1 Mar 03 2002 -dnl @author Erik de Castro Lopo -dnl -dnl Majority written from scratch to replace the standard autoconf macro -dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation -dnl of the AC_TRY_RUN macro. -dnl -dnl Permission to use, copy, modify, distribute, and sell this file for any -dnl purpose is hereby granted without fee, provided that the above copyright -dnl and this permission notice appear in all copies. No representations are -dnl made about the suitability of this software for any purpose. It is -dnl provided "as is" without express or implied warranty. - -dnl Find endian-ness in the following way: -dnl 1) Look in . -dnl 2) If 1) fails, look in and . -dnl 3) If 1) and 2) fails and not cross compiling run a test program. -dnl 4) If 1) and 2) fails and cross compiling then guess based on target. - -AC_DEFUN([MN_C_FIND_ENDIAN], -[AC_CACHE_CHECK(processor byte ordering, - ac_cv_c_byte_order, - -# Initialize to unknown -ac_cv_c_byte_order=unknown - -if test x$ac_cv_header_endian_h = xyes ; then - - # First try which should set BYTE_ORDER. - - [AC_TRY_LINK([ - #include - #if BYTE_ORDER != LITTLE_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=little - )] - - [AC_TRY_LINK([ - #include - #if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=big - )] - - fi - -if test $ac_cv_c_byte_order = unknown ; then - - [AC_TRY_LINK([ - #include - #include - #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros - #endif - ], return 0 ;, - - [AC_TRY_LINK([ - #include - #include - #if BYTE_ORDER != LITTLE_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=little - )] - - [AC_TRY_LINK([ - #include - #include - #if BYTE_ORDER != LITTLE_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=little - )] - - )] - - fi - -if test $ac_cv_c_byte_order = unknown ; then - if test $cross_compiling = yes ; then - # This is the last resort. Try to guess the target processor endian-ness - # by looking at the target CPU type. - [ - case "$target_cpu" in - alpha* | i?86* | mipsel* | ia64*) - ac_cv_c_byte_order=little - ;; - - m68* | mips* | powerpc* | hppa* | sparc*) - ac_cv_c_byte_order=big - ;; - - esac - ] - else - AC_TRY_RUN( - [[ - int main (void) - { /* Are we little or big endian? From Harbison&Steele. */ - union - { long l ; - char c [sizeof (long)] ; - } u ; - u.l = 1 ; - return (u.c [sizeof (long) - 1] == 1); - } - ]], , ac_cv_c_byte_order=big, - ) - - AC_TRY_RUN( - [[int main (void) - { /* Are we little or big endian? From Harbison&Steele. */ - union - { long l ; - char c [sizeof (long)] ; - } u ; - u.l = 1 ; - return (u.c [0] == 1); - }]], , ac_cv_c_byte_order=little, - ) - fi - fi - -) - -if test $ac_cv_c_byte_order = big ; then - ac_cv_c_big_endian=1 - ac_cv_c_little_endian=0 -elif test $ac_cv_c_byte_order = little ; then - ac_cv_c_big_endian=0 - ac_cv_c_little_endian=1 -else - ac_cv_c_big_endian=0 - ac_cv_c_little_endian=0 - - AC_MSG_WARN([[*****************************************************************]]) - AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]]) - AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]]) - AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]]) - AC_MSG_WARN([[*****************************************************************]]) - fi - -] -)# MN_C_FIND_ENDIAN - - diff --git a/M4/llrint.m4 b/M4/llrint.m4 deleted file mode 100644 index 66be2061..00000000 --- a/M4/llrint.m4 +++ /dev/null @@ -1,38 +0,0 @@ -dnl @synopsis MN_C99_FUNC_LLRINT -dnl -dnl Check whether C99's llrint function is available. -dnl @version 1.1 Sep 30 2002 -dnl @author Erik de Castro Lopo -dnl -dnl Permission to use, copy, modify, distribute, and sell this file for any -dnl purpose is hereby granted without fee, provided that the above copyright -dnl and this permission notice appear in all copies. No representations are -dnl made about the suitability of this software for any purpose. It is -dnl provided "as is" without express or implied warranty. -dnl -AC_DEFUN([MN_C99_FUNC_LLRINT], -[AC_CACHE_CHECK(for llrint, - ac_cv_c99_llrint, -[ -llrint_save_CFLAGS=$CFLAGS -CFLAGS="-lm" -AC_TRY_LINK([ -#define _ISOC9X_SOURCE 1 -#define _ISOC99_SOURCE 1 -#define __USE_ISOC99 1 -#define __USE_ISOC9X 1 - -#include -#include -], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no) - -CFLAGS=$llrint_save_CFLAGS - -]) - -if test "$ac_cv_c99_llrint" = yes; then - AC_DEFINE(HAVE_LLRINT, 1, - [Define if you have C99's llrint function.]) -fi -])# MN_C99_FUNC_LLRINT - diff --git a/M4/lrint.m4 b/M4/lrint.m4 deleted file mode 100644 index c2c21d60..00000000 --- a/M4/lrint.m4 +++ /dev/null @@ -1,37 +0,0 @@ -dnl @synopsis MN_C99_FUNC_LRINT -dnl -dnl Check whether C99's lrint function is available. -dnl @version 1.3 Feb 12 2002 -dnl @author Erik de Castro Lopo -dnl -dnl Permission to use, copy, modify, distribute, and sell this file for any -dnl purpose is hereby granted without fee, provided that the above copyright -dnl and this permission notice appear in all copies. No representations are -dnl made about the suitability of this software for any purpose. It is -dnl provided "as is" without express or implied warranty. -dnl -AC_DEFUN([MN_C99_FUNC_LRINT], -[AC_CACHE_CHECK(for lrint, - ac_cv_c99_lrint, -[ -lrint_save_CFLAGS=$CFLAGS -CFLAGS="-lm" -AC_TRY_LINK([ -#define _ISOC9X_SOURCE 1 -#define _ISOC99_SOURCE 1 -#define __USE_ISOC99 1 -#define __USE_ISOC9X 1 - -#include -], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no) - -CFLAGS=$lrint_save_CFLAGS - -]) - -if test "$ac_cv_c99_lrint" = yes; then - AC_DEFINE(HAVE_LRINT, 1, - [Define if you have C99's lrint function.]) -fi -])# MN_C99_FUNC_LRINT - diff --git a/M4/lrintf.m4 b/M4/lrintf.m4 deleted file mode 100644 index 04f4d660..00000000 --- a/M4/lrintf.m4 +++ /dev/null @@ -1,37 +0,0 @@ -dnl @synopsis MN_C99_FUNC_LRINTF -dnl -dnl Check whether C99's lrintf function is available. -dnl @version 1.3 Feb 12 2002 -dnl @author Erik de Castro Lopo -dnl -dnl Permission to use, copy, modify, distribute, and sell this file for any -dnl purpose is hereby granted without fee, provided that the above copyright -dnl and this permission notice appear in all copies. No representations are -dnl made about the suitability of this software for any purpose. It is -dnl provided "as is" without express or implied warranty. -dnl -AC_DEFUN([MN_C99_FUNC_LRINTF], -[AC_CACHE_CHECK(for lrintf, - ac_cv_c99_lrintf, -[ -lrintf_save_CFLAGS=$CFLAGS -CFLAGS="-lm" -AC_TRY_LINK([ -#define _ISOC9X_SOURCE 1 -#define _ISOC99_SOURCE 1 -#define __USE_ISOC99 1 -#define __USE_ISOC9X 1 - -#include -], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no) - -CFLAGS=$lrintf_save_CFLAGS - -]) - -if test "$ac_cv_c99_lrintf" = yes; then - AC_DEFINE(HAVE_LRINTF, 1, - [Define if you have C99's lrintf function.]) -fi -])# MN_C99_FUNC_LRINTF - diff --git a/Makefile.am b/Makefile.am index ce29c219..82dfb0e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,24 +1,20 @@ ## Process this file with automake to produce Makefile.in -ACLOCAL_AMFLAGS = -I M4 +AM_CPPFLAGS = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS) DISTCHECK_CONFIGURE_FLAGS = --enable-werror -if BUILD_OCTAVE_MOD -octave_dir = Octave -endif - -SUBDIRS = Win32 src examples tests +CLEANFILES = programs/*.wav if FULL_SUITE -SUBDIRS += man doc $(octave_dir) regtest programs +if BUILD_OCTAVE_MOD +SUBDIRS = Octave +endif endif -DIST_SUBDIRS = man doc Win32 src Octave examples regtest tests programs - EXTRA_DIST = libsndfile.spec.in sndfile.pc.in Scripts/android-configure.sh \ - Scripts/linux-to-win-cross-configure.sh Scripts/build-test-tarball.mk.in \ - CMakeLists.txt $(cmake_files) sndfile.pc.cmake.in + Scripts/linux-to-win-cross-configure.sh \ + CMakeLists.txt $(cmake_files) sndfile.pc.cmake.in Win32 cmake_files = cmake/ClipMode.cmake cmake/FindFLAC.cmake \ cmake/CMakeAutoGen.cmake cmake/CMakeAutoGenScript.cmake \ @@ -28,27 +24,434 @@ cmake_files = cmake/ClipMode.cmake cmake/FindFLAC.cmake \ cmake/TestLargeFiles.cmake cmake/LibSndFileConfig.cmake.in \ cmake/TestInline.c.in -CLEANFILES = *~ - pkgconfig_DATA = sndfile.pc -m4datadir = $(datadir)/aclocal - #=============================================================================== -test: check-recursive +test: check -# Target to make autogenerated files. -checkprograms : - $(MAKE) -C src libsndfile.la checkprograms - $(MAKE) -C tests checkprograms +# Need this target to force building of test programs. +checkprograms: $(check_PROGRAMS) -testprogs : - $(MAKE) -C src testprogs - $(MAKE) -C tests testprogs +######## +# src/ # +######## +SYMBOL_FILES = src/Symbols.gnu-binutils src/Symbols.darwin src/libsndfile-1.def src/Symbols.os2 src/Symbols.static -test-tarball : Scripts/build-test-tarball.mk - $(MAKE) -C src all libsndfile.la checkprograms - $(MAKE) -C tests all checkprograms - $(MAKE) -f Scripts/build-test-tarball.mk +EXTRA_DIST += src/sndfile.h.in src/config.h.in src/test_endswap.c src/test_endswap.tpl src/test_endswap.def \ + $(SYMBOL_FILES) src/create_symbols_file.py src/binheader_writef_check.py \ + src/GSM610/README src/GSM610/COPYRIGHT src/GSM610/ChangeLog \ + src/G72x/README src/G72x/README.original src/G72x/ChangeLog \ + src/make-static-lib-hidden-privates.sh \ + src/config.h.cmake + +if USE_WIN_VERSION_FILE +WIN_VERSION_FILE = src/version-metadata.rc +else +WIN_VERSION_FILE = +endif + +#=============================================================================== + +lib_LTLIBRARIES = src/libsndfile.la +include_HEADERS = src/sndfile.hh +nodist_include_HEADERS = src/sndfile.h +src_libsndfile_la_CFLAGS = $(EXTERNAL_XIPH_CFLAGS) +# MinGW requires -no-undefined if a DLL is to be built. +src_libsndfile_la_LDFLAGS = -no-undefined -version-info $(SHARED_VERSION_INFO) $(SHLIB_VERSION_ARG) +src_libsndfile_la_SOURCES = src/sndfile.c src/aiff.c src/au.c src/avr.c src/caf.c src/dwd.c src/flac.c src/g72x.c src/htk.c src/ircam.c \ + src/macos.c src/mat4.c src/mat5.c src/nist.c src/paf.c src/pvf.c src/raw.c src/rx2.c src/sd2.c \ + src/sds.c src/svx.c src/txw.c src/voc.c src/wve.c src/w64.c src/wavlike.c src/wav.c src/xi.c src/mpc2k.c src/rf64.c \ + src/ogg_vorbis.c src/ogg_speex.c src/ogg_pcm.c src/ogg_opus.c src/common.h src/sfconfig.h src/sfendian.h src/wavlike.h \ + src/sf_unistd.h src/ogg.h src/chanmap.h +nodist_src_libsndfile_la_SOURCES = $(nodist_include_HEADERS) +src_libsndfile_la_LIBADD = src/GSM610/libgsm.la src/G72x/libg72x.la src/ALAC/libalac.la \ + src/libcommon.la $(EXTERNAL_XIPH_LIBS) -lm +EXTRA_src_libsndfile_la_DEPENDENCIES = $(SYMBOL_FILES) + +noinst_LTLIBRARIES = src/libcommon.la +src_libcommon_la_CFLAGS = $(EXTERNAL_XIPH_CFLAGS) +src_libcommon_la_SOURCES = src/common.c src/file_io.c src/command.c src/pcm.c src/ulaw.c src/alaw.c \ + src/float32.c src/double64.c src/ima_adpcm.c src/ms_adpcm.c src/gsm610.c src/dwvw.c src/vox_adpcm.c \ + src/interleave.c src/strings.c src/dither.c src/cart.c src/broadcast.c src/audio_detect.c \ + src/ima_oki_adpcm.c src/ima_oki_adpcm.h src/alac.c src/chunk.c src/ogg.c src/chanmap.c \ + src/windows.c src/id3.c $(WIN_VERSION_FILE) + +check_PROGRAMS = src/test_main +src_test_main_SOURCES = src/test_main.c src/test_main.h src/test_conversions.c src/test_float.c src/test_endswap.c \ + src/test_audio_detect.c src/test_log_printf.c src/test_file_io.c src/test_ima_oki_adpcm.c \ + src/test_strncpy_crlf.c src/test_broadcast_var.c src/test_cart_var.c \ + src/test_binheader_writef.c +src_test_main_LDADD = src/libcommon.la + +############## +# src/GSM610 # +############## + +noinst_LTLIBRARIES += src/GSM610/libgsm.la +src_GSM610_libgsm_la_SOURCES = src/GSM610/config.h src/GSM610/gsm.h src/GSM610/gsm610_priv.h \ + src/GSM610/add.c src/GSM610/code.c src/GSM610/decode.c src/GSM610/gsm_create.c \ + src/GSM610/gsm_decode.c src/GSM610/gsm_destroy.c src/GSM610/gsm_encode.c \ + src/GSM610/gsm_option.c src/GSM610/long_term.c src/GSM610/lpc.c src/GSM610/preprocess.c \ + src/GSM610/rpe.c src/GSM610/short_term.c src/GSM610/table.c + +############ +# src/G72x # +############ + +noinst_LTLIBRARIES += src/G72x/libg72x.la +src_G72x_libg72x_la_SOURCES = src/G72x/g72x.h src/G72x/g72x_priv.h \ + src/G72x/g721.c src/G72x/g723_16.c src/G72x/g723_24.c src/G72x/g723_40.c src/G72x/g72x.c + +check_PROGRAMS += src/G72x/g72x_test +src_G72x_g72x_test_SOURCES = src/G72x/g72x_test.c +src_G72x_g72x_test_LDADD = src/G72x/libg72x.la + +############ +# src/ALAC # +############ + +noinst_LTLIBRARIES += src/ALAC/libalac.la +src_ALAC_libalac_la_SOURCES = src/ALAC/ALACAudioTypes.h src/ALAC/ALACBitUtilities.h \ + src/ALAC/EndianPortable.h src/ALAC/aglib.h src/ALAC/dplib.h src/ALAC/matrixlib.h \ + src/ALAC/alac_codec.h src/ALAC/shift.h \ + src/ALAC/ALACBitUtilities.c src/ALAC/ag_dec.c \ + src/ALAC/ag_enc.c src/ALAC/dp_dec.c src/ALAC/dp_enc.c src/ALAC/matrix_dec.c \ + src/ALAC/matrix_enc.c src/ALAC/alac_decoder.c src/ALAC/alac_encoder.c + +#=============================================================================== +# Generate an OS specific Symbols files. This is done when the author +# builds the distribution tarball. There should be not need for the +# end user to create these files. + +src/Symbols.gnu-binutils: $(top_srcdir)/src/create_symbols_file.py + $(PYTHON) $< linux $(VERSION) > $@ + +src/Symbols.darwin: $(top_srcdir)/src/create_symbols_file.py + $(PYTHON) $< darwin $(VERSION) > $@ + +src/libsndfile-1.def: $(top_srcdir)/src/create_symbols_file.py + $(PYTHON) $< win32 $(VERSION) > $@ + +src/Symbols.os2: $(top_srcdir)/src/create_symbols_file.py + $(PYTHON) $< os2 $(VERSION) > $@ + +src/Symbols.static: $(top_srcdir)/src/create_symbols_file.py + $(PYTHON) $< static $(VERSION) > $@ + +#=============================================================================== +# Building windows resource files (if needed). + +.rc.lo: + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) $< -o $@ + +#=============================================================================== +# Disable autoheader. +AUTOHEADER=echo + +######## +# doc/ # +######## + +if FULL_SUITE +dist_html_DATA = doc/index.html doc/libsndfile.jpg doc/libsndfile.css doc/print.css doc/api.html \ + doc/command.html doc/bugs.html doc/sndfile_info.html doc/new_file_type.HOWTO \ + doc/win32.html doc/FAQ.html doc/lists.html doc/embedded_files.html doc/octave.html \ + doc/tutorial.html +endif + +############# +# examples/ # +############# + +check_PROGRAMS += examples/make_sine examples/sfprocess examples/list_formats examples/generate examples/sndfilehandle \ + examples/sndfile-to-text examples/sndfile-loopify + +examples_sndfile_to_text_SOURCES = examples/sndfile-to-text.c +examples_sndfile_to_text_LDADD = src/libsndfile.la + +examples_sndfile_loopify_SOURCES = examples/sndfile-loopify.c +examples_sndfile_loopify_LDADD = src/libsndfile.la + +examples_make_sine_SOURCES = examples/make_sine.c +examples_make_sine_LDADD = src/libsndfile.la + +examples_sfprocess_SOURCES = examples/sfprocess.c +examples_sfprocess_LDADD = src/libsndfile.la + +examples_list_formats_SOURCES = examples/list_formats.c +examples_list_formats_LDADD = src/libsndfile.la + +examples_generate_SOURCES = examples/generate.c +examples_generate_LDADD = src/libsndfile.la + +examples_sndfilehandle_SOURCES = examples/sndfilehandle.cc +examples_sndfilehandle_LDADD = src/libsndfile.la + +########## +# tests/ # +########## + +TESTS_ENVIRONMENT = $(SHELL) tests/test_wrapper.sh + +if ENABLE_TEST_COVERAGE +CPP_TEST = +else +CPP_TEST = tests/cpp_test +endif + +TESTS = tests/pedantic-header-test.sh + +check_PROGRAMS += tests/sfversion tests/floating_point_test tests/write_read_test \ + tests/lossy_comp_test tests/error_test tests/ulaw_test tests/alaw_test tests/dwvw_test \ + tests/peak_chunk_test tests/command_test tests/stdio_test \ + tests/pcm_test tests/headerless_test tests/pipe_test tests/header_test tests/misc_test \ + tests/raw_test tests/string_test tests/multi_file_test tests/chunk_test \ + tests/scale_clip_test tests/win32_test tests/aiff_rw_test tests/virtual_io_test \ + tests/locale_test tests/win32_ordinal_test tests/ogg_test tests/compression_size_test \ + tests/checksum_test tests/external_libs_test tests/rdwr_test tests/format_check_test $(CPP_TEST) \ + tests/channel_test tests/long_read_write_test tests/stdin_test tests/stdout_test \ + tests/dither_test tests/fix_this tests/largefile_test tests/benchmark + +EXTRA_DIST += \ + tests/write_read_test.c tests/write_read_test.tpl tests/write_read_test.def \ + tests/pcm_test.c tests/pcm_test.tpl tests/pcm_test.def \ + tests/header_test.c tests/header_test.tpl tests/header_test.def \ + tests/utils.c tests/utils.tpl tests/utils.def \ + tests/scale_clip_test.c tests/scale_clip_test.tpl tests/scale_clip_test.def \ + tests/pipe_test.c tests/pipe_test.tpl tests/pipe_test.def \ + tests/rdwr_test.c tests/rdwr_test.tpl tests/rdwr_test.def \ + tests/floating_point_test.c tests/floating_point_test.tpl tests/floating_point_test.def \ + tests/benchmark.c tests/benchmark.tpl tests/benchmark.def + +# If we're cross compiling from Linux to Windows and running the test suite +# under Wine, we need a symbolic link to the generated libsndfile DLL. + +if LINUX_MINGW_CROSS_TEST + +$(check_PROGRAMS) : libsndfile-1.dll + +libsndfile-1.dll : + $(LN_S) src/.libs/$@ $@ + +clean-local : + -rm -f libsndfile-1.dll + +endif + +#=============================================================================== + +tests_sfversion_SOURCES = tests/sfversion.c +tests_sfversion_LDADD = src/libsndfile.la + +tests_write_read_test_SOURCES = tests/utils.c tests/generate.c tests/generate.h tests/write_read_test.c tests/utils.h +tests_write_read_test_LDADD = src/libsndfile.la + +tests_lossy_comp_test_SOURCES = tests/utils.c tests/lossy_comp_test.c tests/utils.h +tests_lossy_comp_test_LDADD = src/libsndfile.la + +tests_fix_this_SOURCES = tests/utils.c tests/fix_this.c tests/utils.h +tests_fix_this_LDADD = src/libsndfile.la + +tests_error_test_SOURCES = tests/error_test.c tests/utils.c tests/utils.h +tests_error_test_LDADD = src/libsndfile.la + +tests_ulaw_test_SOURCES = tests/utils.c tests/ulaw_test.c tests/utils.h +tests_ulaw_test_LDADD = src/libsndfile.la + +tests_alaw_test_SOURCES = tests/utils.c tests/alaw_test.c tests/utils.h +tests_alaw_test_LDADD = src/libsndfile.la + +tests_aiff_rw_test_SOURCES = tests/utils.c tests/aiff_rw_test.c tests/utils.h +tests_aiff_rw_test_LDADD = src/libsndfile.la + +tests_command_test_SOURCES = tests/command_test.c tests/utils.c tests/utils.h +tests_command_test_LDADD = src/libsndfile.la + +tests_locale_test_SOURCES = tests/locale_test.c tests/utils.c tests/utils.h +tests_locale_test_LDADD = src/libsndfile.la + +tests_largefile_test_SOURCES = tests/largefile_test.c tests/utils.c tests/utils.h +tests_largefile_test_LDADD = src/libsndfile.la + +tests_pcm_test_SOURCES = tests/pcm_test.c tests/utils.c tests/utils.h +tests_pcm_test_LDADD = src/libsndfile.la + +tests_headerless_test_SOURCES = tests/utils.c tests/headerless_test.c tests/utils.h +tests_headerless_test_LDADD = src/libsndfile.la + +tests_stdin_test_SOURCES = tests/stdin_test.c tests/utils.c tests/utils.h +tests_stdin_test_LDADD = src/libsndfile.la + +tests_stdout_test_SOURCES = tests/stdout_test.c tests/utils.h +tests_stdout_test_LDADD = src/libsndfile.la + +tests_stdio_test_SOURCES = tests/stdio_test.c tests/utils.c tests/utils.h +tests_stdio_test_LDADD = src/libsndfile.la + +tests_pipe_test_SOURCES = tests/pipe_test.c tests/utils.c tests/utils.h +tests_pipe_test_LDADD = src/libsndfile.la + +tests_benchmark_SOURCES = tests/benchmark.c tests/utils.h +tests_benchmark_LDADD = src/libsndfile.la + +tests_header_test_SOURCES = tests/header_test.c tests/utils.c tests/utils.h +tests_header_test_LDADD = src/libsndfile.la + +tests_misc_test_SOURCES = tests/misc_test.c tests/utils.c tests/utils.h +tests_misc_test_LDADD = src/libsndfile.la + +tests_raw_test_SOURCES = tests/raw_test.c tests/utils.c tests/utils.h +tests_raw_test_LDADD = src/libsndfile.la + +tests_string_test_SOURCES = tests/string_test.c tests/utils.c tests/utils.h +tests_string_test_LDADD = src/libsndfile.la + +tests_dither_test_SOURCES = tests/dither_test.c tests/utils.c tests/utils.h +tests_dither_test_LDADD = src/libsndfile.la + +tests_chunk_test_SOURCES = tests/chunk_test.c tests/utils.c tests/utils.h +tests_chunk_test_LDADD = src/libsndfile.la + +tests_multi_file_test_SOURCES = tests/multi_file_test.c tests/utils.c tests/utils.h +tests_multi_file_test_LDADD = src/libsndfile.la + +tests_virtual_io_test_SOURCES = tests/virtual_io_test.c tests/utils.c tests/utils.h +tests_virtual_io_test_LDADD = src/libsndfile.la + +tests_ogg_test_SOURCES = tests/ogg_test.c tests/utils.c tests/utils.h +tests_ogg_test_LDADD = src/libsndfile.la + +tests_compression_size_test_SOURCES = tests/compression_size_test.c tests/utils.c tests/utils.h tests/dft_cmp.h +tests_compression_size_test_LDADD = src/libsndfile.la + +tests_rdwr_test_SOURCES = tests/rdwr_test.c tests/utils.c tests/utils.h +tests_rdwr_test_LDADD = src/libsndfile.la + +tests_win32_test_SOURCES = tests/win32_test.c +# Link lib here so that generating the testsuite tarball works correctly. +tests_win32_test_LDADD = src/libsndfile.la + +tests_win32_ordinal_test_SOURCES = tests/win32_ordinal_test.c tests/utils.c tests/utils.h +tests_win32_ordinal_test_LDADD = src/libsndfile.la + +tests_external_libs_test_SOURCES = tests/external_libs_test.c tests/utils.c tests/utils.h +tests_external_libs_test_LDADD = src/libsndfile.la + +tests_format_check_test_SOURCES = tests/format_check_test.c tests/utils.c tests/utils.h +tests_format_check_test_LDADD = src/libsndfile.la + +tests_channel_test_SOURCES = tests/channel_test.c tests/utils.c tests/utils.h +tests_channel_test_LDADD = src/libsndfile.la + +tests_long_read_write_test_SOURCES = tests/long_read_write_test.c tests/utils.c tests/utils.h tests/dft_cmp.h +tests_long_read_write_test_LDADD = src/libsndfile.la + +tests_cpp_test_SOURCES = tests/cpp_test.cc tests/utils.c tests/utils.h +tests_cpp_test_LDADD = src/libsndfile.la + +tests_checksum_test_SOURCES = tests/checksum_test.c tests/utils.c tests/utils.h +tests_checksum_test_LDADD = src/libsndfile.la + +# Lite remove start +tests_dwvw_test_SOURCES = tests/dwvw_test.c tests/utils.c tests/utils.h +tests_dwvw_test_LDADD = src/libsndfile.la + +tests_floating_point_test_SOURCES = tests/utils.c tests/utils.h tests/dft_cmp.c tests/dft_cmp.h tests/floating_point_test.c +tests_floating_point_test_LDADD = src/libsndfile.la + +tests_peak_chunk_test_SOURCES = tests/peak_chunk_test.c tests/utils.c tests/utils.h +tests_peak_chunk_test_LDADD = src/libsndfile.la + +tests_scale_clip_test_SOURCES = tests/scale_clip_test.c tests/utils.c tests/utils.h +tests_scale_clip_test_LDADD = src/libsndfile.la +# Lite remove end + +#=============================================================================== +# Autogen generated sources. +# These GNU style rules actually work. The old style suffix rules do not. + +%.c : %.def %.tpl + cd $(@D) && autogen --writable $(. +dnl Copyright (C) 1999-2017 Erik de Castro Lopo . -dnl Require autoconf version -AC_PREREQ(2.57) +dnl Require autoconf version >= 2.69 +AC_PREREQ([2.69]) AC_INIT([libsndfile],[1.0.29pre1],[sndfile@mega-nerd.com], [libsndfile],[http://www.mega-nerd.com/libsndfile/]) @@ -21,19 +21,27 @@ AS_IF([test "x${CFLAGS+set}" = "xset" || test "x${CXXFLAGS+set}" = "xset" || tes ]) AC_MSG_RESULT([${enable_flags_setting}]) -# Put config stuff in Cfg. -AC_CONFIG_AUX_DIR(Cfg) -AC_CONFIG_MACRO_DIR([M4]) +dnl Put config stuff in 'build-aux'. +AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([src/sndfile.c]) -AC_CANONICAL_TARGET([]) +AC_CANONICAL_HOST +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([src/config.h]) -AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip subdir-objects]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AM_INIT_AUTOMAKE([1.14 foreign dist-bzip2 no-dist-gzip serial-tests subdir-objects]) +AM_SILENT_RULES([yes]) +dnl ==================================================================================== + +AC_PROG_CC AC_PROG_CC_C99 + +AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [ + AC_MSG_ERROR([libsndfile requires a C99 capable compiler!]) + ]) + AC_USE_SYSTEM_EXTENSIONS AC_PROG_CXX @@ -47,7 +55,7 @@ AX_COMPILER_VERSION AC_LANG_POP([C++]) AC_PROG_SED -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +AM_PROG_AR LT_INIT([win32-dll]) LT_PROG_RC @@ -57,25 +65,25 @@ AC_PROG_LN_S AM_PATH_PYTHON -AC_CHECK_PROG(HAVE_AUTOGEN, autogen, yes, no) -AC_CHECK_PROG(HAVE_WINE, wine, yes, no) -AC_CHECK_PROG(HAVE_XCODE_SELECT, xcode-select, yes, no) +AC_CHECK_PROG([HAVE_AUTOGEN], [autogen], [yes], [no]) +AC_CHECK_PROG([HAVE_WINE], [wine], [yes], [no]) +AC_CHECK_PROG([HAVE_XCODE_SELECT], [xcode-select], [yes], [no]) -#------------------------------------------------------------------------------------ -# Rules for library version information: -# -# 1. Start with version information of `0:0:0' for each libtool library. -# 2. Update the version information only immediately before a public release of -# your software. More frequent updates are unnecessary, and only guarantee -# that the current interface number gets larger faster. -# 3. If the library source code has changed at all since the last update, then -# increment revision (`c:r:a' becomes `c:r+1:a'). -# 4. If any interfaces have been added, removed, or changed since the last update, -# increment current, and set revision to 0. -# 5. If any interfaces have been added since the last public release, then increment -# age. -# 6. If any interfaces have been removed since the last public release, then set age -# to 0. +dnl ------------------------------------------------------------------------------------ +dnl Rules for library version information: +dnl +dnl 1. Start with version information of `0:0:0' for each libtool library. +dnl 2. Update the version information only immediately before a public release of +dnl your software. More frequent updates are unnecessary, and only guarantee +dnl that the current interface number gets larger faster. +dnl 3. If the library source code has changed at all since the last update, then +dnl increment revision (`c:r:a' becomes `c:r+1:a'). +dnl 4. If any interfaces have been added, removed, or changed since the last update, +dnl increment current, and set revision to 0. +dnl 5. If any interfaces have been added since the last public release, then increment +dnl age. +dnl 6. If any interfaces have been removed since the last public release, then set age +dnl to 0. CLEAN_VERSION=`echo $PACKAGE_VERSION | $SED "s/p.*//"` VERSION_MAJOR=`echo $PACKAGE_VERSION | $SED "s/\..*//"` @@ -84,18 +92,18 @@ GEN_TOOL="autoconf" SHARED_VERSION_INFO="$VERSION_MAJOR:$VERSION_MINOR:0" -#------------------------------------------------------------------------------------ +dnl ------------------------------------------------------------------------------------ AC_HEADER_STDC -AC_CHECK_HEADERS(endian.h) -AC_CHECK_HEADERS(byteswap.h) -AC_CHECK_HEADERS(locale.h) -AC_CHECK_HEADERS(sys/time.h) +AC_CHECK_HEADERS([endian.h]) +AC_CHECK_HEADERS([byteswap.h]) +AC_CHECK_HEADERS([locale.h]) +AC_CHECK_HEADERS([sys/time.h]) AC_HEADER_SYS_WAIT -AC_CHECK_DECLS(S_IRGRP) +AC_CHECK_DECLS([S_IRGRP]) AS_IF([test "x$ac_cv_have_decl_S_IRGRP" = "xyes"], [ AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP], [1], [Set to 1 if S_IRGRP is defined.]) ], [ @@ -103,15 +111,15 @@ AS_IF([test "x$ac_cv_have_decl_S_IRGRP" = "xyes"], [ ]) AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST], - [test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"]) + [test "x${build_os}:${host_os}:${HAVE_WINE}" = "xlinux-gnu:mingw32msvc:yes"]) -#==================================================================================== -# Couple of initializations here. Fill in real values later. +dnl ==================================================================================== +dnl Couple of initializations here. Fill in real values later. SHLIB_VERSION_ARG="" -#==================================================================================== -# Finished checking, handle options. +dnl ==================================================================================== +dnl Finished checking, handle options. AC_ARG_ENABLE(experimental, AS_HELP_STRING([--enable-experimental], [enable experimental code])) @@ -123,60 +131,60 @@ AS_IF([test "x$enable_experimental" = "xyes"], [ ]) AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE], [${EXPERIMENTAL_CODE}], [Set to 1 to enable experimental code.]) -AC_ARG_ENABLE(werror, - AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles])) +AC_ARG_ENABLE([werror], + [AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles])]) -AC_ARG_ENABLE(stack-smash-protection, - AS_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection])) +AC_ARG_ENABLE([stack-smash-protection], + [AS_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection])]) -AC_ARG_ENABLE(cpu-clip, - AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper])) +AC_ARG_ENABLE([cpu-clip], + [AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper])]) -AC_ARG_ENABLE(bow-docs, - AS_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs])) +AC_ARG_ENABLE([bow-docs], + [AS_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs])]) -AC_ARG_ENABLE(sqlite, - AS_HELP_STRING([--disable-sqlite], [disable use of sqlite])) +AC_ARG_ENABLE([sqlite], + [AS_HELP_STRING([--disable-sqlite], [disable use of sqlite])]) -AC_ARG_ENABLE(alsa, - AS_HELP_STRING([--disable-alsa], [disable use of ALSA])) +AC_ARG_ENABLE([alsa], + [AS_HELP_STRING([--disable-alsa], [disable ALSA support (default=autodetect)])], [], [enable_alsa=auto]) -AC_ARG_ENABLE(external-libs, - AS_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]])) +AC_ARG_ENABLE([external-libs], + [AS_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]])]) AC_ARG_ENABLE(octave, - AS_HELP_STRING([--enable-octave], [disable building of GNU Octave module])) + [AS_HELP_STRING([--enable-octave], [disable building of GNU Octave module])]) AC_ARG_ENABLE([full-suite], - AS_HELP_STRING([--disable-full-suite], [disable building and installing programs, documentation, only build library [[default=no]]])) + [AS_HELP_STRING([--disable-full-suite], [disable building and installing programs, documentation, only build library [[default=no]]])]) AM_CONDITIONAL([FULL_SUITE], [test "x$enable_full_suite" != "xno"]) -AC_ARG_ENABLE(test-coverage, - AS_HELP_STRING([--enable-test-coverage], [enable test coverage])) -AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes]) +AC_ARG_ENABLE([test-coverage], + [AS_HELP_STRING([--enable-test-coverage], [enable test coverage])]) +AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "x$enable_test_coverage" = "xyes"]) -#==================================================================================== -# Check types and their sizes. +dnl ==================================================================================== +dnl Check types and their sizes. -AC_CHECK_SIZEOF(wchar_t,4) -AC_CHECK_SIZEOF(short,2) -AC_CHECK_SIZEOF(int,4) -AC_CHECK_SIZEOF(long,4) -AC_CHECK_SIZEOF(float,4) -AC_CHECK_SIZEOF(double,4) -AC_CHECK_SIZEOF(void*,8) -AC_CHECK_SIZEOF(size_t,4) -AC_CHECK_SIZEOF(int64_t,8) -AC_CHECK_SIZEOF(long long,8) +AC_CHECK_SIZEOF([wchar_t], [4]) +AC_CHECK_SIZEOF([short], [2]) +AC_CHECK_SIZEOF([int], [4]) +AC_CHECK_SIZEOF([long], [4]) +AC_CHECK_SIZEOF([float], [4]) +AC_CHECK_SIZEOF([double], [4]) +AC_CHECK_SIZEOF([void*], [8]) +AC_CHECK_SIZEOF([size_t], [4]) +AC_CHECK_SIZEOF([int64_t], [8]) +AC_CHECK_SIZEOF([long long], [8]) -#==================================================================================== -# Find an appropriate type for sf_count_t. -# On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value. -# Unfortunately there is more than one way of ensuring this so need to do some -# pretty rigourous testing here. +dnl ==================================================================================== +dnl Find an appropriate type for sf_count_t. +dnl On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value. +dnl Unfortunately there is more than one way of ensuring this so need to do some +dnl pretty rigourous testing here. -# Check for common 64 bit file offset types. -AC_CHECK_SIZEOF(off_t,1) +dnl Check for common 64 bit file offset types. +AC_CHECK_SIZEOF([off_t], [1]) AS_IF([test "x$enable_largefile:$ac_cv_sizeof_off_t" = "xno:8"], [ AC_MSG_ERROR(["Error : Cannot disable large file support because sizeof (off_t) == 8."]) @@ -199,13 +207,13 @@ AS_CASE([$host_os], [ SIZEOF_SF_COUNT_T=0 AS_IF([test "x$ac_cv_sizeof_off_t" = "x8"], [ - # If sizeof (off_t) is 8, no further checking is needed. + dnl If sizeof (off_t) is 8, no further checking is needed. TYPEOF_SF_COUNT_T="int64_t" SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL" SIZEOF_SF_COUNT_T=8 ], [ - # Save the old sizeof (off_t) value and then unset it to see if it - # changes when Large File Support is enabled. + dnl Save the old sizeof (off_t) value and then unset it to see if it + dnl changes when Large File Support is enabled. pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t unset ac_cv_sizeof_off_t @@ -253,38 +261,41 @@ AC_SUBST(SF_COUNT_MAX) AC_TYPE_SSIZE_T -#==================================================================================== -# Determine endian-ness of target processor. +dnl ==================================================================================== +dnl Determine endian-ness of host processor. -MN_C_FIND_ENDIAN +AC_C_BIGENDIAN([ + dnl big-endian + ac_cv_c_big_endian=1 + ac_cv_c_little_endian=0 + ], [ + dnl little-endian + ac_cv_c_big_endian=0 + ac_cv_c_little_endian=1 + ]) -AC_DEFINE_UNQUOTED([CPU_IS_BIG_ENDIAN], [${ac_cv_c_big_endian}], - [Target processor is big endian.]) -AC_DEFINE_UNQUOTED([CPU_IS_LITTLE_ENDIAN], [${ac_cv_c_little_endian}], - [Target processor is little endian.]) -AC_DEFINE_UNQUOTED([WORDS_BIGENDIAN], [${ac_cv_c_big_endian}], - [Target processor is big endian.]) +AC_DEFINE_UNQUOTED([CPU_IS_BIG_ENDIAN], [${ac_cv_c_big_endian}], [Host processor is big endian.]) +AC_DEFINE_UNQUOTED([CPU_IS_LITTLE_ENDIAN], [${ac_cv_c_little_endian}], [Host processor is little endian.]) -#==================================================================================== -# Check for functions. +dnl ==================================================================================== +dnl Check for functions. -AC_CHECK_FUNCS(malloc calloc realloc free) -AC_CHECK_FUNCS(open read write lseek lseek64) -AC_CHECK_FUNCS(fstat fstat64 ftruncate fsync) -AC_CHECK_FUNCS(snprintf vsnprintf) -AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r gettimeofday) -AC_CHECK_FUNCS(mmap getpagesize) -AC_CHECK_FUNCS(setlocale) -AC_CHECK_FUNCS(pipe waitpid) +AC_CHECK_FUNCS([malloc calloc realloc free]) +AC_CHECK_FUNCS([open read write lseek lseek64]) +AC_CHECK_FUNCS([fstat fstat64 ftruncate fsync]) +AC_CHECK_FUNCS([snprintf vsnprintf]) +AC_CHECK_FUNCS([gmtime gmtime_r localtime localtime_r gettimeofday]) +AC_CHECK_FUNCS([mmap getpagesize]) +AC_CHECK_FUNCS([setlocale]) +AC_CHECK_FUNCS([pipe waitpid]) -AC_CHECK_LIB([m],floor) -AC_CHECK_FUNCS(floor ceil fmod lround) +AC_SEARCH_LIBS([floor], [m], [], [ + AC_MSG_ERROR([unable to find the floor() function!]) + ]) +AC_CHECK_FUNCS([floor ceil fmod lrint lrintf]) -MN_C99_FUNC_LRINT -MN_C99_FUNC_LRINTF - -#==================================================================================== -# Check for requirements for building plugins for other languages/enviroments. +dnl ==================================================================================== +dnl Check for requirements for building plugins for other languages/enviroments. dnl Octave maths environment http://www.octave.org/ AS_IF([test "x$cross_compiling" = "xno"], [ @@ -297,16 +308,17 @@ AS_IF([test "x$cross_compiling" = "xno"], [ AM_CONDITIONAL(BUILD_OCTAVE_MOD, false) ]) -#==================================================================================== -# Check for Ogg, Vorbis and FLAC. +dnl ==================================================================================== +dnl Check for Ogg, Vorbis and FLAC. HAVE_EXTERNAL_XIPH_LIBS=0 EXTERNAL_XIPH_CFLAGS="" EXTERNAL_XIPH_LIBS="" -# Check for pkg-config outside the if statement. +dnl Check for pkg-config outside the if statement. PKG_PROG_PKG_CONFIG -m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/pkgconfig)) +AX_REQUIRE_DEFINED([PKG_INSTALLDIR]) +PKG_INSTALLDIR AS_IF([test -n "$PKG_CONFIG"], [ AS_IF([test "x$enable_external_libs" = "xno"], [ @@ -314,7 +326,7 @@ AS_IF([test -n "$PKG_CONFIG"], [ ], [ PKG_CHECK_MOD_VERSION(FLAC, flac >= 1.3.1, ac_cv_flac=yes, ac_cv_flac=no) - # Make sure the FLAC_CFLAGS value is sane. + dnl Make sure the FLAC_CFLAGS value is sane. FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s|include/FLAC|include|"` PKG_CHECK_MOD_VERSION(OGG, ogg >= 1.1.3, ac_cv_ogg=yes, ac_cv_ogg=no) @@ -326,9 +338,9 @@ AS_IF([test -n "$PKG_CONFIG"], [ SPEEX_LIBS="" ]) - # Vorbis versions earlier than 1.2.3 have bugs that cause the libsndfile - # test suite to fail on MIPS, PowerPC and others. - # See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549899 + dnl Vorbis versions earlier than 1.2.3 have bugs that cause the libsndfile + dnl test suite to fail on MIPS, PowerPC and others. + dnl See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549899 PKG_CHECK_MOD_VERSION(VORBIS, vorbis >= 1.2.3, ac_cv_vorbis=yes, ac_cv_vorbis=no) PKG_CHECK_MOD_VERSION(VORBISENC, vorbisenc >= 1.2.3, ac_cv_vorbisenc=yes, ac_cv_vorbisenc=no) enable_external_libs=yes @@ -355,25 +367,19 @@ AS_IF([test -n "$PKG_CONFIG"], [ AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_XIPH_LIBS], [$HAVE_EXTERNAL_XIPH_LIBS], [Will be set to 1 if flac, ogg and vorbis are available.]) -#==================================================================================== -# Check for libsqlite3 (only used in regtest). +dnl ==================================================================================== +dnl Check for libsqlite3 (only used in regtest). -ac_cv_sqlite3=no +ac_cv_sqlite3=0 AS_IF([test "x$enable_sqlite" != "xno"], [ - PKG_CHECK_MOD_VERSION(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no) + PKG_CHECK_MOD_VERSION([SQLITE3], [sqlite3 >= 3.2], [ac_cv_sqlite3=1], [ac_cv_sqlite3=0]) ]) -AS_IF([test "x$ac_cv_sqlite3" = "xyes"], [ - HAVE_SQLITE3=1 - ], [ - HAVE_SQLITE3=0 - ]) +AC_DEFINE_UNQUOTED([HAVE_SQLITE3], [${ac_cv_sqlite3}], [Set to 1 if you have libsqlite3.]) +AM_CONDITIONAL([HAVE_SQLITE3], [test "x$ac_cv_sqlite3" = "x1"]) -AC_DEFINE_UNQUOTED([HAVE_SQLITE3], [$HAVE_SQLITE3], [Set to 1 if you have libsqlite3.]) -AM_CONDITIONAL([HAVE_SQLITE3], [test "x$ac_cv_sqlite3" = "xyes"]) - -#==================================================================================== -# Determine if the processor can do clipping on float to int conversions. +dnl ==================================================================================== +dnl Determine if the processor can do clipping on float to int conversions. AS_IF([test "x$enable_cpu_clip" != "xno"], [ MN_C_CLIP_MODE @@ -384,12 +390,12 @@ AS_IF([test "x$enable_cpu_clip" != "xno"], [ ]) AC_DEFINE_UNQUOTED([CPU_CLIPS_POSITIVE], [${ac_cv_c_clip_positive}], - [Target processor clips on positive float to int conversion.]) + [Host processor clips on positive float to int conversion.]) AC_DEFINE_UNQUOTED([CPU_CLIPS_NEGATIVE], [${ac_cv_c_clip_negative}], - [Target processor clips on negative float to int conversion.]) + [Host processor clips on negative float to int conversion.]) -#==================================================================================== -# Target OS specific stuff. +dnl ==================================================================================== +dnl Host OS specific stuff. OS_SPECIFIC_CFLAGS="" OS_SPECIFIC_LINKS="" @@ -417,21 +423,50 @@ AC_DEFINE_UNQUOTED([OS_IS_OPENBSD], [${os_is_openbsd}], [Set to 1 if compiling f AC_DEFINE_UNQUOTED([USE_WINDOWS_API], [${use_windows_api}], [Set to 1 to use the native windows API]) AM_CONDITIONAL(USE_WIN_VERSION_FILE, test ${use_windows_api} -eq 1) -#==================================================================================== -# Check for ALSA. - -ALSA_LIBS="" +dnl ==================================================================================== +dnl Check for ALSA. AS_IF([test "x$enable_alsa" != "xno"], [ - AC_CHECK_HEADERS(alsa/asoundlib.h) - AS_IF([test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"], [ - ALSA_LIBS="-lasound" - enable_alsa=yes + PKG_CHECK_MODULES([ALSA], [alsa], [ + dnl actually test whether ALSA really works, in + dnl order to dodge wrong cross-compilation pickups + save_CFLAGS="${CFLAGS}" + save_LIBS="${LIBS}" + CFLAGS="${CFLAGS} ${ALSA_CFLAGS}" + LIBS="${LIBS} ${ALSA_LIBS}" + AC_CHECK_HEADERS([alsa/asoundlib.h]) + AS_IF([test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"], [ + dnl ALSA definitely works + AC_DEFINE([HAVE_ALSA], [1], [Set to 1 if you have alsa]) + alsa_works="yes" + ], [ + dnl picked up wrong ALSA + alsa_works="no" + + dnl reset flags + ALSA_CFLAGS="" + ALSA_LIBS="" + ]) + CFLAGS="${save_CFLAGS}" + LIBS="${save_LIBS}" + ], [ + dnl could not find ALSA + alsa_works="no" + ]) + + AS_IF([test "x$alsa_works" = "xno"], [ + AS_IF([test "x$enable_alsa" = "xyes"], [ + dnl explicitly passed --enable-alsa, hence error out loud and clearly + AC_MSG_ERROR([You explicitly requested alsa support, but alsa could not be found!]) + ], [ + dnl did not explicitly pass --enable-alsa, relying on default automagic on + enable_alsa="no (auto)" + ]) ]) ]) -#==================================================================================== -# Check for OpenBSD's sndio. +dnl ==================================================================================== +dnl Check for OpenBSD's sndio. SNDIO_LIBS="" HAVE_SNDIO_H=0 @@ -446,8 +481,8 @@ AS_CASE([$host_os], AC_DEFINE_UNQUOTED([HAVE_SNDIO_H], [${HAVE_SNDIO_H}], [Set to 1 if is available.]) -#==================================================================================== -# Test for sanity when cross-compiling. +dnl ==================================================================================== +dnl Test for sanity when cross-compiling. AS_IF([test "x$ac_cv_sizeof_short" != "x2"], [ AC_MSG_WARN([[******************************************************************]]) @@ -478,8 +513,8 @@ AS_IF([test "x$ac_cv_prog_HAVE_AUTOGEN" = "xno"], [ touch tests/*.c tests/*.h ]) -#==================================================================================== -# Settings for the HTML documentation. +dnl ==================================================================================== +dnl Settings for the HTML documentation. AS_IF([test "x$enable_bow_docs" = "xyes"], [ HTML_BGCOLOUR="white" @@ -489,8 +524,8 @@ AS_IF([test "x$enable_bow_docs" = "xyes"], [ HTML_FGCOLOUR="white" ]) -#==================================================================================== -# Now use the information from the checking stage. +dnl ==================================================================================== +dnl Now use the information from the checking stage. win32_target_dll=0 COMPILER_IS_GCC=0 @@ -501,6 +536,14 @@ AS_IF([test "x$enable_flags_setting" = "xyes"], [ AC_LANG_PUSH([C++]) AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CXXFLAGS]) AC_LANG_POP([C++]) + + AS_CASE([${host_os}], + [darwin*], [ + ldflags_test="-Wl,-dead_strip_dylibs"], + [linux*], [ + ldflags_test="-Wl,-O1 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections"] + ) + AX_APPEND_LINK_FLAGS([${ldflags_test}], [LDFLAGS]) ]) AS_IF([test "x$enable_werror" = "xyes"], [ @@ -533,24 +576,24 @@ dnl the console with messages of macro redefinitions. AX_ADD_FORTIFY_SOURCE AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [ - # OS specific tweaks. + dnl OS specific tweaks. AS_CASE([$host_os], [darwin* | rhapsody*], [ - # Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody. - # System headers on these systems are broken. + dnl Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody. + dnl System headers on these systems are broken. temp_CFLAGS=`echo $CFLAGS | $SED "s/-Wall -pedantic//" | $SED "s/-Wshadow//" | $SED "s/-Waggregate-return//"` CFLAGS=$temp_CFLAGS - SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"], + SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(top_srcdir)/src/Symbols.darwin"], [linux*|kfreebsd*-gnu*|gnu*], [ - SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.gnu-binutils"], + SHLIB_VERSION_ARG="-Wl,--version-script=\$(top_srcdir)/src/Symbols.gnu-binutils"], [mingw*], [ - SHLIB_VERSION_ARG="-Wc,-static-libgcc -Wl,\$(srcdir)/libsndfile-1.def" + SHLIB_VERSION_ARG="-Wc,-static-libgcc -Wl,\$(top_srcdir)/src/libsndfile-1.def" win32_target_dll=1 AS_IF([test "x$enable_shared" = "xno"], [ win32_target_dll=0 ])], [os2*], [ - SHLIB_VERSION_ARG="-Wl,-export-symbols \$(srcdir)/Symbols.os2" + SHLIB_VERSION_ARG="-Wl,-export-symbols \$(top_srcdir)/src/Symbols.os2" ]) COMPILER_IS_GCC=1 @@ -584,7 +627,7 @@ AS_IF([test "x$enable_static" = "xno"], [ TEST_BINDIR=tests/ ]) -#------------------------------------------------------------------------------- +dnl ------------------------------------------------------------------------------- AC_SUBST(HOST_TRIPLET) @@ -602,7 +645,6 @@ AC_SUBST(WIN_RC_VERSION) AC_SUBST(HAVE_EXTERNAL_XIPH_LIBS) AC_SUBST(OS_SPECIFIC_CFLAGS) AC_SUBST(OS_SPECIFIC_LINKS) -AC_SUBST(ALSA_LIBS) AC_SUBST(SNDIO_LIBS) AC_SUBST(EXTERNAL_XIPH_CFLAGS) @@ -610,23 +652,30 @@ AC_SUBST(EXTERNAL_XIPH_LIBS) AC_SUBST(SRC_BINDIR) AC_SUBST(TEST_BINDIR) -AC_CONFIG_FILES([ \ - src/Makefile man/Makefile examples/Makefile tests/Makefile regtest/Makefile \ - doc/Makefile Win32/Makefile Octave/Makefile programs/Makefile \ - Makefile \ - src/version-metadata.rc tests/test_wrapper.sh tests/pedantic-header-test.sh \ - doc/libsndfile.css Scripts/build-test-tarball.mk libsndfile.spec sndfile.pc \ - src/sndfile.h src/libsndfile.def +AC_CONFIG_FILES([ + Makefile Octave/Makefile + src/version-metadata.rc src/sndfile.h src/libsndfile.def + tests/test_wrapper.sh tests/pedantic-header-test.sh + doc/libsndfile.css libsndfile.spec sndfile.pc ]) AC_OUTPUT -# Make sure these are executable. -chmod u+x tests/test_wrapper.sh Scripts/build-test-tarball.mk +dnl ==================================================================================== -#==================================================================================== +AS_IF([test -z "$PKG_CONFIG"], [ + AS_ECHO([" *****************************************************************"]) + AS_ECHO([" *** The pkg-config program is missing. ***"]) + AS_ECHO([" *** External FLAC/Ogg/Vorbis libs cannot be found without it. ***"]) + AS_ECHO([" *** http://pkg-config.freedesktop.org/wiki/ ***"]) + AS_ECHO([" *****************************************************************"]) + ]) +AX_RECURSIVE_EVAL([$libdir], [full_absolute_libdir]) +AX_RECURSIVE_EVAL([$bindir], [full_absolute_bindir]) +AX_RECURSIVE_EVAL([$pkgconfigdir], [full_absolute_pkgconfigdir]) +AX_RECURSIVE_EVAL([$htmldir], [full_absolute_htmldir]) AC_MSG_RESULT([ --=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=- +-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=- Configuration summary : @@ -644,40 +693,26 @@ AC_MSG_RESULT([ Experimental code : ................... ${enable_experimental:-no} Using ALSA in example programs : ...... ${enable_alsa:-no} External FLAC/Ogg/Vorbis : ............ ${enable_external_libs:-no} + + Tools : + + C Compiler Vendor is : ................ ${ax_cv_c_compiler_vendor} (${ax_cv_c_compiler_version}) + CXX Compiler Vendor is : .............. ${ax_cv_cxx_compiler_vendor} (${ax_cv_cxx_compiler_version}) + + Sanitizer enabled : ................... ${enable_sanitizer:-no} + Stack smash protection : .............. ${enable_stack_smash_protection:-no} + + Installation directories : + + Library directory : ................... ${full_absolute_libdir} + Program directory : ................... ${full_absolute_bindir} + Pkgconfig directory : ................. ${full_absolute_pkgconfigdir} + HTML docs directory : ................. ${full_absolute_htmldir} + +Compiling some other packages against libsndfile may require +the addition of '$full_absolute_pkgconfigdir' to the +PKG_CONFIG_PATH environment variable. ]) -AS_IF([test -z "$PKG_CONFIG"], [ - AS_ECHO([" *****************************************************************"]) - AS_ECHO([" *** The pkg-config program is missing. ***"]) - AS_ECHO([" *** External FLAC/Ogg/Vorbis libs cannot be found without it. ***"]) - AS_ECHO([" *** http://pkg-config.freedesktop.org/wiki/ ***"]) - AS_ECHO([" *****************************************************************"]) - ]) - -AS_ECHO([" Tools :"]) -AS_ECHO([""]) -AS_ECHO([" C Compiler Vendor is : ................ ${ax_cv_c_compiler_vendor} (${ax_cv_c_compiler_version})"]) -AS_ECHO([" CXX Compiler Vendor is : .............. ${ax_cv_cxx_compiler_vendor} (${ax_cv_cxx_compiler_version})"]) - -AS_ECHO([" Sanitizer enabled : ................... ${enable_sanitizer:-no}"]) -AS_ECHO([" Stack smash protection : .............. ${enable_stack_smash_protection:-no}"]) - -AX_RECURSIVE_EVAL([$libdir], [full_absolute_libdir]) -AX_RECURSIVE_EVAL([$bindir], [full_absolute_bindir]) -AX_RECURSIVE_EVAL([$pkgconfigdir], [full_absolute_pkgconfigdir]) -AX_RECURSIVE_EVAL([$htmldir], [full_absolute_htmldir]) -AS_ECHO([""]) -AS_ECHO([" Installation directories :"]) -AS_ECHO([""]) -AS_ECHO([" Library directory : ................... $full_absolute_libdir"]) -AS_ECHO([" Program directory : ................... $full_absolute_bindir"]) -AS_ECHO([" Pkgconfig directory : ................. $full_absolute_pkgconfigdir"]) -AS_ECHO([" HTML docs directory : ................. $full_absolute_htmldir"]) -AS_ECHO([""]) -AS_ECHO(["Compiling some other packages against libsndfile may require"]) -AS_ECHO(["the addition of '$full_absolute_pkgconfigdir' to the"]) -AS_ECHO(["PKG_CONFIG_PATH environment variable."]) -AS_ECHO([""]) - -# Remove symlink created by Scripts/android-configure.sh. +dnl Remove symlink created by Scripts/android-configure.sh. rm -f gdbclient diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index d12afbe1..00000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -## Process this file with automake to produce Makefile.in - -html_DATA = index.html libsndfile.jpg libsndfile.css print.css api.html \ - command.html bugs.html sndfile_info.html new_file_type.HOWTO \ - win32.html FAQ.html lists.html embedded_files.html octave.html \ - tutorial.html - -EXTRA_DIST = $(html_DATA) - diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index f342c78d..00000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -## Process this file with automake to produce Makefile.in - -check_PROGRAMS = make_sine sfprocess list_formats generate sndfilehandle \ - sndfile-to-text sndfile-loopify - -AM_CPPFLAGS = -I$(top_srcdir)/src - -sndfile_to_text_SOURCES = sndfile-to-text.c -sndfile_to_text_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_loopify_SOURCES = sndfile-loopify.c -sndfile_loopify_LDADD = $(top_builddir)/src/libsndfile.la - -make_sine_SOURCES = make_sine.c -make_sine_LDADD = $(top_builddir)/src/libsndfile.la - -sfprocess_SOURCES = sfprocess.c -sfprocess_LDADD = $(top_builddir)/src/libsndfile.la - -list_formats_SOURCES = list_formats.c -list_formats_LDADD = $(top_builddir)/src/libsndfile.la - -generate_SOURCES = generate.c -generate_LDADD = $(top_builddir)/src/libsndfile.la - -sndfilehandle_SOURCES = sndfilehandle.cc -sndfilehandle_LDADD = $(top_builddir)/src/libsndfile.la - -CLEANFILES = *~ *.exe diff --git a/M4/ax_add_fortify_source.m4 b/m4/ax_add_fortify_source.m4 similarity index 100% rename from M4/ax_add_fortify_source.m4 rename to m4/ax_add_fortify_source.m4 diff --git a/M4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4 similarity index 100% rename from M4/ax_append_compile_flags.m4 rename to m4/ax_append_compile_flags.m4 diff --git a/M4/ax_append_flag.m4 b/m4/ax_append_flag.m4 similarity index 100% rename from M4/ax_append_flag.m4 rename to m4/ax_append_flag.m4 diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4 new file mode 100644 index 00000000..6f7f1745 --- /dev/null +++ b/m4/ax_append_link_flags.m4 @@ -0,0 +1,65 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the linker works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is +# used. During the check the flag is always added to the linker's flags. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG. +# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AC_DEFUN([AX_APPEND_LINK_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4]) +done +])dnl AX_APPEND_LINK_FLAGS diff --git a/M4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 similarity index 100% rename from M4/ax_check_compile_flag.m4 rename to m4/ax_check_compile_flag.m4 diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4 new file mode 100644 index 00000000..819409a2 --- /dev/null +++ b/m4/ax_check_link_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_LINK_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS diff --git a/M4/ax_compiler_vendor.m4 b/m4/ax_compiler_vendor.m4 similarity index 100% rename from M4/ax_compiler_vendor.m4 rename to m4/ax_compiler_vendor.m4 diff --git a/M4/ax_compiler_version.m4 b/m4/ax_compiler_version.m4 similarity index 100% rename from M4/ax_compiler_version.m4 rename to m4/ax_compiler_version.m4 diff --git a/M4/ax_recursive_eval.m4 b/m4/ax_recursive_eval.m4 similarity index 100% rename from M4/ax_recursive_eval.m4 rename to m4/ax_recursive_eval.m4 diff --git a/M4/ax_require_defined.m4 b/m4/ax_require_defined.m4 similarity index 100% rename from M4/ax_require_defined.m4 rename to m4/ax_require_defined.m4 diff --git a/M4/clip_mode.m4 b/m4/clip_mode.m4 similarity index 100% rename from M4/clip_mode.m4 rename to m4/clip_mode.m4 diff --git a/M4/extra_pkg.m4 b/m4/extra_pkg.m4 similarity index 100% rename from M4/extra_pkg.m4 rename to m4/extra_pkg.m4 diff --git a/M4/flexible_array.m4 b/m4/flexible_array.m4 similarity index 100% rename from M4/flexible_array.m4 rename to m4/flexible_array.m4 diff --git a/M4/mkoctfile_version.m4 b/m4/mkoctfile_version.m4 similarity index 100% rename from M4/mkoctfile_version.m4 rename to m4/mkoctfile_version.m4 diff --git a/M4/octave.m4 b/m4/octave.m4 similarity index 100% rename from M4/octave.m4 rename to m4/octave.m4 diff --git a/M4/stack_protect.m4 b/m4/stack_protect.m4 similarity index 100% rename from M4/stack_protect.m4 rename to m4/stack_protect.m4 diff --git a/man/Makefile.am b/man/Makefile.am deleted file mode 100644 index 4964336a..00000000 --- a/man/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -## Process this file with automake to produce Makefile.in - -man_MANS = sndfile-info.1 sndfile-play.1 sndfile-convert.1 sndfile-cmp.1 \ - sndfile-metadata-get.1 sndfile-metadata-set.1 sndfile-concat.1 \ - sndfile-interleave.1 sndfile-deinterleave.1 sndfile-salvage.1 - -EXTRA_DIST = sndfile-info.1 sndfile-play.1 sndfile-convert.1 sndfile-cmp.1 \ - sndfile-metadata-get.1 sndfile-concat.1 sndfile-interleave.1 \ - sndfile-salvage.1 - -# Same manpage for both programs. -sndfile-metadata-set.1 : sndfile-metadata-get.1 - $(LN_S) $(srcdir)/sndfile-metadata-get.1 $@ - -sndfile-deinterleave.1 : sndfile-interleave.1 - $(LN_S) $(srcdir)/sndfile-interleave.1 $@ diff --git a/programs/Makefile.am b/programs/Makefile.am deleted file mode 100644 index 55e24511..00000000 --- a/programs/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -## Process this file with automake to produce Makefile.in - -bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert sndfile-cmp \ - sndfile-metadata-set sndfile-metadata-get sndfile-interleave \ - sndfile-deinterleave sndfile-concat sndfile-salvage - -OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@ -OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@ - -AM_CPPFLAGS = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS) - -CLEANFILES = *~ sndfile-*.exe *.wav - -# This is the BeOS version of sndfile-play. It needs to be compiled with the C++ -# compiler. -EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metadata-set.py - -sndfile_info_SOURCES = sndfile-info.c common.c common.h -sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_play_SOURCES = sndfile-play.c common.c common.h -sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) $(SNDIO_LIBS) - -sndfile_convert_SOURCES = sndfile-convert.c common.c common.h -sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_cmp_SOURCES = sndfile-cmp.c common.c common.h -sndfile_cmp_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_metadata_set_SOURCES = sndfile-metadata-set.c common.c common.h -sndfile_metadata_set_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_metadata_get_SOURCES = sndfile-metadata-get.c common.c common.h -sndfile_metadata_get_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_interleave_SOURCES = sndfile-interleave.c common.c common.h -sndfile_interleave_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_deinterleave_SOURCES = sndfile-deinterleave.c common.c common.h -sndfile_deinterleave_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_concat_SOURCES = sndfile-concat.c common.c common.h -sndfile_concat_LDADD = $(top_builddir)/src/libsndfile.la - -sndfile_salvage_SOURCES = sndfile-salvage.c common.c common.h -sndfile_salvage_LDADD = $(top_builddir)/src/libsndfile.la - -check : - $(PYTHON) $(top_srcdir)/programs/test-sndfile-metadata-set.py @HOST_TRIPLET@ diff --git a/regtest/Makefile.am b/regtest/Makefile.am deleted file mode 100644 index cc335aa2..00000000 --- a/regtest/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -## Process this file with automake to produce Makefile.in - -if HAVE_SQLITE3 -bin_PROGRAMS = sndfile-regtest -endif - -noinst_HEADERS = regtest.h - -AM_CPPFLAGS = -I$(top_srcdir)/src $(SQLITE3_CFLAGS) $(OS_SPECIFIC_CFLAGS) - -sndfile_regtest_SOURCES = sndfile-regtest.c database.c checksum.c -sndfile_regtest_LDADD = $(top_builddir)/src/libsndfile.la $(SQLITE3_LIBS) - -CLEANFILES = *~ *.exe diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 15d45bc4..00000000 --- a/src/Makefile.am +++ /dev/null @@ -1,132 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = subdir-objects - -lib_LTLIBRARIES = libsndfile.la -include_HEADERS = sndfile.hh -nodist_include_HEADERS = sndfile.h - -noinst_LTLIBRARIES = GSM610/libgsm.la G72x/libg72x.la ALAC/libalac.la libcommon.la - -SYMBOL_FILES = Symbols.gnu-binutils Symbols.darwin libsndfile-1.def Symbols.os2 Symbols.static - -EXTRA_DIST = sndfile.h.in config.h.in test_endswap.c test_endswap.tpl test_endswap.def \ - $(SYMBOL_FILES) create_symbols_file.py binheader_writef_check.py \ - GSM610/README GSM610/COPYRIGHT GSM610/ChangeLog \ - G72x/README G72x/README.original G72x/ChangeLog \ - make-static-lib-hidden-privates.sh \ - config.h.cmake - -noinst_HEADERS = common.h sfconfig.h sfendian.h wavlike.h sf_unistd.h ogg.h chanmap.h - -check_PROGRAMS = test_main G72x/g72x_test - -FILESPECIFIC = sndfile.c aiff.c au.c avr.c caf.c dwd.c flac.c g72x.c htk.c ircam.c \ - macos.c mat4.c mat5.c nist.c paf.c pvf.c raw.c rx2.c sd2.c \ - sds.c svx.c txw.c voc.c wve.c w64.c wavlike.c wav.c xi.c mpc2k.c rf64.c \ - ogg_vorbis.c ogg_speex.c ogg_pcm.c ogg_opus.c - -CLEANFILES = *~ *.exe G72x/*.exe error.dat - -if USE_WIN_VERSION_FILE -WIN_VERSION_FILE = version-metadata.rc -else -WIN_VERSION_FILE = -endif - -libsndfile_la_CFLAGS = $(EXTERNAL_XIPH_CFLAGS) - -#=============================================================================== -# MinGW requires -no-undefined if a DLL is to be built. -libsndfile_la_LDFLAGS = -no-undefined -version-info $(SHARED_VERSION_INFO) $(SHLIB_VERSION_ARG) -libsndfile_la_SOURCES = $(FILESPECIFIC) $(noinst_HEADERS) -nodist_libsndfile_la_SOURCES = $(nodist_include_HEADERS) -libsndfile_la_LIBADD = GSM610/libgsm.la G72x/libg72x.la ALAC/libalac.la \ - libcommon.la $(EXTERNAL_XIPH_LIBS) -lm - -EXTRA_libsndfile_la_DEPENDENCIES = $(SYMBOL_FILES) - -libcommon_la_CFLAGS = $(EXTERNAL_XIPH_CFLAGS) -libcommon_la_SOURCES = common.c file_io.c command.c pcm.c ulaw.c alaw.c \ - float32.c double64.c ima_adpcm.c ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c \ - interleave.c strings.c dither.c cart.c broadcast.c audio_detect.c \ - ima_oki_adpcm.c ima_oki_adpcm.h alac.c chunk.c ogg.c chanmap.c \ - windows.c id3.c $(WIN_VERSION_FILE) - - -#====================================================================== -# Subdir libraries. - -GSM610_libgsm_la_SOURCES = GSM610/config.h GSM610/gsm.h GSM610/gsm610_priv.h \ - GSM610/add.c GSM610/code.c GSM610/decode.c GSM610/gsm_create.c \ - GSM610/gsm_decode.c GSM610/gsm_destroy.c GSM610/gsm_encode.c \ - GSM610/gsm_option.c GSM610/long_term.c GSM610/lpc.c GSM610/preprocess.c \ - GSM610/rpe.c GSM610/short_term.c GSM610/table.c - -G72x_libg72x_la_SOURCES = G72x/g72x.h G72x/g72x_priv.h \ - G72x/g721.c G72x/g723_16.c G72x/g723_24.c G72x/g723_40.c G72x/g72x.c - -ALAC_libalac_la_SOURCES = ALAC/ALACAudioTypes.h ALAC/ALACBitUtilities.h \ - ALAC/EndianPortable.h ALAC/aglib.h ALAC/dplib.h ALAC/matrixlib.h \ - ALAC/alac_codec.h ALAC/shift.h \ - ALAC/ALACBitUtilities.c ALAC/ag_dec.c \ - ALAC/ag_enc.c ALAC/dp_dec.c ALAC/dp_enc.c ALAC/matrix_dec.c \ - ALAC/matrix_enc.c ALAC/alac_decoder.c ALAC/alac_encoder.c - -#=============================================================================== -# Test programs. - -test_main_SOURCES = test_main.c test_main.h test_conversions.c test_float.c test_endswap.c \ - test_audio_detect.c test_log_printf.c test_file_io.c test_ima_oki_adpcm.c \ - test_strncpy_crlf.c test_broadcast_var.c test_cart_var.c \ - test_binheader_writef.c -test_main_LDADD = libcommon.la - -G72x_g72x_test_SOURCES = G72x/g72x_test.c -G72x_g72x_test_LDADD = G72x/libg72x.la - -SUFFIXES = .def .tpl - -.def.c: - autogen --writable $< - -check : - $(PYTHON) $(srcdir)/binheader_writef_check.py $(srcdir)/*.c - G72x/g72x_test$(EXEEXT) all - ./test_main$(EXEEXT) - -# Need this target to force building of test programs. -checkprograms : $(check_PROGRAMS) - -#====================================================================== -# Generate an OS specific Symbols files. This is done when the author -# builds the distribution tarball. There should be not need for the -# end user to create these files. - -Symbols.gnu-binutils: create_symbols_file.py - $(PYTHON) $(srcdir)/create_symbols_file.py linux $(VERSION) > $@ - -Symbols.darwin: create_symbols_file.py - $(PYTHON) $(srcdir)/create_symbols_file.py darwin $(VERSION) > $@ - -libsndfile-1.def: create_symbols_file.py - $(PYTHON) $(srcdir)/create_symbols_file.py win32 $(VERSION) > $@ - -Symbols.os2: create_symbols_file.py - $(PYTHON) $(srcdir)/create_symbols_file.py os2 $(VERSION) > $@ - -Symbols.static: create_symbols_file.py - $(PYTHON) $(srcdir)/create_symbols_file.py static $(VERSION) > $@ - -#====================================================================== -# Building windows resource files (if needed). - -.rc.lo: - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) $< -o $@ - -#====================================================================== -# Disable autoheader. -AUTOHEADER=echo - - - diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index dfe59552..00000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,198 +0,0 @@ -## Process this file with automake to produce Makefile.in - -if ENABLE_TEST_COVERAGE -CPP_TEST = -else -CPP_TEST = cpp_test -endif - -AM_CPPFLAGS = -I$(top_srcdir)/src - -check_PROGRAMS = sfversion floating_point_test write_read_test \ - lossy_comp_test error_test ulaw_test alaw_test dwvw_test \ - peak_chunk_test command_test stdin_test stdout_test stdio_test \ - pcm_test headerless_test pipe_test benchmark header_test misc_test \ - raw_test string_test multi_file_test dither_test chunk_test \ - scale_clip_test win32_test fix_this aiff_rw_test virtual_io_test \ - locale_test largefile_test win32_ordinal_test ogg_test compression_size_test \ - checksum_test external_libs_test rdwr_test format_check_test $(CPP_TEST) \ - channel_test long_read_write_test - -noinst_HEADERS = dft_cmp.h utils.h generate.h - -autogen_sources = \ - write_read_test.c write_read_test.tpl write_read_test.def \ - pcm_test.c pcm_test.tpl pcm_test.def \ - header_test.c header_test.tpl header_test.def \ - utils.c utils.tpl utils.def \ - scale_clip_test.c scale_clip_test.tpl scale_clip_test.def \ - pipe_test.c pipe_test.tpl pipe_test.def \ - rdwr_test.c rdwr_test.tpl rdwr_test.def \ - floating_point_test.c floating_point_test.tpl floating_point_test.def \ - benchmark.c benchmark.tpl benchmark.def - -EXTRA_DIST = $(autogen_sources) - -CLEANFILES = *~ *.exe - -#=============================================================================== -# If we're cross compiling from Linux to Windows and running the test suite -# under Wine, we need a symbolic link to the generated libsndfile DLL. - -if LINUX_MINGW_CROSS_TEST - -$(check_PROGRAMS) : libsndfile-1.dll - -libsndfile-1.dll : - ln -s $(top_builddir)/src/.libs/$@ $@ - -clean-local : - -rm -f libsndfile-1.dll - -endif - -#=============================================================================== - -check: test_wrapper.sh - sh test_wrapper.sh - -# Need this target to force building of test programs. -checkprograms : $(check_PROGRAMS) - -#=============================================================================== - -sfversion_SOURCES = sfversion.c -sfversion_LDADD = $(top_builddir)/src/libsndfile.la - -write_read_test_SOURCES = utils.c generate.c write_read_test.c -write_read_test_LDADD = $(top_builddir)/src/libsndfile.la - -lossy_comp_test_SOURCES = utils.c lossy_comp_test.c -lossy_comp_test_LDADD = $(top_builddir)/src/libsndfile.la - -fix_this_SOURCES = utils.c fix_this.c -fix_this_LDADD = $(top_builddir)/src/libsndfile.la - -error_test_SOURCES = error_test.c utils.c -error_test_LDADD = $(top_builddir)/src/libsndfile.la - -ulaw_test_SOURCES = utils.c ulaw_test.c -ulaw_test_LDADD = $(top_builddir)/src/libsndfile.la - -alaw_test_SOURCES = utils.c alaw_test.c -alaw_test_LDADD = $(top_builddir)/src/libsndfile.la - -aiff_rw_test_SOURCES = utils.c aiff_rw_test.c -aiff_rw_test_LDADD = $(top_builddir)/src/libsndfile.la - -command_test_SOURCES = command_test.c utils.c -command_test_LDADD = $(top_builddir)/src/libsndfile.la - -locale_test_SOURCES = locale_test.c utils.c -locale_test_LDADD = $(top_builddir)/src/libsndfile.la - -largefile_test_SOURCES = largefile_test.c utils.c -largefile_test_LDADD = $(top_builddir)/src/libsndfile.la - -pcm_test_SOURCES = pcm_test.c utils.c -pcm_test_LDADD = $(top_builddir)/src/libsndfile.la - -headerless_test_SOURCES = utils.c headerless_test.c -headerless_test_LDADD = $(top_builddir)/src/libsndfile.la - -stdin_test_SOURCES = stdin_test.c utils.c -stdin_test_LDADD = $(top_builddir)/src/libsndfile.la - -stdout_test_SOURCES = stdout_test.c -stdout_test_LDADD = $(top_builddir)/src/libsndfile.la - -stdio_test_SOURCES = stdio_test.c utils.c -stdio_test_LDADD = $(top_builddir)/src/libsndfile.la - -pipe_test_SOURCES = pipe_test.c utils.c -pipe_test_LDADD = $(top_builddir)/src/libsndfile.la - -benchmark_SOURCES = benchmark.c -benchmark_LDADD = $(top_builddir)/src/libsndfile.la - -header_test_SOURCES = header_test.c utils.c -header_test_LDADD = $(top_builddir)/src/libsndfile.la - -misc_test_SOURCES = misc_test.c utils.c -misc_test_LDADD = $(top_builddir)/src/libsndfile.la - -raw_test_SOURCES = raw_test.c utils.c -raw_test_LDADD = $(top_builddir)/src/libsndfile.la - -string_test_SOURCES = string_test.c utils.c -string_test_LDADD = $(top_builddir)/src/libsndfile.la - -dither_test_SOURCES = dither_test.c utils.c -dither_test_LDADD = $(top_builddir)/src/libsndfile.la - -chunk_test_SOURCES = chunk_test.c utils.c -chunk_test_LDADD = $(top_builddir)/src/libsndfile.la - -multi_file_test_SOURCES = multi_file_test.c utils.c -multi_file_test_LDADD = $(top_builddir)/src/libsndfile.la - -virtual_io_test_SOURCES = virtual_io_test.c utils.c -virtual_io_test_LDADD = $(top_builddir)/src/libsndfile.la - -ogg_test_SOURCES = ogg_test.c utils.c -ogg_test_LDADD = $(top_builddir)/src/libsndfile.la - -compression_size_test_SOURCES = compression_size_test.c utils.c -compression_size_test_LDADD = $(top_builddir)/src/libsndfile.la - -rdwr_test_SOURCES = rdwr_test.c utils.c -rdwr_test_LDADD = $(top_builddir)/src/libsndfile.la - -win32_test_SOURCES = win32_test.c -# Link lib here so that generating the testsuite tarball works correctly. -win32_test_LDADD = $(top_builddir)/src/libsndfile.la - -win32_ordinal_test_SOURCES = win32_ordinal_test.c utils.c -win32_ordinal_test_LDADD = $(top_builddir)/src/libsndfile.la - -external_libs_test_SOURCES = external_libs_test.c utils.c -external_libs_test_LDADD = $(top_builddir)/src/libsndfile.la - -format_check_test_SOURCES = format_check_test.c utils.c -format_check_test_LDADD = $(top_builddir)/src/libsndfile.la - -channel_test_SOURCES = channel_test.c utils.c -channel_test_LDADD = $(top_builddir)/src/libsndfile.la - -long_read_write_test_SOURCES = long_read_write_test.c utils.c -long_read_write_test_LDADD = $(top_builddir)/src/libsndfile.la - -cpp_test_SOURCES = cpp_test.cc utils.c -cpp_test_LDADD = $(top_builddir)/src/libsndfile.la - -checksum_test_SOURCES = checksum_test.c utils.c -checksum_test_LDADD = $(top_builddir)/src/libsndfile.la - -# Lite remove start -dwvw_test_SOURCES = utils.c dwvw_test.c -dwvw_test_LDADD = $(top_builddir)/src/libsndfile.la - -floating_point_test_SOURCES = utils.c dft_cmp.c floating_point_test.c -floating_point_test_LDADD = $(top_builddir)/src/libsndfile.la - -peak_chunk_test_SOURCES = peak_chunk_test.c utils.c -peak_chunk_test_LDADD = $(top_builddir)/src/libsndfile.la - -scale_clip_test_SOURCES = scale_clip_test.c utils.c -scale_clip_test_LDADD = $(top_builddir)/src/libsndfile.la -# Lite remove end - -#=============================================================================== -# Autogen generated sources. -# These GNU style rules actually work. The old style suffix rules do not. - -%.c : %.def %.tpl - autogen --writable $< - -%.h : %.def %.tpl - autogen --writable $< diff --git a/tests/pipe_test.tpl b/tests/pipe_test.tpl index 5e915a26..9bb30cc7 100644 --- a/tests/pipe_test.tpl +++ b/tests/pipe_test.tpl @@ -56,7 +56,6 @@ typedef struct const char *ext ; } FILETYPE ; -static int file_exists (const char *filename) ; static void useek_pipe_rw_test (int filetype, const char *ext) ; static void pipe_read_test (int filetype, const char *ext) ; static void pipe_write_test (const char *ext) ; @@ -95,9 +94,6 @@ int main (void) { int k ; - if (file_exists ("libsndfile.spec.in")) - exit_if_true (chdir ("tests") != 0, "\n Error : chdir ('tests') failed.\n") ; - for (k = 0 ; read_only_types [k].format ; k++) pipe_read_test (read_only_types [k].format, read_only_types [k].ext) ; @@ -141,7 +137,7 @@ pipe_read_test (int filetype, const char *ext) test_writef_short_or_die (outfile, 0, data, PIPE_TEST_LEN, __LINE__) ; sf_close (outfile) ; - snprintf (buffer, sizeof (buffer), "cat %s | ./stdin_test %s ", filename, ext) ; + snprintf (buffer, sizeof (buffer), "cat %s | ./tests/stdin_test %s ", filename, ext) ; if ((retval = system (buffer)) != 0) { retval = WEXITSTATUS (retval) ; printf ("\n\n Line %d : pipe test returned error for file type \"%s\".\n\n", __LINE__, ext) ; @@ -162,7 +158,7 @@ pipe_write_test (const char *ext) print_test_name ("pipe_write_test", ext) ; - snprintf (buffer, sizeof (buffer), "./stdout_test %s | ./stdin_test %s ", ext, ext) ; + snprintf (buffer, sizeof (buffer), "./tests/stdout_test %s | ./tests/stdin_test %s ", ext, ext) ; if ((retval = system (buffer))) { retval = WEXITSTATUS (retval) ; printf ("\n\n Line %d : pipe test returned error file type \"%s\".\n\n", __LINE__, ext) ; @@ -341,7 +337,7 @@ pipe_test_others (FILETYPE* list1, FILETYPE* list2) test_writef_short_or_die (outfile, 0, data, PIPE_TEST_LEN, __LINE__) ; sf_close (outfile) ; - snprintf (buffer, sizeof (buffer), "cat %s | ./stdin_test %s %d ", filename, info.extension, PIPE_TEST_LEN) ; + snprintf (buffer, sizeof (buffer), "cat %s | ./tests/stdin_test %s %d ", filename, info.extension, PIPE_TEST_LEN) ; if ((retval = system (buffer)) == 0) { retval = WEXITSTATUS (retval) ; printf ("\n\n Line %d : pipe test should have returned error file type \"%s\" but didn't.\n\n", __LINE__, info.name) ; @@ -362,15 +358,5 @@ pipe_test_others (FILETYPE* list1, FILETYPE* list2) /*============================================================================== */ -static int -file_exists (const char *filename) -{ struct stat buf ; - - if (stat (filename, &buf)) - return 0 ; - - return 1 ; -} /* file_exists */ - #endif diff --git a/tests/stdio_test.c b/tests/stdio_test.c index 42e3f286..a065a040 100644 --- a/tests/stdio_test.c +++ b/tests/stdio_test.c @@ -63,7 +63,6 @@ main (void) static size_t file_length (const char *filename) ; -static int file_exists (const char *filename) ; static void stdio_test (const char *filetype) ; static const char *filetypes [] = @@ -76,9 +75,6 @@ int main (void) { int k ; - if (file_exists ("libsndfile.spec.in")) - exit_if_true (chdir ("tests") != 0, "\n Error : chdir ('tests') failed.\n") ; - for (k = 0 ; filetypes [k] ; k++) stdio_test (filetypes [k]) ; @@ -94,7 +90,7 @@ stdio_test (const char *filetype) print_test_name ("stdio_test", filetype) ; - snprintf (buffer, sizeof (buffer), "./stdout_test %s > stdio.%s", filetype, filetype) ; + snprintf (buffer, sizeof (buffer), "./tests/stdout_test %s > stdio.%s", filetype, filetype) ; if ((retval = system (buffer))) { retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ; printf ("%s : %s", buffer, (strerror (retval))) ; @@ -107,7 +103,7 @@ stdio_test (const char *filetype) exit (1) ; } ; - snprintf (buffer, sizeof (buffer), "./stdin_test %s < stdio.%s", filetype, filetype) ; + snprintf (buffer, sizeof (buffer), "./tests/stdin_test %s < stdio.%s", filetype, filetype) ; if ((retval = system (buffer))) { retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ; printf ("%s : %s", buffer, (strerror (retval))) ; @@ -141,15 +137,5 @@ file_length (const char *filename) return buf.st_size ; } /* file_length */ -static int -file_exists (const char *filename) -{ struct stat buf ; - - if (stat (filename, &buf)) - return 0 ; - - return 1 ; -} /* file_exists */ - #endif diff --git a/tests/test_wrapper.sh.in b/tests/test_wrapper.sh.in index 0fe00ca5..33bd13cc 100644 --- a/tests/test_wrapper.sh.in +++ b/tests/test_wrapper.sh.in @@ -1,6 +1,6 @@ -#!/bin/sh +#!/usr/bin/env sh -# Copyright (C) 2008-2016 Erik de Castro Lopo +# Copyright (C) 2008-2017 Erik de Castro Lopo # # All rights reserved. # @@ -34,26 +34,10 @@ HOST_TRIPLET=@HOST_TRIPLET@ PACKAGE_VERSION=@PACKAGE_VERSION@ LIB_VERSION=$(echo $PACKAGE_VERSION | sed "s/[a-z].*//") +TOP_SRCDIR=@top_srcdir@ +PYTHON=@PYTHON@ -if test -f tests/sfversion@EXEEXT@ ; then - cd tests - fi - -if test ! -f sfversion@EXEEXT@ ; then - echo "Not able to find test executables." - exit 1 - fi - -if test -f libsndfile.so.$LIB_VERSION ; then - # This will work on Linux, but not on Mac. - # Windows is already sorted out. - export LD_LIBRARY_PATH=`pwd` - if test ! -f libsndfile.so.1 ; then - ln -s libsndfile.so.$LIB_VERSION libsndfile.so.1 - fi - fi - -sfversion=$(./sfversion@EXEEXT@ | grep libsndfile | sed "s/-exp$//") +sfversion=$(./tests/sfversion@EXEEXT@ | grep libsndfile | sed "s/-exp$//") if test "$sfversion" != libsndfile-$PACKAGE_VERSION ; then echo "Error : sfversion ($sfversion) and PACKAGE_VERSION ($PACKAGE_VERSION) don't match." @@ -63,48 +47,44 @@ if test "$sfversion" != libsndfile-$PACKAGE_VERSION ; then # Force exit on errors. set -e -# Generic-tests -uname -a - # Check the header file. -sh pedantic-header-test.sh +/usr/bin/env sh tests/pedantic-header-test.sh # Need this for when we're running from files collected into the # libsndfile-testsuite-@PACKAGE_VERSION@ tarball. -if test -x test_main@EXEEXT@ ; then - echo "Running unit tests from src/ directory of source code tree." - ./test_main@EXEEXT@ - echo - echo "Running end-to-end tests from tests/ directory." - fi +echo "Running unit tests from src/ directory of source code tree." +./src/test_main@EXEEXT@ -./error_test@EXEEXT@ -./pcm_test@EXEEXT@ -./ulaw_test@EXEEXT@ -./alaw_test@EXEEXT@ -./dwvw_test@EXEEXT@ -./command_test@EXEEXT@ ver -./command_test@EXEEXT@ norm -./command_test@EXEEXT@ format -./command_test@EXEEXT@ peak -./command_test@EXEEXT@ trunc -./command_test@EXEEXT@ inst -./command_test@EXEEXT@ cue -./command_test@EXEEXT@ current_sf_info -./command_test@EXEEXT@ bext -./command_test@EXEEXT@ bextch -./command_test@EXEEXT@ chanmap -./command_test@EXEEXT@ cart -./floating_point_test@EXEEXT@ -./checksum_test@EXEEXT@ -./scale_clip_test@EXEEXT@ -./headerless_test@EXEEXT@ -./rdwr_test@EXEEXT@ -./locale_test@EXEEXT@ -./win32_ordinal_test@EXEEXT@ -./external_libs_test@EXEEXT@ -./format_check_test@EXEEXT@ -./channel_test@EXEEXT@ +echo +echo "Running end-to-end tests from tests/ directory." + +./tests/error_test@EXEEXT@ +./tests/pcm_test@EXEEXT@ +./tests/ulaw_test@EXEEXT@ +./tests/alaw_test@EXEEXT@ +./tests/dwvw_test@EXEEXT@ +./tests/command_test@EXEEXT@ ver +./tests/command_test@EXEEXT@ norm +./tests/command_test@EXEEXT@ format +./tests/command_test@EXEEXT@ peak +./tests/command_test@EXEEXT@ trunc +./tests/command_test@EXEEXT@ inst +./tests/command_test@EXEEXT@ cue +./tests/command_test@EXEEXT@ current_sf_info +./tests/command_test@EXEEXT@ bext +./tests/command_test@EXEEXT@ bextch +./tests/command_test@EXEEXT@ chanmap +./tests/command_test@EXEEXT@ cart +./tests/floating_point_test@EXEEXT@ +./tests/checksum_test@EXEEXT@ +./tests/scale_clip_test@EXEEXT@ +./tests/headerless_test@EXEEXT@ +./tests/rdwr_test@EXEEXT@ +./tests/locale_test@EXEEXT@ +./tests/win32_ordinal_test@EXEEXT@ +./tests/external_libs_test@EXEEXT@ +./tests/format_check_test@EXEEXT@ +./tests/channel_test@EXEEXT@ # The w64 G++ compiler requires an extra runtime DLL which we don't have, # so skip this test. @@ -114,7 +94,7 @@ case "$HOST_TRIPLET" in i686-w64-mingw32) ;; *) - ./cpp_test@EXEEXT@ + ./tests/cpp_test@EXEEXT@ ;; esac @@ -123,248 +103,259 @@ echo " $sfversion passed common tests." echo "----------------------------------------------------------------------" # aiff-tests -./write_read_test@EXEEXT@ aiff -./lossy_comp_test@EXEEXT@ aiff_ulaw -./lossy_comp_test@EXEEXT@ aiff_alaw -./lossy_comp_test@EXEEXT@ aiff_gsm610 -echo "==========================" -echo "./lossy_comp_test@EXEEXT@ aiff_ima" -echo "==========================" -./peak_chunk_test@EXEEXT@ aiff -./header_test@EXEEXT@ aiff -./misc_test@EXEEXT@ aiff -./string_test@EXEEXT@ aiff -./multi_file_test@EXEEXT@ aiff -./aiff_rw_test@EXEEXT@ -./chunk_test@EXEEXT@ aiff +./tests/write_read_test@EXEEXT@ aiff +./tests/lossy_comp_test@EXEEXT@ aiff_ulaw +./tests/lossy_comp_test@EXEEXT@ aiff_alaw +./tests/lossy_comp_test@EXEEXT@ aiff_gsm610 +echo "----------------------------------------------------------------------" +echo " lossy_comp_test@EXEEXT@ aiff_ima" +echo "----------------------------------------------------------------------" + +./tests/peak_chunk_test@EXEEXT@ aiff +./tests/header_test@EXEEXT@ aiff +./tests/misc_test@EXEEXT@ aiff +./tests/string_test@EXEEXT@ aiff +./tests/multi_file_test@EXEEXT@ aiff +./tests/aiff_rw_test@EXEEXT@ +./tests/chunk_test@EXEEXT@ aiff echo "----------------------------------------------------------------------" echo " $sfversion passed tests on AIFF files." echo "----------------------------------------------------------------------" # au-tests -./write_read_test@EXEEXT@ au -./lossy_comp_test@EXEEXT@ au_ulaw -./lossy_comp_test@EXEEXT@ au_alaw -./lossy_comp_test@EXEEXT@ au_g721 -./lossy_comp_test@EXEEXT@ au_g723 -./header_test@EXEEXT@ au -./misc_test@EXEEXT@ au -./multi_file_test@EXEEXT@ au +./tests/write_read_test@EXEEXT@ au +./tests/lossy_comp_test@EXEEXT@ au_ulaw +./tests/lossy_comp_test@EXEEXT@ au_alaw +./tests/lossy_comp_test@EXEEXT@ au_g721 +./tests/lossy_comp_test@EXEEXT@ au_g723 +./tests/header_test@EXEEXT@ au +./tests/misc_test@EXEEXT@ au +./tests/multi_file_test@EXEEXT@ au echo "----------------------------------------------------------------------" echo " $sfversion passed tests on AU files." echo "----------------------------------------------------------------------" # caf-tests -./write_read_test@EXEEXT@ caf -./lossy_comp_test@EXEEXT@ caf_ulaw -./lossy_comp_test@EXEEXT@ caf_alaw -./header_test@EXEEXT@ caf -./peak_chunk_test@EXEEXT@ caf -./misc_test@EXEEXT@ caf -./chunk_test@EXEEXT@ caf -./string_test@EXEEXT@ caf -./long_read_write_test@EXEEXT@ alac +./tests/write_read_test@EXEEXT@ caf +./tests/lossy_comp_test@EXEEXT@ caf_ulaw +./tests/lossy_comp_test@EXEEXT@ caf_alaw +./tests/header_test@EXEEXT@ caf +./tests/peak_chunk_test@EXEEXT@ caf +./tests/misc_test@EXEEXT@ caf +./tests/chunk_test@EXEEXT@ caf +./tests/string_test@EXEEXT@ caf +./tests/long_read_write_test@EXEEXT@ alac echo "----------------------------------------------------------------------" echo " $sfversion passed tests on CAF files." echo "----------------------------------------------------------------------" # wav-tests -./write_read_test@EXEEXT@ wav -./lossy_comp_test@EXEEXT@ wav_pcm -./lossy_comp_test@EXEEXT@ wav_ima -./lossy_comp_test@EXEEXT@ wav_msadpcm -./lossy_comp_test@EXEEXT@ wav_ulaw -./lossy_comp_test@EXEEXT@ wav_alaw -./lossy_comp_test@EXEEXT@ wav_gsm610 -./lossy_comp_test@EXEEXT@ wav_g721 -./peak_chunk_test@EXEEXT@ wav -./header_test@EXEEXT@ wav -./misc_test@EXEEXT@ wav -./string_test@EXEEXT@ wav -./multi_file_test@EXEEXT@ wav -./chunk_test@EXEEXT@ wav +./tests/write_read_test@EXEEXT@ wav +./tests/lossy_comp_test@EXEEXT@ wav_pcm +./tests/lossy_comp_test@EXEEXT@ wav_ima +./tests/lossy_comp_test@EXEEXT@ wav_msadpcm +./tests/lossy_comp_test@EXEEXT@ wav_ulaw +./tests/lossy_comp_test@EXEEXT@ wav_alaw +./tests/lossy_comp_test@EXEEXT@ wav_gsm610 +./tests/lossy_comp_test@EXEEXT@ wav_g721 +./tests/peak_chunk_test@EXEEXT@ wav +./tests/header_test@EXEEXT@ wav +./tests/misc_test@EXEEXT@ wav +./tests/string_test@EXEEXT@ wav +./tests/multi_file_test@EXEEXT@ wav +./tests/chunk_test@EXEEXT@ wav echo "----------------------------------------------------------------------" echo " $sfversion passed tests on WAV files." echo "----------------------------------------------------------------------" # w64-tests -./write_read_test@EXEEXT@ w64 -./lossy_comp_test@EXEEXT@ w64_ima -./lossy_comp_test@EXEEXT@ w64_msadpcm -./lossy_comp_test@EXEEXT@ w64_ulaw -./lossy_comp_test@EXEEXT@ w64_alaw -./lossy_comp_test@EXEEXT@ w64_gsm610 -./header_test@EXEEXT@ w64 -./misc_test@EXEEXT@ w64 +./tests/write_read_test@EXEEXT@ w64 +./tests/lossy_comp_test@EXEEXT@ w64_ima +./tests/lossy_comp_test@EXEEXT@ w64_msadpcm +./tests/lossy_comp_test@EXEEXT@ w64_ulaw +./tests/lossy_comp_test@EXEEXT@ w64_alaw +./tests/lossy_comp_test@EXEEXT@ w64_gsm610 +./tests/header_test@EXEEXT@ w64 +./tests/misc_test@EXEEXT@ w64 echo "----------------------------------------------------------------------" echo " $sfversion passed tests on W64 files." echo "----------------------------------------------------------------------" # rf64-tests -./write_read_test@EXEEXT@ rf64 -./header_test@EXEEXT@ rf64 -./misc_test@EXEEXT@ rf64 -./string_test@EXEEXT@ rf64 -./peak_chunk_test@EXEEXT@ rf64 -./chunk_test@EXEEXT@ rf64 +./tests/write_read_test@EXEEXT@ rf64 +./tests/header_test@EXEEXT@ rf64 +./tests/misc_test@EXEEXT@ rf64 +./tests/string_test@EXEEXT@ rf64 +./tests/peak_chunk_test@EXEEXT@ rf64 +./tests/chunk_test@EXEEXT@ rf64 echo "----------------------------------------------------------------------" echo " $sfversion passed tests on RF64 files." echo "----------------------------------------------------------------------" # raw-tests -./write_read_test@EXEEXT@ raw -./lossy_comp_test@EXEEXT@ raw_ulaw -./lossy_comp_test@EXEEXT@ raw_alaw -./lossy_comp_test@EXEEXT@ raw_gsm610 -./lossy_comp_test@EXEEXT@ vox_adpcm -./raw_test@EXEEXT@ +./tests/write_read_test@EXEEXT@ raw +./tests/lossy_comp_test@EXEEXT@ raw_ulaw +./tests/lossy_comp_test@EXEEXT@ raw_alaw +./tests/lossy_comp_test@EXEEXT@ raw_gsm610 +./tests/lossy_comp_test@EXEEXT@ vox_adpcm +./tests/raw_test@EXEEXT@ echo "----------------------------------------------------------------------" echo " $sfversion passed tests on RAW (header-less) files." echo "----------------------------------------------------------------------" # paf-tests -./write_read_test@EXEEXT@ paf -./header_test@EXEEXT@ paf -./misc_test@EXEEXT@ paf +./tests/write_read_test@EXEEXT@ paf +./tests/header_test@EXEEXT@ paf +./tests/misc_test@EXEEXT@ paf echo "----------------------------------------------------------------------" echo " $sfversion passed tests on PAF files." echo "----------------------------------------------------------------------" # svx-tests -./write_read_test@EXEEXT@ svx -./header_test@EXEEXT@ svx -./misc_test@EXEEXT@ svx +./tests/write_read_test@EXEEXT@ svx +./tests/header_test@EXEEXT@ svx +./tests/misc_test@EXEEXT@ svx echo "----------------------------------------------------------------------" echo " $sfversion passed tests on SVX files." echo "----------------------------------------------------------------------" # nist-tests -./write_read_test@EXEEXT@ nist -./lossy_comp_test@EXEEXT@ nist_ulaw -./lossy_comp_test@EXEEXT@ nist_alaw -./header_test@EXEEXT@ nist -./misc_test@EXEEXT@ nist +./tests/write_read_test@EXEEXT@ nist +./tests/lossy_comp_test@EXEEXT@ nist_ulaw +./tests/lossy_comp_test@EXEEXT@ nist_alaw +./tests/header_test@EXEEXT@ nist +./tests/misc_test@EXEEXT@ nist echo "----------------------------------------------------------------------" echo " $sfversion passed tests on NIST files." echo "----------------------------------------------------------------------" # ircam-tests -./write_read_test@EXEEXT@ ircam -./lossy_comp_test@EXEEXT@ ircam_ulaw -./lossy_comp_test@EXEEXT@ ircam_alaw -./header_test@EXEEXT@ ircam -./misc_test@EXEEXT@ ircam +./tests/write_read_test@EXEEXT@ ircam +./tests/lossy_comp_test@EXEEXT@ ircam_ulaw +./tests/lossy_comp_test@EXEEXT@ ircam_alaw +./tests/header_test@EXEEXT@ ircam +./tests/misc_test@EXEEXT@ ircam echo "----------------------------------------------------------------------" echo " $sfversion passed tests on IRCAM files." echo "----------------------------------------------------------------------" # voc-tests -./write_read_test@EXEEXT@ voc -./lossy_comp_test@EXEEXT@ voc_ulaw -./lossy_comp_test@EXEEXT@ voc_alaw -./header_test@EXEEXT@ voc -./misc_test@EXEEXT@ voc +./tests/write_read_test@EXEEXT@ voc +./tests/lossy_comp_test@EXEEXT@ voc_ulaw +./tests/lossy_comp_test@EXEEXT@ voc_alaw +./tests/header_test@EXEEXT@ voc +./tests/misc_test@EXEEXT@ voc echo "----------------------------------------------------------------------" echo " $sfversion passed tests on VOC files." echo "----------------------------------------------------------------------" # mat4-tests -./write_read_test@EXEEXT@ mat4 -./header_test@EXEEXT@ mat4 -./misc_test@EXEEXT@ mat4 +./tests/write_read_test@EXEEXT@ mat4 +./tests/header_test@EXEEXT@ mat4 +./tests/misc_test@EXEEXT@ mat4 echo "----------------------------------------------------------------------" echo " $sfversion passed tests on MAT4 files." echo "----------------------------------------------------------------------" # mat5-tests -./write_read_test@EXEEXT@ mat5 -./header_test@EXEEXT@ mat5 -./misc_test@EXEEXT@ mat5 +./tests/write_read_test@EXEEXT@ mat5 +./tests/header_test@EXEEXT@ mat5 +./tests/misc_test@EXEEXT@ mat5 echo "----------------------------------------------------------------------" echo " $sfversion passed tests on MAT5 files." echo "----------------------------------------------------------------------" # pvf-tests -./write_read_test@EXEEXT@ pvf -./header_test@EXEEXT@ pvf -./misc_test@EXEEXT@ pvf +./tests/write_read_test@EXEEXT@ pvf +./tests/header_test@EXEEXT@ pvf +./tests/misc_test@EXEEXT@ pvf echo "----------------------------------------------------------------------" echo " $sfversion passed tests on PVF files." echo "----------------------------------------------------------------------" # xi-tests -./lossy_comp_test@EXEEXT@ xi_dpcm +./tests/lossy_comp_test@EXEEXT@ xi_dpcm echo "----------------------------------------------------------------------" echo " $sfversion passed tests on XI files." echo "----------------------------------------------------------------------" # htk-tests -./write_read_test@EXEEXT@ htk -./header_test@EXEEXT@ htk -./misc_test@EXEEXT@ htk +./tests/write_read_test@EXEEXT@ htk +./tests/header_test@EXEEXT@ htk +./tests/misc_test@EXEEXT@ htk echo "----------------------------------------------------------------------" echo " $sfversion passed tests on HTK files." echo "----------------------------------------------------------------------" # avr-tests -./write_read_test@EXEEXT@ avr -./header_test@EXEEXT@ avr -./misc_test@EXEEXT@ avr +./tests/write_read_test@EXEEXT@ avr +./tests/header_test@EXEEXT@ avr +./tests/misc_test@EXEEXT@ avr echo "----------------------------------------------------------------------" echo " $sfversion passed tests on AVR files." echo "----------------------------------------------------------------------" # sds-tests -./write_read_test@EXEEXT@ sds -./header_test@EXEEXT@ sds -./misc_test@EXEEXT@ sds +./tests/write_read_test@EXEEXT@ sds +./tests/header_test@EXEEXT@ sds +./tests/misc_test@EXEEXT@ sds echo "----------------------------------------------------------------------" echo " $sfversion passed tests on SDS files." echo "----------------------------------------------------------------------" # sd2-tests -./write_read_test@EXEEXT@ sd2 +./tests/write_read_test@EXEEXT@ sd2 echo "----------------------------------------------------------------------" echo " $sfversion passed tests on SD2 files." echo "----------------------------------------------------------------------" # wve-tests -./lossy_comp_test@EXEEXT@ wve +./tests/lossy_comp_test@EXEEXT@ wve echo "----------------------------------------------------------------------" echo " $sfversion passed tests on WVE files." echo "----------------------------------------------------------------------" # mpc2k-tests -./write_read_test@EXEEXT@ mpc2k -./header_test@EXEEXT@ mpc2k -./misc_test@EXEEXT@ mpc2k +./tests/write_read_test@EXEEXT@ mpc2k +./tests/header_test@EXEEXT@ mpc2k +./tests/misc_test@EXEEXT@ mpc2k echo "----------------------------------------------------------------------" echo " $sfversion passed tests on MPC 2000 files." echo "----------------------------------------------------------------------" # flac-tests -./write_read_test@EXEEXT@ flac -./compression_size_test@EXEEXT@ flac -./string_test@EXEEXT@ flac -./header_test@EXEEXT@ flac +./tests/write_read_test@EXEEXT@ flac +./tests/compression_size_test@EXEEXT@ flac +./tests/string_test@EXEEXT@ flac +./tests/header_test@EXEEXT@ flac echo "----------------------------------------------------------------------" echo " $sfversion passed tests on FLAC files." echo "----------------------------------------------------------------------" # vorbis-tests -./ogg_test@EXEEXT@ -./compression_size_test@EXEEXT@ vorbis -./lossy_comp_test@EXEEXT@ ogg_vorbis -./string_test@EXEEXT@ ogg -./misc_test@EXEEXT@ ogg +./tests/ogg_test@EXEEXT@ +./tests/compression_size_test@EXEEXT@ vorbis +./tests/lossy_comp_test@EXEEXT@ ogg_vorbis +./tests/string_test@EXEEXT@ ogg +./tests/misc_test@EXEEXT@ ogg echo "----------------------------------------------------------------------" echo " $sfversion passed tests on OGG/VORBIS files." echo "----------------------------------------------------------------------" # io-tests -./stdio_test@EXEEXT@ -./pipe_test@EXEEXT@ -./virtual_io_test@EXEEXT@ +./tests/stdio_test@EXEEXT@ +./tests/pipe_test@EXEEXT@ +./tests/virtual_io_test@EXEEXT@ echo "----------------------------------------------------------------------" echo " $sfversion passed stdio/pipe/vio tests." echo "----------------------------------------------------------------------" + +"${PYTHON}" "tests/${TOP_SRCDIR}/src/binheader_writef_check.py" "tests/${TOP_SRCDIR}/src"/*.c +echo "----------------------------------------------------------------------" +echo " $sfversion passed binary header tests." +echo "----------------------------------------------------------------------" + +"${PYTHON}" "tests/${TOP_SRCDIR}/programs/test-sndfile-metadata-set.py" "${HOST_TRIPLET}" +echo "----------------------------------------------------------------------" +echo " $sfversion passed sndfile metadata tests." +echo "----------------------------------------------------------------------"