Anonymous avatar Anonymous committed 34cb086

fix to acinclude.m4

Comments (0)

Files changed (2)

 
 
 dnl Usage:
+dnl CHECK_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl
+dnl Adds the required libraries to $CHECK_LIBS and $CHECK_CFLAGS does an
+dnl AC_SUBST(CHECK_LIBS) and AC_SUBST(CHECK_CFLAGS)
+dnl
+
+
+AC_DEFUN([CHECK_CHECK],
+[
+AC_REQUIRE([AC_CANONICAL_HOST])
+
+
+AC_ARG_WITH(check,
+	AS_HELP_STRING([--with-check=PATH],
+	               [prefix where check is installed [default=auto]]))
+
+if test x$with_check = xno; then
+
+$3
+
+else
+
+
+
+dnl save LIBS
+saved_LIBS="$LIBS"
+saved_CFGLAGS="$CFLAGS"
+
+if test x$with_check != x; then
+	CFLAGS="$CFLAGS -I$with_check/include"
+	LIBS="$LIBS -L$with_check/lib -lcheck"
+fi
+
+AC_MSG_CHECKING(for check >= $1)
+
+dnl Get major, minor, and micro version from arg MINIMUM-VERSION
+check_config_major_version=`echo $1 | \
+    sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+check_config_minor_version=`echo $1 | \
+    sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+check_config_micro_version=`echo $1 | \
+    sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+dnl Compare MINIMUM-VERSION with libparted version
+AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <check.h>
+
+int main ()
+{
+	int		major = CHECK_MAJOR_VERSION,
+			minor = CHECK_MINOR_VERSION,
+			micro = CHECK_MICRO_VERSION;
+	const char	*version;    
+	
+
+	if ((major > $check_config_major_version) ||
+	   ((major == $check_config_major_version) && (minor > $check_config_minor_version)) ||
+	   ((major == $check_config_major_version) && (minor == $check_config_minor_version) && (micro >= $check_config_micro_version))) {
+
+		return 0;
+	} else {
+		printf(" *** Looked for check version >= %d.%d.%d, found %d.%d.%d\n",
+			$check_config_major_version, $check_config_minor_version,
+			$check_config_micro_version, major, minor, micro);
+		return 1;
+	}
+}
+], 
+    AC_MSG_RESULT(yes),
+    AC_MSG_RESULT(no) ; $3,
+    [echo $ac_n "cross compiling; assumed OK... $ac_c"])
+
+dnl restore orignial LIBS and set @CHECK_LIBS@
+
+if test x$with_check != x; then
+	CHECK_CFLAGS="-I$with_check/include"
+	CHECK_LIBS="-L$with_check/lib -lcheck"
+else
+	CHECK_LIBS="-lcheck"
+	CHECK_CFLAGS=""
+fi
+AC_SUBST(CHECK_LIBS)
+AC_SUBST(CHECK_CFLAGS)
+LIBS="$saved_LIBS"
+
+
+dnl Execute ACTION-IF-FOUND
+$2
+
+fi
+
+])
+
+
+dnl Usage:
 dnl CHECK_CURSES([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 dnl
 dnl Example:
 AC_SUBST(CURSES_LIBS)
 
 
-])
+])
 CHECK_CURSES(have_curses=true , have_curses=false)
 AC_SUBST(CURSES_LIBS)
 
-dnl Check if we have check... FIXME: Running autogen requires check installed
+dnl Check if we have check...
 
 dnl PKG_CHECK_MODULES([CHECK],[check >= 0.8.2], have_check=true, have_check=false)
 CHECK_CHECK([0.8.2], have_check=true, have_check=false)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.