$NetBSD: patch-aa,v 1.12 2009/09/24 15:53:12 tnn Exp $

--- configure.ac.orig	2009-06-17 01:24:18.000000000 +0200
+++ configure.ac
@@ -83,13 +83,24 @@ AC_SUBST(GVPLUGIN_VERSION)
 GRAPHVIZ_VERSION_BUILD=0
 GRAPHVIZ_VERSION_REVISION=0
 case "${host_os}" in
-  *uwin* | *cygwin* | *mingw32* )
+  *uwin* | *cygwin* | *mingw32* ) 
 	# Windows version numbers
 	# For the build number: months since Jan 2000, day of month from the timestamp
 	# For the revision number: hour, minute from the timestamp
-	if test $GRAPHVIZ_VERSION_MICRO != "0"; then
-		GRAPHVIZ_VERSION_BUILD=`expr \( ${GRAPHVIZ_VERSION_MICRO:0:4} - 2000 \) \* 12 + ${GRAPHVIZ_VERSION_MICRO:4:2}`${GRAPHVIZ_VERSION_MICRO:6:2}
-		GRAPHVIZ_VERSION_REVISION=${GRAPHVIZ_VERSION_MICRO:9:4}
+
+	if test $GRAPHVIZ_VERSION_MICRO = "0"; then
+		GRAPHVIZ_VERSION_BUILD=0
+		GRAPHVIZ_VERSION_REVISION=0
+	else
+		# JR: patch from Michael van Elst:
+		#     if we have a shellm we should have a working awk, too
+		eval `echo "$GRAPHVIZ_VERSION_MICRO" | awk '{
+			print "GRAPHVIZ_VERSION_BUILD=" \
+				(substr($1,1,4)-2000)*12+substr($1,5,2) \
+				substr($1,7,2)
+			print "GRAPHVIZ_VERSION_REVISION=" \
+				substr($1,10,4)
+		}'`
 	fi
 	;;
 esac
@@ -811,7 +822,7 @@ else
 		        LUA_VERSION=`$PKGCONFIG --modversion lua$l`
                         LUA_INCLUDES="$LUA_CFLAGS "`$PKGCONFIG --cflags lua$l`
                         LUA_LIBS="$LUA_LFLAGS "`$PKGCONFIG --libs lua$l`
-		        LUA_INSTALL_DIR="/usr/lib$LIBPOSTFIX/lua/`$PKGCONFIG --variable=V lua`"
+		        LUA_INSTALL_DIR="${PREFIX}/lib$LIBPOSTFIX/lua/`$PKGCONFIG --variable=V lua`"
     
 		        pkgconfig_lualib_found=`$PKGCONFIG --exists lualib$l 2>/dev/null`
 		        if test  "x$?" = "x0"; then
@@ -833,7 +844,7 @@ else
                 LUA_INCLUDES=`$LUACONFIG --include`
                 LUA_LIBS=`$LUACONFIG --libs`
 	        LUA_VERSION="5.0.x"
-	        LUA_INSTALL_DIR="/usr/lib$LIBPOSTFIX/lua/5.0"
+	        LUA_INSTALL_DIR="${PREFIX}/lib$LIBPOSTFIX/lua/5.0"
             fi
         fi
     
@@ -923,8 +934,8 @@ else
         use_ocaml="No (ocaml not available)"
       else
         AC_CHECK_PROG(OCAML_OPT,ocamlopt,ocamlopt)
-        OCAML_INCLUDES=-I/usr/lib$LIBPOSTFIX/ocaml
-        OCAML_LIBS=-L/usr/lib$LIBPOSTFIX/ocaml
+        OCAML_INCLUDES=-I${PREFIX}/lib$LIBPOSTFIX/ocaml
+        OCAML_LIBS=-L${PREFIX}/lib$LIBPOSTFIX/ocaml
         save_CPPFLAGS=$CPPFLAGS
         CPPFLAGS="$CPPFLAGS $OCAML_INCLUDES"
         AC_CHECK_HEADER(caml/mlvalues.h,[
@@ -1010,13 +1021,13 @@ else
       if test "x$PHP" = "x"; then
         use_php="No (php not available)"
       else
-        if test -d /usr/include/php5; then
-          PHP_INCLUDES="-I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/Zend -I/usr/include/php5/TSRM"
+        if test -d ${PREFIX}/include/php5; then
+          PHP_INCLUDES="-I${PREFIX}/include/php5 -I${PREFIX}/include/php5/main -I${PREFIX}/include/php5/Zend -I${PREFIX}/include/php5/TSRM"
         else
-          PHP_INCLUDES="-I/usr/include/php -I/usr/include/php/main -I/usr/include/php/Zend -I/usr/include/php/TSRM"
+          PHP_INCLUDES="-I${PREFIX}/include/php -I${PREFIX}/include/php/main -I${PREFIX}/include/php/Zend -I${PREFIX}/include/php/TSRM"
         fi
-        PHP_INSTALL_DIR="/usr/lib${LIBPOSTFIX}/php/modules"
-        PHP_INSTALL_DATADIR="/usr/share/php"
+        PHP_INSTALL_DIR="${PREFIX}/lib${LIBPOSTFIX}/php/modules"
+        PHP_INSTALL_DATADIR="${PREFIX}/share/php"
         PHP_LIBS=
         save_CPPFLAGS=$CPPFLAGS
         CPPFLAGS="$CPPFLAGS $PHP_INCLUDES"
@@ -2324,7 +2335,7 @@ dnl INCLUDES and LIBS for PLATFORMSDK
 
 AC_ARG_WITH(platformsdkincludedir,
   [AS_HELP_STRING([--with-platformsdkincludedir=DIR],[use Platform SDK (Windows) includes from DIR])],
-  [PLATFORMSDKINCLUDE=$withval; PLATFORMSDKINCLUDE_ESCAPED=${PLATFORMSDKINCLUDE//'\\'/\\\\}; PLATFORMSDKINCLUDE_ESCAPED=${PLATFORMSDKINCLUDE_ESCAPED// /\\ }])
+  [PLATFORMSDKINCLUDE=$withval; PLATFORMSDKINCLUDE_ESCAPED=`echo ${PLATFORMSDKINCLUDE} | sed "s/'\\'/\\\\/g" | sed "s/ /\\ /g"`])
 
 AC_ARG_WITH(platformsdklibdir,
   [AS_HELP_STRING([--with-platformsdklibdir=DIR],[use Platform SDK (Windows) libraries from DIR])],
@@ -2869,10 +2880,12 @@ AC_MSG_CHECKING(if have working sincos()
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
 	#include <stdio.h>
 	#include <assert.h>
+	#include <time.h>
 	#define PI 3.14159265358979323846
 	extern void sincos(double x, double *s, double *c);
 	int main () {
 		double sinx=0.0, cosx=1.0;
+		sincos(time(NULL)&1,&sinx,&cosx);
 		sincos(PI/2.0,&sinx,&cosx);
 		assert(sinx>0.9999999);
 		assert(sinx<1.0000001);
