]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Preliminary framework for Solaris support.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 12 Jan 2011 06:34:08 +0000 (06:34 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 12 Jan 2011 06:34:08 +0000 (06:34 +0000)
Partly from Rainer Orth.

From-SVN: r168697

15 files changed:
libgo/Makefile.am
libgo/Makefile.in
libgo/configure
libgo/configure.ac
libgo/go/debug/proc/proc_solaris.go [new file with mode: 0644]
libgo/go/debug/proc/regs_solaris_386.go [new file with mode: 0644]
libgo/go/debug/proc/regs_solaris_amd64.go [new file with mode: 0644]
libgo/go/debug/proc/regs_solaris_sparc.go [new file with mode: 0644]
libgo/go/debug/proc/regs_solaris_sparcv9.go [new file with mode: 0644]
libgo/syscalls/syscall_solaris.go [new file with mode: 0644]
libgo/syscalls/syscall_solaris_386.go [new file with mode: 0644]
libgo/syscalls/syscall_solaris_amd64.go [new file with mode: 0644]
libgo/syscalls/syscall_solaris_sparc.go [new file with mode: 0644]
libgo/syscalls/syscall_solaris_sparcv9.go [new file with mode: 0644]
libgo/testsuite/Makefile.in

index f7a0da07e4865ce2432b2e1b772ec380ec041886..0259a0effdb8aa37d9dffa7f9fe3ab43e3695d0b 100644 (file)
@@ -1188,7 +1188,8 @@ libgo_go_objs = \
 
 libgo_la_SOURCES = $(runtime_files)
 
-libgo_la_LIBADD = $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS)
+libgo_la_LIBADD = \
+       $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
 
 libgobegin_a_SOURCES = \
        runtime/go-main.c
@@ -1203,8 +1204,7 @@ LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
        $(AM_GOCFLAGS) $(GOCFLAGS)
 
 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
-       $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) \
-       $(PTHREAD_LIBS) $(MATH_LIBS) -o $@
+       $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
 
 # Build a package.
 BUILDARCHIVE = \
index 383b825ec4493d2621d522510005fb313e58cbc3..8ef2a43bc155ad0dad61d29543bf47ed7d9830e0 100644 (file)
@@ -121,7 +121,8 @@ libgobegin_a_OBJECTS = $(am_libgobegin_a_OBJECTS)
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libgo_la_DEPENDENCIES = $(libgo_go_objs) $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1)
 am__libgo_la_SOURCES_DIST = runtime/go-append.c runtime/go-assert.c \
        runtime/go-assert-interface.c \
        runtime/go-byte-array-to-string.c runtime/go-breakpoint.c \
@@ -329,6 +330,7 @@ MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MATH_LIBS = @MATH_LIBS@
 MKDIR_P = @MKDIR_P@
+NET_LIBS = @NET_LIBS@
 NM = @NM@
 NMEDIT = @NMEDIT@
 OBJCOPY = @OBJCOPY@
@@ -1541,7 +1543,9 @@ libgo_go_objs = \
        testing/libscript.la
 
 libgo_la_SOURCES = $(runtime_files)
-libgo_la_LIBADD = $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS)
+libgo_la_LIBADD = \
+       $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
+
 libgobegin_a_SOURCES = \
        runtime/go-main.c
 
@@ -1552,8 +1556,7 @@ LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
        $(AM_GOCFLAGS) $(GOCFLAGS)
 
 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
-       $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) \
-       $(PTHREAD_LIBS) $(MATH_LIBS) -o $@
+       $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
 
 
 # Build a package.
index 461aea3f15744a282475bce608acb1be08d5dadc..ff404f2a02641d32d2a563018a40d4c32053a302 100644 (file)
@@ -607,18 +607,25 @@ HAVE_SYS_MMAN_H_FALSE
 HAVE_SYS_MMAN_H_TRUE
 PTHREAD_LIBS
 PTHREAD_CFLAGS
+NET_LIBS
 MATH_LIBS
 USING_SPLIT_STACK_FALSE
 USING_SPLIT_STACK_TRUE
 SPLIT_STACK
 GOARCH
-LIBGO_IS_ARM_FALSE
-LIBGO_IS_ARM_TRUE
 LIBGO_IS_X86_64_FALSE
 LIBGO_IS_X86_64_TRUE
+LIBGO_IS_SPARCV9_FALSE
+LIBGO_IS_SPARCV9_TRUE
+LIBGO_IS_SPARC_FALSE
+LIBGO_IS_SPARC_TRUE
+LIBGO_IS_ARM_FALSE
+LIBGO_IS_ARM_TRUE
 LIBGO_IS_386_FALSE
 LIBGO_IS_386_TRUE
 GOOS
+LIBGO_IS_SOLARIS_FALSE
+LIBGO_IS_SOLARIS_TRUE
 LIBGO_IS_RTEMS_FALSE
 LIBGO_IS_RTEMS_TRUE
 LIBGO_IS_LINUX_FALSE
@@ -10871,7 +10878,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10874 "configure"
+#line 10881 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10977,7 +10984,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10980 "configure"
+#line 10987 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13192,12 +13199,14 @@ is_darwin=no
 is_freebsd=no
 is_linux=no
 is_rtems=no
+is_solaris=no
 GOOS=unknown
 case ${host} in
-  *-*-darwin*) is_darwin=yes; GOOS=darwin ;;
-  *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;;
-  *-*-linux*)  is_linux=yes; GOOS=linux  ;;
-  *-*-rtems*)  is_rtems=yes; GOOS=rtems  ;;
+  *-*-darwin*)   is_darwin=yes;  GOOS=darwin ;;
+  *-*-freebsd*)  is_freebsd=yes; GOOS=freebsd ;;
+  *-*-linux*)    is_linux=yes;   GOOS=linux ;;
+  *-*-rtems*)    is_rtems=yes;   GOOS=rtems ;;
+  *-*-solaris2*) is_solaris=yes; GOOS=solaris ;;
 esac
  if test $is_darwin = yes; then
   LIBGO_IS_DARWIN_TRUE=
@@ -13231,11 +13240,21 @@ else
   LIBGO_IS_RTEMS_FALSE=
 fi
 
+ if test $is_solaris = yes; then
+  LIBGO_IS_SOLARIS_TRUE=
+  LIBGO_IS_SOLARIS_FALSE='#'
+else
+  LIBGO_IS_SOLARIS_TRUE='#'
+  LIBGO_IS_SOLARIS_FALSE=
+fi
+
 
 
 is_386=no
-is_x86_64=no
 is_arm=no
+is_sparc=no
+is_sparcv9=no
+is_x86_64=no
 GOARCH=unknown
 case ${host} in
   i[34567]86-*-* | x86_64-*-*)
@@ -13253,8 +13272,10 @@ else
 fi
 rm -f conftest.err conftest.$ac_ext
     if test "$is_386" = "yes"; then
+      is_386=yes
       GOARCH=386
     else
+      is_x86_64=yes
       GOARCH=amd64
     fi
     ;;
@@ -13262,6 +13283,28 @@ rm -f conftest.err conftest.$ac_ext
     is_arm=yes
     GOARCH=arm
     ;;
+  sparc*-*-*)
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if defined(__sparcv9) || defined(__arch64__)
+#error 64-bit
+#endif
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  is_sparc=yes
+else
+  is_sparcv9=yes
+fi
+rm -f conftest.err conftest.$ac_ext
+    if test "$is_sparc" = "yes"; then
+      is_sparc=yes
+      GOARCH=sparc
+    else
+      is_sparcv9=yes
+      GOARCH=sparcv9
+    fi
+    ;;
 esac
  if test $is_386 = yes; then
   LIBGO_IS_386_TRUE=
@@ -13271,14 +13314,6 @@ else
   LIBGO_IS_386_FALSE=
 fi
 
- if test $is_x86_64 = yes; then
-  LIBGO_IS_X86_64_TRUE=
-  LIBGO_IS_X86_64_FALSE='#'
-else
-  LIBGO_IS_X86_64_TRUE='#'
-  LIBGO_IS_X86_64_FALSE=
-fi
-
  if test $is_arm = yes; then
   LIBGO_IS_ARM_TRUE=
   LIBGO_IS_ARM_FALSE='#'
@@ -13287,11 +13322,35 @@ else
   LIBGO_IS_ARM_FALSE=
 fi
 
+ if test $is_sparc = yes; then
+  LIBGO_IS_SPARC_TRUE=
+  LIBGO_IS_SPARC_FALSE='#'
+else
+  LIBGO_IS_SPARC_TRUE='#'
+  LIBGO_IS_SPARC_FALSE=
+fi
+
+ if test $isv_sparcv9 = yes; then
+  LIBGO_IS_SPARCV9_TRUE=
+  LIBGO_IS_SPARCV9_FALSE='#'
+else
+  LIBGO_IS_SPARCV9_TRUE='#'
+  LIBGO_IS_SPARCV9_FALSE=
+fi
+
+ if test $is_x86_64 = yes; then
+  LIBGO_IS_X86_64_TRUE=
+  LIBGO_IS_X86_64_FALSE='#'
+else
+  LIBGO_IS_X86_64_TRUE='#'
+  LIBGO_IS_X86_64_FALSE=
+fi
+
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fsplit-stack is supported" >&5
 $as_echo_n "checking whether -fsplit-stack is supported... " >&6; }
-if test "${ac_cv_libgo_split_stack_supported+set}" = set; then :
+if test "${libgo_cv_c_split_stack_supported+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   CFLAGS_hold=$CFLAGS
@@ -13301,16 +13360,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 int i;
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_libgo_split_stack_supported=yes
+  libgo_cv_c_split_stack_supported=yes
 else
-  ac_cv_libgo_split_stack_supported=no
+  libgo_cv_c_split_stack_supported=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 CFLAGS=$CFLAGS_hold
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libgo_split_stack_supported" >&5
-$as_echo "$ac_cv_libgo_split_stack_supported" >&6; }
-if test "$ac_cv_libgo_split_stack_supported" = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_split_stack_supported" >&5
+$as_echo "$libgo_cv_c_split_stack_supported" >&6; }
+if test "$libgo_cv_c_split_stack_supported" = yes; then
   SPLIT_STACK=-fsplit-stack
 
 $as_echo "#define USING_SPLIT_STACK 1" >>confdefs.h
@@ -13319,7 +13378,7 @@ else
   SPLIT_STACK=
 fi
 
- if test "$ac_cv_libgo_split_stack_supported" = yes; then
+ if test "$libgo_cv_c_split_stack_supported" = yes; then
   USING_SPLIT_STACK_TRUE=
   USING_SPLIT_STACK_FALSE='#'
 else
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether linker supports split stack" >&5
 $as_echo_n "checking whether linker supports split stack... " >&6; }
-if test "${ac_cv_libgo_linker_supports_split_stack+set}" = set; then :
+if test "${libgo_cv_c_linker_supports_split_stack+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_libgo_linker_supports_split_stack=no
+  libgo_cv_c_linker_supports_split_stack=no
 if $LD --help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
-  ac_cv_libgo_linker_supports_split_stack=yes
+  libgo_cv_c_linker_supports_split_stack=yes
 fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libgo_linker_supports_split_stack" >&5
-$as_echo "$ac_cv_libgo_linker_supports_split_stack" >&6; }
-if test "$ac_cv_libgo_linker_supports_split_stack" = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_linker_supports_split_stack" >&5
+$as_echo "$libgo_cv_c_linker_supports_split_stack" >&6; }
+if test "$libgo_cv_c_linker_supports_split_stack" = yes; then
 
 $as_echo "#define LINKER_SUPPORTS_SPLIT_STACK 1" >>confdefs.h
 
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket libraries" >&5
+$as_echo_n "checking for socket libraries... " >&6; }
+if test "${libgo_cv_lib_sockets+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  libgo_cv_lib_sockets=
+   libgo_check_both=no
+   ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
+if test "x$ac_cv_func_connect" = x""yes; then :
+  libgo_check_socket=no
+else
+  libgo_check_socket=yes
+fi
+
+   if test "$libgo_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 :
+  libgo_cv_lib_sockets="-lsocket"
+else
+  libgo_check_both=yes
+fi
+
+   fi
+   if test "$libgo_check_both" = "yes"; then
+     libgo_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 :
+  libgo_check_nsl=no
+                   libgo_cv_lib_sockets="-lsocket -lnsl"
+fi
+
+     unset ac_cv_func_accept
+     LIBS=$libgo_old_libs
+   fi
+   unset ac_cv_func_gethostbyname
+   libgo_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 :
+  libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lnsl"
+fi
+
+fi
+
+   unset ac_cv_func_gethostbyname
+   LIBS=$libgo_old_libs
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_lib_sockets" >&5
+$as_echo "$libgo_cv_lib_sockets" >&6; }
+NET_LIBS="$libgo_cv_lib_sockets"
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -pthread is supported" >&5
 $as_echo_n "checking whether -pthread is supported... " >&6; }
-if test "${ac_cv_libgo_pthread_supported+set}" = set; then :
+if test "${libgo_cv_lib_pthread+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   CFLAGS_hold=$CFLAGS
@@ -13401,17 +13577,17 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 int i;
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_libgo_pthread_supported=yes
+  libgo_cv_lib_pthread=yes
 else
-  ac_cv_libgo_pthread_supported=no
+  libgo_cv_lib_pthread=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 CFLAGS=$CFLAGS_hold
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libgo_pthread_supported" >&5
-$as_echo "$ac_cv_libgo_pthread_supported" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_lib_pthread" >&5
+$as_echo "$libgo_cv_lib_pthread" >&6; }
 PTHREAD_CFLAGS=
-if test "$ac_cv_libgo_pthread_supported" = yes; then
+if test "$libgo_cv_lib_pthread" = yes; then
   PTHREAD_CFLAGS=-pthread
 fi
 
@@ -13759,7 +13935,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -minline-all-stringops" >&5
 $as_echo_n "checking whether compiler supports -minline-all-stringops... " >&6; }
-if test "${ac_cv_libgo_compiler_supports_inline_all_stringops+set}" = set; then :
+if test "${libgo_cv_c_stringops+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   CFLAGS_hold=$CFLAGS
@@ -13769,17 +13945,17 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 int i;
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_libgo_compiler_supports_inline_all_stringops=yes
+  libgo_cv_c_stringops=yes
 else
-  ac_cv_libgo_compiler_supports_inline_all_stringops=no
+  libgo_cv_c_stringops=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 CFLAGS=$CFLAGS_hold
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libgo_compiler_supports_inline_all_stringops" >&5
-$as_echo "$ac_cv_libgo_compiler_supports_inline_all_stringops" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_stringops" >&5
+$as_echo "$libgo_cv_c_stringops" >&6; }
 STRINGOPS_FLAG=
-if test "$ac_cv_libgo_compiler_supports_inline_all_stringops" = yes; then
+if test "$libgo_cv_c_stringops" = yes; then
   STRINGOPS_FLAG=-minline-all-stringops
 fi
 
@@ -14018,18 +14194,30 @@ if test -z "${LIBGO_IS_RTEMS_TRUE}" && test -z "${LIBGO_IS_RTEMS_FALSE}"; then
   as_fn_error "conditional \"LIBGO_IS_RTEMS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${LIBGO_IS_386_TRUE}" && test -z "${LIBGO_IS_386_FALSE}"; then
-  as_fn_error "conditional \"LIBGO_IS_386\" was never defined.
+if test -z "${LIBGO_IS_SOLARIS_TRUE}" && test -z "${LIBGO_IS_SOLARIS_FALSE}"; then
+  as_fn_error "conditional \"LIBGO_IS_SOLARIS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${LIBGO_IS_X86_64_TRUE}" && test -z "${LIBGO_IS_X86_64_FALSE}"; then
-  as_fn_error "conditional \"LIBGO_IS_X86_64\" was never defined.
+if test -z "${LIBGO_IS_386_TRUE}" && test -z "${LIBGO_IS_386_FALSE}"; then
+  as_fn_error "conditional \"LIBGO_IS_386\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${LIBGO_IS_ARM_TRUE}" && test -z "${LIBGO_IS_ARM_FALSE}"; then
   as_fn_error "conditional \"LIBGO_IS_ARM\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${LIBGO_IS_SPARC_TRUE}" && test -z "${LIBGO_IS_SPARC_FALSE}"; then
+  as_fn_error "conditional \"LIBGO_IS_SPARC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGO_IS_SPARCV9_TRUE}" && test -z "${LIBGO_IS_SPARCV9_FALSE}"; then
+  as_fn_error "conditional \"LIBGO_IS_SPARCV9\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBGO_IS_X86_64_TRUE}" && test -z "${LIBGO_IS_X86_64_FALSE}"; then
+  as_fn_error "conditional \"LIBGO_IS_X86_64\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USING_SPLIT_STACK_TRUE}" && test -z "${USING_SPLIT_STACK_FALSE}"; then
   as_fn_error "conditional \"USING_SPLIT_STACK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
index 42e379d31d49d90094066df69003163f614b33cf..41860d14286c73620a90644e3f11e69682d57505 100644 (file)
@@ -116,22 +116,28 @@ is_darwin=no
 is_freebsd=no
 is_linux=no
 is_rtems=no
+is_solaris=no
 GOOS=unknown
 case ${host} in
-  *-*-darwin*) is_darwin=yes; GOOS=darwin ;;
-  *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;;
-  *-*-linux*)  is_linux=yes; GOOS=linux  ;;
-  *-*-rtems*)  is_rtems=yes; GOOS=rtems  ;;
+  *-*-darwin*)   is_darwin=yes;  GOOS=darwin ;;
+  *-*-freebsd*)  is_freebsd=yes; GOOS=freebsd ;;
+  *-*-linux*)    is_linux=yes;   GOOS=linux ;;
+  *-*-rtems*)    is_rtems=yes;   GOOS=rtems ;;
+  *-*-solaris2*) is_solaris=yes; GOOS=solaris ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes)
 AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes)
 AM_CONDITIONAL(LIBGO_IS_LINUX, test $is_linux = yes)
 AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
+AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)
 AC_SUBST(GOOS)
 
+dnl N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
 is_386=no
-is_x86_64=no
 is_arm=no
+is_sparc=no
+is_sparcv9=no
+is_x86_64=no
 GOARCH=unknown
 case ${host} in
 changequote(,)dnl
@@ -143,8 +149,10 @@ changequote([,])dnl
 #endif],
 [is_386=yes], [is_x86_64=yes])
     if test "$is_386" = "yes"; then
+      is_386=yes
       GOARCH=386
     else
+      is_x86_64=yes
       GOARCH=amd64
     fi
     ;;
@@ -152,22 +160,38 @@ changequote([,])dnl
     is_arm=yes
     GOARCH=arm
     ;;
+  sparc*-*-*)
+    AC_PREPROC_IFELSE([
+#if defined(__sparcv9) || defined(__arch64__)
+#error 64-bit
+#endif],
+[is_sparc=yes], [is_sparcv9=yes])
+    if test "$is_sparc" = "yes"; then
+      is_sparc=yes
+      GOARCH=sparc
+    else
+      is_sparcv9=yes
+      GOARCH=sparcv9
+    fi
+    ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes)
-AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
 AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
+AM_CONDITIONAL(LIBGO_IS_SPARC, test $is_sparc = yes)
+AM_CONDITIONAL(LIBGO_IS_SPARCV9, test $isv_sparcv9 = yes)
+AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
 AC_SUBST(GOARCH)
 
 dnl Use -fsplit-stack when compiling C code if available.
 AC_CACHE_CHECK([whether -fsplit-stack is supported],
-[ac_cv_libgo_split_stack_supported],
+[libgo_cv_c_split_stack_supported],
 [CFLAGS_hold=$CFLAGS
 CFLAGS="$CFLAGS -fsplit-stack"
 AC_COMPILE_IFELSE([[int i;]],
-[ac_cv_libgo_split_stack_supported=yes],
-[ac_cv_libgo_split_stack_supported=no])
+[libgo_cv_c_split_stack_supported=yes],
+[libgo_cv_c_split_stack_supported=no])
 CFLAGS=$CFLAGS_hold])
-if test "$ac_cv_libgo_split_stack_supported" = yes; then
+if test "$libgo_cv_c_split_stack_supported" = yes; then
   SPLIT_STACK=-fsplit-stack
   AC_DEFINE(USING_SPLIT_STACK, 1,
                [Define if the compiler supports -fsplit-stack])
@@ -176,7 +200,7 @@ else
 fi
 AC_SUBST(SPLIT_STACK)
 AM_CONDITIONAL(USING_SPLIT_STACK,
-       test "$ac_cv_libgo_split_stack_supported" = yes)
+       test "$libgo_cv_c_split_stack_supported" = yes)
 
 dnl Check whether the linker does stack munging when calling from
 dnl split-stack into non-split-stack code.  We check this by looking
@@ -184,12 +208,12 @@ dnl at the --help output.  FIXME: This is only half right: it's
 dnl possible for the linker to support this for some targets but not
 dnl others.
 AC_CACHE_CHECK([whether linker supports split stack],
-[ac_cv_libgo_linker_supports_split_stack],
-ac_cv_libgo_linker_supports_split_stack=no
+[libgo_cv_c_linker_supports_split_stack],
+libgo_cv_c_linker_supports_split_stack=no
 if $LD --help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
-  ac_cv_libgo_linker_supports_split_stack=yes
+  libgo_cv_c_linker_supports_split_stack=yes
 fi)
-if test "$ac_cv_libgo_linker_supports_split_stack" = yes; then
+if test "$libgo_cv_c_linker_supports_split_stack" = yes; then
   AC_DEFINE(LINKER_SUPPORTS_SPLIT_STACK, 1,
            [Define if the linker support split stack adjustments])
 fi
@@ -199,17 +223,48 @@ MATH_LIBS=
 AC_CHECK_LIB([m], [sqrt], MATH_LIBS=-lm)
 AC_SUBST(MATH_LIBS)
 
+dnl Test for -lsocket and -lnsl.  Copied from libjava/configure.ac.
+AC_CACHE_CHECK([for socket libraries], libgo_cv_lib_sockets,
+  [libgo_cv_lib_sockets=
+   libgo_check_both=no
+   AC_CHECK_FUNC(connect, libgo_check_socket=no, libgo_check_socket=yes)
+   if test "$libgo_check_socket" = "yes"; then
+     unset ac_cv_func_connect
+     AC_CHECK_LIB(socket, main, libgo_cv_lib_sockets="-lsocket",
+                 libgo_check_both=yes)
+   fi
+   if test "$libgo_check_both" = "yes"; then
+     libgo_old_libs=$LIBS
+     LIBS="$LIBS -lsocket -lnsl"
+     unset ac_cv_func_accept
+     AC_CHECK_FUNC(accept,
+                  [libgo_check_nsl=no
+                   libgo_cv_lib_sockets="-lsocket -lnsl"])
+     unset ac_cv_func_accept
+     LIBS=$libgo_old_libs
+   fi
+   unset ac_cv_func_gethostbyname
+   libgo_old_libs="$LIBS"
+   AC_CHECK_FUNC(gethostbyname, ,
+                [AC_CHECK_LIB(nsl, main,
+                       [libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lnsl"])])
+   unset ac_cv_func_gethostbyname
+   LIBS=$libgo_old_libs
+])
+NET_LIBS="$libgo_cv_lib_sockets"
+AC_SUBST(NET_LIBS)
+
 dnl Test whether the compiler supports the -pthread option.
 AC_CACHE_CHECK([whether -pthread is supported],
-[ac_cv_libgo_pthread_supported],
+[libgo_cv_lib_pthread],
 [CFLAGS_hold=$CFLAGS
 CFLAGS="$CFLAGS -pthread"
 AC_COMPILE_IFELSE([[int i;]],
-[ac_cv_libgo_pthread_supported=yes],
-[ac_cv_libgo_pthread_supported=no])
+[libgo_cv_lib_pthread=yes],
+[libgo_cv_lib_pthread=no])
 CFLAGS=$CFLAGS_hold])
 PTHREAD_CFLAGS=
-if test "$ac_cv_libgo_pthread_supported" = yes; then
+if test "$libgo_cv_lib_pthread" = yes; then
   PTHREAD_CFLAGS=-pthread
 fi
 AC_SUBST(PTHREAD_CFLAGS)
@@ -230,15 +285,15 @@ AC_CHECK_FUNCS(srandom random strsignal)
 dnl For x86 we want to use the -minline-all-stringops option to avoid
 dnl forcing a stack split when calling memcpy and friends.
 AC_CACHE_CHECK([whether compiler supports -minline-all-stringops],
-[ac_cv_libgo_compiler_supports_inline_all_stringops],
+[libgo_cv_c_stringops],
 [CFLAGS_hold=$CFLAGS
 CFLAGS="$CFLAGS -minline-all-stringops"
 AC_COMPILE_IFELSE([int i;],
-[ac_cv_libgo_compiler_supports_inline_all_stringops=yes],
-[ac_cv_libgo_compiler_supports_inline_all_stringops=no])
+[libgo_cv_c_stringops=yes],
+[libgo_cv_c_stringops=no])
 CFLAGS=$CFLAGS_hold])
 STRINGOPS_FLAG=
-if test "$ac_cv_libgo_compiler_supports_inline_all_stringops" = yes; then
+if test "$libgo_cv_c_stringops" = yes; then
   STRINGOPS_FLAG=-minline-all-stringops
 fi
 AC_SUBST(STRINGOPS_FLAG)
diff --git a/libgo/go/debug/proc/proc_solaris.go b/libgo/go/debug/proc/proc_solaris.go
new file mode 100644 (file)
index 0000000..a72c592
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
+
+import "os"
+
+// Process tracing is not supported on Solaris yet.
+
+func Attach(pid int) (Process, os.Error) {
+       return nil, os.NewError("debug/proc not implemented on Solaris")
+}
+
+func ForkExec(argv0 string, argv []string, envv []string, dir string, fd []*os.File) (Process, os.Error) {
+       return Attach(0)
+}
diff --git a/libgo/go/debug/proc/regs_solaris_386.go b/libgo/go/debug/proc/regs_solaris_386.go
new file mode 100644 (file)
index 0000000..3fc3e51
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
diff --git a/libgo/go/debug/proc/regs_solaris_amd64.go b/libgo/go/debug/proc/regs_solaris_amd64.go
new file mode 100644 (file)
index 0000000..3fc3e51
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
diff --git a/libgo/go/debug/proc/regs_solaris_sparc.go b/libgo/go/debug/proc/regs_solaris_sparc.go
new file mode 100644 (file)
index 0000000..3fc3e51
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
diff --git a/libgo/go/debug/proc/regs_solaris_sparcv9.go b/libgo/go/debug/proc/regs_solaris_sparcv9.go
new file mode 100644 (file)
index 0000000..3fc3e51
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright 2011 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package proc
diff --git a/libgo/syscalls/syscall_solaris.go b/libgo/syscalls/syscall_solaris.go
new file mode 100644 (file)
index 0000000..ec22933
--- /dev/null
@@ -0,0 +1,7 @@
+// syscall_solaris.go -- Solaris 2 specific syscall interface.
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
diff --git a/libgo/syscalls/syscall_solaris_386.go b/libgo/syscalls/syscall_solaris_386.go
new file mode 100644 (file)
index 0000000..20e8b5d
--- /dev/null
@@ -0,0 +1,19 @@
+// syscall_solaris_386.go -- Solaris/x86 specific support
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
+
+import "unsafe"
+
+const ARCH = "386"
+
+// FIXME: ptrace(3C) has this, but exec.go expects the next.
+//func libc_ptrace(request int, pid Pid_t, addr int, data int) int __asm__ ("ptrace")
+
+func libc_ptrace(request int, pid Pid_t, addr uintptr, data *byte) int __asm__ ("ptrace")
+
+var dummy *byte
+const sizeofPtr uintptr = uintptr(unsafe.Sizeof(dummy))
diff --git a/libgo/syscalls/syscall_solaris_amd64.go b/libgo/syscalls/syscall_solaris_amd64.go
new file mode 100644 (file)
index 0000000..628e781
--- /dev/null
@@ -0,0 +1,23 @@
+// syscall_solaris_amd64.go -- Solaris/x64 specific support
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
+
+import "unsafe"
+
+const ARCH = "amd64"
+
+// FIXME: ptrace(3C) has this, but exec.go expects the next.
+//func libc_ptrace(request int, pid Pid_t, addr int, data int) int __asm__ ("ptrace")
+
+// 64-bit ptrace(3C) doesn't exist
+func libc_ptrace(request int, pid Pid_t, addr uintptr, data *byte) int {
+       errno := ENOSYS
+       return -1
+}
+
+var dummy *byte
+const sizeofPtr uintptr = uintptr(unsafe.Sizeof(dummy))
diff --git a/libgo/syscalls/syscall_solaris_sparc.go b/libgo/syscalls/syscall_solaris_sparc.go
new file mode 100644 (file)
index 0000000..91758d5
--- /dev/null
@@ -0,0 +1,7 @@
+// syscall_solaris_sparc.go -- Solaris SPARC specific support
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
diff --git a/libgo/syscalls/syscall_solaris_sparcv9.go b/libgo/syscalls/syscall_solaris_sparcv9.go
new file mode 100644 (file)
index 0000000..f371dd2
--- /dev/null
@@ -0,0 +1,7 @@
+// syscall_solaris_v9.go -- Solaris sparc9v specific support
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
index 6e957d3f87bf483f74ae280de07c58826f7fc3d0..9610691578132ecae993cdb0a2d4a07b9083207e 100644 (file)
@@ -105,6 +105,7 @@ MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MATH_LIBS = @MATH_LIBS@
 MKDIR_P = @MKDIR_P@
+NET_LIBS = @NET_LIBS@
 NM = @NM@
 NMEDIT = @NMEDIT@
 OBJCOPY = @OBJCOPY@