php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #59241
Patch uuid_version_check_fix.patch revision 2011-10-25 12:25 UTC by dominic dot benson at thirdlight dot com

Patch uuid_version_check_fix.patch for uuid Bug #59241

Patch version 2011-10-25 12:25 UTC

Return to Bug #59241 | Download this patch
Patch Revisions:

Developer: dominic.benson@thirdlight.com

diff -rupN uuid-1.0.2.orig/config.m4 uuid-1.0.2/config.m4
--- uuid-1.0.2.orig/config.m4	2008-04-01 16:59:22.000000000 +0100
+++ uuid-1.0.2/config.m4	2011-10-25 11:08:00.000000000 +0100
@@ -23,14 +23,33 @@ if test "$PHP_UUID" != "no"; then
   export OLD_CPPFLAGS="$CPPFLAGS"
   export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_UUID"
 
-  AC_MSG_CHECKING(PHP version)
-  AC_TRY_COMPILE([#include <php_version.h>], [
-#if PHP_VERSION_ID < 40000
-#error  this extension requires at least PHP version 4.0.0
-#endif
-],
-[AC_MSG_RESULT(ok)],
-[AC_MSG_ERROR([need at least PHP 4.0.0])])
+  AC_MSG_CHECKING([PHP version])
+
+  tmp_version=$PHP_VERSION
+  if test -z "$tmp_version"; then
+    if test -z "$PHP_CONFIG"; then
+      AC_MSG_ERROR([php-config not found])
+    fi
+    php_version=`$PHP_CONFIG --version 2>/dev/null|head -n 1|$PHP_OCI8_SED -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
+  else
+    php_version=`echo "$tmp_version"|$PHP_OCI8_SED -e 's#\([0-9]\.[0-9]*\.[0-9]*\)\(.*\)#\1#'`
+  fi
+
+  if test -z "$php_version"; then
+    AC_MSG_ERROR([failed to detect PHP version, please report])
+  fi
+
+  ac_IFS=$IFS
+  IFS="."
+  set $php_version
+  IFS=$ac_IFS
+  uuid_php_version=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
+
+  if test "$uuid_php_version" -lt "4000000"; then
+    AC_MSG_ERROR([You need at least PHP 4.0.0 to be able to use this version of UUID. PHP $php_version found])
+  else
+    AC_MSG_RESULT([$php_version, ok])
+  fi
 
   export CPPFLAGS="$OLD_CPPFLAGS"
 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 04:01:38 2024 UTC