automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automake 1.8.2 compiler dependency type checking fails on Solaris sh


From: Mark Phillips
Subject: Automake 1.8.2 compiler dependency type checking fails on Solaris sh
Date: Thu, 26 Feb 2004 17:08:19 +0000 (GMT)

I have been investigating why a load of 1.8.2 self tests fail for me,
in particular the autohdr4.test.

After loads of hacking, I have established the problem is a
portability issue in the sh code generated by the _AM_DEPENDENCIES
macro.

What happens is that the generated configure script fails to create
all the dependency type check input header files, which in turn causes
the code to decide the compiler dependency type is "none", which then
causes the autohdr4 test to fail (because the binary does not get
re-compiled when the config.bot file is changed).

The failure occurs if the configure script is invoked using the
Solaris 5.8 /bin/sh, but ONLY if CONFIG_SHELL is set to a different
shell.

If configure is simply invoked using "/bin/sh configure", without CONFIG_SHELL
set, it will re-invoke itself using bash and hence the bug will NOT be
seen.

What actually fails is the _AM_DEPENDENCIES compiler dependency type
check, which automake hooks into AC_PROG_CC.

The following piece of sh code (from _AM_DEPENDENCIES) fails using
/bin/sh or /usr/bin/sh (but works using bash or /usr/xpg4/bin/sh):-

   : > sub/conftest.c
    for i in 1 2 3 4 5 6; do
      echo '#include "conftst'$i'.h"' >> sub/conftest.c
      : > sub/conftst$i.h
    done

It appears that the processing of the "null" command ":" is handled in
an inconsistent way by the Solaris sh. In particular the ": >
sub/conftst$i.h" inside the loop only creates ONE file.... Presumable
the $i in the redirection only gets evaluated once for some reason.

I am not sure what the most portable fix would be, but replacing the
all the ": >"s with "echo >"s works for me!

See the output from the following test code for the different shells:-
----------------------------------------------------------------------
#!/bin/sh
rm -fr sub
mkdir sub
    : > sub/xx
    for i in 1 2 3 4 5 6; do
      : > sub/conftst$i.h
    done
ls -R sub
----------------------------------------------------------------------
/bin/sh -vx ~/tmp/broken.sh
#!/bin/sh
rm -fr sub
+ rm -fr sub
mkdir sub
+ mkdir sub
    : > sub/xx
+ :
    for i in 1 2 3 4 5 6; do
      : > sub/conftst$i.h
    done
+ :
+ :
+ :
+ :
+ :
+ :
ls -R sub
+ ls -R sub
sub:
conftst1.h  xx
----------------------------------------------------------------------

Using bash or /usr/xpg4/bin/sh it works:-
----------------------------------------------------------------------
 /usr/xpg4/bin/sh -vx ~/tmp/broken.sh
#!/bin/sh
rm -fr sub
+ rm -fr sub
mkdir sub
+ mkdir sub
    : > sub/xx
+ :
+ 1> sub/xx
    for i in 1 2 3 4 5 6; do
      : > sub/conftst$i.h
    done
+ :
+ 1> sub/conftst1.h
+ :
+ 1> sub/conftst2.h
+ :
+ 1> sub/conftst3.h
+ :
+ 1> sub/conftst4.h
+ :
+ 1> sub/conftst5.h
+ :
+ 1> sub/conftst6.h
ls -R sub
+ ls -R sub
sub:
conftst1.h  conftst2.h  conftst3.h  conftst4.h  conftst5.h  conftst6.h  xx
----------------------------------------------------------------------

Cheers
Mark Phillips


-- 
Mark S. Phillips                ESN 742 2461
address@hidden          Tel. +44 1279 402461
Nortel Networks plc, London Road, Harlow, Essex, CM17 9NA
[Co #3937799, Registered office address: Maidenhead Office Park,
Westacott Way, Maidenhead, Berkshire SL6 3QH.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]