From patchwork Mon Nov 3 16:54:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 406298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 77A6E140081 for ; Tue, 4 Nov 2014 03:54:53 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=nEpnH2hUMV4eiY/DxI+a77AmDr/nU/N30qYqXpFMwhJmKHjlUjMtz oraVrAFa4FQbpbUT0I0U8+XEbYBK57i3ri9c52/qpCdR8+xBXoO6UP28LLKoX9Da /7PIVwajbFzps1j2TyMlbr9HRQye5A7kw0P/mkNwY3wb5LeSTgaf2k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=2NfYNHH6NGQycu/aaE+6ckpgQz8=; b=cJyA9cfKUp6HSGkBfrj+ W7yaf6SSU7Z6+XsHgaeYkQeyTGITfh2EnYDQf2GZpE6GwmHQjVLdW7/2QWTyYIAA pgCQG6wTGHbSHxuIw8LYwtWviA7BXwgif2IxCaDDpqPv2L+uYJvBbSDsAEAhjOXs 8LVaLRZ8wfhgzfFh6ZLifq4= Received: (qmail 20287 invoked by alias); 3 Nov 2014 16:54:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20277 invoked by uid 89); 3 Nov 2014 16:54:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: smtp-relay.CeBiTec.Uni-Bielefeld.DE Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Nov 2014 16:54:44 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 2E635629 for ; Mon, 3 Nov 2014 17:54:42 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id on6SITe4UJte for ; Mon, 3 Nov 2014 17:54:39 +0100 (CET) Received: from fuego.CeBiTec.Uni-Bielefeld.DE (p5487ADDA.dip0.t-ipconnect.de [84.135.173.218]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 495C0628 for ; Mon, 3 Nov 2014 17:54:39 +0100 (CET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: [libcc1, build] Enable libcc1 on Solaris Date: Mon, 03 Nov 2014 17:54:35 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes I noticed that the new libcc1 wasn't built on Solaris. This happens because socketpair doesn't live in libc, but in libsocket instead. To deal with this, I've copied the libgo (and libjava) code to detect the need for libsocket and libnsl. Once the build was attempted, two failures had to be dealt with: * FD_ZERO and friends need for a memset declaration. * On Solaris 10, AF_LOCAL isn't defined in system headers, while AF_UNIX is. In both libgo and libjava, there are unconditional uses of AF_UNIX, so I've followed their lead. Those changes allowed libcc1.so to build. Bootstrapped without regressions on i386-pc-solaris2.1[01] and x86_64-unknown-linux-gnu, ok for mainline? Btw., MAINTAINERS doesn't currently list a libcc1 maintainer. I believe it should. Rainer 2014-10-31 Rainer Orth * configure.ac (libcc1_cv_lib_sockets): Check for -lsocket -lnsl. * configure: Regenerate. * connection.cc: Include . * libcc1.cc (libcc1_compile): Use AF_UNIX instead of AF_LOCAL. # HG changeset patch # Parent f122bfdb06f01264f8c4766b51f932d37a0eca3d Enable libcc1 on Solaris diff --git a/libcc1/configure.ac b/libcc1/configure.ac --- a/libcc1/configure.ac +++ b/libcc1/configure.ac @@ -63,6 +63,36 @@ if test "$GXX" = yes; then fi AC_SUBST(libsuffix) +dnl Test for -lsocket and -lnsl. Copied from libgo/configure.ac. +AC_CACHE_CHECK([for socket libraries], libcc1_cv_lib_sockets, + [libcc1_cv_lib_sockets= + libcc1_check_both=no + AC_CHECK_FUNC(connect, libcc1_check_socket=no, libcc1_check_socket=yes) + if test "$libcc1_check_socket" = "yes"; then + unset ac_cv_func_connect + AC_CHECK_LIB(socket, main, libcc1_cv_lib_sockets="-lsocket", + libcc1_check_both=yes) + fi + if test "$libcc1_check_both" = "yes"; then + libcc1_old_libs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + unset ac_cv_func_accept + AC_CHECK_FUNC(accept, + [libcc1_check_nsl=no + libcc1_cv_lib_sockets="-lsocket -lnsl"]) + unset ac_cv_func_accept + LIBS=$libcc1_old_libs + fi + unset ac_cv_func_gethostbyname + libcc1_old_libs="$LIBS" + AC_CHECK_FUNC(gethostbyname, , + [AC_CHECK_LIB(nsl, main, + [libcc1_cv_lib_sockets="$libcc1_cv_lib_sockets -lnsl"])]) + unset ac_cv_func_gethostbyname + LIBS=$libcc1_old_libs +]) +LIBS="$LIBS $libcc1_cv_lib_sockets" + # If any of these functions are missing, simply don't bother building # this plugin. GCC_ENABLE_PLUGINS diff --git a/libcc1/connection.cc b/libcc1/connection.cc --- a/libcc1/connection.cc +++ b/libcc1/connection.cc @@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. #include #include #include +#include #include #include "marshall.hh" #include "connection.hh" diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc --- a/libcc1/libcc1.cc +++ b/libcc1/libcc1.cc @@ -440,7 +440,7 @@ libcc1_compile (struct gcc_base_context libcc1 *self = (libcc1 *) s; int fds[2]; - if (socketpair (AF_LOCAL, SOCK_STREAM, 0, fds) != 0) + if (socketpair (AF_UNIX, SOCK_STREAM, 0, fds) != 0) { self->print ("could not create socketpair\n"); return 0;