$NetBSD: patch-configure,v 1.4 2018/01/26 13:25:29 jperkin Exp $

* Adding Interix support.
* Ignore doxygen.
* Ignore VCS.
* Handle SSP in pkgsrc.
* Put -std= in CFLAGS not CPPFLAGS.

--- configure.orig	2017-12-25 07:00:28.000000000 +0000
+++ configure
@@ -5428,7 +5428,7 @@ else
     if test x"$target_alias" = x; then :
 
 	case "$target_os" in #(
-  darwin*) :
+  nodarwin*) :
 
 	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for real target cpu" >&5
 $as_echo_n "checking for real target cpu... " >&6; }
@@ -7873,6 +7873,7 @@ fi
 	stack_protector=no
      ;; #(
   *) :
+	stack_protector=no
      ;;
 esac
     if test -z "${stack_protector+set}"; then :
@@ -9295,7 +9296,7 @@ rm -f core conftest.err conftest.$ac_obj
 		  # is often also needed in CPPFLAGS, because some feature
 		  # definitions vary depending on such standards options.
 		  case "${ansi_options}" in #(
-  *-std=iso9899:1999*) :
+  *-std=iso9899:1999*|*-std=gnu99*) :
 
 		    # RUBY_APPEND_OPTIONS(CPPFLAGS)
 	for rb_opt in ${ansi_options}; do
@@ -9303,9 +9304,9 @@ rm -f core conftest.err conftest.$ac_obj
   *" ${rb_opt} "*) :
      ;; #(
   '  ') :
-     CPPFLAGS="${rb_opt}" ;; #(
+     CFLAGS="${rb_opt}" ;; #(
   *) :
-     CPPFLAGS="$CPPFLAGS ${rb_opt}" ;;
+     CFLAGS="$CFLAGS ${rb_opt}" ;;
 esac
 	done
 		   ;; #(
@@ -9536,6 +9537,10 @@ esac
     	LIBS="-lm $LIBS"
 		ac_cv_func_round=no
 		 ;; #(
+  interix*) :
+	LIBS="-lm $LIBS"
+	ac_cv_func_getpgrp_void=yes
+		 ;; #(
   *) :
     	LIBS="-lm $LIBS" ;;
 esac
@@ -20224,6 +20229,8 @@ else
 # ifdef _MSC_VER
 #  include <malloc.h>
 #  define alloca _alloca
+# elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
+#   include <stdlib.h>
 # else
 #  ifdef HAVE_ALLOCA_H
 #   include <alloca.h>
@@ -24996,7 +25003,9 @@ fi
   interix*) :
     	: ${LDSHARED='$(CC) -shared'}
 			XLDFLAGS="$XLDFLAGS -Wl,-E"
+			DLDFLAGS="$DLDFLAGS "'-Wl,-h,$(.TARGET) -Wl,--image-base,$$(($$RANDOM %4096/2*262144+1342177280))'
 			LIBPATHFLAG=" -L%1\$-s"
+			RPATHFLAG=' -Wl,-R%1$-s'
 			rb_cv_dlopen=yes ;; #(
   freebsd*|dragonfly*) :
 
@@ -26229,7 +26238,7 @@ fi
   freebsd*|dragonfly*) :
 
 	SOLIBS='$(LIBS)'
-	LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)'
+	LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)$(TEENY)'
 	LIBRUBY_SONAME='$(LIBRUBY_SO)'
 	if test "$rb_cv_binary_elf" != "yes" ; then :
 
@@ -26326,6 +26335,7 @@ fi
 	    LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,*_threadptr_*'
 
 fi
+	RUBY_SO_NAME="${RUBY_SO_NAME}"'.$(RUBY_PROGRAM_VERSION)'
 	LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "' $(XLDFLAGS)'
 	LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT)'
 	LIBRUBY_SONAME='lib$(RUBY_BASE_NAME).$(RUBY_API_VERSION).$(SOEXT)'
@@ -26334,7 +26344,12 @@ fi
 	 ;; #(
   interix*) :
 
-	LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)'
+	SOLIBS='$(LIBS)'
+	LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR).$(TEENY)'
+	# link explicitly to 0x48000000
+	LIBRUBY_DLDFLAGS='-Wl,-h,lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR) -Wl,--image-base,1207959552'
+	LIBRUBYARG_SHARED='-Wl,-R -Wl,${PREFIX}/lib} -L${libdir} -L. -l$(RUBY_SO_NAME)'
+	LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_SO_NAME).so'
 	 ;; #(
   mingw*|cygwin*|mswin*) :
 
@@ -26516,7 +26531,7 @@ if test "$enable_rpath" = yes; then :
 esac
     rpathflag=`IFS="$PATH_SEPARATOR"
         echo x "$rpathflag" |
-        sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${libprefix}${IFS}g;s${IFS}%s${IFS}${libprefix}${IFS}g"
+        sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${libprefix}${IFS}g;s${IFS}%s${IFS}${PREFIX}/lib${IFS}g"
     `
     LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${rpathflag}"
     LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED"
@@ -27058,15 +27073,7 @@ fi
 
 if test "$install_doc" != no; then :
 
-    if test "$install_rdoc" != no; then :
-
-	RDOCTARGET="rdoc"
-
-else
-
-	RDOCTARGET="nodoc"
-
-fi
+    RDOCTARGET="nodoc"
     if test "$install_capi" != no -a -n "$DOXYGEN"; then :
 
 	CAPITARGET="capi"
@@ -29143,31 +29150,7 @@ which seems to be undefined.  Please mak
     "Makefile":F)
     tmpmk=confmk$$.tmp
     {
-	if test ${VCS+set}; then :
-
-	    :
-
-elif svn info "$srcdir" > /dev/null 2>&1; then :
-
-	    VCS='svn'
-
-elif git_dir=`$GIT --work-tree="$srcdir" --git-dir="$srcdir/.git" rev-parse --git-dir 2>/dev/null`; then :
-
-	    if test -d "$git_dir/svn"; then :
-
-		VCS='$(GIT) svn'
-
-else
-
-		VCS='$(GIT)'
-
-fi
-
-else
-
-	    VCS='echo cannot'
-
-fi
+        VCS='echo cannot'
 	case "$VCS" in #(
   svn) :
     VCSUP='$(VCS) up $(SVNUPOPTIONS)' ;; #(
