From 172f948fbba58a1000409c182ee79fc166fda9bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Mon, 29 Mar 2010 14:26:28 +0200
Subject: [PATCH] * configure.ac (ABI): Attempt to use a better, ABI-dependant,
 default value for libdir.

* configure.ac (ABI): Detect which ABI the compiler is using.
On x86_64, also check for __arch64__.

Rev: nettle/ChangeLog:1.70
Rev: nettle/configure.ac:1.17
---
 ChangeLog    |  5 +++++
 configure.ac | 35 +++++++++++++++++++++++++++++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 99dde0a8..926cefb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-03-29  Niels M�ller  <nisse@lysator.liu.se>
 
+	* configure.ac (ABI): Attempt to use a better, ABI-dependant,
+	default value for libdir.
+
+	* x86/md5-compress.asm: Fixed function name in epilogue.
+
 	* asm.m4 (EPILOGUE): Use . to refer to current address.
 
 	* configure.ac (ABI): Detect which ABI the compiler is using.
diff --git a/configure.ac b/configure.ac
index f4cfd3aa..9d18b771 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,7 +94,7 @@ AC_CHECK_TOOL(NM, nm, strings)
 AC_CHECK_TOOL(OBJDUMP, objdump, false)
 
 if test "x$ac_cv_prog_cc_stdc" = xno ; then
-  AC_ERROR([the C compiler doesn't handle ANSI-C])
+  AC_ERROR([the C compiler doesn't handle ANSI-C]) #'
 fi
 
 AC_PROG_INSTALL
@@ -146,7 +146,38 @@ esac
 
 if test "x$ABI" != xstandard ; then
   AC_MSG_NOTICE([Compiler uses $ABI-bit ABI. To change, set CFLAGS.])
-  AC_MSG_NOTICE([You may want to set libdir!])
+  if test "$libdir" = '${exec_prefix}/lib' ; then
+    # Try setting a better default
+    case "$host_cpu:$host_os:$ABI" in
+      *:solaris*:32|*:sunos*:32)
+	libdir='${exec_prefix}/lib'
+	;;
+      *:solaris*:64|*:sunos*:64)
+	libdir='${exec_prefix}/lib/64'
+	;;
+      # According to the fhs, all architectures except IA64
+      # puts 32-bit libraries in lib, and 64-bit in lib64.
+      *:linux*:32)
+	libdir='${exec_prefix}/lib'
+	;;
+      *:linux*:64)
+	libdir='${exec_prefix}/lib64'
+	;;
+      # On freebsd, it seems 32-bit libraries are in lib32,
+      # and 64-bit in lib. Don't know about "kfreebsd", does
+      # it follow the Linux fhs conventions?
+      *:freebsd*:32)
+	libdir='${exec_prefix}/lib32'
+	;;
+      *:freebsd*:64)
+	libdir='${exec_prefix}/lib'
+	;;
+      *)
+        AC_MSG_WARN([Don't know where to install $ABI-bit libraries on this system.]); #'
+
+    esac
+    AC_MSG_NOTICE([Libraries to be installed in $libdir.])
+  fi
 fi
 
 # Select assembler code
-- 
GitLab