With the set of libphobos Solaris patches just posted, it would become
possible to enable libphobos on Solaris 11/x86 by default.

This is what this patch does.  

* It uses a LIBPHOBOS_SUPPORTED variable both in toplevel configure and
  libphobos/configure.tgt, following what libvtv does.

* It's necessary to disable libphobos when Solaris as is in use: it has
  a relatively low line length limit of 10240 which is exceeded in a few
  libphobos files.

Bootstrapped without regressions on i386-pc-solaris2.11 (as and gas, gas
and gld, Solaris 11.3/11.4/11.5) on top of the previous set of patches.

Also tested manually that explicit
--enable-libphobos/--disable-libphobos give the desired results
(i.e. override the defaults).

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-01-23  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        toplevel:
        * configure.ac (enable_libphobos): Check LIBPHOBOS_SUPPORTED.
        * configure: Regenerate.

        libphobos:
        * configure.tgt (LIBPHOBOS_SUPPORTED): Default to no.
        Set to yes explicitly.
        (x86_64-*-solaris2.11* | i?86-*-solaris2.11*): Mark supported.
        * configure.ac (x86_64-*-solaris2.* | i?86-*-solaris2.*): Only
        mark supported with gas.
        (ENABLE_LIBPHOBOS): New conditional.
        * configure: Regenerate.
        * Makefile.am (SUBDIRS): Only set if ENABLE_LIBPHOBOS.
        * Makefile.in: Regenerate.

# HG changeset patch
# Parent  7943668e276d15b949fddd7723cb5213fb465977
Enable libphobos on Solaris 11/x86

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -694,7 +694,7 @@ if test -d ${srcdir}/libphobos; then
 	AC_MSG_CHECKING([for libphobos support])
 	if (srcdir=${srcdir}/libphobos; \
 		. ${srcdir}/configure.tgt; \
-		test -n "$UNSUPPORTED")
+		test "$LIBPHOBOS_SUPPORTED" != "yes")
 	then
 	    AC_MSG_RESULT([no])
 	    noconfigdirs="$noconfigdirs target-libphobos"
diff --git a/libphobos/Makefile.am b/libphobos/Makefile.am
--- a/libphobos/Makefile.am
+++ b/libphobos/Makefile.am
@@ -15,7 +15,11 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-SUBDIRS = libdruntime src testsuite
+if ENABLE_LIBPHOBOS
+  SUBDIRS = libdruntime src testsuite
+else
+  SUBDIRS =
+endif
 
 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -114,6 +114,42 @@ AC_SUBST(phobos_compiler_shared_flag)
 lt_prog_compiler_pic_D="$phobos_compiler_shared_flag"
 pic_mode='default'
 
+AC_MSG_CHECKING([for --enable-libphobos])
+AC_ARG_ENABLE(libphobos,
+  [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])])
+AC_MSG_RESULT($enable_libphobos)
+
+# See if supported.
+unset LIBPHOBOS_SUPPORTED
+AC_MSG_CHECKING([for host support for libphobos])
+. ${srcdir}/configure.tgt
+case ${host} in
+  x86_64-*-solaris2.* | i?86-*-solaris2.*)
+    # libphobos doesn't compile with the Solaris/x86 assembler due to a
+    # relatively low linelength limit.
+    as_prog=`$CC -print-prog-name=as`
+    if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
+      druntime_cv_use_gas=yes;
+    else
+      druntime_cv_use_gas=no;
+    fi
+    rm -f a.out
+    if test x$druntime_cv_use_gas = xno; then
+      LIBPHOBOS_SUPPORTED=no
+    fi
+    ;;
+esac
+AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
+
+# Decide if it's usable.
+case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
+*:no)  use_libphobos=no  ;;
+*:yes) use_libphobos=yes ;;
+yes:*) use_libphobos=yes ;;
+*:*)   use_libphobos=no  ;;
+esac
+AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes)
+
 # Determine what GCC version number to use in filesystem paths.
 GCC_BASE_VER
 
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -21,16 +21,21 @@
 
 # Disable the libphobos or libdruntime components on untested or known
 # broken systems.  More targets shall be added after testing.
+LIBPHOBOS_SUPPORTED=no
 case "${target}" in
   arm*-*-linux*)
+	LIBPHOBOS_SUPPORTED=yes
 	;;
   mips*-*-linux*)
+	LIBPHOBOS_SUPPORTED=yes
 	;;
   x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
+	LIBPHOBOS_SUPPORTED=yes
 	;;
   x86_64-*-linux* | i?86-*-linux*)
+	LIBPHOBOS_SUPPORTED=yes
 	;;
-  *)
-	UNSUPPORTED=1
+  x86_64-*-solaris2.11* | i?86-*-solaris2.11*)
+	LIBPHOBOS_SUPPORTED=yes
 	;;
 esac

Reply via email to