diff --git a/configure.in b/configure.in index 6d503a1a..d57e8010 100644 --- a/configure.in +++ b/configure.in @@ -219,6 +219,60 @@ else echo "no zlib found, using version provided by SimGear." fi +# Check for the presence of SimGear +AC_CHECK_HEADER(simgear/version.h) +if test "x$ac_cv_header_simgear_version_h" != "xyes"; then + echo + echo "You *must* have the SimGear support library installed on your system" + echo "to build the FGFS simulator!" + echo + echo "Please see README.SimGear for more details." + echo + echo "configure aborted." + exit +fi + +AC_MSG_CHECKING(for proper simgear version) + +AC_TRY_RUN([ +#include + +#if !defined(SIMGEAR_VERSION) +#error simgear version too old, please upgrade. +#endif + +#define STRINGIFY(X) XSTRINGIFY(X) +#define XSTRINGIFY(X) #X + +#define MIN_MAJOR 0 +#define MIN_MINOR 0 +#define MIN_MICRO 13 + +int main() { + int major, minor, micro; + + printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); + + sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, µ ); + + if ( major < MIN_MAJOR ) { + return -1; + } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) { + return -1; + } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){ + return -1; + } + + return 0; +} + +], + AC_MSG_RESULT(yes), + [AC_MSG_RESULT(wrong version); + AC_MSG_ERROR([Install latest simgear first...])], + AC_MSG_RESULT(yes) +) + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T