summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/x86_64-linux/pyconfig.h2
-rw-r--r--config/x86_64-midipix/pyconfig.h2
-rw-r--r--profiles/toolchain/64-default.h7
-rw-r--r--profiles/toolchain/64-le-ieee.h6
-rw-r--r--project/config/cfgdefs.sh44
5 files changed, 44 insertions, 17 deletions
diff --git a/config/x86_64-linux/pyconfig.h b/config/x86_64-linux/pyconfig.h
index bd82e42..90430d2 100644
--- a/config/x86_64-linux/pyconfig.h
+++ b/config/x86_64-linux/pyconfig.h
@@ -5,8 +5,6 @@
#include "osapi/rtld.h"
#include "osapi/linux.h"
#include "osapi/overrides.h"
-#include "toolchain/64-default.h"
-#include "toolchain/64-le-ieee.h"
/* cf. Modules/posixmodule.c */
#define HAVE_BROKEN_NICE 1
diff --git a/config/x86_64-midipix/pyconfig.h b/config/x86_64-midipix/pyconfig.h
index 87740b2..72f12fd 100644
--- a/config/x86_64-midipix/pyconfig.h
+++ b/config/x86_64-midipix/pyconfig.h
@@ -4,8 +4,6 @@
#include "osapi/modern.h"
#include "osapi/rtld.h"
#include "osapi/midipix.h"
-#include "toolchain/64-default.h"
-#include "toolchain/64-le-ieee.h"
/* cf. Modules/posixmodule.c */
#define HAVE_BROKEN_NICE 1
diff --git a/profiles/toolchain/64-default.h b/profiles/toolchain/64-default.h
deleted file mode 100644
index e39b71a..0000000
--- a/profiles/toolchain/64-default.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef PY_TOOLCHAIN_64_DEFAULT_H
-#define PY_TOOLCHAIN_64_DEFAULT_H
-
-#define HAVE_GCC_ASM_FOR_X87 1
-#define HAVE_GCC_ASM_FOR_X64 1
-
-#endif
diff --git a/profiles/toolchain/64-le-ieee.h b/profiles/toolchain/64-le-ieee.h
deleted file mode 100644
index d982677..0000000
--- a/profiles/toolchain/64-le-ieee.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef PY_TOOLCHAIN_64_LE_IEEE_H
-#define PY_TOOLCHAIN_64_LE_IEEE_H
-
-#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1
-
-#endif
diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh
index 560afa6..adbfc33 100644
--- a/project/config/cfgdefs.sh
+++ b/project/config/cfgdefs.sh
@@ -141,6 +141,50 @@ cfgdefs_perform_common_tests()
mb_cfgtest_headers='pthread.h'
cfgtest_type_size 'pthread_t'
+ # toolchain
+ cfgtest_newline
+ cfgtest_comment 'toolchain'
+
+ # x87
+ mb_code_snippet=''
+ mb_code_snippet="$mb_code_snippet "'void fn(void)'
+ mb_code_snippet="$mb_code_snippet "'{__asm__ __volatile__ ("fnstcw pcw");'
+ mb_code_snippet="$mb_code_snippet "' __asm__ __volatile__ ("fldcw pcw");}'
+
+ if cfgtest_code_snippet "$mb_code_snippet"; then
+ cfgtest_cflags_append '-DHAVE_GCC_ASM_FOR_X87'
+ fi
+
+ # x64
+ mb_code_snippet=''
+ mb_code_snippet="$mb_code_snippet "'void fn(void)'
+ mb_code_snippet="$mb_code_snippet "'{__asm__ __volatile__ ("callq *%rax");}'
+
+ if cfgtest_code_snippet "$mb_code_snippet"; then
+ cfgtest_cflags_append '-DHAVE_GCC_ASM_FOR_X64'
+ fi
+
+ # IEEE 754: little endian / big endian
+ if $mb_cfgtest_cc -E -dM - < /dev/null \
+ | grep '__BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__' \
+ > /dev/null; then
+ cfgtest_cflags_append '-DDOUBLE_IS_LITTLE_ENDIAN_IEEE754'
+
+ elif $mb_cfgtest_cc -E -dM - < /dev/null \
+ | grep '__BYTE_ORDER__ __ORDER_BIG_ENDIAN__' \
+ > /dev/null; then
+ cfgtest_cflags_append '-DDOUBLE_IS_BIG_ENDIAN_IEEE754'
+
+ else
+ cfgtest_newline
+ cfgtest_comment 'cfgdefs.sh: cannot detect little/big endian,'
+ cfgtest_comment 'cfgtest.sh: so defined both macros below.'
+ cfgtest_newline
+
+ cfgtest_cflags_append '-DDOUBLE_IS_LITTLE_ENDIAN_IEEE754'
+ cfgtest_cflags_append '-DDOUBLE_IS_BIG_ENDIAN_IEEE754'
+ fi
+
# getrandom: easier to simply test,
# than to test whether we need to test
# (and then test).