This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Macroize gas version number checks in gcc/configure.in (take three)
- From: Nathanael Nerode <neroden at twcny dot rr dot com>
- To: gcc-patches at gcc dot gnu dot org, aoliva at redhat dot com
- Date: Thu, 6 Mar 2003 15:10:02 -0500
- Subject: [patch] Macroize gas version number checks in gcc/configure.in (take three)
Previous version was bogus, since I had the logic of all the tests reversed.
Tested on i686-pc-linux-gnu. Seems to work...
* aclocal.m4: Introduce gcc_GAS_VERSION_GTE_IFELSE,
_gcc_COMPUTE_GAS_VERSION.
* configure.in: Use them.
* configure: Regenerate.
Index: aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/gcc/aclocal.m4,v
retrieving revision 1.65
diff -u -r1.65 aclocal.m4
--- aclocal.m4 13 Jan 2003 17:23:25 -0000 1.65
+++ aclocal.m4 6 Mar 2003 20:04:36 -0000
@@ -1642,3 +1642,53 @@
AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
[Define .init_array/.fini_array sections are available and working.])
fi])
+
+dnl # _gcc_COMPUTE_GAS_VERSION
+dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
+dnl #
+dnl # WARNING:
+dnl # gcc_cv_as_gas_srcdir must be defined before this.
+dnl # This gross requirement will go away eventually.
+AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
+[gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
+for f in $gcc_cv_as_bfd_srcdir/configure \
+ $gcc_cv_as_gas_srcdir/configure \
+ $gcc_cv_as_gas_srcdir/configure.in \
+ $gcc_cv_as_gas_srcdir/Makefile.in ; do
+ gcc_cv_gas_version=`grep '^VERSION=[[0-9]]*\.[[0-9]]*' $f`
+ if test x$gcc_cv_gas_version != x; then
+ break
+ fi
+done
+gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
+gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
+gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
+]) []dnl # _gcc_COMPUTE_GAS_VERSION
+
+dnl # gcc_GAS_VERSION_GTE_IFELSE(major, minor, patchlevel,
+dnl # [command_if_true = :], [command_if_false = :])
+dnl # Check to see if the version of GAS is greater than or
+dnl # equal to the specified version.
+dnl #
+dnl # The first ifelse() shortens the shell code if the patchlevel
+dnl # is unimportant (the usual case). The others handle missing
+dnl # commands. Note that the tests are structured so that the most
+dnl # common version number cases are tested first.
+AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
+[AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION]) []dnl
+ifelse([$3],[0],
+[if test $gcc_cv_gas_major_version -eq $1 \
+&& test $gcc_cv_gas_minor_version -ge $2 \
+|| test $gcc_cv_gas_major_version -gt $1 ; then
+],
+[if test $gcc_cv_gas_major_version -eq $1 \
+&& (test $gcc_cv_gas_minor_version -gt $2 \
+ || (test $gcc_cv_gas_minor_version -eq $2 \
+ && test $gcc_cv_gas_patch_version -ge $3 )) \
+|| test $gcc_cv_gas_major_version -gt $1 ; then
+])
+ifelse([$4],[],[:],[$4])
+ifelse([$5],[],[],[else $5])
+fi
+]) []dnl # gcc_GAS_VERSION_GTE_IFELSE
+
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.649
diff -u -r1.649 configure.in
--- configure.in 4 Mar 2003 21:48:51 -0000 1.649
+++ configure.in 6 Mar 2003 20:04:48 -0000
@@ -1410,7 +1410,6 @@
gcc_cv_gas_major_version=
gcc_cv_gas_minor_version=
gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
-gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
if test -x "$DEFAULT_ASSEMBLER"; then
gcc_cv_as="$DEFAULT_ASSEMBLER"
elif test -x "$AS"; then
@@ -1420,22 +1419,9 @@
gcc_cv_as=./as$host_exeext
elif test -f $gcc_cv_as_gas_srcdir/configure.in \
&& test -f ../gas/Makefile; then
- # Single tree build which includes gas.
- in_tree_gas=yes
- for f in $gcc_cv_as_bfd_srcdir/configure $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in
- do
-changequote(,)dnl
- gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
-changequote([,])dnl
- if test x$gcc_cv_gas_version != x; then
- break
- fi
- done
-changequote(,)dnl
- gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
- gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
- gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"`
-changequote([,])dnl
+ # Single tree build which includes gas.
+ in_tree_gas=yes
+ _gcc_COMPUTE_GAS_VERSION
fi
if test "x$gcc_cv_as" = x; then
@@ -1634,18 +1620,17 @@
AC_MSG_CHECKING(assembler alignment features)
gcc_cv_as_alignment_features=none
if test $in_tree_gas = yes; then
- # Gas version 2.6 and later support for .balign and .p2align.
- # bytes to skip when using .p2align.
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then
- gcc_cv_as_alignment_features=".balign and .p2align"
- AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
- fi
- # Gas version 2.8 and later support specifying the maximum
- # bytes to skip when using .p2align.
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then
- gcc_cv_as_alignment_features=".p2align including maximum skip"
- AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
- fi
+ # Gas version 2.6 and later support for .balign and .p2align.
+ gcc_GAS_VERSION_GTE_IFELSE(2,6,0,[
+ gcc_cv_as_alignment_features=".balign and .p2align"
+ AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN)
+ ])
+ # Gas version 2.8 and later support specifying the maximum
+ # bytes to skip when using .p2align.
+ gcc_GAS_VERSION_GTE_IFELSE(2,8,0,[
+ gcc_cv_as_alignment_features=".p2align including maximum skip"
+ AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN)
+ ])
elif test x$gcc_cv_as != x; then
# Check if we have .balign and .p2align
echo ".balign 4" > conftest.s
@@ -1669,9 +1654,11 @@
AC_MSG_CHECKING(assembler subsection support)
gcc_cv_as_subsections=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
- gcc_cv_as_subsections="working .subsection -1"
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+ gcc_cv_as_subsections="working .subsection -1"
+ fi
+ ])
elif test x$gcc_cv_as != x; then
# Check if we have .subsection
echo ".subsection 1" > conftest.s
@@ -1707,9 +1694,9 @@
AC_MSG_CHECKING(assembler weak support)
gcc_cv_as_weak=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then
+ gcc_GAS_VERSION_GTE_IFELSE(2,2,0,[
gcc_cv_as_weak="yes"
- fi
+ ])
elif test x$gcc_cv_as != x; then
# Check if we have .weak
echo " .weak foobar" > conftest.s
@@ -1726,15 +1713,11 @@
AC_MSG_CHECKING(assembler hidden support)
gcc_cv_as_hidden=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -eq 12 \
- -a "$gcc_cv_gas_patch_version" -ge 1 \
- -o "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -gt 12 \
- -o "$gcc_cv_gas_major_version" -gt 2 \
- && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
- gcc_cv_as_hidden="yes"
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,12,1,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+ gcc_cv_as_hidden="yes"
+ fi
+ ])
elif test x$gcc_cv_as != x; then
# Check if we have .hidden
echo " .hidden foobar" > conftest.s
@@ -1801,9 +1784,11 @@
AC_MSG_CHECKING(assembler leb128 support)
gcc_cv_as_leb128=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
- gcc_cv_as_leb128="yes"
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+ gcc_cv_as_leb128="yes"
+ fi
+ ])
elif test x$gcc_cv_as != x; then
# Check if we have .[us]leb128, and support symbol arithmetic with it.
cat > conftest.s <<EOF
@@ -1845,9 +1830,11 @@
AC_MSG_CHECKING(assembler eh_frame optimization)
gcc_cv_as_eh_frame=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
- gcc_cv_as_eh_frame="yes"
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+ gcc_cv_as_eh_frame="yes"
+ fi
+ ])
elif test x$gcc_cv_as != x; then
# Check if this is GAS.
as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1`
@@ -1923,9 +1910,11 @@
AC_MSG_CHECKING(assembler section merging support)
gcc_cv_as_shf_merge=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
- gcc_cv_as_shf_merge=yes
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
+ gcc_cv_as_shf_merge=yes
+ fi
+ ])
elif test x$gcc_cv_as != x; then
# Check if we support SHF_MERGE sections
echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s
@@ -2059,11 +2048,9 @@
if test -z "$tls_first_major"; then
:
elif test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \
- -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \
- -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then
+ gcc_GAS_VERSION_GTE_IFELSE($tls_first_major,$tls_first_minor,0,[
gcc_cv_as_tls=yes
- fi
+ ])
elif test x$gcc_cv_as != x; then
echo "$conftest_s" > conftest.s
if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1
@@ -2085,11 +2072,9 @@
gcc_cv_as_explicit_relocs, [
gcc_cv_as_explicit_relocs=unknown
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -ge 12 \
- -o "$gcc_cv_gas_major_version" -gt 2; then
+ gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
gcc_cv_as_explicit_relocs=yes
- fi
+ ])
elif test x$gcc_cv_as != x; then
cat > conftest.s << 'EOF'
.set nomacro
@@ -2242,9 +2227,9 @@
AC_MSG_CHECKING(assembler instructions)
gcc_cv_as_instructions=
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then
+ gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
gcc_cv_as_instructions="filds fists"
- fi
+ ])
elif test x$gcc_cv_as != x; then
set "filds fists" "filds mem; fists mem"
while test $# -gt 0
@@ -2265,11 +2250,9 @@
AC_MSG_CHECKING(assembler GOTOFF in data directives)
gcc_cv_as_gotoff_in_data=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -ge 11 \
- -o "$gcc_cv_gas_major_version" -gt 2; then
+ gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
gcc_cv_as_gotoff_in_data=yes
- fi
+ ])
elif test x$gcc_cv_as != x; then
cat > conftest.s <<EOF
.text
@@ -2292,14 +2275,10 @@
AC_CACHE_CHECK([assembler supports ltoffx and ldxmov],
gcc_cv_as_ltoffx_ldxmov_relocs, [
gcc_cv_as_ltoffx_ldxmov_relocs=unknown
- if test x$gcc_cv_gas_major_version != x \
- -a x$gcc_cv_gas_minor_version != x
- then
- if test "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -ge 14 \
- -o "$gcc_cv_gas_major_version" -gt 2; then
- gcc_cv_as_ltoffx_ldxmov_relocs=yes
- fi
+ if test $in_tree_gas = yes ; then
+ gcc_GAS_VERSION_GTE_IFELSE(2,14,0,[
+ gcc_cv_as_ltoffx_ldxmov_relocs=yes
+ ])
elif test x$gcc_cv_as != x; then
cat > conftest.s << 'EOF'
changequote(,)dnl
@@ -2342,13 +2321,12 @@
;;
esac
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -ge 11 \
- -o "$gcc_cv_gas_major_version" -gt 2 \
- && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
- && test x"$insn" != x ; then
- gcc_cv_as_dwarf2_debug_line="yes"
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+ && test x"$insn" != x ; then
+ gcc_cv_as_dwarf2_debug_line="yes"
+ fi
+ ])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo ' .file 1 "conftest.s"' > conftest.s
echo ' .loc 1 3 0' >> conftest.s
@@ -2381,13 +2359,12 @@
AC_MSG_CHECKING(assembler --gdwarf2 support)
gcc_cv_as_gdwarf2_flag=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -ge 11 \
- -o "$gcc_cv_gas_major_version" -gt 2 \
- && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
- && test x"$insn" != x ; then
- gcc_cv_as_gdwarf2_flag="yes"
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+ && test x"$insn" != x ; then
+ gcc_cv_as_gdwarf2_flag="yes"
+ fi
+ ])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo '' > conftest.s
# ??? This fails with non-gnu grep.
@@ -2406,13 +2383,12 @@
AC_MSG_CHECKING(assembler --gstabs support)
gcc_cv_as_gstabs_flag=no
if test $in_tree_gas = yes ; then
- if test "$gcc_cv_gas_major_version" -eq 2 \
- -a "$gcc_cv_gas_minor_version" -ge 11 \
- -o "$gcc_cv_gas_major_version" -gt 2 \
- && grep 'obj_format = elf' ../gas/Makefile > /dev/null \
- && test x"$insn" != x ; then
- gcc_cv_as_gstabs_flag="yes"
- fi
+ gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+ && test x"$insn" != x ; then
+ gcc_cv_as_gstabs_flag="yes"
+ fi
+ ])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo '' > conftest.s
# ??? This fails with non-gnu grep.