diff --git a/build/config.mk b/build/config.mk index 1a1c1f89..5d4ed62a 100644 --- a/build/config.mk +++ b/build/config.mk @@ -37,14 +37,4 @@ all default: $(DEFAULT_BUILD) VERSION=\"1.1.0\" -ORDINALS_H = $(topdir)/include/FLAC/ordinals.h - -$(ORDINALS_H): $(ORDINALS_H).in - sed \ - -e "s/@FLaC__SIZE16@/short/g" \ - -e "s/@FLaC__SIZE32@/int/g" \ - -e "s/@FLaC__SIZE64@/long long/g" \ - -e "s/@FLaC__USIZE16@/unsigned short/g" \ - -e "s/@FLaC__USIZE32@/unsigned int/g" \ - -e "s/@FLaC__USIZE64@/unsigned long long/g" \ - $< > $@ +CONFIG_CFLAGS=-DHAVE_INTTYPES_H diff --git a/build/exe.mk b/build/exe.mk index 49dfd1b4..15093814 100644 --- a/build/exe.mk +++ b/build/exe.mk @@ -45,9 +45,9 @@ PROGRAM = $(BINPATH)/$(PROGRAM_NAME) DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME) RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME) -debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) -valgrind: CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) -release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) LFLAGS = -L$(LIBPATH) diff --git a/build/lib.mk b/build/lib.mk index 81af6646..9da9af11 100644 --- a/build/lib.mk +++ b/build/lib.mk @@ -55,9 +55,9 @@ else LINKD = $(CC) -shared endif -debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) -valgrind: CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) -release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) LFLAGS = -L$(LIBPATH) diff --git a/build/project_builder_prebuild_phase.sh b/build/project_builder_prebuild_phase.sh index 54747021..27ba77dd 100755 --- a/build/project_builder_prebuild_phase.sh +++ b/build/project_builder_prebuild_phase.sh @@ -1,2 +1 @@ -cd include/FLAC -sed -e 's/@FLaC__SIZE16@/short/g' -e 's/@FLaC__SIZE32@/int/g' -e 's/@FLaC__SIZE64@/long long/g' -e 's/@FLaC__USIZE16@/unsigned short/g' -e 's/@FLaC__USIZE32@/unsigned int/g' -e 's/@FLaC__USIZE64@/unsigned long long/g' ordinals.h.in > ordinals.h +true diff --git a/configure.in b/configure.in index 3a480cde..b0070b83 100644 --- a/configure.in +++ b/configure.in @@ -304,56 +304,6 @@ if test -n "$NASM" ; then AC_DEFINE(FLAC__HAS_NASM) fi -dnl Check for type sizes - -AC_CHECK_SIZEOF(short) -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(long) -AC_CHECK_SIZEOF(long long) - -case 2 in - $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";; - $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";; -esac - -case 4 in - $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";; - $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";; - $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";; -esac - -case 8 in - $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";; - $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";; - $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";; -esac - -if test -z "$FLaC__SIZE16"; then - AC_MSG_ERROR(No 16 bit type found on this platform!) -fi -if test -z "$FLaC__USIZE16"; then - AC_MSG_ERROR(No unsigned 16 bit type found on this platform!) -fi -if test -z "$FLaC__SIZE32"; then - AC_MSG_ERROR(No 32 bit type found on this platform!) -fi -if test -z "$FLaC__USIZE32"; then - AC_MSG_ERROR(No unsigned 32 bit type found on this platform!) -fi -if test -z "$FLaC__SIZE64"; then - AC_MSG_WARN(No 64 bit type found on this platform!) -fi -if test -z "$FLaC__USIZE64"; then - AC_MSG_ERROR(No unsigned 64 bit type found on this platform!) -fi - -AC_SUBST(FLaC__SIZE16) -AC_SUBST(FLaC__USIZE16) -AC_SUBST(FLaC__SIZE32) -AC_SUBST(FLaC__USIZE32) -AC_SUBST(FLaC__SIZE64) -AC_SUBST(FLaC__USIZE64) - OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include' if test x$debug = xtrue; then OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -g -O0 -DDEBUG" @@ -424,7 +374,6 @@ AC_OUTPUT( \ src/test_streams/Makefile \ include/Makefile \ include/FLAC/Makefile \ - include/FLAC/ordinals.h \ include/FLAC++/Makefile \ include/OggFLAC/Makefile \ include/OggFLAC++/Makefile \ diff --git a/flac.pbproj/project.pbxproj b/flac.pbproj/project.pbxproj index 0d768799..ab02de45 100644 --- a/flac.pbproj/project.pbxproj +++ b/flac.pbproj/project.pbxproj @@ -844,7 +844,7 @@ buildSettings = { HEADER_SEARCH_PATHS = include; OPTIMIZATION_CFLAGS = "-O3"; - OTHER_CFLAGS = "-DVERSION=\\\\\\\"1.1.0\\\\\\\""; + OTHER_CFLAGS = "-DVERSION=\\\\\\\"1.1.0\\\\\\\" -DHAVE_INTTYPES_H"; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; PRODUCT_NAME = flac; @@ -1721,7 +1721,7 @@ buildSettings = { HEADER_SEARCH_PATHS = include; OPTIMIZATION_CFLAGS = "-O3"; - OTHER_CFLAGS = "-DVERSION=\\\\\\\"1.1.0\\\\\\\""; + OTHER_CFLAGS = "-DVERSION=\\\\\\\"1.1.0\\\\\\\" -DHAVE_INTTYPES_H"; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; PRODUCT_NAME = metaflac; diff --git a/include/FLAC/ordinals.h.in b/include/FLAC/ordinals.h similarity index 80% rename from include/FLAC/ordinals.h.in rename to include/FLAC/ordinals.h index 697286e7..f1fb8cf8 100644 --- a/include/FLAC/ordinals.h.in +++ b/include/FLAC/ordinals.h @@ -32,18 +32,23 @@ #ifndef FLAC__ORDINALS_H #define FLAC__ORDINALS_H -#ifdef true -#undef true -#endif -#ifdef false -#undef false -#endif -#ifndef __cplusplus -#define true 1 -#define false 0 +#ifdef HAVE_CONFIG_H +#include #endif -typedef int FLAC__bool; +#ifdef HAVE_INTTYPES_H +#include +#elif defined(HAVE_U_INT) +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#define uint8_t u_int8_t +#define uint16_t u_int16_t +#define uint32_t u_int32_t +#define uint64_t u_int64_t +#elif !defined(_MSC_VER) +#error Unable to find fixed-size data types +#endif typedef signed char FLAC__int8; typedef unsigned char FLAC__uint8; @@ -56,15 +61,28 @@ typedef unsigned __int16 FLAC__uint16; typedef unsigned __int32 FLAC__uint32; typedef unsigned __int64 FLAC__uint64; #else -typedef @FLaC__SIZE16@ FLAC__int16; -typedef @FLaC__SIZE32@ FLAC__int32; -typedef @FLaC__SIZE64@ FLAC__int64; -typedef @FLaC__USIZE16@ FLAC__uint16; -typedef @FLaC__USIZE32@ FLAC__uint32; -typedef @FLaC__USIZE64@ FLAC__uint64; +typedef int16_t FLAC__int16; +typedef int32_t FLAC__int32; +typedef int64_t FLAC__int64; +typedef uint16_t FLAC__uint16; +typedef uint32_t FLAC__uint32; +typedef uint64_t FLAC__uint64; #endif +typedef int FLAC__bool; + typedef FLAC__uint8 FLAC__byte; typedef float FLAC__real; +#ifdef true +#undef true +#endif +#ifdef false +#undef false +#endif +#ifndef __cplusplus +#define true 1 +#define false 0 +#endif + #endif diff --git a/src/libFLAC/libFLAC_dynamic.dsp b/src/libFLAC/libFLAC_dynamic.dsp index f6d1d1e4..20f69538 100644 --- a/src/libFLAC/libFLAC_dynamic.dsp +++ b/src/libFLAC/libFLAC_dynamic.dsp @@ -375,34 +375,7 @@ SOURCE=..\..\include\FLAC\metadata.h # End Source File # Begin Source File -SOURCE=..\..\include\FLAC\ordinals.h.in - -!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" - -USERDEP__ORDIN="..\..\include\FLAC\ordinals.h.in" -# Begin Custom Build -InputDir=..\..\include\FLAC -InputPath=..\..\include\FLAC\ordinals.h.in - -"$(InputDir)\ordinals.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy "$(InputDir)\ordinals.h.in" "$(InputDir)\ordinals.h" - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" - -USERDEP__ORDIN="..\..\include\FLAC\ordinals.h.in" -# Begin Custom Build -InputDir=..\..\include\FLAC -InputPath=..\..\include\FLAC\ordinals.h.in - -"$(InputDir)\ordinals.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy "$(InputDir)\ordinals.h.in" "$(InputDir)\ordinals.h" - -# End Custom Build - -!ENDIF - +SOURCE=..\..\include\FLAC\ordinals.h # End Source File # Begin Source File diff --git a/src/libFLAC/libFLAC_static.dsp b/src/libFLAC/libFLAC_static.dsp index efa6099c..fd0adaf9 100644 --- a/src/libFLAC/libFLAC_static.dsp +++ b/src/libFLAC/libFLAC_static.dsp @@ -368,34 +368,7 @@ SOURCE=..\..\include\FLAC\metadata.h # End Source File # Begin Source File -SOURCE=..\..\include\FLAC\ordinals.h.in - -!IF "$(CFG)" == "libFLAC_static - Win32 Release" - -USERDEP__ORDIN="..\..\include\FLAC\ordinals.h.in" -# Begin Custom Build -InputDir=..\..\include\FLAC -InputPath=..\..\include\FLAC\ordinals.h.in - -"$(InputDir)\ordinals.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy "$(InputDir)\ordinals.h.in" "$(InputDir)\ordinals.h" - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" - -USERDEP__ORDIN="..\..\include\FLAC\ordinals.h.in" -# Begin Custom Build -InputDir=..\..\include\FLAC -InputPath=..\..\include\FLAC\ordinals.h.in - -"$(InputDir)\ordinals.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy "$(InputDir)\ordinals.h.in" "$(InputDir)\ordinals.h" - -# End Custom Build - -!ENDIF - +SOURCE=..\..\include\FLAC\ordinals.h # End Source File # Begin Source File