Allow gcc4 to be built as the secondary compiler on a gcc2-hybrid

* add new configure-option '--enable-hybrid-secondary'
* pick alternative include- and library-paths, if in hybrid-secondary
  mode
* switch to 'STARTFILE_PREFIX_SPEC', as that allows more obvious 
  specification of the search order
This commit is contained in:
Oliver Tappe 2013-07-07 18:12:57 +02:00
parent db57f3c887
commit bf6a88ff3a
4 changed files with 118 additions and 18 deletions

View File

@ -98,6 +98,8 @@ build_objdir := $(toplevel_builddir)/$(build_subdir)
build_libobjdir := $(toplevel_builddir)/$(build_libsubdir)
target_objdir := $(toplevel_builddir)/$(target_subdir)
ENABLE_HYBRID_SECONDARY = @ENABLE_HYBRID_SECONDARY@
# --------
# Defined vpaths
# --------
@ -2218,6 +2220,10 @@ DRIVER_DEFINES = \
`test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
-DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\""
ifeq ($(ENABLE_HYBRID_SECONDARY),yes)
DRIVER_DEFINES += -DENABLE_HYBRID_SECONDARY
endif
gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \
Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \
configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) $(VEC_H)
@ -3989,6 +3995,10 @@ PREPROCESSOR_DEFINES = \
-DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
@TARGET_SYSTEM_ROOT_DEFINE@
ifeq ($(ENABLE_HYBRID_SECONDARY),yes)
PREPROCESSOR_DEFINES += -DENABLE_HYBRID_SECONDARY
endif
cppbuiltin.o: cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
cppbuiltin.h Makefile
$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \

View File

@ -68,9 +68,56 @@ Boston, MA 02111-1307, USA. */
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
/* For both native and cross compiler, use standard Haiku include file
#ifdef ENABLE_HYBRID_SECONDARY
/* For a secondary compiler on a hybrid system, use alternative search paths.*/
#define INCLUDE_DEFAULTS \
{ \
{ GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
{ GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
{ GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
{ GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, \
{ FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, \
{ TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 }, \
{ "/boot/common/non-packaged/develop/headers/gcc4", 0, 0, 0, 0, 0 }, \
{ "/boot/common/develop/headers/gcc4", 0, 0, 0, 0, 0 }, \
{ "/boot/system/develop/headers/os", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/app", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/device", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/drivers", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/game", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/interface", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/kernel", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/locale", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/mail", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/media", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/midi", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/midi2", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/net", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/opengl", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/storage", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/support", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/translation", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/add-ons/graphics", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/add-ons/input_server", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/add-ons/mail_daemon", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/add-ons/registrar", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/add-ons/screen_saver", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/add-ons/tracker", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/be_apps/Deskbar", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/be_apps/NetPositive", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/os/be_apps/Tracker", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/3rdparty", 0, 0, 0, 1, 0 }, \
{ "/boot/system/develop/headers/bsd", 0, 0, 1, 1, 0 }, \
{ "/boot/system/develop/headers/glibc", 0, 0, 1, 1, 0 }, \
{ "/boot/system/develop/headers/gnu", 0, 0, 1, 1, 0 }, \
{ "/boot/system/develop/headers/posix", 0, 0, 1, 1, 0 }, \
{ "/boot/system/develop/headers", 0, 0, 0, 1, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
}
#else /* ENABLE_HYBRID_SECONDARY */
/* For both native and cross compiler, use standard Haiku include file
search paths.
For a cross compiler, it is expected that an appropriate sysroot has
For a cross compiler, it is expected that an appropriate sysroot has
been configured (e.g. /boot/system/develop/cross/x86) which will
be appended to each search folder given below. */
#define INCLUDE_DEFAULTS \
@ -117,6 +164,7 @@ Boston, MA 02111-1307, USA. */
{ "/boot/system/develop/headers", 0, 0, 0, 1, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
}
#endif /* ENABLE_HYBRID_SECONDARY */
/* Whee. LIBRARY_PATH is Be's LD_LIBRARY_PATH, which of course will
cause nasty problems if we override it. */
@ -125,12 +173,19 @@ Boston, MA 02111-1307, USA. */
/* With STANDARD_STARTFILE_PREFIX_{1,2} set to "/boot/common/develop/lib/"
and "/boot/system/develop/lib/", MD_STARTFILE_PREFIX adds the last one of the
standard paths. The user specific paths are set via LIBRARY_PATH_ENV. */
#undef STANDARD_STARTFILE_PREFIX_1
#define STANDARD_STARTFILE_PREFIX_1 "/boot/common/develop/lib/"
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_2 "/boot/system/develop/lib/"
#undef MD_STARTFILE_PREFIX
#define MD_STARTFILE_PREFIX "/boot/common/non-packaged/develop/lib/"
#undef STARTFILE_PREFIX_SPEC
#ifdef ENABLE_HYBRID_SECONDARY
/* For a secondary compiler on a hybrid system, use alternative search paths.*/
#define STARTFILE_PREFIX_SPEC \
"/boot/common/non-packaged/develop/lib/gcc4/ \
/boot/common/develop/lib/gcc4/ \
/boot/system/develop/lib/gcc4/"
#else /* ENABLE_HYBRID_SECONDARY */
#define STARTFILE_PREFIX_SPEC \
"/boot/common/non-packaged/develop/lib/ \
/boot/common/develop/lib/ \
/boot/system/develop/lib/"
#endif /* ENABLE_HYBRID_SECONDARY */
/* Haiku doesn't have a separate math library. */
#define MATH_LIBRARY ""

44
gcc/gcc/configure vendored
View File

@ -768,6 +768,7 @@ with_cpu
enable_multiarch
enable_multilib
ENABLE_BUILD_WITH_CXX
ENABLE_HYBRID_SECONDARY
coverage_flags
valgrind_command
valgrind_path_defines
@ -872,6 +873,7 @@ enable_werror_always
enable_checking
enable_coverage
enable_gather_detailed_mem_stats
enable_hybrid_secondary
enable_build_with_cxx
with_stabs
enable_multilib
@ -1575,6 +1577,7 @@ Optional Features:
optimization. Values are opt, noopt,
default is noopt
--enable-gather-detailed-mem-stats enable detailed memory allocation stats gathering
--enable-hybrid-secondary build a secondary compiler for a Haiku hybrid system
--enable-build-with-cxx build with C++ compiler instead of C compiler
--enable-multilib enable library support for multiple ABIs
--enable-multiarch enable support for multiarch paths
@ -6845,6 +6848,21 @@ fi
# Miscenalleous configure options
# -------------------------------
# handle --enable-hybrid-secondary
# Check whether --enable-hybrid_secondary was given.
if test "${enable_hybrid_secondary+set}" = set; then :
enableval=$enable_hybrid_secondary; ENABLE_HYBRID_SECONDARY=$enableval
else
ENABLE_HYBRID_SECONDARY=no
fi
if test "$ENABLE_HYBRID_SECONDARY" = "yes"; then
$as_echo "#define ENABLE_HYBRID_SECONDARY 1" >>confdefs.h
fi
# See if we are building gcc with C++.
# Check whether --enable-build-with-cxx was given.
if test "${enable_build_with_cxx+set}" = set; then :
@ -8645,6 +8663,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# UNSORTED
# --------
# Configure -lm usage for host tools that need it
math_library="-lm"
case $host in
@ -8654,7 +8673,6 @@ case $host in
;;
esac
# These libraries may be used by collect2.
# We may need a special search path to get them linked.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for collect2 libraries" >&5
@ -14608,7 +14626,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
esac
;;
beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
@ -16733,9 +16751,16 @@ gnu*)
;;
haiku*)
library_names_spec='${libname}${shared_ext}'
dynamic_linker="$host_os ld.so"
version_type=linux
need_lib_prefix=no
need_version=no
dynamic_linker="$host_os runtime_loader"
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LIBRARY_PATH
shlibpath_overrides_runpath=yes
sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
hardcode_into_libs=yes
;;
hpux9* | hpux10* | hpux11*)
@ -17252,7 +17277,7 @@ else
lt_cv_dlopen_libs=
case $host_os in
beos*)
beos* | haiku* )
lt_cv_dlopen="load_add_on"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
@ -17530,7 +17555,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 17530 "configure"
#line 17557 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17636,7 +17661,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 17636 "configure"
#line 17663 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -18582,8 +18607,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
haiku*)
archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
link_all_deplibs_CXX=yes
allow_undefined_flag_CXX=unsupported
archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
;;
hpux9*)
@ -19449,7 +19474,6 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;

View File

@ -583,6 +583,17 @@ fi
# Miscenalleous configure options
# -------------------------------
# handle --enable-hybrid-secondary
AC_ARG_ENABLE(hybrid_secondary,
[ --enable-hybrid-secondary build a secondary compiler for a Haiku hybrid system],
ENABLE_HYBRID_SECONDARY=$enableval,
ENABLE_HYBRID_SECONDARY=no)
AC_SUBST(ENABLE_HYBRID_SECONDARY)
if test "$ENABLE_HYBRID_SECONDARY" = "yes"; then
AC_DEFINE(ENABLE_HYBRID_SECONDARY, 1,
[Define if building hybrid secondary compiler.])
fi
# See if we are building gcc with C++.
AC_ARG_ENABLE(build-with-cxx,
[ --enable-build-with-cxx build with C++ compiler instead of C compiler],