From b7cf40bb1d6750283c703e386d61ef5bd8ae754c Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Mon, 5 Oct 1998 14:15:32 +0000
Subject: [PATCH] [project @ 1998-10-05 14:15:31 by simonm] Add support for
 FreeBSD 3.0 (ELFish). Rename i386-unknown-freebsd to i386-unknown-freebsd2,
 and add i386-unknown-freebsd3.

NOTE: this won't bootstrap an ELF GHC using an a.out GHC, some laying
on of hands is required for that.
---
 aclocal.m4   | 14 +++++++++++---
 configure.in | 21 +++++++++++++++------
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 09f7790bdd19..527cd07ed22f 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4,v 1.28 1998/09/29 17:30:09 sof Exp $
+dnl $Id: aclocal.m4,v 1.29 1998/10/05 14:15:32 simonm Exp $
 dnl 
 dnl Extra autoconf macros for the Glasgow fptools
 dnl
@@ -57,6 +57,11 @@ dnl underscore.
 dnl 
 dnl We assume that they _haven't_ if anything goes wrong.
 dnl
+dnl Some nlist implementations seem to try to be compatible by ignoring
+dnl a leading underscore sometimes (eg. FreeBSD).  We therefore have
+dnl to work around this by checking for *no* leading underscore first.
+dnl Sigh.  --SDM
+dnl
 AC_DEFUN(FPTOOLS_UNDERSCORE,
 [AC_CHECK_LIB(elf, nlist, LIBS="-lelf $LIBS")dnl
 AC_CACHE_CHECK([leading underscore in symbol names], fptools_cv_lead_uscore,
@@ -76,7 +81,8 @@ AC_TRY_RUN([#ifdef HAVE_NLIST_H
 #include <nlist.h>
 changequote(<<, >>)dnl
 <<
-struct nlist xYzzY[] = {{"_xYzzY", 0},{0}};
+struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
+struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}};
 #endif
 
 main(argc, argv)
@@ -84,7 +90,9 @@ int argc;
 char **argv;
 {
 #ifdef HAVE_NLIST_H
-    if(nlist(argv[0], xYzzY) == 0 && xYzzY[0].n_value != 0)
+    if(nlist(argv[0], xYzzY1) == 0 && xYzzY1[0].n_value != 0)
+        exit(1);
+    if(nlist(argv[0], xYzzY2) == 0 && xYzzY2[0].n_value != 0)
         exit(0);>>
 changequote([, ])dnl
 #endif
diff --git a/configure.in b/configure.in
index dcb5fa0aba48..b12f6828f7a8 100644
--- a/configure.in
+++ b/configure.in
@@ -113,14 +113,23 @@ i[[3456]]86-*-linux*)
         HostVendor_CPP='unknown'
         HostOS_CPP='linux'
         ;;
-i[[3456]]86-*-freebsd*)
-	HostPlatform=i386-unknown-freebsd # hack again
-	TargetPlatform=i386-unknown-freebsd
-	BuildPlatform=i386-unknown-freebsd
-        HostPlatform_CPP='i386_unknown_freebsd'
+i[[3456]]86-*-freebsd3*) # FreeBSD 3.0+ uses ELF
+	HostPlatform=i386-unknown-freebsd3 # hack again
+	TargetPlatform=i386-unknown-freebsd3
+	BuildPlatform=i386-unknown-freebsd3
+        HostPlatform_CPP='i386_unknown_freebsd3'
         HostArch_CPP='i386'
         HostVendor_CPP='unknown'
-        HostOS_CPP='freebsd'
+        HostOS_CPP='freebsd3'
+        ;;
+i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
+	HostPlatform=i386-unknown-freebsd2 # hack again
+	TargetPlatform=i386-unknown-freebsd2
+	BuildPlatform=i386-unknown-freebsd2
+        HostPlatform_CPP='i386_unknown_freebsd2'
+        HostArch_CPP='i386'
+        HostVendor_CPP='unknown'
+        HostOS_CPP='freebsd2'
         ;;
 i[[3456]]86-*-netbsd*)
 	HostPlatform=i386-unknown-netbsd # hack again
-- 
GitLab