@ -1,12 +1,12 @@
# Configure paths for OpenHBCI
# by Christian Stimming 2002-07-30
# by Christian Stimming 2002-07-30, updated 2003-05-09
# Copied from glib-2.0.m4 by Owen Taylor 1997-2001
dnl AM_PATH_OPENHBCI([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for OPENHBCI, and define OPENHBCI_CFLAGS, OPENHBCI_CXXFLAGS and OPENHBCI_LIBS
dnl
AC_DEFUN(AM_PATH_OPENHBCI,
[ dnl
AC_DEFUN(AM_PATH_OPENHBCI, [
dnl
dnl Get the c[xx]flags and libraries from openhbci-config
dnl
AC_MSG_CHECKING(for OpenHBCI)
@ -34,8 +34,6 @@ if test -x "${hbci_config}" ; then
OPENHBCI_LIBS="`${hbci_config} --libraries`"
OPENHBCI_CFLAGS="`${hbci_config} --includes`"
OPENHBCI_CXXFLAGS="`${hbci_config} --includes`"
AS_SCRUB_INCLUDE(OPENHBCI_CFLAGS)
AS_SCRUB_INCLUDE(OPENHBCI_CXXFLAGS)
else
AC_MSG_ERROR([
Could not find bin/openhbci-config in prefix ${OPENHBCI_PREFIX}.
@ -44,8 +42,9 @@ else
fi
AC_MSG_RESULT($hbci_dir)
min_openhbci_version=ifelse([$1], ,0.9.0,$1)
min_openhbci_version=ifelse([$1], ,0.9.0.0 ,$1)
AC_MSG_CHECKING(for OpenHBCI - version >= $min_openhbci_version)
dnl AC_LANG_PUSH(C++) -- DON'T use C++ here!!!
if test "x$enable_openhbcitest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
@ -63,57 +62,94 @@ dnl
#include <string.h>
#include <stdlib.h>
#ifndef OPENHBCI_VERSION_BUILD
# define OPENHBCI_VERSION_BUILD 0
#endif
int
main ()
{
int major, minor, micro;
int getmajor, getminor, getmicro;
int major, minor, micro, build ;
int getmajor, getminor, getmicro, getbuild ;
char *tmp_version;
system ("touch conf.openhbcitest");
/* HP/UX 9 writes to sscanf strings */
tmp_version = strdup("$min_openhbci_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
printf("%s, bad version string\n", "$min_openhbci_version");
exit(1);
build=0;
if (sscanf(tmp_version, "%d.%d.%d.%d", &major, &minor, µ, &build) != 4)
{
build = 0;
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3)
{
micro = 0;
if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2)
{
minor = 0;
if (sscanf(tmp_version, "%d", &major) != 1)
{
printf("\n*** AM PATH OPENHBCI: bad version string: %s\n", "$min_openhbci_version");
exit(1);
}
}
}
}
#if ((OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || \
(OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>17))
/* Four-argument libraryVersion_build() was introduced with 0.9.9.18. */
HBCI_Hbci_libraryVersion_build(&getmajor, &getminor, &getmicro, &getbuild);
#elif ((OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || \
(OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>8))
/* Four-argument libraryVersion() was introduced with 0.9.9.9. */
HBCI_Hbci_libraryVersion(&getmajor, &getminor, &getmicro, &getbuild);
#else
HBCI_Hbci_libraryVersion(&getmajor, &getminor, &getmicro);
getbuild = OPENHBCI_VERSION_BUILD;
#endif
if ((getmajor != OPENHBCI_VERSION_MAJOR) ||
(getminor != OPENHBCI_VERSION_MINOR) ||
(getmicro != OPENHBCI_VERSION_PATCHLEVEL))
(getmicro != OPENHBCI_VERSION_PATCHLEVEL) ||
(getbuild != OPENHBCI_VERSION_BUILD))
{
printf("*** OpenHBCI header files (version %d.%d.%d) do not match\n",
printf("\n*** OpenHBCI header files openhbci.h "
"(version %d.%d.%d build %d) do not match\n",
OPENHBCI_VERSION_MAJOR,
OPENHBCI_VERSION_MINOR,
OPENHBCI_VERSION_PATCHLEVEL);
printf("*** installed library (version %d.%d.%d)\n",
getmajor, getminor, getmicro);
OPENHBCI_VERSION_PATCHLEVEL,
OPENHBCI_VERSION_BUILD);
printf("*** installed library libopenhbci.so "
"(version %d.%d.%d build %d)\n",
getmajor, getminor, getmicro, getbuild);
exit(1);
}
else
{
if ((getmajor > major) ||
((getmajor == major) && (getminor > minor)) ||
((getmajor == major) && (getminor == minor) && (getmicro >= micro)))
((getmajor == major) && (getminor == minor) && (getmicro > micro)) ||
((getmajor == major) && (getminor == minor) &&
(getmicro == micro) && (getbuild >= build)))
{
return 0;
}
else
{
printf("\n*** An old version of OpenHBCI (%d.%d.%d) was found.\n",
getmajor, getminor, getmicro);
printf("*** You need OpenHBCI in version %d.%d.%d or newer. The latest version\n",
major, minor, micro);
printf("*** of OpenHBCI is always available from http://www.openhbci.de.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that you need to specify the right path by\n");
printf("*** --with-openhbci-prefix=PATH. (Also, check that your LD_LIBRARY_PATH\n");
printf("*** enviroment variable is correct, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
printf("\n*** An old version of OpenHBCI (%d.%d.%d build %d) was found.\n",
getmajor, getminor, getmicro, getbuild);
printf("*** You need OpenHBCI in version %d.%d.%d build %d or newer. The latest\n",
major, minor, micro, build);
printf("*** version of OpenHBCI is always available from http://www.openhbci.de.\n");
if (build > 0)
printf("*** Note: The non-zero build number '%d' indicates that the latest CVS \n"
"*** version of openhbci is required.\n", build);
printf("***\n"
"*** If you have already installed a sufficiently new version, this error\n"
"*** probably means that you need to specify the right path by\n"
"*** --with-openhbci-prefix=PATH. (Also, check that your LD_LIBRARY_PATH\n"
"*** enviroment variable is correct, or edit /etc/ld.so.conf\n"
"*** so that the correct libraries are found at run-time)\n");
}
}
return 1;
@ -128,7 +164,7 @@ if test "x$no_openhbci" = x ; then
else
AC_MSG_RESULT(no)
if test -f conf.openhbcitest ; then
:
:
else
echo "*** Could not run OpenHBCI test program, checking why..."
ac_save_CFLAGS="$CFLAGS"
@ -138,7 +174,7 @@ else
AC_TRY_LINK([
#include <openhbci.h>
#include <stdio.h>
], [ return ((OPENHBCI_VERSION_MAJOR) || (OPENHBCI_VERSION_MINOR) || (OPENHBCI_VERSION_PATCHLEVEL) ); ],
], [ return ((OPENHBCI_VERSION_MAJOR) || (OPENHBCI_VERSION_MINOR)); ],
[ echo "***"
echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding OpenHBCI or finding the wrong"
@ -164,5 +200,6 @@ fi
AC_SUBST(OPENHBCI_CFLAGS)
AC_SUBST(OPENHBCI_LIBS)
AC_SUBST(OPENHBCI_CXXFLAGS)
dnl AC_LANG_POP(C++)
rm -f conf.openhbcitest
])