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
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
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
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=
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-*-*)
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
;;
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=
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='#'
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
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
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
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
{ $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
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
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
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
#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
;;
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])
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
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
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)
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)