This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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]

libnosys/configure.in: test for symbol prefix _ and fix configure .previous etc. output


Please excuse the mixing of two actually independent changes!
I'll split them up on request, but I thought them small enough
(and being neighbors in the same diff chunk) that it didn't
matter.

The first part, setting cache-id variables, is because before,
without setting the cache-id variable, you get this
configure-time output:
...
checking for .previous assembler directive...
checking for .popsection assembler directive...
checking for section attributes...
...

With this patch:
checking for .previous assembler directive... yes
checking for .popsection assembler directive... yes
checking for section attributes... yes


The second part updates the "dollar prefix" (what target has
them?) test to also handle _-prefixed symbols.  The rename is to
make the test reflect the effect of the test better; controlling
the __SYMBOL_PREFIX config macro.

The configure output difference is:
checking for function prefix... no
compared to:
checking for symbol prefix... _

I have an update for libnosys/warning.h to make use of the
setting for ELF targets coming next.

(diff -u seemed a little more readable than diff -c)

2005-01-16  Hans-Peter Nilsson  <hp@axis.com>

	* libnosys/configure.in (libc_cv_asm_previous_directive): Set
	cache-id variable.
	(libc_cv_asm_popsection_directive): Ditto.
	(libc_cv_section_attributes): Ditto.
	(libc_symbol_prefix): Rename from libc_dollar_prefix.  Check for
	"_" as well, and set __SYMBOL_PREFIX accordingly.
	* libnosys/configure: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/libgloss/libnosys/configure.in,v
retrieving revision 1.3
diff -c -p -u -p -r1.3 configure.in
cvs diff: conflicting specifications of output style
--- configure.in	11 May 2002 20:48:04 -0000	1.3
+++ configure.in	16 Jan 2005 13:49:36 -0000
@@ -137,53 +139,63 @@ case "${target}" in
 
         AC_CACHE_CHECK(for .previous assembler directive,
                          libc_cv_asm_previous_directive, [dnl
+        libc_cv_asm_previous_directive=no
         cat > conftest.s <<EOF
 .section foo_section
 .previous
 EOF
         if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
+          libc_cv_asm_previous_directive=yes
           AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
         fi
         rm -f conftest*])
 
         AC_CACHE_CHECK(for .popsection assembler directive,
                          libc_cv_asm_popsection_directive, [dnl
+        libc_cv_asm_popsection_directive=no
         cat > conftest.s <<EOF
 .pushsection foo_section
 .popsection
 EOF
         if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
+          libc_cv_asm_popsection_directive=yes
           AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
         fi
         rm -f conftest*])
 
         AC_CACHE_CHECK(for section attributes,
                          libc_cv_section_attributes, [dnl
+        libc_cv_section_attributes=no
         cat > conftest.c <<EOF
 int secttest __attribute__ ((section (".gnu.warning.secttest"))) = 10;
 int main() {}
 EOF
         if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.c 1>&AC_FD_CC); then
+          libc_cv_section_attributes=yes
           AC_DEFINE(HAVE_SECTION_ATTRIBUTES)
         fi
         rm -f conftest*])
         ;;
 esac
 
-AC_CACHE_CHECK(for function prefix, libc_dollar_prefix, [dnl
+AC_CACHE_CHECK(for symbol prefix, libc_symbol_prefix, [dnl
 cat > conftest.c <<\EOF
 foo () { }
 EOF
 dnl
+libc_symbol_prefix=none
 if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null]);
 then
-  libc_dollar_prefix=yes
+  libc_symbol_prefix='$'
 else
-  libc_dollar_prefix=no
+  if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "_foo" > /dev/null]);
+  then
+    libc_symbol_prefix=_
+  fi
 fi
 rm -f conftest* ])
-if test $libc_dollar_prefix = yes ; then
-  AC_DEFINE(__SYMBOL_PREFIX, "$")
+if test $libc_symbol_prefix != none; then
+  AC_DEFINE_UNQUOTED(__SYMBOL_PREFIX, "$libc_symbol_prefix")
 else
   AC_DEFINE(__SYMBOL_PREFIX, "")
 fi

brgds, H-P


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