$NetBSD: patch-configure,v 1.9 2021/04/25 07:51:26 mrg Exp $

1. chunk: fix
./configure.lineno: 1: Syntax error: Bad substitution
http://www.graphviz.org/mantisbt/view.php?id=2362
2. chunk: use the same path for all platforms in pkgsrc
other chunks: use lua/php/... from pkgsrc
last chunk: fix
./configure.lineno: 27203: Syntax error: ")" unexpected (expecting "fi")
http://www.graphviz.org/mantisbt/view.php?id=2362
last last chunk: fix sed expression not to use + which is not in BRE (guile)

--- configure.orig	2020-04-08 07:52:13.000000000 +0000
+++ configure
@@ -3369,8 +3369,15 @@ case "${host_os}" in
 	# 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}
+		# 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
@@ -3387,7 +3394,6 @@ if test -z "$LIBPOSTFIX"; then
     *linux* )
       case "${host_cpu}" in
-        aarch64 | powerpc64 | powerpc64le | s390x | x86_64 | sparc64 | mips64* | riscv64 )
+        aarch64* | powerpc64 | powerpc64le | s390x | x86_64 | sparc64 | mips64* | riscv64 )
-          LIBPOSTFIX="64"
           INTGOSIZE=64
           ;;
       esac
@@ -3395,7 +3401,6 @@ if test -z "$LIBPOSTFIX"; then
     *solaris* )
       case "${host_cpu}" in
         x86_64 | sparc64 )
-          LIBPOSTFIX="/64"
           INTGOSIZE=64
           ;;
       esac
@@ -18350,7 +18355,7 @@ esac
 
 
 
-if test "${GCC}" == "yes"
+if test "${GCC}" = "yes"
 then
   # Enable common warnings flags
   CFLAGS="${CFLAGS} -Wall"
@@ -21191,7 +21196,7 @@ done
       if test "x$GUILE" = "x"; then
         use_guile="No (guile not available)"
       else
-        GUILE_VERSION=`$GUILE --version | sed -n '1 s/^.* \+\([0-9\.]\+\)$/\1/ p'`
+        GUILE_VERSION=`$GUILE --version | sed -n '1 s/^.* \([0-9\.]*\)$/\1/ p'`
         GUILE_VERSION_MAJOR=`echo $GUILE_VERSION | cut -d '.' -f 1`
         GUILE_VERSION_MINOR=`echo $GUILE_VERSION | cut -d '.' -f 2`
         if test 0$GUILE_VERSION_MAJOR -lt 2; then
@@ -21870,7 +21875,7 @@ $as_echo_n "checking for Lua headers and
 		        LUA_VERSION=`$PKG_CONFIG --modversion lua$l`
                         LUA_INCLUDES="$LUA_CFLAGS "`$PKG_CONFIG --cflags lua$l`
                         LUA_LIBS="$LUA_LFLAGS "`$PKG_CONFIG --libs lua$l`
-		        LUA_INSTALL_DIR="/usr/lib$LIBPOSTFIX/lua/`$PKG_CONFIG --variable=V lua`"
+		        LUA_INSTALL_DIR="${PREFIX}/lib$LIBPOSTFIX/lua/`$PKGCONFIG --variable=V lua`"
 
 		        pkgconfig_lualib_found=`$PKG_CONFIG --exists lualib$l 2>/dev/null`
 		        if test  "x$?" = "x0"; then
@@ -21934,7 +21939,7 @@ $as_echo_n "checking for Lua headers and
                 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
 
@@ -22212,8 +22217,8 @@ $as_echo "no" >&6; }
 fi
 
 
-        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_fn_c_check_header_mongrel "$LINENO" "caml/mlvalues.h" "ac_cv_header_caml_mlvalues_h" "$ac_includes_default"
@@ -22487,7 +22492,7 @@ test -n "$PHPCONFIG" || PHPCONFIG="php-c
         else
           PHP_INCLUDES="`$PHPCONFIG --includes`"
           PHP_INSTALL_DIR="`$PHPCONFIG --extension-dir`"
-          PHP_INSTALL_DATADIR="/usr/share/php"
+          PHP_INSTALL_DATADIR="${PREFIX}/share/php"
           PHP_LIBS="`$PHPCONFIG --ldflags` `$PHPCONFIG --libs`"
           save_CPPFLAGS=$CPPFLAGS
           CPPFLAGS="$CPPFLAGS $PHP_INCLUDES"
@@ -27143,10 +27148,6 @@ fi
 
 
 
-# Check whether --with-platformsdkincludedir was given.
-if test "${with_platformsdkincludedir+set}" = set; then :
-  withval=$with_platformsdkincludedir; PLATFORMSDKINCLUDE=$withval; PLATFORMSDKINCLUDE_ESCAPED=${PLATFORMSDKINCLUDE//'\\'/\\\\}; PLATFORMSDKINCLUDE_ESCAPED=${PLATFORMSDKINCLUDE_ESCAPED// /\\ }
-fi
 
 
 
