summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project/config/cfgdefs.sh109
-rw-r--r--project/pycompile.mk3
2 files changed, 56 insertions, 56 deletions
diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh
index 81a9912..7738fda 100644
--- a/project/config/cfgdefs.sh
+++ b/project/config/cfgdefs.sh
@@ -10,10 +10,15 @@
# finally, cfgdefs.sh may update the contents of the
# build-time-generated cfgdefs.mk.
+
# cfgdefs helper functions
. "$mb_project_dir/project/config/cfghost.sh"
+# sofort's config test framework
+. "$mb_project_dir/sofort/cfgtest.sh"
+
+
# no custom switches yet
for arg ; do
case "$arg" in
@@ -30,78 +35,72 @@ cfgdefs_set_cfghost_flavors()
cfghost_set_native_cfghost
}
-# cfghost
-cfgdefs_set_cfghost_flavors
-# system tests: target
-mb_cfgdefs_cc=$(make -s -f Makefile.tmp .display-cc)
-mb_cfgdefs_cflags=$(make -s -f Makefile.tmp .display-cflags)
+cfgdefs_perform_target_tests()
+{
+ # init
+ cfgtest_target_section
-printf '\n\n#system tests: target\n' >> $mb_pwd/cfgdefs.mk
+ # headers
+ cfgtest_header_absence 'stropts.h'
-# <stropts.h>
-$mb_cfgdefs_cc $mb_cfgdefs_cflags -E -xc - \
- --include=stropts.h < /dev/null \
- > /dev/null 2>/dev/null || \
- printf 'CFLAGS_CONFIG\t\t+= -DHAVE_NO_STROPTS_H\n' \
- >> $mb_pwd/cfgdefs.mk
+ # openssl
+ mb_cfgtest_headers='openssl/x509.h'
-# openssl 1.1 or newer or a compatible libressl
-printf 'void * addr = &X509_NAME_ENTRY_set;' \
- | $mb_cfgdefs_cc $mb_cfgdefs_cflags \
- --include=openssl/x509.h -S -xc - -o - \
- > /dev/null 2>/dev/null && \
- printf 'CFLAGS_CONFIG\t\t+= -DOPENSSL_VERSION_1_1\n' \
- >> $mb_pwd/cfgdefs.mk
+ cfgtest_interface_presence 'X509_NAME_ENTRY_set' \
+ && cfgtest_cflags_append '-DOPENSSL_VERSION_1_1'
-# ncurses: python refers to the internals of typedef struct _win_st WINDOW
-printf 'CFLAGS_CONFIG\t\t+= -DNCURSES_INTERNALS\n' >> $mb_pwd/cfgdefs.mk
+ # ncurses: python refers to members of typedef struct _win_st WINDOW
+ cfgtest_cflags_append '-DNCURSES_INTERNALS'
-# ncurses: tinfo
-mb_ncurses_libs="-lpanelw -lncursesw"
+ # ncurses libs
+ mb_ncurses_libs='-lpanelw -lncursesw'
+ mb_ncurses_tinfo='-ltinfo'
-if [ $mb_disable_shared = 'yes' ]; then
- printf 'int main(void){return 0;}' \
- | $mb_cfgdefs_cc $mb_cfgdefs_cflags \
- -ltinfo -o a.out -xc - \
- < /dev/null 2>/dev/null \
- && mb_ncurses_libs="$mb_ncurses_libs -ltinfo"
-else
- $mb_cfgdefs_cc $mb_cfgdefs_cflags \
- -shared -ltinfo -o a.out -xc - \
- < /dev/null 2>/dev/null \
- && mb_ncurses_libs="$mb_ncurses_libs -ltinfo"
-fi
+ cfgtest_library_presence $mb_ncurses_tinfo \
+ && mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo"
-printf 'LDFLAGS_NCURSES_LIBS\t+= %s\n' "$mb_ncurses_libs" \
- >> $mb_pwd/cfgdefs.mk
+ mb_cfgtest_makevar='LDFLAGS_NCURSES_LIBS'
+ cfgtest_makevar_append $mb_ncurses_libs
+ # pretty cfgdefs.mk
+ cfgtest_newline
+}
-# system tests: (native) pycompile
-printf '\n\n#system tests: (native) pycompile\n' >> $mb_pwd/cfgdefs.mk
-$mb_native_cc -E -xc - \
- --include=stropts.h < /dev/null \
- > /dev/null 2>/dev/null || \
- printf 'PYCOMPILE_CFLAGS\t+= -DHAVE_NO_STROPTS_H\n' \
- >> $mb_pwd/cfgdefs.mk
+cfgdefs_perform_native_tests()
+{
+ # init
+ cfgtest_native_section
-# ncurses: tinfo
-mb_ncurses_libs="-lpanelw -lncursesw"
+ # headers
+ cfgtest_header_absence 'stropts.h'
-printf 'int main(void){return 0;}' \
- | $mb_native_cc \
- -ltinfo -o a.out -xc - \
- < /dev/null 2>/dev/null \
- && mb_ncurses_libs="$mb_ncurses_libs -ltinfo"
+ # ncurses: python refers to members of typedef struct _win_st WINDOW
+ cfgtest_cflags_append '-DNCURSES_INTERNALS'
-printf 'PYCOMPILE_NCURSES_LIBS\t+= %s\n' "$mb_ncurses_libs" \
- >> $mb_pwd/cfgdefs.mk
+ # ncurses libs
+ mb_ncurses_libs='-lpanelw -lncursesw'
+ mb_ncurses_tinfo='-ltinfo'
+ cfgtest_library_presence $mb_ncurses_tinfo \
+ && mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo"
+
+ cfgtest_ldflags_append $mb_ncurses_libs
+
+ # pretty cfgdefs.mk
+ cfgtest_newline
+}
+
+
+# cfghost
+cfgdefs_set_cfghost_flavors
-# clean-up
-rm -f a.out
+# target-specific tests
+cfgdefs_perform_target_tests
+# native system tests
+cfgdefs_perform_native_tests
# all done
return 0
diff --git a/project/pycompile.mk b/project/pycompile.mk
index 71b741f..fedcf80 100644
--- a/project/pycompile.mk
+++ b/project/pycompile.mk
@@ -20,9 +20,10 @@ PYCOMPILE_CFLAGS += -DPLATFORM=\"$(NATIVE_OS)\"
PYCOMPILE_CFLAGS += -DPREFIX=\"$(PYCOMPILE_PREFIX)\"
PYCOMPILE_CFLAGS += -DEXEC_PREFIX=\"$(PYCOMPILE_PREFIX)\"
PYCOMPILE_CFLAGS += -DPYTHONPATH=\"$(PYCOMPILE_PATH)\"
+PYCOMPILE_CFLAGS += $(NATIVE_CC_CFLAGS)
PYCOMPILE_LDFLAGS += -lreadline -lm -lutil -lpthread
-PYCOMPILE_LDFLAGS += $(PYCOMPILE_NCURSES_LIBS)
+PYCOMPILE_LDFLAGS += $(NATIVE_CC_LDFLAGS)
PYCOMPILE_LDFLAGS += -lreadline -lm -lutil -lpthread
$(PYCOMPILE_DIR)/tree.tag: