--- configure.orig	Fri Dec 14 04:16:06 2001
+++ configure	Fri Mar  1 11:20:58 2002
@@ -7126,6 +7126,9 @@
 
 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];
@@ -7199,6 +7202,9 @@
 # define F77_SYMBOL(x)   x
 #endif
 
+int MAIN_ () { return 0; }
+int MAIN__ () { return 0; }
+
 typedef struct {
         double r;
         double i;
@@ -7938,16 +7944,16 @@
 fi
 
 fi
-echo $ac_n "checking for main in -lncurses""... $ac_c" 1>&6
-echo "configure:7943: checking for main in -lncurses" >&5
-ac_lib_var=`echo ncurses'_'main | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for main in -ltermcap""... $ac_c" 1>&6
+echo "configure:7945: checking for main in -ltermcap" >&5
+ac_lib_var=`echo termcap'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lncurses  $LIBS"
+LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7951 "configure"
+#line 7953 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -7969,26 +7975,26 @@
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo ncurses | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    ac_tr_lib=HAVE_LIB`echo termcap | sed -e 's/[^a-zA-Z0-9_]/_/g' \
     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_lib 1
 EOF
 
-  LIBS="-lncurses $LIBS"
+  LIBS="-ltermcap $LIBS"
 
 else
   echo "$ac_t""no" 1>&6
-echo $ac_n "checking for main in -ltermcap""... $ac_c" 1>&6
-echo "configure:7984: checking for main in -ltermcap" >&5
-ac_lib_var=`echo termcap'_'main | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for main in -ltermlib""... $ac_c" 1>&6
+echo "configure:7986: checking for main in -ltermlib" >&5
+ac_lib_var=`echo termlib'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-ltermcap  $LIBS"
+LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7992 "configure"
+#line 7994 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8010,26 +8016,26 @@
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo termcap | sed -e 's/^a-zA-Z0-9_/_/g' \
+    ac_tr_lib=HAVE_LIB`echo termlib | sed -e 's/^a-zA-Z0-9_/_/g' \
     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_lib 1
 EOF
 
-  LIBS="-ltermcap $LIBS"
+  LIBS="-ltermlib $LIBS"
 
 else
   echo "$ac_t""no" 1>&6
-echo $ac_n "checking for main in -ltermlib""... $ac_c" 1>&6
-echo "configure:8025: checking for main in -ltermlib" >&5
-ac_lib_var=`echo termlib'_'main | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for main in -lncurses""... $ac_c" 1>&6
+echo "configure:8027: checking for main in -lncurses" >&5
+ac_lib_var=`echo ncurses'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-ltermlib  $LIBS"
+LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8033 "configure"
+#line 8035 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8051,13 +8057,13 @@
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo termlib | sed -e 's/^a-zA-Z0-9_/_/g' \
+    ac_tr_lib=HAVE_LIB`echo ncurses | sed -e 's/^a-zA-Z0-9_/_/g' \
     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_lib 1
 EOF
 
-  LIBS="-ltermlib $LIBS"
+  LIBS="-lncurses $LIBS"
 
 else
   echo "$ac_t""no" 1>&6
@@ -10887,10 +10893,9 @@
   ac_cv_sizeof_long=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 10891 "configure"
+#line 10893 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-#include <sys/types.h>
 main()
 {
   FILE *f=fopen("conftestval", "w");
@@ -10899,7 +10904,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:10903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -10919,7 +10924,7 @@
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:10923: checking size of long long" >&5
+echo "configure:10924: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10927,10 +10932,9 @@
   ac_cv_sizeof_long_long=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 10931 "configure"
+#line 10932 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-#include <sys/types.h>
 main()
 {
   FILE *f=fopen("conftestval", "w");
@@ -10970,7 +10974,6 @@
 #line 10971 "configure"
 #include "confdefs.h"
 #include <stdio.h>
-#include <sys/types.h>
 main()
 {
   FILE *f=fopen("conftestval", "w");
@@ -11683,6 +11686,7 @@
     main_ldflags="-export-dynamic"
     ;;
   netbsd*)
+    fpicflags="-fPIC"
     if ${CPP} - -dM < /dev/null | grep -q __ELF__; then
       main_ldflags="-export-dynamic"
       shlib_ldflags="-shared"
