1 dnl acinclude.m4 -- configure macros
3 dnl Copyright 2009 The Go Authors. All rights reserved.
4 dnl Use of this source code is governed by a BSD-style
5 dnl license that can be found in the LICENSE file.
7 dnl Go support--this could be in autoconf.
8 dnl This version is probably autoconf 2.64 specific.
10 AC_LANG_DEFINE([Go], [go], [GO], [],
12 ac_compile='$GOC -c $GOCFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
13 ac_link='$GOC -o conftest$ac_exeext $GOCFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
17 AU_DEFUN([AC_LANG_GO], [AC_LANG(Go)])
19 m4_define([AC_LANG_PROGRAM(Go)],
26 m4_define([_AC_LANG_IO_PROGRAM(Go)],
27 [AC_LANG_PROGRAM([import "os"],
28 [if f, err := os.Create("conftest.out"), err != nil {
31 if err := f.Close(); err != nil {
37 m4_define([AC_LANG_CALL(Go)],
40 [func $2();])],[$2();])])
42 m4_define([AC_LANG_FUNC_LINK_TRY(Go)],
48 m4_define([AC_LANG_BOOL_COMPILE_TRY(Go)],
49 [AC_LANG_PROGRAM([$1], [var test_array @<:@1 - 2 * !($2)@:>@;
50 test_array @<:@0@:>@ = 0
53 m4_define([AC_LANG_INT_SAVE(Go)],
56 func longval() long { return $2 }
57 func ulongval() ulong { return $2 }],
58 [panic("unimplemented")])])
60 AC_DEFUN([AC_LANG_COMPILER(Go)],
61 [AC_REQUIRE([AC_PROG_GO])])
63 AN_MAKEVAR([GOC], [AC_PROG_GO])
64 AN_PROGRAM([gccgo], [AC_PROG_GO])
65 AC_DEFUN([AC_PROG_GO],
67 AC_ARG_VAR([GOC], [Go compiler command])dnl
68 AC_ARG_VAR([GOCFLAGS], [Go compiler flags])dnl
69 _AC_ARG_VAR_LDFLAGS()dnl
71 [AC_CHECK_TOOLS(GOC, [$1])],
72 [AC_CHECK_TOOL(GOC, gccgo)
73 if test -z "$GOC"; then
74 if test -n "$ac_tool_prefix"; then
75 AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [$ac_tool_prefix}gccgo])
78 if test -z "$GOC"; then
79 AC_CHECK_PROG(GOC, gccgo, gccgo, , , gccgo)
83 # Provide some information about the compiler.
84 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
87 _AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
88 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
89 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl