$NetBSD: patch-configure,v 1.11 2013/11/24 14:17:19 taca Exp $

* Adding Interix and MirBSD support.
* Ignore doxygen.

--- configure.orig	2013-11-22 04:24:15.000000000 +0000
+++ configure
@@ -10741,6 +10741,9 @@ esac
   superux*) :
     	ac_cv_func_setitimer=no
 		 ;; #(
+  interix*) :
+    	LIBS="-lm $LIBS"
+		ac_cv_func_getpgrp_void=yes ;; #(
   *) :
     	LIBS="-lm $LIBS" ;;
 esac
@@ -11344,7 +11347,13 @@ for ac_header in limits.h sys/file.h sys
 		 net/socket.h sys/socket.h process.h atomic.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+"
 if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -12089,6 +12098,9 @@ fi
 ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "#ifdef HAVE_TIME_H
 #include <time.h>
 #endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
 "
 if test "x$ac_cv_type_struct_timespec" = xyes; then :
 
@@ -13880,6 +13892,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>
@@ -15832,7 +15846,7 @@ done
     MAINLIBS="-pthread $MAINLIBS" ;; #(
   *) :
     case "$target_os" in #(
-  openbsd*) :
+  openbsd*|mirbsd*) :
     LIBS="-pthread $LIBS" ;; #(
   *) :
     LIBS="-l$pthread_lib $LIBS" ;;
@@ -16282,7 +16296,9 @@ esac ;; #(
   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*) :
 
@@ -16294,7 +16310,7 @@ esac ;; #(
 			  test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED="ld -Bshareable"
 			fi
 			rb_cv_dlopen=yes ;; #(
-  openbsd*) :
+  openbsd*|mirbsd*) :
     	: ${LDSHARED='$(CC) -shared ${CCDLFLAGS}'}
 			if test "$rb_cv_binary_elf" = yes; then
 			    LDFLAGS="$LDFLAGS -Wl,-E"
@@ -16825,7 +16841,7 @@ _ACEOF
   freebsd*|dragonfly*) :
 
 	SOLIBS='$(LIBS)'
-	LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
+	LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)$(TEENY)'
 	if test "$rb_cv_binary_elf" != "yes" ; then
 	    LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)"
 	    LIBRUBY_ALIASES=''
@@ -16842,7 +16858,7 @@ _ACEOF
 	   LIBRUBY_ALIASES=""
 	fi
 	 ;; #(
-  openbsd*) :
+  openbsd*|mirbsd*) :
 
 	SOLIBS='$(LIBS)'
 	LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
@@ -16903,7 +16919,12 @@ esac
 	 ;; #(
   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,${libdir} -L${libdir} -L. -l$(RUBY_SO_NAME)'
+	LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_SO_NAME).so'
 	 ;; #(
   *) :
      ;;
@@ -16966,11 +16987,7 @@ if test "$install_doc" != no; then
     else
 	RDOCTARGET="nodoc"
     fi
-    if test "$install_capi" != no -a -n "$DOXYGEN"; then
-	CAPITARGET="capi"
-    else
-	CAPITARGET="nodoc"
-    fi
+    CAPITARGET="nodoc"
 else
     RDOCTARGET="nodoc"
     CAPITARGET="nodoc"
