gcj.texi: Document -static-libgcj option.

gcc/java/
2006-03-08  David Daney  <ddaney@avtrex.com>

	* gcj.texi: Document -static-libgcj option.

libjava/
2006-03-08  David Daney  <ddaney@avtrex.com>

	* configure.ac (LD): Add AC_CHECK_TOOL for ld.
	(LD_START_STATIC_SPEC): New AC_SUBST, set with ld check.
	(LD_FINISH_STATIC_SPEC): Ditto
	* configure: Regenerated.
	* libgcj.spec.in: Wrap -lgcj in LD_START_STATIC_SPEC and
	LD_FINISH_STATIC_SPEC.

From-SVN: r111847
This commit is contained in:
David Daney 2006-03-08 20:22:02 +00:00 committed by David Daney
parent dedfa46611
commit d6c122f73b
6 changed files with 137 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2006-03-08 David Daney <ddaney@avtrex.com>
* gcj.texi: Document -static-libgcj option.
2006-02-20 Andrew Haley <aph@redhat.com>
* jcf-parse.c (parse_class_file): Set input_location from

View File

@ -420,6 +420,20 @@ Create an application whose command-line processing is that
of the @code{gij} command.
This option is an alternative to using @code{--main}; you cannot use both.
@item -static-libgcj
This option causes linking to be done against a static version of the
libgcj runtime library. This option is only available if
corresponding linker support exists.
@strong{Caution:} Static linking of libgcj may cause essential parts
of libgcj to be omitted. Some parts of libgcj use reflection to load
classes at runtime. Since the linker does not see these references at
link time, it can omit the referred to classes. The result is usually
(but not always) a @code{ClassNotFoundException} being thrown at
runtime. Caution must be used when using this option. For more
details see:
@w{@uref{http://gcc.gnu.org/wiki/Statically%20linking%20libgcj}}
@end table
@node Code Generation

View File

@ -1,3 +1,12 @@
2006-03-08 David Daney <ddaney@avtrex.com>
* configure.ac (LD): Add AC_CHECK_TOOL for ld.
(LD_START_STATIC_SPEC): New AC_SUBST, set with ld check.
(LD_FINISH_STATIC_SPEC): Ditto
* configure: Regenerated.
* libgcj.spec.in: Wrap -lgcj in LD_START_STATIC_SPEC and
LD_FINISH_STATIC_SPEC.
2006-03-07 Tom Tromey <tromey@redhat.com>
PR libgcj/26103:

100
libjava/configure vendored
View File

@ -310,7 +310,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_subdir host_subdir target_subdir libgcj_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE GTK_AWT_TRUE GTK_AWT_FALSE QT_AWT_TRUE QT_AWT_FALSE GCJH ZIP INCLTDL LIBLTDL DIRLTDL LIBTOOL CXXCPP CPPFLAGS GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME INTERPRETER LIBFFI LIBFFIINCS PLATFORM_INNER_NAT_HDRS CPP EGREP USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC LIBGCJTESTSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CAIRO_TRUE GTK_CAIRO_FALSE PKG_CONFIG CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS extra_ldflags_libjava GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ac_ct_GCJ ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir dbexecdir GCJVERSION gxx_include_dir libstdcxx_incdir ALLOCA PERL SYSDEP_SOURCES here LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_subdir host_subdir target_subdir libgcj_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE GTK_AWT_TRUE GTK_AWT_FALSE QT_AWT_TRUE QT_AWT_FALSE GCJH ZIP INCLTDL LIBLTDL DIRLTDL LIBTOOL CXXCPP CPPFLAGS GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME INTERPRETER LIBFFI LIBFFIINCS PLATFORM_INNER_NAT_HDRS CPP EGREP USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC LIBGCJTESTSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CAIRO_TRUE GTK_CAIRO_FALSE PKG_CONFIG CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS extra_ldflags_libjava GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ac_ct_GCJ ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir dbexecdir GCJVERSION gxx_include_dir libstdcxx_incdir ALLOCA PERL SYSDEP_SOURCES LD_START_STATIC_SPEC LD_FINISH_STATIC_SPEC here LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -3726,6 +3726,85 @@ else
AS="$ac_cv_prog_AS"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
set dummy ${ac_tool_prefix}ld; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_LD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$LD"; then
ac_cv_prog_LD="$LD" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_LD="${ac_tool_prefix}ld"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
LD=$ac_cv_prog_LD
if test -n "$LD"; then
echo "$as_me:$LINENO: result: $LD" >&5
echo "${ECHO_T}$LD" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_LD"; then
ac_ct_LD=$LD
# Extract the first word of "ld", so it can be a program name with args.
set dummy ld; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_LD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_LD"; then
ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_LD="ld"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_LD=$ac_cv_prog_ac_ct_LD
if test -n "$ac_ct_LD"; then
echo "$as_me:$LINENO: result: $ac_ct_LD" >&5
echo "${ECHO_T}$ac_ct_LD" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
LD=$ac_ct_LD
else
LD="$ac_cv_prog_LD"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
@ -5589,7 +5668,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 5592 "configure"' > conftest.$ac_ext
echo '#line 5671 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -6592,7 +6671,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then
:
else
cat > conftest.$ac_ext << EOF
#line 6595 "configure"
#line 6674 "configure"
struct S { ~S(); };
void bar();
void foo()
@ -16729,6 +16808,17 @@ _ACEOF
fi
# Check if linker supports static linking on a per library basis
LD_START_STATIC_SPEC=
LD_FINISH_STATIC_SPEC=
if $LD --help 2>&1 | grep -q -e -call_shared ; then
if $LD --help 2>&1 | grep -q -e -non_shared ; then
LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
fi
fi
here=`${PWDCMD-pwd}`
@ -17624,6 +17714,8 @@ s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
s,@AS@,$AS,;t t
s,@ac_ct_AS@,$ac_ct_AS,;t t
s,@LD@,$LD,;t t
s,@ac_ct_LD@,$ac_ct_LD,;t t
s,@AR@,$AR,;t t
s,@ac_ct_AR@,$ac_ct_AR,;t t
s,@RANLIB@,$RANLIB,;t t
@ -17748,6 +17840,8 @@ s,@libstdcxx_incdir@,$libstdcxx_incdir,;t t
s,@ALLOCA@,$ALLOCA,;t t
s,@PERL@,$PERL,;t t
s,@SYSDEP_SOURCES@,$SYSDEP_SOURCES,;t t
s,@LD_START_STATIC_SPEC@,$LD_START_STATIC_SPEC,;t t
s,@LD_FINISH_STATIC_SPEC@,$LD_FINISH_STATIC_SPEC,;t t
s,@here@,$here,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t

View File

@ -113,6 +113,7 @@ AC_SUBST(LDFLAGS)
AM_INIT_AUTOMAKE([1.9.0])
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(LD, ld)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
@ -1418,6 +1419,17 @@ fi
# See if we support thread-local storage.
GCC_CHECK_TLS
# Check if linker supports static linking on a per library basis
LD_START_STATIC_SPEC=
LD_FINISH_STATIC_SPEC=
if $LD --help 2>&1 | grep -q -e -call_shared ; then
if $LD --help 2>&1 | grep -q -e -non_shared ; then
LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
fi
fi
AC_SUBST(LD_START_STATIC_SPEC)
AC_SUBST(LD_FINISH_STATIC_SPEC)
here=`${PWDCMD-pwd}`
AC_SUBST(here)

View File

@ -4,6 +4,6 @@
# to link with libgcj.
#
%rename lib liborig
*lib: -lgcj -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig)
*lib: @LD_START_STATIC_SPEC@ -lgcj @LD_FINISH_STATIC_SPEC@ -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig)
*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ -fkeep-inline-functions