Ralf Wildenhues <ralf.wildenh...@gmx.de> writes: > * Ian Lance Taylor wrote on Tue, Oct 12, 2010 at 11:42:56PM CEST: >> This patch adds support for the Go programming language to libtool. Go >> is described at http://golang.org/ . >> >> I'm not very familiar with libtool. This patch is mostly a >> cut-and-paste job. It is enough to let me use automake with LIBTOOL to >> build libraries from Go code. > > Do you have, or are working on, an Automake patch for Go support?
I do not have an automake patch, although that is a logical next step. I've been using libtool with a Makefile.am which uses this definition: LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GCCGO) $(INCLUDES) \ $(AM_GOFLAGS) $(GOFLAGS) and then runs $(LTGOCOMPILE) as needed. Adding Go support to automake may be a little tricky as Go requires a slightly different compilation model: you must pass all files that are in the same package to the compiler at once. You can't compile them separately. >> The patch requires a patch which I've proposed for autoconf: >> >> http://lists.gnu.org/archive/html/autoconf-patches/2010-10/msg00004.html >> >> I'm not sure how to handle a libtool patch which requires an autoconf >> patch. Perhaps this can not be committed until the next libtool >> release. > > We usually try to support older Autoconf as well (currently back to > 2.59), so that people don't need to upgrade all at once. When only > macros from Autoconf proper are missing (as opposed to macros from other > third parties), they can be treated similarly to how AC_PROG_SED is > treated with a backup in libtool.m4. Done. >> In any case I would appreciate any comments and any advice as to how to >> get this committed to libtool. Thanks. > > tests/suffix.test should be updated. Dont. > Can you send output of > ./libtool --tag=GO --config > > for Libtool with Go support enabled? You need to patch Libtool's > configure.ac to enable Go support (this should be part of the patch as > well). Attached. > A NEWS entry would be good. Done. > Testsuite additions (to the new testsuite) > would be nice, like one setup where Go is the only language enabled (to > verify that object and executable extension computation work etc). > We can write those tests if you're not familiar with Autotest. Can you suggest a test that I can look at to see what this should look like? Updated patch attached (two patches from git format-patch, let me know if there is a better way to send this). Ian
# Which release of libtool.m4 was used? macro_version=2.4.1a macro_revision=1.3300 # Assembler program. AS="as" # DLL creation program. DLLTOOL="false" # Object dumper program. OBJDUMP="objdump" # Whether or not to build shared libraries. build_libtool_libs=yes # Whether or not to build static libraries. build_old_libs=yes # What type of objects to build. pic_mode=default # Whether or not to optimize for fast installation. fast_install=yes # Shell to use when invoking shell scripts. SHELL="/bin/sh" # An echo program that protects backslashes. ECHO="printf %s\\n" # The host system. host_alias= host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= build=x86_64-unknown-linux-gnu build_os=linux-gnu # A sed program that does not truncate output. SED="/bin/sed" # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # A grep program that handles long lines. GREP="/bin/grep" # An ERE matcher. EGREP="/bin/grep -E" # A literal string matcher. FGREP="/bin/grep -F" # A BSD- or MS-compatible name lister. NM="/usr/bin/nm -B" # Whether we need soft or hard links. LN_S="ln -s" # What is the maximum length of a command? max_cmd_len=1572864 # Object file suffix (normally "o"). objext=o # Executable file suffix (normally ""). exeext= # whether the shell understands "unset". lt_unset=unset # turn spaces into newlines. SP2NL="tr \\040 \\012" # turn newlines into spaces. NL2SP="tr \\015\\012 \\040\\040" # convert $build file names to $host format. to_host_file_cmd=func_convert_file_noop # convert $build files to toolchain format. to_tool_file_cmd=func_convert_file_noop # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" # Command to use when deplibs_check_method = "file_magic". file_magic_cmd="\$MAGIC_CMD" # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob="" # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob="no" # Command to associate shared and link libraries. sharedlib_from_linklib_cmd="printf %s\\n" # The archiver. AR="ar" # Flags to create an archive. AR_FLAGS="cru" # How to feed a file listing to the archiver. archiver_list_spec="@" # A symbol stripping program. STRIP="strip" # Commands used to install an old-style archive. RANLIB="ranlib" old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" old_postuninstall_cmds="" # Whether to use a lock for old archive extraction. lock_old_archive_extraction=no # A C compiler. LTCC="gcc" # LTCC compiler flags. LTCFLAGS="-g -O2" # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'" # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'" # Specify filename containing input files for $NM. nm_file_list_spec="@" # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot= # The name of the directory that contains temporary libtool files. objdir=.libs # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=file # Must we lock files when doing compilation? need_locks="no" # Manifest tool. MANIFEST_TOOL=":" # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL="" # Tool to change global to local symbols on Mac OS X. NMEDIT="" # Tool to manipulate fat objects and archives on Mac OS X. LIPO="" # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL="" # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64="" # Old archive suffix (normally "a"). libext=a # Shared library suffix (normally ".so"). shrext_cmds=".so" # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds="" # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" # Do we need the "lib" prefix for modules? need_lib_prefix=no # Do we need a version for libraries? need_version=no # Library versioning type. version_type=linux # Shared library runtime path variable. runpath_var=LD_RUN_PATH # Shared library path variable. shlibpath_var=LD_LIBRARY_PATH # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=no # Format of library name prefix. libname_spec="lib\$name" # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" # The coded name of the library, if different from the real name. soname_spec="\${libname}\${release}\${shared_ext}\$major" # Permission mode override for installation of shared libraries. install_override_mode="" # Command to use after installation of a shared archive. postinstall_cmds="" # Command to use after uninstallation of a shared archive. postuninstall_cmds="" # Commands used to finish a libtool library installation in a directory. finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval="" # Whether we should hardcode library paths into libraries. hardcode_into_libs=yes # Compile-time system search path for libraries. sys_lib_search_path_spec="/home/iant/gcc/gccgo-install/lib/gcc/x86_64-unknown-linux-gnu/4.6.0 /home/iant/gcc/gccgo-install/lib64 /lib64 /usr/lib64 " # Run-time system search path for libraries. sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/nvidia-current /usr/lib32/nvidia-current /usr/lib32/alsa-lib /usr/lib/alsa-lib /usr/local/lib /usr/lib/opencryptoki /usr/lib/opencryptoki/stdll /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu " # Whether dlopen is supported. dlopen_support=yes # Whether dlopen of programs is supported. dlopen_self=yes # Whether dlopen of statically linked programs is supported. dlopen_self_static=no # Commands to strip libraries. old_striplib="strip --strip-debug" striplib="strip --strip-unneeded" # The linker used to build libraries. LD="/home/iant/binutils/gold-dir/ld -m elf_x86_64" # How to create reloadable object files. reload_flag=" -r" reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" # Commands used to build an old-style archive. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" # A language specific compiler. CC="gcc" # Is the compiler the GNU compiler? with_gcc=yes # Compiler flag to turn off builtin functions. no_builtin_flag=" -fno-builtin" # Additional compiler flags for building library objects. pic_flag=" -fPIC -DPIC" # How to pass a linker flag through the compiler. wl="-Wl," # Compiler flag to prevent dynamic linking. link_static_flag="-static" # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=no # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=no # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec="\${wl}--export-dynamic" # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" # Whether the compiler copes with passing no objects directly. compiler_needs_object="no" # Create an old-style archive from a shared archive. old_archive_from_new_cmds="" # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds="" # Commands used to build a shared archive. archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" # Commands used to build a loadable module if different from building # a shared archive. module_cmds="" module_expsym_cmds="" # Whether we are building with GNU ld or not. with_gnu_ld="yes" # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag="" # Flag that enforces no undefined symbols. no_undefined_flag="" # Flag to hardcode $libdir into a binary during linking. # This must work even if $libdir does not exist hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" # If ld is used when linking, flag to hardcode $libdir into a binary # during linking. This must work even if $libdir does not exist. hardcode_libdir_flag_spec_ld="" # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator="" # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=no # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting ${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=no # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=no # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=unsupported # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=no # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=no # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=unknown # Set to "yes" if exported symbols are required. always_export_symbols=no # The commands to list exported symbols. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" # Symbols that should not be listed in the preloaded symbols. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" # Symbols that must always be exported. include_expsyms="" # Commands necessary for linking programs (against libraries) with templates. prelink_cmds="" # Commands necessary for finishing linking programs. postlink_cmds="" # Specify filename containing input files. file_list_spec="" # How to hardcode a shared library path into an executable. hardcode_action=immediate # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs="" # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects="" postdep_objects="" predeps="" postdeps="" # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path="" # ### BEGIN LIBTOOL TAG CONFIG: GO # The linker used to build libraries. LD="/home/iant/binutils/gold-dir/ld -m elf_x86_64" # How to create reloadable object files. reload_flag=" -r" reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" # Commands used to build an old-style archive. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" # A language specific compiler. CC="gccgo" # Is the compiler the GNU compiler? with_gcc= # Compiler flag to turn off builtin functions. no_builtin_flag=" -fno-builtin" # Additional compiler flags for building library objects. pic_flag=" -fPIC" # How to pass a linker flag through the compiler. wl="-Wl," # Compiler flag to prevent dynamic linking. link_static_flag="-static" # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=no # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=no # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec="\${wl}--export-dynamic" # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" # Whether the compiler copes with passing no objects directly. compiler_needs_object="no" # Create an old-style archive from a shared archive. old_archive_from_new_cmds="" # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds="" # Commands used to build a shared archive. archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" # Commands used to build a loadable module if different from building # a shared archive. module_cmds="" module_expsym_cmds="" # Whether we are building with GNU ld or not. with_gnu_ld="yes" # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag="" # Flag that enforces no undefined symbols. no_undefined_flag="" # Flag to hardcode $libdir into a binary during linking. # This must work even if $libdir does not exist hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" # If ld is used when linking, flag to hardcode $libdir into a binary # during linking. This must work even if $libdir does not exist. hardcode_libdir_flag_spec_ld="" # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator="" # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=no # Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting ${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=no # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=no # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=unsupported # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=no # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=no # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=unknown # Set to "yes" if exported symbols are required. always_export_symbols=no # The commands to list exported symbols. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" # Symbols that should not be listed in the preloaded symbols. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" # Symbols that must always be exported. include_expsyms="" # Commands necessary for linking programs (against libraries) with templates. prelink_cmds="" # Commands necessary for finishing linking programs. postlink_cmds="" # Specify filename containing input files. file_list_spec="" # How to hardcode a shared library path into an executable. hardcode_action=immediate # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs="" # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects="" postdep_objects="" predeps="" postdeps="" # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path="" # ### END LIBTOOL TAG CONFIG: GO
>From b4af7daf876a49174e87a76345f4c8f96521702c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor <i...@google.com> Date: Tue, 12 Oct 2010 14:38:49 -0700 Subject: [PATCH 1/2] Add Go support. --- ChangeLog | 11 ++++++ doc/libtool.texi | 3 +- libltdl/config/ltmain.m4sh | 2 +- libltdl/m4/libtool.m4 | 84 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9caba84..732b2d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-10-12 Ian Lance Taylor <i...@google.com> + + * libltdl/m4/libtool.m4 (LT_LANG): Add Go. + (AC_PROG_GO): Provide. + (_LT_SYS_HIDDEN_LIBDEPS): Add Go case. + (_LT_LANG_GO_CONFIG): Define. + (LT_PROG_GO): Define. + * libltdl/config/ltmain.m4sh: Match *.go. + * doc/libtool.texi (LT_INIT): Mention Go. + (Tags): Mention Go. + 2010-10-07 Roumen Petrov <bugtr...@roumenpetrov.info> Add test case for 69e77671 (cwrapper PATH manipulation order) diff --git a/doc/libtool.texi b/doc/libtool.texi index cd5a181..302e6ed 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -2169,7 +2169,7 @@ specifying @option{--with-pic} to @command{configure}. @defmac LT_LANG (@var{language}) Enable @command{libtool} support for the language given if it has not yet already been enabled. Languages accepted are ``C++'', -``Fortran 77'', ``Java'' and ``Windows Resource''. +``Fortran 77'', ``Java'', ``Go'', and ``Windows Resource''. If Autoconf language support macros such as @code{AC_PROG_CXX} are used in your @file{configure.ac}, Libtool language support will automatically @@ -2768,6 +2768,7 @@ correspondence between language names and tags names. @item Java @tab GCJ @item Fortran 77 @tab F77 @item Fortran @tab FC +...@item Go @tab GO @item Windows Resource @tab RC @end multitable diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 1078e75..ee09925 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -1270,7 +1270,7 @@ func_mode_compile () *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 967dd38..fac9cc6 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -801,6 +801,7 @@ AC_DEFUN([LT_LANG], m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], @@ -852,6 +853,10 @@ AC_PROVIDE_IFELSE([AC_PROG_GCJ], m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) @@ -6902,6 +6907,11 @@ public class foo { } }; _LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS @@ -7423,6 +7433,75 @@ CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCCGO-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- @@ -7492,6 +7571,11 @@ AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GCCGO, gccgo,) +]) # LT_PROG_RC # ---------- -- 1.7.1
>From 1a57c1ff77b726ec1604bfa115ff4bdd48588bd6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor <i...@google.com> Date: Wed, 13 Oct 2010 10:17:22 -0700 Subject: [PATCH 2/2] Update Go support based on comments from Ralf Wildenhues. --- NEWS | 4 ++++ configure.ac | 1 + libltdl/m4/libtool.m4 | 23 +++++++++++++++++++++++ tests/suffix.test | 2 +- 4 files changed, 29 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS index 90e33f7..26139bb 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 2.4.2 2010-12-??: git version 2.4.1a, Libtool team: +* New features: + + - Initial support for Go, using the gccgo compiler. + * Bug fixes: - The generic approximation of the command line length limit (when getconf is diff --git a/configure.ac b/configure.ac index 63ee8bf..0bad772 100644 --- a/configure.ac +++ b/configure.ac @@ -196,6 +196,7 @@ _LTDL_SETUP LT_LANG(C++) LT_LANG(Fortran 77) LT_LANG(Fortran) +LT_LANG(Go) LT_LANG(Java) LT_LANG(Windows Resource) diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index fac9cc6..d572d5a 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -822,6 +822,29 @@ m4_defun([_LT_LANG], _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GCCGO], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GCCGO, gccgo) +if test -z "$GCCGO"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GCCGO, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GCCGO"; then + AC_CHECK_PROG(GCCGO, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- diff --git a/tests/suffix.test b/tests/suffix.test index a035897..b5c2a88 100755 --- a/tests/suffix.test +++ b/tests/suffix.test @@ -25,7 +25,7 @@ # Extensions taken from the ones that Automake recognizes, plus Objective C, # and GNU Ada. Also test that multiple dots are handled correctly. -extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 F90 f95 F95 f03 F03 for m s sx ada.ada" +extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 F90 f95 F95 f03 F03 for go m s sx ada.ada" bad_names="foo." . tests/defs || exit 1 -- 1.7.1