configure.ac 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Configure script for gotools.
  2. # Copyright 2015 Free Software Foundation, Inc.
  3. #
  4. # This file is free software; you can redistribute it and/or modify it
  5. # under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful, but
  10. # WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; see the file COPYING3. If not see
  16. # <http://www.gnu.org/licenses/>.
  17. AC_INIT(package-unused, version-unused,, gotools)
  18. AC_PREREQ(2.64)
  19. AC_CONFIG_SRCDIR(Makefile.am)
  20. m4_include([config/go.m4])
  21. # Determine the noncanonical names used for directories.
  22. ACX_NONCANONICAL_BUILD
  23. ACX_NONCANONICAL_HOST
  24. ACX_NONCANONICAL_TARGET
  25. dnl Autoconf 2.5x and later will set a default program prefix if
  26. dnl --target was used, even if it was the same as --host. Disable
  27. dnl that behavior. This must be done before AC_CANONICAL_SYSTEM
  28. dnl to take effect.
  29. test "$host_noncanonical" = "$target_noncanonical" &&
  30. test "$program_prefix$program_suffix$program_transform_name" = \
  31. NONENONEs,x,x, &&
  32. program_transform_name=s,y,y,
  33. AC_CANONICAL_SYSTEM
  34. AC_ARG_PROGRAM
  35. AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dist -Wall -Wno-portability])
  36. AM_MAINTAINER_MODE
  37. AC_PROG_INSTALL
  38. AC_PROG_CC
  39. AC_PROG_GO
  40. AM_CONDITIONAL(NATIVE, test "$cross_compiling" = no)
  41. dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac.
  42. AC_CACHE_CHECK([for socket libraries], gotools_cv_lib_sockets,
  43. [gotools_cv_lib_sockets=
  44. gotools_check_both=no
  45. AC_CHECK_FUNC(connect, gotools_check_socket=no, gotools_check_socket=yes)
  46. if test "$gotools_check_socket" = "yes"; then
  47. unset ac_cv_func_connect
  48. AC_CHECK_LIB(socket, main, gotools_cv_lib_sockets="-lsocket",
  49. gotools_check_both=yes)
  50. fi
  51. if test "$gotools_check_both" = "yes"; then
  52. gotools_old_libs=$LIBS
  53. LIBS="$LIBS -lsocket -lnsl"
  54. unset ac_cv_func_accept
  55. AC_CHECK_FUNC(accept,
  56. [gotools_check_nsl=no
  57. gotools_cv_lib_sockets="-lsocket -lnsl"])
  58. unset ac_cv_func_accept
  59. LIBS=$gotools_old_libs
  60. fi
  61. unset ac_cv_func_gethostbyname
  62. gotools_old_libs="$LIBS"
  63. AC_CHECK_FUNC(gethostbyname, ,
  64. [AC_CHECK_LIB(nsl, main,
  65. [gotools_cv_lib_sockets="$gotools_cv_lib_sockets -lnsl"])])
  66. unset ac_cv_func_gethostbyname
  67. LIBS=$gotools_old_libs
  68. ])
  69. NET_LIBS="$gotools_cv_lib_sockets"
  70. AC_SUBST(NET_LIBS)
  71. dnl Test if -lrt is required for sched_yield and/or nanosleep.
  72. AC_SEARCH_LIBS([sched_yield], [rt])
  73. AC_SEARCH_LIBS([nanosleep], [rt])
  74. AC_CONFIG_FILES(Makefile)
  75. AC_OUTPUT