aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2014-11-13 10:22:22 +0000
committerRainer Orth <ro@gcc.gnu.org>2014-11-13 10:22:22 +0000
commit0ed4f879945c6e171f00fa010e047c79bf269548 (patch)
tree605ae9e80d7559c7bfb37f3899c767187ebdeda6
parent6a4f06787f9c0a9806a3f67a73dd12c33a8e8071 (diff)
downloadgcc-0ed4f879945c6e171f00fa010e047c79bf269548.zip
gcc-0ed4f879945c6e171f00fa010e047c79bf269548.tar.gz
gcc-0ed4f879945c6e171f00fa010e047c79bf269548.tar.bz2
Enable libcc1 on Solaris
* configure.ac (libcc1_cv_lib_sockets): Check for -lsocket -lnsl. * configure: Regenerate. * connection.cc: Include <string.h>. * libcc1.cc (libcc1_compile): Use AF_UNIX instead of AF_LOCAL. From-SVN: r217471
-rw-r--r--libcc1/ChangeLog7
-rwxr-xr-xlibcc1/configure116
-rw-r--r--libcc1/configure.ac30
-rw-r--r--libcc1/connection.cc1
-rw-r--r--libcc1/libcc1.cc2
5 files changed, 155 insertions, 1 deletions
diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog
index 023c444..1164c50 100644
--- a/libcc1/ChangeLog
+++ b/libcc1/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac (libcc1_cv_lib_sockets): Check for -lsocket -lnsl.
+ * configure: Regenerate.
+ * connection.cc: Include <string.h>.
+ * libcc1.cc (libcc1_compile): Use AF_UNIX instead of AF_LOCAL.
+
2014-11-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR target/63610
diff --git a/libcc1/configure b/libcc1/configure
index 05384d3..d8daefb 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -14371,6 +14371,122 @@ if test "$GXX" = yes; then
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket libraries" >&5
+$as_echo_n "checking for socket libraries... " >&6; }
+if test "${libcc1_cv_lib_sockets+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ libcc1_cv_lib_sockets=
+ libcc1_check_both=no
+ ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
+if test "x$ac_cv_func_connect" = x""yes; then :
+ libcc1_check_socket=no
+else
+ libcc1_check_socket=yes
+fi
+
+ if test "$libcc1_check_socket" = "yes"; then
+ unset ac_cv_func_connect
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lsocket" >&5
+$as_echo_n "checking for main in -lsocket... " >&6; }
+if test "${ac_cv_lib_socket_main+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_socket_main=yes
+else
+ ac_cv_lib_socket_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_main" >&5
+$as_echo "$ac_cv_lib_socket_main" >&6; }
+if test "x$ac_cv_lib_socket_main" = x""yes; then :
+ libcc1_cv_lib_sockets="-lsocket"
+else
+ libcc1_check_both=yes
+fi
+
+ fi
+ if test "$libcc1_check_both" = "yes"; then
+ libcc1_old_libs=$LIBS
+ LIBS="$LIBS -lsocket -lnsl"
+ unset ac_cv_func_accept
+ ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept"
+if test "x$ac_cv_func_accept" = x""yes; then :
+ libcc1_check_nsl=no
+ libcc1_cv_lib_sockets="-lsocket -lnsl"
+fi
+
+ unset ac_cv_func_accept
+ LIBS=$libcc1_old_libs
+ fi
+ unset ac_cv_func_gethostbyname
+ libcc1_old_libs="$LIBS"
+ ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
+if test "x$ac_cv_func_gethostbyname" = x""yes; then :
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5
+$as_echo_n "checking for main in -lnsl... " >&6; }
+if test "${ac_cv_lib_nsl_main+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_nsl_main=yes
+else
+ ac_cv_lib_nsl_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_main" >&5
+$as_echo "$ac_cv_lib_nsl_main" >&6; }
+if test "x$ac_cv_lib_nsl_main" = x""yes; then :
+ libcc1_cv_lib_sockets="$libcc1_cv_lib_sockets -lnsl"
+fi
+
+fi
+
+ unset ac_cv_func_gethostbyname
+ LIBS=$libcc1_old_libs
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcc1_cv_lib_sockets" >&5
+$as_echo "$libcc1_cv_lib_sockets" >&6; }
+LIBS="$LIBS $libcc1_cv_lib_sockets"
+
# If any of these functions are missing, simply don't bother building
# this plugin.
# Check for plugin support
diff --git a/libcc1/configure.ac b/libcc1/configure.ac
index 1e0925f..6c97afd 100644
--- 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
index 3e57bbc..5db4204 100644
--- a/libcc1/connection.cc
+++ b/libcc1/connection.cc
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include <string>
#include <unistd.h>
#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include "marshall.hh"
#include "connection.hh"
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index 15320c2..7d7d2c1 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -440,7 +440,7 @@ libcc1_compile (struct gcc_base_context *s,
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;