Append output of executing the test program, so that we can add other #define's

The sbrk example shows the result of sbrk(0) first run.
This commit is contained in:
Christophe de Dinechin 2017-05-03 15:19:43 +02:00
parent 5ee5fafc3f
commit 0f1266d53b
3 changed files with 10 additions and 12 deletions

View File

@ -87,6 +87,6 @@ AS_DEPEND= $(CC) $(CPPFLAGS) $(CPPFLAGS_$*) -MM -MP -MF $@ -MT $(@:.d=) $<
CONFIG_UPPER=$(shell echo -n "$*" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_')
CONFIG_FLAGS=$(shell grep '// [A-Z]*FLAGS=' "$<" | sed -e 's|// [A-Z]*FLAGS=||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' > "$@"
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 && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@"; [ -f "$<".out ] && cat >> "$@" "$<".out; true
CXX_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define' HAVE_$(CONFIG_UPPER) $(shell $(CXX) $(CXXFLAGS) $(CXXFLAGS_CONFIG_$*) $(CONFIG_FLAGS) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe > "$<".out && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@"; [ -f "$<".out ] && cat >> "$@" "$<".out; true
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

@ -1,10 +0,0 @@
#define HAVE_STDIO_H 1
#define HAVE_UNISTD_H 1
/* #undef HAVE_NONEXISTENT_H */
#define HAVE_SYS_TIME_H 1
/* #undef HAVE_SYS_IMPROBABLE_H */
#define HAVE_IOSTREAM 1
/* #undef HAVE_CLEARENV_H */
#define HAVE_LIBM 1
/* #undef HAVE_LIBOONY */
#define HAVE_SBRK_H 1

8
config/check_sbrk.c Normal file
View File

@ -0,0 +1,8 @@
#include <unistd.h>
#include <stdio.h>
int main()
{
printf("#define CONFIG_SBRK_BASE ((void *) %p)\n", sbrk(0));
return 0;
}