Re: Possible patch for autoconf?

2001-04-25 Thread Akim Demaille

 Daniel == Daniel Carroll [EMAIL PROTECTED] writes:

Daniel The attached patch worked for me, though.

Could you try this patch instead?  I find the code somewhat hard to
follow, and preferred to introduce IFELSE to make it more readable.

I also submit this patch.



Index: ChangeLog
from  Akim Demaille  [EMAIL PROTECTED]

* aclang.m4 (_AC_PROG_PREPROC_WORKS): Rename and extend as...
(_AC_PROG_PREPROC_WORKS_IFELSE): this.
Adjust to admit
(AC_PROG_CPP, AC_PROG_CXXCPP): Use it.
Reported by Daniel Carroll.

Index: acgeneral.m4
===
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.720
diff -u -u -r1.720 acgeneral.m4
--- acgeneral.m4 2001/04/25 15:32:09 1.720
+++ acgeneral.m4 2001/04/25 17:23:52
@@ -2715,12 +2715,11 @@
 # 
 # Try to preprocess PROGRAM.
 #
+# This macro can be used during the selection of a preprocessor.
 # Run cpp and set ac_cpp_err to yes for an error, to
 # $ac_(c,cxx)_preproc_warn_flag if there are warnings or to  if
 # neither warnings nor errors have been detected.  eval is necessary
 # to expand ac_cpp.
-#
-# This macro can be used during the selection of a preprocessor.
 AC_DEFUN([_AC_PREPROC_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
 if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) /dev/null; then
Index: aclang.m4
===
RCS file: /cvs/autoconf/aclang.m4,v
retrieving revision 1.125
diff -u -u -r1.125 aclang.m4
--- aclang.m4 2001/04/15 16:20:30 1.125
+++ aclang.m4 2001/04/25 17:23:53
@@ -804,33 +804,36 @@
 [AC_REQUIRE([AC_PROG_CPP])])


-# _AC_PROG_PREPROC_WORKS
-# --
+# _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
+# ---
 # Check if $ac_cpp is a working preprocessor that can flag absent
-# includes either by the exit status or by warnings
-# Set ac_cpp_err to a non-empty value if the preprocessor failed
-# This macro is for all languages, not only C
-AC_DEFUN([_AC_PROG_PREPROC_WORKS],
-[# Use a header file that comes with gcc, so configuring glibc
+# includes either by the exit status or by warnings.
+# Set ac_cpp_err to a non-empty value if the preprocessor failed.
+# This macro is for all languages, not only C.
+AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE],
+[# We don't know yet if stderr is the criterion (vs exit status).
+ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe
+
+# Use a header file that comes with gcc, so configuring glibc
 # with a fresh cross-compiler works.
 # On the NeXT, cc -E runs the code through the compiler's parser,
 # not just through cpp. Syntax error is here to catch this case.
-ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe
 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include assert.h
 Syntax error]])],
-[# Now check whether non-existent headers can be detected and how
-# Skip if ac_cpp_err is not empty - ac_cpp is broken
-if test -z $ac_cpp_err; then
-  _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ac_nonexistent.h]])],
-  [# cannot detect missing includes at all
-ac_cpp_err=yes],
-  [if test x$ac_cpp_err = xmaybe; then
-  ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=yes
-else
-  ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=
-fi
-ac_cpp_err=])
-fi])])# _AC_PROG_PREPROC_WORKS
+[# OK, works on sane cases.  Now check whether non-existent headers can
+# be detected and how.
+_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ac_nonexistent.h]])],
+[# Broken: cannot detect missing includes.
+m4_default([$2], :)],
+[# OK, detects failures.  How?
+if test x$ac_cpp_err = xmaybe; then
+   ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=yes
+else
+   ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=
+fi
+$1])],
+  [# Broken: cannot fails on valid input.
+m4_default([$2], :)])])# _AC_PROG_PREPROC_WORKS_IFELSE


 # AC_PROG_CPP
@@ -856,22 +859,17 @@
 # Double quotes because CPP needs to be expanded
 for CPP in $CC -E $CC -E -traditional-cpp /lib/cpp
 do
-  _AC_PROG_PREPROC_WORKS
-  if test -z $ac_cpp_err; then
-break
-  fi
+  _AC_PROG_PREPROC_WORKS_IFELSE([break])
 done
 ac_cv_prog_CPP=$CPP
   ])dnl
   CPP=$ac_cv_prog_CPP
 else
-  _AC_PROG_PREPROC_WORKS
   ac_cv_prog_CPP=$CPP
 fi
 AC_MSG_RESULT([$CPP])
-if test -n $ac_cpp_err; then
-  AC_MSG_ERROR([C preprocessor $CPP fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+[AC_MSG_ERROR([C preprocessor $CPP fails sanity check])])
 AC_SUBST(CPP)dnl
 AC_LANG_POP(C)dnl
 ])# AC_PROG_CPP
@@ -1071,22 +1069,17 @@
 # Double quotes because CXXCPP needs to be expanded
 for CXXCPP in $CXX -E /lib/cpp
 do
-  _AC_PROG_PREPROC_WORKS()
-  if test -z $ac_cpp_err; then
-break
-  fi
+  _AC_PROG_PREPROC_WORKS_IFELSE([break])
 done
 ac_cv_prog_CXXCPP=$CXXCPP
   ])dnl
   CXXCPP=$ac_cv_prog_CXXCPP
 else
-  

Re: Possible patch for autoconf?

2001-04-23 Thread Daniel Carroll

On Sun, Apr 22, 2001 at 03:15:08AM -0300, Alexandre Oliva wrote:
 On Apr 20, 2001, Daniel Carroll [EMAIL PROTECTED] wrote:
 
  I have a somewhat unusal C compiler and version
  of unix that is giving me problems with a configure
  script (using Autoconf 2.13).
 
 Try autoconf 2.49e, it's supposed to work with compilers that print
 stuff when run.

It looks like someone submitted some code for that, but they don't
appear to work.

The attached patch worked for me, though.

- Dan



*** autoconf-2.49e.orig/aclang.m4   Tue Apr 17 07:12:03 2001
--- autoconf-2.49e/aclang.m4Mon Apr 23 14:56:52 2001
***
*** 820,826 
  Syntax error]])],
  [# Now check whether non-existent headers can be detected and how
  # Skip if ac_cpp_err is not empty - ac_cpp is broken
! if test -z $ac_cpp_err; then
_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ac_nonexistent.h]])],
[# cannot detect missing includes at all
  ac_cpp_err=yes],
--- 820,826 
  Syntax error]])],
  [# Now check whether non-existent headers can be detected and how
  # Skip if ac_cpp_err is not empty - ac_cpp is broken
! if test -z $ac_cpp_err -o x$ac_cpp_err = xmaybe; then
_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ac_nonexistent.h]])],
[# cannot detect missing includes at all
  ac_cpp_err=yes],
*** autoconf-2.49e.orig/acgeneral.m4Fri Apr 20 10:47:18 2001
--- autoconf-2.49e/acgeneral.m4 Mon Apr 23 14:57:00 2001
***
*** 2734,2740 
  else
ac_cpp_err=yes
  fi
! if test -z $ac_cpp_err; then
m4_default([$2], :)
  else
echo $as_me: failed program was: AS_MESSAGE_LOG_FD
--- 2734,2740 
  else
ac_cpp_err=yes
  fi
! if test -z $ac_cpp_err -o x$ac_cpp_err = xmaybe; then
m4_default([$2], :)
  else
echo $as_me: failed program was: AS_MESSAGE_LOG_FD



Re: Possible patch for autoconf?

2001-04-22 Thread Alexandre Oliva

On Apr 20, 2001, Daniel Carroll [EMAIL PROTECTED] wrote:

 I have a somewhat unusal C compiler and version
 of unix that is giving me problems with a configure
 script (using Autoconf 2.13).

Try autoconf 2.49e, it's supposed to work with compilers that print
stuff when run.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicampoliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist*Please* write to mailing lists, not to me




Possible patch for autoconf?

2001-04-20 Thread Daniel Carroll

Hello,

I have a somewhat unusal C compiler and version
of unix that is giving me problems with a configure
script (using Autoconf 2.13).

The result is that configure incorrectly decides that
the limits.h header doesn't exist.

There are two related reasons for this problem:
  a) The C compiler likes to print a copyright message on 
   stderr every time that it is executed.  It looks
   something like (qwe.c is an empty file):

   dan@mesaweb:~/t/newac $ cc -E qwe.c
   NCR High Performance C Compiler R3.0c 
   (c) Copyright 1994-97, NCR Corporation
   (c) Copyright 1987-97, MetaWare Incorporated

   #pragma warning_level 3

   The problem with this is that the configure script
   generated by autoconf thinks that this means that
   using 'cc -E' isn't a good way to get at the C preprocessor,
   So configure defaults to using /lib/cpp instead.

  b) The second reason is that /lib/cpp chokes on a preprocessor
   construct in limits.h that 'cc -E' will accept.

   That construct is:

   #if #machine(i386)


Getting GCC to compile on this platform is not something that I
have succeeded at yet, so switching to it really isn't an option
at this point.

Now, for what it's worth, there are ways to suppress this copyright
message, but this version of UNIX ships with the message enabled by
default.  And it's somewhat of a hassle to figure out where to tweak
the system to globally disable this message.




I'm not sure how you would like to deal with this (since submitting
patches isn't something that I've done before), but the attached
patch fixes the problem on my system.

Thanks.

- Dan ([EMAIL PROTECTED] - Daniel Carroll - Mesa State College)



*** autoconf-2.13-orig/acgeneral.m4 Tue Jan  5 06:27:37 1999
--- autoconf-2.13/acgeneral.m4  Fri Apr 20 12:15:59 2001
***
*** 1669,1675 
  dnl with ` +' to stderr in eval and subshells.
  ac_try="$ac_cpp conftest.$ac_ext /dev/null 2conftest.out"
  AC_TRY_EVAL(ac_try)
! ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  if test -z "$ac_err"; then
ifelse([$2], , :, [rm -rf conftest*
$2])
--- 1669,1675 
  dnl with ` +' to stderr in eval and subshells.
  ac_try="$ac_cpp conftest.$ac_ext /dev/null 2conftest.out"
  AC_TRY_EVAL(ac_try)
! ac_err=`grep -v '^ *+' conftest.out | grep -v 'NCR High Performance C Compiler' | 
grep -v '^(c) Copyright' | grep -v "^conftest.${ac_ext}\$"`
  if test -z "$ac_err"; then
ifelse([$2], , :, [rm -rf conftest*
$2])