Skip to content

Commit

Permalink
Add HAVE_CONFIG_H def. this is useful when embedding the library in o…
Browse files Browse the repository at this point in the history
…ther libs/using the code directly.
  • Loading branch information
talaviram committed Aug 7, 2019
1 parent cfb5dbd commit bdbd1ed
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 19 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include(CheckSymbolExists)
include(CheckTypeSize)
include(CMakePushCheckState)
include(ClipMode)
add_definitions(-DHAVE_CONFIG_H)

set(SAMPLERATE_SRC
${PROJECT_SOURCE_DIR}/src/samplerate.c
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ CLEANFILES = src/src_sinc.s
# MinGW requires -no-undefined if a DLL is to be built.
src_libsamplerate_la_LDFLAGS = -no-undefined -version-info $(SHARED_VERSION_INFO) $(SHLIB_VERSION_ARG)
src_libsamplerate_la_SOURCES = src/samplerate.c src/src_sinc.c src/src_zoh.c src/src_linear.c \
src/common.h src/float_cast.h src/fastest_coeffs.h src/mid_qual_coeffs.h src/high_qual_coeffs.h
src/common.h src/float_cast.h src/fastest_coeffs.h src/mid_qual_coeffs.h src/high_qual_coeffs.h \
src/src_config.h

#-------------------------------------------------------------------------------
# An extra check for bad asm.
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ dnl ============================================================================
dnl Compiler stuff.

AS_IF([test "x$enable_flags_setting" = "xyes"], [
AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CFLAGS])
AX_APPEND_COMPILE_FLAGS([-DHAVE_CONFIG_H -O2 -pipe], [CFLAGS])
AS_CASE([${host_os}],
[darwin*], [
Expand Down
2 changes: 1 addition & 1 deletion examples/audio_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string.h>
#include <unistd.h>

#include <config.h>
#include "src_config.h"

#include "audio_out.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/timewarp-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#include "config.h"
#include "src_config.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/varispeed-play.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <unistd.h>
#include <string.h>

#include "config.h"
#include "src_config.h"

#include <float_cast.h>

Expand Down
2 changes: 1 addition & 1 deletion src/float_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
** long int lrint (double x) ;
*/

#include "config.h"
#include "src_config.h"

/*
** The presence of the required functions are detected during the configure
Expand Down
2 changes: 1 addition & 1 deletion src/samplerate.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdlib.h>
#include <string.h>

#include "config.h"
#include "src_config.h"

#include "samplerate.h"
#include "float_cast.h"
Expand Down
12 changes: 12 additions & 0 deletions src/src_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
** Copyright (c) 1999-2016, Erik de Castro Lopo <erikd@mega-nerd.com>
** All rights reserved.
**
** This code is released under 2-clause BSD license. Please see the
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

// allow config.h to be optional
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
2 changes: 1 addition & 1 deletion src/src_linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdlib.h>
#include <string.h>

#include "config.h"
#include "src_config.h"
#include "float_cast.h"
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion src/src_sinc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdlib.h>
#include <string.h>

#include "config.h"
#include "src_config.h"
#include "float_cast.h"
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion src/src_zoh.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdlib.h>
#include <string.h>

#include "config.h"
#include "src_config.h"
#include "float_cast.h"
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/calc_snr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#include "config.h"
#include "src_config.h"

#include "util.h"

Expand Down
2 changes: 1 addition & 1 deletion tests/callback_hang_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#include "config.h"
#include "src_config.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion tests/multi_channel_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#include "config.h"
#include "src_config.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion tests/multichan_throughput_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <samplerate.h>

#include "config.h"
#include "src_config.h"

#include "util.h"
#include "float_cast.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/snr_bw_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#include "config.h"
#include "src_config.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion tests/src-evaluate.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <string.h>
#include <ctype.h>

#include "config.h"
#include "src_config.h"

#if (HAVE_FFTW3 && HAVE_SNDFILE && HAVE_SYS_TIMES_H)

Expand Down
2 changes: 1 addition & 1 deletion tests/throughput_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <samplerate.h>

#include "config.h"
#include "src_config.h"

#include "util.h"
#include "float_cast.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#include "config.h"
#include "src_config.h"

#define ABS(a) (((a) < 0) ? - (a) : (a))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
Expand Down
2 changes: 1 addition & 1 deletion tests/varispeed_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING
*/

#include "config.h"
#include "src_config.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down

0 comments on commit bdbd1ed

Please sign in to comment.