- Introduce CONF_CC variable to compile configure.c
- Introduce CONF_HOST_ARCH to configure.c to enable overriding target
at compile time
Signed-off-by: Alexander Egorenkov <egorenar-dev(a)posteo.net>
---
Makefile | 4 ++-
configure.c | 76 ++++++++++++++++++++++++++++-------------------------
2 files changed, 43 insertions(+), 37 deletions(-)
diff --git a/Makefile b/Makefile
index 7455410..402be6e 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,8 @@
# GNU General Public License for more details.
#
+CONF_CC = ${CC}
+
PROGRAM=crash
#
@@ -288,7 +290,7 @@ force:
make_configure: force
@rm -f configure
- @${CC} ${CONF_FLAGS} -o configure configure.c ${WARNING_ERROR} ${WARNING_OPTIONS}
+ @${CONF_CC} ${CONF_FLAGS} -o configure configure.c ${WARNING_ERROR} ${WARNING_OPTIONS}
clean: make_configure
@./configure ${CONF_TARGET_FLAG} -q -b
diff --git a/configure.c b/configure.c
index 7f6d19e..d736c56 100644
--- a/configure.c
+++ b/configure.c
@@ -120,6 +120,45 @@ void add_extra_lib(char *);
#define MIPS 11
#define SPARC64 12
+#ifndef CONF_HOST_ARCH
+#ifdef __alpha__
+#define CONF_HOST_ARCH ALPHA
+#endif
+#ifdef __i386__
+#define CONF_HOST_ARCH X86
+#endif
+#ifdef __powerpc__
+#define CONF_HOST_ARCH PPC
+#endif
+#ifdef __ia64__
+#define CONF_HOST_ARCH IA64
+#endif
+#ifdef __s390__
+#define CONF_HOST_ARCH S390
+#endif
+#ifdef __s390x__
+#define CONF_HOST_ARCH S390X
+#endif
+#ifdef __powerpc64__
+#define CONF_HOST_ARCH PPC64
+#endif
+#ifdef __x86_64__
+#define CONF_HOST_ARCH X86_64
+#endif
+#ifdef __arm__
+#define CONF_HOST_ARCH ARM
+#endif
+#ifdef __aarch64__
+#define CONF_HOST_ARCH ARM64
+#endif
+#ifdef __mips__
+#define CONF_HOST_ARCH MIPS
+#endif
+#ifdef __sparc_v9__
+#define CONF_HOST_ARCH SPARC64
+#endif
+#endif // #ifndef CONF_HOST_ARCH
+
#define TARGET_X86 "TARGET=X86"
#define TARGET_ALPHA "TARGET=ALPHA"
#define TARGET_PPC "TARGET=PPC"
@@ -349,42 +388,7 @@ get_current_configuration(struct supported_gdb_version *sp)
static char buf[512];
char *p;
-#ifdef __alpha__
- target_data.target = ALPHA;
-#endif
-#ifdef __i386__
- target_data.target = X86;
-#endif
-#ifdef __powerpc__
- target_data.target = PPC;
-#endif
-#ifdef __ia64__
- target_data.target = IA64;
-#endif
-#ifdef __s390__
- target_data.target = S390;
-#endif
-#ifdef __s390x__
- target_data.target = S390X;
-#endif
-#ifdef __powerpc64__
- target_data.target = PPC64;
-#endif
-#ifdef __x86_64__
- target_data.target = X86_64;
-#endif
-#ifdef __arm__
- target_data.target = ARM;
-#endif
-#ifdef __aarch64__
- target_data.target = ARM64;
-#endif
-#ifdef __mips__
- target_data.target = MIPS;
-#endif
-#ifdef __sparc_v9__
- target_data.target = SPARC64;
-#endif
+ target_data.target = CONF_HOST_ARCH;
set_initial_target(sp);
--
2.28.0