$NetBSD: patch-ac,v 1.25 2010/05/06 07:33:41 adam Exp $

--- configure.orig	2010-03-31 22:10:52.000000000 +0000
+++ configure
@@ -3755,7 +3755,7 @@ fi
 
 
 if test "${want_R_shlib}" = yes; then
-  LIBR="-L\$(R_HOME)/lib\$(R_ARCH) -lR"
+  LIBR="-Wl,-R${prefix}/lib/R/lib\$(R_ARCH) -L\$(R_HOME)/lib\$(R_ARCH) -lR"
 else
   LIBR=
 fi
@@ -23591,6 +23591,7 @@ cat > conftest.c <<EOF
 #else
 # define F77_SYMBOL(x)   x
 #endif
+int MAIN__ () { return 0; }
 int main () {
   exit(0);
 }
@@ -23667,6 +23668,9 @@ cat > conftest.c <<EOF
 
 extern void F77_SYMBOL(cftest)(int *a, int *b, double *x, double *y);
 
+int MAIN_ () { return 0; }
+int MAIN__ () { return 0; }
+
 int main () {
   int a[3] = {17, 237, 2000000000}, b[2], res = 0;
   double x[3] = {3.14159265, 123.456789, 2.3e34}, z[3];
@@ -23762,6 +23766,9 @@ typedef struct {
 
 extern void F77_SYMBOL(cftest)(Rcomplex *x);
 
+int MAIN_ () { return 0; }
+int MAIN__ () { return 0; }
+
 int main () {
     Rcomplex z[3];
 
@@ -25918,7 +25925,7 @@ $as_echo "$as_me: WARNING: Use of flat n
       SHLIB_LIBADD="-lcc_dynamic"
     fi
     ;;
-  freebsd*)
+  freebsd* | dragonfly*)
     ## Only sure for FreeBSD 3 and above.
     main_ldflags="-export-dynamic"
     shlib_ldflags="-shared"
@@ -26007,6 +26014,12 @@ $as_echo "$as_me: WARNING: Use of flat n
     fcpicflags=
     ;;
   netbsd*)
+    fpicflags="-fPIC"
+    case "${host_cpu}" in
+      powerpc*)
+	cpicflags="-fPIC"
+	;;
+    esac
     if ${CPP} - -dM < /dev/null | grep __ELF__ >/dev/null ; then
       main_ldflags="-export-dynamic"
       shlib_ldflags="-shared"
@@ -26104,7 +26117,7 @@ fi
 : ${FPICFLAGS="${fpicflags}"}
 if test -z "${FPICFLAGS}"; then
   case "${host_os}" in
-    aix*|cygwin*|irix*|mingw*|osf*)
+    aix*|cygwin*|irix*|mingw*|osf*|darwin*)
       ;;
     *)
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: I could not determine FPICFLAGS." >&5
@@ -29156,6 +29169,15 @@ cat > conftest.c <<EOF
 #endif
 extern void F77_SYMBOL(test1)(int *iflag);
 
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+
 int main () {
   int iflag;
   F77_SYMBOL(test1)(&iflag);
@@ -29223,6 +29245,14 @@ else
 #else
 # define F77_SYMBOL(x)   x
 #endif
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
 void F77_SYMBOL(xerbla)(char *srname, int *info)
 {}
 void blas_set () {
