This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to make g++ find its include files again
On Sun, 4 October 1998, 17:17:43, manfred@s-direktnet.de wrote:
> On Sat, 3 October 1998, 20:57:00, toon@moene.indiv.nluug.nl wrote:
>
> > I wrote:
> >
> [snip]
> > This is what I get on compiling - am I doing something wrong ?
> >
> > % /usr/snp/bin/g++ -v exntest.cc
> > Reading specs from
> > /usr/snp/lib/gcc-lib/m68k-next-nextstep3/egcs-2.92.11/specs
> > gcc version egcs-2.92.11 19981003 (gcc2 ss-980609 experimental)
> > /usr/snp/lib/gcc-lib/m68k-next-nextstep3/egcs-2.92.11/cpp
> > -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
> > -D__GNUC_MINOR__=92 -Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__
> > -D__BIG_ENDIAN__ -D__ARCHITECTURE__="m68k" -D_NEXT_SOURCE
> > -D__mc68000__ -D__m68k__ -D__NeXT__ -D__unix__ -D__MACH__
> > -D__BIG_ENDIAN__ -D__ARCHITECTURE__="m68k" -D_NEXT_SOURCE
> > -D__mc68000 -D__m68k -D__NeXT -D__unix -Asystem(unix) -Asystem(mach)
> > -Acpu(m68k) -Amachine(m68k) -D__EXCEPTIONS -D__STDC__
> > -D_NEXT_SOURCE exntest.cc /usr/tmp/ccVcK1KJ.ii
> > GNU CPP version egcs-2.92.11 19981003 (gcc2 ss-980609 experimental)
> > (68k, MIT syntax)
> > #include "..." search starts here:
> > #include <...> search starts here:
> >
> > /usr/snp/lib/gcc-lib/m68k-next-nextstep3/egcs-2.92.11/../../../../include
> > /usr/snp/lib/gcc-lib/m68k-next-nextstep3/egcs-2.92.11/../../../../m68k-next-nextstep3/include
> > /usr/snp/lib/gcc-lib/m68k-next-nextstep3/egcs-2.92.11/include
> > /usr/snp/lib/gcc-lib/m68k-next-nextstep3/egcs-2.92.11/include/ansi
> > /usr/snp/lib/gcc-lib/m68k-next-nextstep3/egcs-2.92.11/include/bsd
> > /NextDeveloper/Headers
> > /NextDeveloper/Headers/ansi
> > /NextDeveloper/Headers/bsd
> > /NextDeveloper/2.0CompatibleHeaders
> > /usr/include
> > /usr/include/bsd
> > End of search list.
> > exntest.cc:13: cstdio: No such file or directory
> > %
>
> Locating C++ include files has been broken by the introduction of the $(unlibsubdir)
> patch :-( Unfortunately, it now completely ignores e.g. --with-gxx-include-dir=...
> and --enable-version-specific-runtime-libs. I'm working on a fix.
The introduction of the $(unlibsubdir) patch made g++ fail
finding its include files, provided the user specified either
`--with-gxx-include-dir=...'
or
`--enable-version-specific-runtime-libs'
when running configure. As a result, the libstdc++/libio
Makefiles are using $(gxx_include_dir) for installing the C++
header files, while cccp.o gets a hardcoded
-DGPLUSPLUS_INCLUDE_DIR=\"$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include/g++\"
- no usage of the modified $(gxx_include_dir) at all.
The patch below introduces a new variable/macro "${use_unlibsubdir}"
which is properly set by configure and then emitted into the generated
Makefile. Depending on its value GPLUSPLUS_INCLUDE_DIR will now be
"$(gxx_include_dir)" if either of the above config params have been used,
or the unreadable relative path, else.
Jeff, btw, the new $(unlibsubdir) isn't used consistently;
I've added a similar change to protoize.o/unprotoize.o, too;
cpplib.o is completely missing an appropriate change, though.
Is this intentional?
I'm currently running three builds to check all three possible
variants; all built cccp executables so far contain the correct
directory names for C++ include files.
OK to install?
manfred
1998-10-06 Manfred Hollstein <manfred@s-direktnet.de>
* Makefile.in (use_unlibsubdir): New macro set by configure.
(cccp.o): Define GPLUSPLUS_INCLUDE_DIR properly.
(protoize.o, unprotoize.o): Likewise.
* configure.in (use_unlibsubdir): New variable; call AC_SUBST
with it.
* configure: Regenerate using autoconf 2.12.1.
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981006.orig/gcc/Makefile.in egcs-19981006/gcc/Makefile.in
--- egcs-19981006.orig/gcc/Makefile.in Tue Oct 6 11:35:59 1998
+++ egcs-19981006/gcc/Makefile.in Tue Oct 6 12:08:21 1998
@@ -272,6 +272,9 @@ libdir = @libdir@
libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
# Used to produce a relative $(tooldir) in gcc.o
unlibsubdir = ../../..
+# Use $(unlibsubdir) only if neither --with-gxx-include-dir nor
+# --enable-version-specific-runtime-libs have been specified.
+use_unlibsubdir = @use_unlibsubdir@
# Directory in which the compiler finds g++ includes.
gxx_include_dir= @gxx_include_dir@
# Directory to search for site-specific includes.
@@ -1860,11 +1863,13 @@ $(srcdir)/cexp.c: $(srcdir)/cexp.y
# We use $(libsubdir)/$(unlibsubdir) to match the
# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used.
+# But, we will do this only if neither --with-gxx-include-dir nor
+# --enable-version-specific-runtime-libs have been specified.
cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h gansidecl.h \
mbchar.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include/g++\" \
+ -DGPLUSPLUS_INCLUDE_DIR=\"`if test x$(use_unlibsubdir) = xyes; then echo $(libsubdir)/$(unlibsubdir)/..\`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++; else echo $(gxx_include_dir); fi`\" \
-DLOCAL_INCLUDE_DIR=\"$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include\" \
-DCROSS_INCLUDE_DIR=\"$(libsubdir)/$(unlibsubdir)/../$(target_alias)/sys-include\" \
-DTOOL_INCLUDE_DIR=\"$(libsubdir)/$(unlibsubdir)/../$(target_alias)/include\" \
@@ -1916,7 +1921,7 @@ unprotoize$(exeext): unprotoize.o getopt
protoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
+ -DGPLUSPLUS_INCLUDE_DIR=\"`if test x$(use_unlibsubdir) = xyes; then echo $(libsubdir)/$(unlibsubdir)/..\`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++; else echo $(gxx_include_dir); fi`\" \
-DCROSS_INCLUDE_DIR=\"$(libsubdir)/$(unlibsubdir)/../$(target_alias)/sys-include\" \
-DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
-DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
@@ -1926,7 +1931,7 @@ protoize.o: protoize.c $(srcdir)/../incl
unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
+ -DGPLUSPLUS_INCLUDE_DIR=\"`if test x$(use_unlibsubdir) = xyes; then echo $(libsubdir)/$(unlibsubdir)/..\`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++; else echo $(gxx_include_dir); fi`\" \
-DCROSS_INCLUDE_DIR=\"$(libsubdir)/$(unlibsubdir)/../$(target_alias)/sys-include\" \
-DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
-DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981006.orig/gcc/configure.in egcs-19981006/gcc/configure.in
--- egcs-19981006.orig/gcc/configure.in Thu Oct 1 10:52:38 1998
+++ egcs-19981006/gcc/configure.in Tue Oct 6 11:51:53 1998
@@ -159,12 +159,16 @@ no) ;;
*) gxx_include_dir=$with_gxx_include_dir ;;
esac])
+# Use $(unlibsubdir) only if neither --with-gxx-include-dir nor
+# --enable-version-specific-runtime-libs have been specified.
+use_unlibsubdir=no
if test x${gxx_include_dir} = x; then
if test x${enable_version_specific_runtime_libs} = xyes; then
gxx_include_dir='${libsubdir}/include/g++'
else
topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
gxx_include_dir='${prefix}/include/g++'-${libstdcxx_interface}
+ use_unlibsubdir=yes
fi
fi
@@ -4030,6 +4034,7 @@ AC_SUBST(gcc_version)
AC_SUBST(gcc_version_trigger)
AC_SUBST(local_prefix)
AC_SUBST(gxx_include_dir)
+AC_SUBST(use_unlibsubdir)
AC_SUBST(fixincludes)
AC_SUBST(build_install_headers_dir)
AC_SUBST(build_exeext)