Discussion:
[autoconf archive] syntax error in ax_lib_postgresql.m4 script.
Jules Lamur
2018-03-22 21:51:29 UTC
Permalink
Hello !

I encounter a syntax error while executing the AX_LIB_POSTGRESQL macro:

./configure: line 16962: syntax error near unexpected token
`$POSTGRESQL_VERSION,ge,$postgresql_version_req,'
./configure: line 16962: `       
AX_COMPARE_VERSION($POSTGRESQL_VERSION,ge,$postgresql_version_req,

I use this exact version of the script (which is the latest):
https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob;f=m4/ax_lib_postgresql.m4;h=e05dd17b7c8686323dcfa384c4408762630ae70b;hb=06a4043bea3ff31f81529fa78e5921aeadc986b5

Unfortunately, I don't have enough knowledge about autoconf to debug the
issue, could someone help me to fix it?

Regards,
Jules Lamur.
Eric Blake
2018-03-22 22:15:31 UTC
Permalink
Post by Jules Lamur
Hello !
./configure: line 16962: syntax error near unexpected token
`$POSTGRESQL_VERSION,ge,$postgresql_version_req,'
./configure: line 16962: `
AX_COMPARE_VERSION($POSTGRESQL_VERSION,ge,$postgresql_version_req,
You reached the autoconf list, not the autoconf-archive list; but the
AX_COMPARE_VERSION macro belongs to autoconf-archive.

At first glance, it looks like your configure.ac attempted to call the
AX_COMPARE_VERSION macro, but that you failed to provide any .m4 macro
in any of the include directories searched by autoconf to actually
expand that macro, so autoconf just blindly output the text from your
configure.ac into the shell script instead of expanding it as desired.
Usually, you should either copy the .m4 file containing the definition
of AX_COMPARE_VERSION into your project, or else set up a -I
/path/to/library where autoconf-archive macros reside, as part of your
autoconf invocation processing your configure.ac file.

Furthermore, you probably want to add:

m4_pattern_forbid([AX_])

to your configure.ac, so autoconf can flag up front that it failed to
expand the AX_COMPARE_VERSION macro as expected, rather than getting a
cryptic shell error later on during the execution of ./configure about
the syntax error at the point in the generated configure where the
attempted macro was not expanded.
Post by Jules Lamur
https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob;f=m4/ax_lib_postgresql.m4;h=e05dd17b7c8686323dcfa384c4408762630ae70b;hb=06a4043bea3ff31f81529fa78e5921aeadc986b5
Unfortunately, I don't have enough knowledge about autoconf to debug the
issue, could someone help me to fix it?
It's probably a question to the autoconf-archive list on their
recommended practices for how to best install their .m4 files for use in
your configure.ac file.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Eric Blake
2018-03-22 22:18:49 UTC
Permalink
Post by Eric Blake
m4_pattern_forbid([AX_])
Make that m4_pattern_forbid([^AX_]) so that it is properly anchored to
only flag words that begin with AX, rather than anywhere in the middle.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Jules Lamur
2018-03-22 22:36:05 UTC
Permalink
Thank you for this quick answer !
Including the file solved the problem, it was indeed an undefined macro.

By the way, sorry to be on the wrong mailing list, but unless I
misunderstand the following autoconf-archive mailing lists topics, none
on them is suitable for my question :

* autoconf-archive-announce (Receive announcments of new releases.)
* autoconf-archive-commits (E-mail notifications for the Autoconf
Archive git repository.)
* autoconf-archive-maintainers (Autoconf Archive Shop Talk)

---

Anyway, thank you for your help and improvement recommandations.

Regards,
Jules Lamur.
Post by Eric Blake
Post by Jules Lamur
Hello !
./configure: line 16962: syntax error near unexpected token
`$POSTGRESQL_VERSION,ge,$postgresql_version_req,'
./configure: line 16962: `
AX_COMPARE_VERSION($POSTGRESQL_VERSION,ge,$postgresql_version_req,
You reached the autoconf list, not the autoconf-archive list; but the
AX_COMPARE_VERSION macro belongs to autoconf-archive.
At first glance, it looks like your configure.ac attempted to call the
AX_COMPARE_VERSION macro, but that you failed to provide any .m4 macro
in any of the include directories searched by autoconf to actually
expand that macro, so autoconf just blindly output the text from your
configure.ac into the shell script instead of expanding it as desired.
Usually, you should either copy the .m4 file containing the definition
of AX_COMPARE_VERSION into your project, or else set up a -I
/path/to/library where autoconf-archive macros reside, as part of your
autoconf invocation processing your configure.ac file.
m4_pattern_forbid([AX_])
to your configure.ac, so autoconf can flag up front that it failed to
expand the AX_COMPARE_VERSION macro as expected, rather than getting a
cryptic shell error later on during the execution of ./configure about
the syntax error at the point in the generated configure where the
attempted macro was not expanded.
Post by Jules Lamur
https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob;f=m4/ax_lib_postgresql.m4;h=e05dd17b7c8686323dcfa384c4408762630ae70b;hb=06a4043bea3ff31f81529fa78e5921aeadc986b5
Unfortunately, I don't have enough knowledge about autoconf to debug the
issue, could someone help me to fix it?
It's probably a question to the autoconf-archive list on their
recommended practices for how to best install their .m4 files for use
in your configure.ac file.
Loading...