$NetBSD: patch-ac,v 1.11 2004/01/05 12:20:57 markd Exp $

--- configure.orig	2003-11-21 23:31:30.000000000 +1300
+++ configure
@@ -2108,7 +2108,7 @@ else
   WANT_R_SHLIB_FALSE=
 fi
 if test "${want_R_shlib}" = yes; then
-  LIBR="-L\$(R_HOME)/bin -lR"
+  LIBR="-Wl,-R${prefix}/lib/R/bin -L\$(R_HOME)/bin -lR"
 else
   LIBR=
 fi
@@ -11414,13 +11414,13 @@ _ACEOF
 fi
 
 
-echo "$as_me:$LINENO: checking for main in -lncurses" >&5
-echo $ECHO_N "checking for main in -lncurses... $ECHO_C" >&6
-if test "${ac_cv_lib_ncurses_main+set}" = set; then
+echo "$as_me:$LINENO: checking for main in -ltermcap" >&5
+echo $ECHO_N "checking for main in -ltermcap... $ECHO_C" >&6
+if test "${ac_cv_lib_termcap_main+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lncurses  $LIBS"
+LIBS="-ltermcap  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 /* confdefs.h.  */
@@ -11450,34 +11450,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ncurses_main=yes
+  ac_cv_lib_termcap_main=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ncurses_main=no
+ac_cv_lib_termcap_main=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_main" >&5
-echo "${ECHO_T}$ac_cv_lib_ncurses_main" >&6
-if test $ac_cv_lib_ncurses_main = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_main" >&5
+echo "${ECHO_T}$ac_cv_lib_termcap_main" >&6
+if test $ac_cv_lib_termcap_main = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBNCURSES 1
+#define HAVE_LIBTERMCAP 1
 _ACEOF
 
-  LIBS="-lncurses $LIBS"
+  LIBS="-ltermcap $LIBS"
 
 else
 
-echo "$as_me:$LINENO: checking for main in -ltermcap" >&5
-echo $ECHO_N "checking for main in -ltermcap... $ECHO_C" >&6
-if test "${ac_cv_lib_termcap_main+set}" = set; then
+echo "$as_me:$LINENO: checking for main in -ltermlib" >&5
+echo $ECHO_N "checking for main in -ltermlib... $ECHO_C" >&6
+if test "${ac_cv_lib_termlib_main+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltermcap  $LIBS"
+LIBS="-ltermlib  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 /* confdefs.h.  */
@@ -11507,34 +11507,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_termcap_main=yes
+  ac_cv_lib_termlib_main=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_termcap_main=no
+ac_cv_lib_termlib_main=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_main" >&5
-echo "${ECHO_T}$ac_cv_lib_termcap_main" >&6
-if test $ac_cv_lib_termcap_main = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_termlib_main" >&5
+echo "${ECHO_T}$ac_cv_lib_termlib_main" >&6
+if test $ac_cv_lib_termlib_main = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBTERMCAP 1
+#define HAVE_LIBTERMLIB 1
 _ACEOF
 
-  LIBS="-ltermcap $LIBS"
+  LIBS="-ltermlib $LIBS"
 
 else
 
-echo "$as_me:$LINENO: checking for main in -ltermlib" >&5
-echo $ECHO_N "checking for main in -ltermlib... $ECHO_C" >&6
-if test "${ac_cv_lib_termlib_main+set}" = set; then
+echo "$as_me:$LINENO: checking for main in -lncurses" >&5
+echo $ECHO_N "checking for main in -lncurses... $ECHO_C" >&6
+if test "${ac_cv_lib_ncurses_main+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltermlib  $LIBS"
+LIBS="-lncurses  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 /* confdefs.h.  */
@@ -11564,24 +11564,24 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_termlib_main=yes
+  ac_cv_lib_ncurses_main=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_termlib_main=no
+ac_cv_lib_ncurses_main=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_termlib_main" >&5
-echo "${ECHO_T}$ac_cv_lib_termlib_main" >&6
-if test $ac_cv_lib_termlib_main = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_main" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_main" >&6
+if test $ac_cv_lib_ncurses_main = yes; then
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBTERMLIB 1
+#define HAVE_LIBNCURSES 1
 _ACEOF
 
-  LIBS="-ltermlib $LIBS"
+  LIBS="-lncurses $LIBS"
 
 fi
 
@@ -15834,6 +15834,7 @@ cat > conftest.c <<EOF
 #else
 # define F77_SYMBOL(x)   x
 #endif
+int MAIN__ () { return 0; }
 int main () {
   exit(0);
 }
@@ -15902,6 +15903,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];
@@ -15990,6 +15994,9 @@ typedef struct {
 
 extern void F77_SYMBOL(cftest)(Rcomplex *x);
 
+int MAIN_ () { return 0; }
+int MAIN__ () { return 0; }
+
 int main () {
     Rcomplex z[3];
 
@@ -17020,135 +17027,6 @@ echo "${ECHO_T}no" >&6
 fi
 
     fi
-    if test "${G77}" = yes; then
-      ac_safe=_mieee
-echo "$as_me:$LINENO: checking whether ${F77} accepts -mieee" >&5
-echo $ECHO_N "checking whether ${F77} accepts -mieee... $ECHO_C" >&6
-if eval "test \"\${r_cv_prog_f77_flag_${ac_safe}+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-
-r_save_FFLAGS="${FFLAGS}"
-FFLAGS="${FFLAGS} -mieee"
-cat >conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "r_cv_prog_f77_flag_${ac_safe}=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "r_cv_prog_f77_flag_${ac_safe}=no"
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-FFLAGS="${r_save_FFLAGS}"
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-fi
-
-if eval "test \"`echo '$r_cv_prog_f77_flag_'$ac_safe`\" = yes"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-  separator=""
-test -z "${separator}" && separator=" "
-if test -z "${R_XTRA_FFLAGS}"; then
-  R_XTRA_FFLAGS="-mieee"
-else
-  R_XTRA_FFLAGS="${R_XTRA_FFLAGS}${separator}-mieee"
-fi
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-    else
-      ac_safe=_fpe3
-echo "$as_me:$LINENO: checking whether ${F77} accepts -fpe3" >&5
-echo $ECHO_N "checking whether ${F77} accepts -fpe3... $ECHO_C" >&6
-if eval "test \"\${r_cv_prog_f77_flag_${ac_safe}+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-
-r_save_FFLAGS="${FFLAGS}"
-FFLAGS="${FFLAGS} -fpe3"
-cat >conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "r_cv_prog_f77_flag_${ac_safe}=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "r_cv_prog_f77_flag_${ac_safe}=no"
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-FFLAGS="${r_save_FFLAGS}"
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-fi
-
-if eval "test \"`echo '$r_cv_prog_f77_flag_'$ac_safe`\" = yes"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-  separator=""
-test -z "${separator}" && separator=" "
-if test -z "${R_XTRA_FFLAGS}"; then
-  R_XTRA_FFLAGS="-fpe3"
-else
-  R_XTRA_FFLAGS="${R_XTRA_FFLAGS}${separator}-fpe3"
-fi
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-    fi
     if test "${GXX}" = yes; then
       ac_safe=_mieee
 echo "$as_me:$LINENO: checking whether ${CXX-c++} accepts -mieee" >&5
@@ -18017,6 +17895,7 @@ fi ;;
     fpicflags=
     ;;
   netbsd*)
+    fpicflags="-fPIC"
     if ${CPP} - -dM < /dev/null | grep __ELF__ >/dev/null ; then
       main_ldflags="-export-dynamic"
       shlib_ldflags="-shared"
