This is the mail archive of the mailing list for the GCC project.

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

[PATCH] Remember configure's options for later recall

This patch comes out of a brief discussion on libstdc++-v3 over the
question, "How to tell whether -v2 or -v3 was chosen at configure
time?" or more generally, "How to tell what was passed to configure?"
The particular message that led to this patch is

(In that message's main(), I forgot to declare the happy magic symbol
as extern; I'm not proposing that the compiler magically recognize that
particular symbol and provide a definition.  :-)

This patch provides that functionality.  For the happy magic symbol, I
picked __configure_args more or less at random.

I did not regenerate gcc/configure for this patch, because for some
reason my version of autoconf keeps wanting to introduce "site-file"
clauses; I'm sure they're harmless, but I didn't feel like introducing
unrelated stuff into that script.


  $ ./test/bin/gcc -v
  Reading specs from ./test/bin/../lib/gcc-lib/sparc-sun-solaris2.8/2.96/specs
  gcc version 2.96 20000925 (experimental)
  $ ./test/bin/gcc ~/ca.c 
  $ ./a.out 
  ../../unified/gcc/configure  --host=sparc-sun-solaris2.8 --target=sparc-sun-solaris2.8 --prefix=/tmp/pedwards/test --srcdir=../../unified/gcc --with-gcc-version-trigger=/stuff/pme/unified/gcc/version.c --with-gnu-as --with-gnu-ld --with-gcc --with-gnu-as --with-gnu-ld --enable-gnu-binutils --enable-languages=c --cache-file=../config.cache
  $ cat ~/ca.c 
  #include <stdio.h>
  int main()
       extern const char * const __configure_args;
       printf ("%s\n", __configure_args);

Some of those configure options tend to get multiplied during recursion...
the same text is used for creating config.status.

2000-09-26  Phil Edwards  <>

	* (LIB2FUNCS_EXTRA): Add configargs.c.  Add dependancies.
	*  Generate configargs.c before AC_OUTPUT.

RCS file: /cvs/gcc/egcs/gcc/,v
retrieving revision 1.516
diff -u -3 -r1.516
---	2000/09/25 22:34:53	1.516
+++	2000/09/26 04:35:17
@@ -417,7 +417,7 @@
 # List of extra C and assembler files to add to libgcc2.a.
 # Assembler files should have names ending in `.asm'.
+LIB2FUNCS_EXTRA = configargs.c
 # Handle cpp installation.
@@ -1204,6 +1204,8 @@
 dumpvers: dumpvers.c
 version.o: version.c version.h
+configargs.o: configargs.c
 ggc-common.o: ggc-common.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
 	flags.h $(GGC_H) varray.h hash.h
RCS file: /cvs/gcc/egcs/gcc/,v
retrieving revision 1.426
diff -u -3 -r1.426
---	2000/09/23 15:23:12	1.426
+++	2000/09/26 04:35:17
@@ -5197,6 +5197,12 @@
 	target=`echo $target | sed -e 's/\(..............\).*/\1/'`
+# Remember configure arguments for libgcc.
+cat > configargs.c <<EOF
+extern const char * const __configure_args;
+const char * const __configure_args = "$0 $ac_configure_args";
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)

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