This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++config.h hacking


Alexandre, you seem like somebody who could help me out with this.
Jakub, this is what I was talking about.

I'm trying to change the way c++config.h is constructed, to allow me to
order defines within the file, and substitute values at configure or
build time.

Currently, c++config is created by catting include/bits/c++config,
catting in the version info, and then catting in config.h.

from include/Makefile.am:

# Host includes dynamic.
${host_builddir}/c++config.h: ${top_builddir}/config.h \
				${glibcxx_srcdir}/include/bits/c++config \
				stamp-${host_alias} \
				${toplevel_srcdir}/gcc/DATESTAMP
	@cat ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
	sed -e 's/^/#define __GLIBCXX__ /' \
            < ${toplevel_srcdir}/gcc/DATESTAMP >> $@ ;\
	sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
	    -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
	    -e 's/VERSION/_GLIBCXX_VERSION/g' \
	    -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
	    < ${CONFIG_HEADER} >> $@ ;\
	echo "#endif // _CXXCONFIG_" >>$@

Instead, what I'd like to do is something like copy include/bits/c+
+config.h to the build directory, do the replacements, cat in config.h
to this.

# Host includes dynamic.
if ENABLE_SYMVERS_GNU_NAMESPACE
nsa_version=1
else
nsa_version=0
endif
${host_builddir}/c++config.h: ${CONFIG_HEADER} \
	  		      ${glibcxx_srcdir}/include/bits/c++config \
			      stamp-${host_alias} \
			      ${toplevel_srcdir}/gcc/DATESTAMP
	@cat ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
	sed -n '1,/__GLIBCXX__/p' $@ > tmp1.top; \
	sed -n '/__GLIBCXX__/,$$p' $@ > tmp1.bottom; \
	sed -e 's/^/#define __GLIBCXX__ /' \
            < ${toplevel_srcdir}/gcc/DATESTAMP >> tmp1.top ; \
	cat tmp1.top tmp1.bottom > $@; \
	sed -n '1,/_GLIBCXX_NAMESPACE_ASSOCIATION_VERSION /p' $@ > tmp.top; \
	sed -n '/_GLIBCXX_NAMESPACE_ASSOCIATION_VERSION/,$$p' $@ > tmp.bottom;\
	sed -e 's/^/#define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION /' \
            < `echo ${nsa_version}` >> tmp.top ; \
	cat tmp.top tmp.bottom > $@; \
	sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
	    -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
	    -e 's/VERSION/_GLIBCXX_VERSION/g' \
	    -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
	    < ${CONFIG_HEADER} >> $@ ;\
	echo "#endif // _CXXCONFIG_" >> $@


Anyway. I'm kind of brain dead at this point, and am looking for
advice. Is there a simpler way to do what I am trying to do that I am
missing?

-benjamin


Attachment: c++config.orig
Description: Text document

Attachment: c++config.desired
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]