On 03/26/2012 03:36 PM, Philipp Thomas wrote: > > I'm patching a Makefile.am and am thus calling autoreconf to regen the > Makefile.in. Unfortunately the configure.ac is doing advanced autoconf/m4 > stuff that I don't quite understand. > > configure.ac at the top has > > ############################################################################### > # prelude > ############################################################################### > > m4_include([project/project.m4sugar]) > > m4_define([SVNINFO],m4_esyscmd([svn info 2>/dev/null])) Running m4_esyscmd without later checking that m4_sysval was 0 is risky; if the 'svn info' call failed, you are blindly proceeding on with SVNINFO defined to garbage. > > m4_define([PRJ_repo_url],m4_bregexp(SVNINFO,[^URL: *\(.+\)],[\1])) > m4_define([PRJ_repo_root],m4_bregexp(SVNINFO,[^Repository Root: *\(.+\)],[\1])) > m4_define([PRJ_repo_uuid],m4_bregexp(SVNINFO,[^Repository UUID: *\(.+\)],[\1])) > m4_define([PRJ_repo_rev],m4_bregexp(SVNINFO,[^Last Changed Rev: *\(.+\)],[\1])) My guess is that SVNINFO contains garbage, or at least no longer matches the regular expression being checked here, so that this line is defining PRJ_repo_rev to the empty string. > m4_define([PRJ_repo_date],m4_bregexp(SVNINFO,[^Last Changed Date: *\(.+\)],[\1])) > m4_define([PRJ_repo_type],ifelse(m4_bregexp(PRJ_repo_url,[/releases/]),[-1],[developer],[stable])) For style, I'd recommend s/ifelse/m4_if/g Also, use spaces! Long space-less lines are hard to read. m4_define([PRJ_repo_type], m4_if(m4_bregexp(PRJ_repo_url, [/releases/]) [-1], [developer], [stable])) gives the same result for that line. > PRJ_repo_type,[developer],m4_format([%d.%d-r%d],PRJ_version_major,PRJ_version_minor,PRJ_repo_rev), > m4_format([%d.%d-r%d],PRJ_version_major,PRJ_version_minor,PRJ_repo_rev))) I'm assuming that these are lines 25 and 26. m4_format() complains if you pair a %d format specifier with an empty string, which is what I'm guessing has happened to PRJ_repo_rev. > > And the included project.m4sugar is: > > dnl > dnl This file defines highest-level project meta-data in autoconf M4 format. > dnl It is needed downstream by configure.ac. > dnl > define([PRJ_name], [MP4v2]) Again, for style, I'd recommend s/define/m4_define/. > Autoconf 2.68 reports: > > /usr/bin/m4:configure.ac:25: empty string treated as 0 > /usr/bin/m4:configure.ac:26: empty string treated as 0 > > Coould somebody please help me understanding what is going wrong so that I > might fix the sources? You need to figure out why PRJ_repo_rev is empty (is the embedded 'svn info' call doing the right thing?), and perhaps decide if it should be an explicit '0' instead of an empty string. Perhaps as: m4_define([PRJ_repo_rev], m4_bregexp(SVNINFO, [^Last Changed Rev: *\(.+\)], [\1])) m4_if(m4_defn([PRJ_repo_rev]), [], [m4_define([PRJ_repo_rev], [0])]) That way, the m4_format() will no longer be pairing %d with an empty string. It may help in your debugging to add lines like these after all the m4_define() calls: [#] MY MARKER [#] m4_defn([PRJ_name]) [#] m4_defn([PRJ_repo_url]) ... then look at the resulting configure file for 'MY MARKER' to see in the generated shell code the state of the m4 parser at the point where you dumped all those definitions, which will then help you understand what autoconf was doing with those m4 macros through the rest of the configure.ac. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf