From ca92cd15c67e52a9ed2d390f946b750e777b47d7 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 13 Jun 2013 21:57:38 -0700 Subject: [PATCH] configure: Test whether compiler can create both 32 and 64-bit binaries If not, tell the user and recommend installing gcc-multilib. Then simply don't attempt to compile the unspoorted library. --- Makefile.local | 12 +++++++++++- configure | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/Makefile.local b/Makefile.local index 123de57..179700e 100644 --- a/Makefile.local +++ b/Makefile.local @@ -8,8 +8,18 @@ FINAL_FIPS_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS) FINAL_LIBFIPS_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS) -ldl FINAL_FIPS_LINKER = CC +ALL_TARGETS = fips + +ifeq ($(COMPILER_SUPPORTS_32),Yes) +ALL_TARGETS += libfips-32.so +endif + +ifeq ($(COMPILER_SUPPORTS_64),Yes) +ALL_TARGETS += libfips-64.so +endif + .PHONY: all -all: fips libfips-64.so libfips-32.so +all: $(ALL_TARGETS) ifeq ($(MAKECMDGOALS),) ifeq ($(shell cat .first-build-message 2>/dev/null),) diff --git a/configure b/configure index 679f543..c584c93 100755 --- a/configure +++ b/configure @@ -345,6 +345,43 @@ printf "\t${WARN_CFLAGS}\n" rm -f minimal minimal.c +printf "#include \nint main(void){return 0;}\n" > arch-minimal.c + +printf "Checking for machine-dependent compiler support:\n" + +printf " Compiler can create 32-bit binaries... " +have_m32=Yes +if ${CC} -m32 -o arch-minimal arch-minimal.c > /dev/null 2>&1 +then + printf "Yes.\n" +else + printf "No.\n" + have_m32=No +fi + +printf " Compiler can create 64-bit binaries... " +have_m64=Yes +if ${CC} -m64 -o arch-minimal arch-minimal.c > /dev/null 2>&1 +then + printf "Yes.\n" +else + printf "No.\n" + have_m64=No +fi + +if [ "$have_m32" = "No" ] || [ "$have_m64" = "No" ]; then + cat <