Some factorization

This commit is contained in:
Christophe de Dinechin 2017-05-03 14:47:18 +02:00
parent 26dedc59e1
commit 5ee5fafc3f
3 changed files with 9 additions and 4 deletions

View File

@ -37,7 +37,8 @@ CONFIG= HAVE_<stdio.h> \
HAVE_<iostream> \ HAVE_<iostream> \
HAVE_clearenv \ HAVE_clearenv \
HAVE_libm \ HAVE_libm \
HAVE_liboony HAVE_liboony \
HAVE_sbrk
# Define what to test # Define what to test
TESTS=product count-characters TESTS=product count-characters

View File

@ -84,6 +84,9 @@ AS_DEPEND= $(CC) $(CPPFLAGS) $(CPPFLAGS_$*) -MM -MP -MF $@ -MT $(@:.d=) $<
# Configuration checks # Configuration checks
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
CC_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_$*_H' $$($(CC) $(CFLAGS) $(CFLAGS_CONFIG_$*) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | tr '[:lower:]' '[:upper:]' | sed -e 's|[^[:alnum:]]|_|g' -e 's|_DEFINE_\(.*\)_0|/* \#undef \1 */|g' -e 's|_DEFINE_\(.*\)_1|\#define \1 1|g' > "$@" CONFIG_UPPER=$(shell echo -n "$*" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_')
CXX_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_$*' $$($(CXX) $(CXXFLAGS) $(CXXFLAGS_CONFIG_$*) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | tr '[:lower:]' '[:upper:]' | sed -e 's|[^[:alnum:]]|_|g' -e 's|_DEFINE_\(.*\)_0|/* \#undef \1 */|g' -e 's|_DEFINE_\(.*\)_1|\#define \1 1|g' > "$@" CONFIG_FLAGS=$(shell grep '// [A-Z]*FLAGS=' "$<" | sed -e 's|// [A-Z]*FLAGS=||g')
LIB_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_LIB$*' $$($(CC) $(CCFLAGS) $(CXXFLAGS_CONFIG_$*) -l$* "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | tr '[:lower:]' '[:upper:]' | sed -e 's|[^[:alnum:]]|_|g' -e 's|_DEFINE_\(.*\)_0|/* \#undef \1 */|g' -e 's|_DEFINE_\(.*\)_1|\#define \1 1|g' > "$@"
CC_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define' HAVE_$(CONFIG_UPPER)_H $(shell $(CC) $(CFLAGS) $(CFLAGS_CONFIG_$*) $(CONFIG_FLAGS) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe > "$<".out 2>&1 && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@"
CXX_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define' HAVE_$(CONFIG_UPPER) $(shell $(CXX) $(CXXFLAGS) $(CXXFLAGS_CONFIG_$*) $(CONFIG_FLAGS) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe > "$<".out 2>&1 && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@"
LIB_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_LIB'$(CONFIG_UPPER) $$($(CC) $(CCFLAGS) $(CFLAGS_CONFIG_$*) -l$* "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@"

View File

@ -7,3 +7,4 @@
/* #undef HAVE_CLEARENV_H */ /* #undef HAVE_CLEARENV_H */
#define HAVE_LIBM 1 #define HAVE_LIBM 1
/* #undef HAVE_LIBOONY */ /* #undef HAVE_LIBOONY */
#define HAVE_SBRK_H 1