* Makefile.in, src/Makefile.in, doc/Makefile.in: Use mkdir -p.
* include/cln/version.h.in, src/base/verion.cc: New files.
* configure.in: Generate include/cln/version.h.
* cln.m4: Rewrote it. Check result of cln-config without compiling.
Do cross-check library version and header version information.
\( $cln_config_major_version -eq $cln_min_major_version -a $cln_config_minor_version -eq $cln_min_minor_version -a $cln_config_micro_version -lt $cln_min_micro_version \); then
echo -e "\n*** 'cln-config --version' returned $cln_config_major_version.$cln_config_minor_version.$cln_config_micro_version, but the minimum version"
echo "*** of CLN required is $cln_min_major_version.$cln_min_minor_version.$cln_min_micro_version. If cln-config is correct, then it is"
echo "*** best to upgrade to the required version."
echo "*** If cln-config was wrong, set the environment variable CLN_CONFIG"
echo "*** to point to the correct copy of cln-config, and remove the file"
echo "*** config.cache before re-running configure."
ifelse([$3], , :, [$3])
else
dnl The versions match so far. Now do a sanity check: Does the result of cln-config
dnl match the version of the headers and the version built into the library, too?
no_cln=""
if test "x$enable_clntest" = "xyes" ; then
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $CLN_CPPFLAGS"
LIBS="$LIBS $CLN_LIBS"
rm -f conf.clntest
AC_TRY_RUN([
#include <stdio.h>
#include <string.h>
#include <cln/config.h>
#include <cln/version.h>
/* we do not #include <stdlib.h> because autoconf in C++ mode inserts a
prototype for exit() that conflicts with the one in stdlib.h */
extern "C" int system(const char *);
char* my_strdup (char *str)
int main(void)
{
char *new_str;
int major, minor, micro;
char *tmp_version;
if (str) {
new_str = new char[(strlen (str) + 1) * sizeof(char)];
strcpy (new_str, str);
} else
new_str = NULL;
system("touch conf.clntest");
return new_str;
}
int main()
{
int major, minor, micro;
char *tmp_version;
system("touch conf.clntest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_cln_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
printf("%s, bad version string\n", "$min_cln_version");
printf("\n*** 'cln-config --version' returned %d.%d.%d, but the header file I found\n", $cln_config_major_version, $cln_config_minor_version, $cln_config_micro_version);
printf("*** corresponds to %d.%d.%d. This mismatch suggests your installation of CLN\n", CL_VERSION_MAJOR, CL_VERSION_MINOR, CL_VERSION_PATCHLEVEL);
printf("*** is corrupted. Please inquire and consider reinstalling CLN.\n");
return 1;
if ((CL_VERSION_MAJOR != $cln_config_major_version) ||
printf("\n*** 'cln-config --version' returned %d.%d.%d, but the header file I found\n", $cln_config_major_version, $cln_config_minor_version, $cln_config_micro_version);
printf("*** corresponds to %d.%d.%d. This mismatch suggests your installation of CLN\n", CL_VERSION_MAJOR, CL_VERSION_MINOR, CL_VERSION_PATCHLEVEL);
printf("*** is corrupted or you have specified some wrong -I compiler flags.\n");
printf("*** Please inquire and consider reinstalling CLN.\n");
return 1;
}
if ((cln::version_major != $cln_config_major_version) ||
printf("\n*** 'cln-config --version' returned %d.%d.%d, but the library I found\n", $cln_config_major_version, $cln_config_minor_version, $cln_config_micro_version);
printf("*** corresponds to %d.%d.%d. This mismatch suggests your installation of CLN\n", cln::version_major, cln::version_minor, cln::version_patchlevel);
printf("*** is corrupted or you have specified some wrong -L compiler flags.\n");
printf("*** Please inquire and consider reinstalling CLN.\n");
return 1;
}
} else {
printf("\n*** 'cln-config --version' returned %d.%d.%d, but the minimum version\n", $cln_config_major_version, $cln_config_minor_version, $cln_config_micro_version);
printf("*** of CLN required is %d.%d.%d. If cln-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If cln-config was wrong, set the environment variable CLN_CONFIG\n");
printf("*** to point to the correct copy of cln-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");