Trying to run buildconf on FreeBSD 9.0-CURRENT with GNU m4
installed from ports, I get a confusing error message:

f...@r500 ~/git/curl $./buildconf 
buildconf: autoconf version 2.62 (ok)
buildconf: autom4te version 2.62 (ok)
buildconf: autoheader version 2.62 (ok)
buildconf: automake version 1.10.1 (ok)
buildconf: aclocal version 1.10.1 (ok)
buildconf: libtool version 2.2.6 (ok)
buildconf: libtoolize found
buildconf: m4 version  found. You need a GNU m4 installed!
f...@r500 ~/git/curl $

The first attached patch changes this to:

f...@r500 ~/git/curl $./buildconf 
buildconf: autoconf version 2.62 (ok)
buildconf: autom4te version 2.62 (ok)
buildconf: autoheader version 2.62 (ok)
buildconf: automake version 1.10.1 (ok)
buildconf: aclocal version 1.10.1 (ok)
buildconf: libtool version 2.2.6 (ok)
buildconf: libtoolize found
buildconf: m4 version not recognized. You need a GNU m4 installed!
f...@r500 ~/git/curl $

Note that this still implies that some m4 version is available
so maybe it should simply say "no usable m4 version found ...".

With the second patch, GNU m4 is properly picked up:

f...@r500 ~/git/curl $./buildconf 
buildconf: autoconf version 2.62 (ok)
buildconf: autom4te version 2.62 (ok)
buildconf: autoheader version 2.62 (ok)
buildconf: automake version 1.10.1 (ok)
buildconf: aclocal version 1.10.1 (ok)
buildconf: libtool version 2.2.6 (ok)
buildconf: libtoolize found
buildconf: GNU m4 version 1.4.14 (ok)
buildconf: running libtoolize
buildconf: running aclocal
/usr/local/share/aclocal/smpeg.m4:13: warning: underquoted definition of 
AM_PATH_SMPEG
/usr/local/share/aclocal/smpeg.m4:13:   run info '(automake)Extending aclocal'
/usr/local/share/aclocal/smpeg.m4:13:   or see 
http://sources.redhat.com/automake/automake.html#Extending-aclocal
buildconf: running aclocal hack to convert all mv to mv -f
buildconf: running autoheader
buildconf: cp lib/curl_config.h.in src/curl_config.h.in
buildconf: running autoconf
buildconf: running automake
Useless use of /d modifier in transliteration operator at 
/usr/local/share/automake-1.10/Automake/Wrap.pm line 60.
configure.ac:169: installing `./config.guess'
configure.ac:169: installing `./config.sub'
docs/examples/Makefile.am: installing `./depcomp'
buildconf: OK
f...@r500 ~/git/curl $

The third patch is purely cosmetical and could be viewed
either as an improvement or an obfuscation.

Even without the patch it is, of course, possible to simply
run "M4=gm4 ./buildconf", but this isn't exactly obvious and
not mentioned in GIT-INFO either.

Fabian
From 3ff9b3613111ea9d13047f9a1304680ff3f7489e Mon Sep 17 00:00:00 2001
From: Fabian Keil <[email protected]>
Date: Thu, 19 Aug 2010 15:50:32 +0200
Subject: [PATCH 1/3] If the m4 version isn't recognized at all, just say so

'm4 version  found. You need a GNU m4 installed!' is a bit confusing.
---
 buildconf |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/buildconf b/buildconf
index 2b62afd..10eed4c 100755
--- a/buildconf
+++ b/buildconf
@@ -254,7 +254,11 @@ m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
   echo "buildconf: GNU m4 version $m4_version (ok)"
 else
-  echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
+  if test -z "$m4"; then
+    echo "buildconf: m4 version not recognized. You need a GNU m4 installed!"
+  else
+    echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
+  fi
   exit 1
 fi
 
-- 
1.7.1.1

From 211cac54d59536a771947e93b8d1ccdaa66be4db Mon Sep 17 00:00:00 2001
From: Fabian Keil <[email protected]>
Date: Thu, 19 Aug 2010 16:04:18 +0200
Subject: [PATCH 2/3] If m4 doesn't support --version, try if gm4 does.

---
 buildconf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/buildconf b/buildconf
index 10eed4c..997031b 100755
--- a/buildconf
+++ b/buildconf
@@ -248,7 +248,7 @@ fi
 #--------------------------------------------------------------------------
 # m4 check
 #
-m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
+m4=`${M4:-m4} --version 2>/dev/null || ${M4:-gm4} --version 2>/dev/null | head -n 1`;
 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
 
 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
-- 
1.7.1.1

From b6a3d9225f1ef428a540bf5c7c55046a190f2c53 Mon Sep 17 00:00:00 2001
From: Fabian Keil <[email protected]>
Date: Thu, 19 Aug 2010 16:07:03 +0200
Subject: [PATCH 3/3] In the m4 detection line, factor out the 2>dev/null

---
 buildconf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/buildconf b/buildconf
index 997031b..76e310e 100755
--- a/buildconf
+++ b/buildconf
@@ -248,7 +248,7 @@ fi
 #--------------------------------------------------------------------------
 # m4 check
 #
-m4=`${M4:-m4} --version 2>/dev/null || ${M4:-gm4} --version 2>/dev/null | head -n 1`;
+m4=`(${M4:-m4} --version || ${M4:-gm4} --version) 2>/dev/null | head -n 1`;
 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
 
 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
-- 
1.7.1.1

Attachment: signature.asc
Description: PGP signature

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to