$NetBSD: patch-aa,v 1.6 2002/03/31 16:24:29 dmcmahill Exp $

--- Configure.orig	Fri Apr 27 09:51:44 2001
+++ Configure
@@ -169,35 +169,9 @@
 pth="\
   /bin\
   /usr/bin\
-  /usr/locateal/bin\
-  /usr/ucb\
-  /usr/locateal\
-  /usr/lbin\
-  /usr/5bin\
-  /etc\
-  /usr/etc\
-  /usr/gnu/bin\
-  /usr/new\
-  /usr/new/bin\
-  /usr/nbin\
-  /sys5.3/bin\
-  /sys5.3/usr/bin\
-  /bsd4.3/bin\
-  /bsd4.3/usr/ucb\
-  /bsd4.3/usr/bin\
-  /usr/bsd\
-  /bsd43/bin\
-  /opt/ansic/bin\
-  /usr/ccs/bin\
+  $LOCALBASE/bin\
   /usr/lib\
-  /usr/ucblib\
-  /lib\
-  /usr/ccs/lib\
-  /sbin\
-  /usr/sbin\
-  /usr/libexec\
-  /usr/openwin/bin\
-  /usr/local/bin\
+  $BUILDLINK_DIR/lib\
 "
 # /usr/openwin/bin added for xmkmf
 
@@ -272,7 +246,7 @@
 ==========================================================================
 I know of the following Operating Systems
 EOM
-  rep='os2 freebsd cygwin linux hpux aix osf1 solaris sunos nextstep concentrix irix';
+  rep='os2 freebsd netbsd cygwin linux hpux aix osf1 solaris sunos nextstep concentrix irix';
   . ./display
   echo $n ..."Any of these apply ? $c"
   dflt=$osname; . ./myread
@@ -308,7 +282,7 @@
 #   Modifications for pretty name and asm file
 #
 case "$osname" in
-  cygwin*|linux|freebsd|os2) pretty="$pretty running $osname";;
+  cygwin*|linux|freebsd|netbsd|os2) pretty="$pretty running $osname";;
   nextstep) pretty="$pretty running $osname";
             if test "$arch" = m68k; then asmarch=none; fi ;;
 esac
@@ -362,7 +336,7 @@
 case "$osname-$arch" in
   os2-*)  ln_s=cp; make_sh=sh; exe_suff=.exe; extraflag="-Zexe" ;;
   cygwin*) ln_s="ln -s"; make_sh="/bin/sh"; exe_suff=.exe; extraflag="" ;;
-  *)       ln_s="ln -s"; make_sh="/bin/sh"; exe_suff=; extraflag="" ;;
+  *)       ln_s="ln -sf"; make_sh="/bin/sh"; exe_suff=; extraflag="" ;;
 esac
 
 ####################### CONFIGURE - LIBRARIES ###############################
@@ -405,20 +379,8 @@
 	fi;;
       os2) libpth=`echo $LIBRARY_PATH | sed 's/;/ /g' | sed 's,\\\\,/,g'`;;
  	*) libpth="\
- 	/usr/local/lib\
- 	/lib\
  	/usr/lib\
- 	/opt/lib\
- 	/opt/local/lib\
- 	/opt/gnu/lib\
- 	/lib/pa1.1\
- 	/usr/lib/large\
- 	/lib/large\
- 	/usr/lib/small\
- 	/lib/small\
- 	/usr/ccs/lib\
- 	/usc/ucblib\
- 	/usr/shlib\
+        $BUILDLINK_DIR/lib\
  	.\
      ";;
      esac
@@ -528,21 +490,11 @@
        $cygtop/H-${arch}-cygwin32/${arch}-cygwin32/include\
      ";;
       *) incpth="\
-      /usr/local/include/readline\
-      /usr/include/readline\
-      /opt/include/readline\
-      /opt/local/include/readline\
-      /opt/gnu/include/readline\
-      /usr/unsupported/include/readline\
-      /usr/local/include\
-      /usr/include\
-      /opt/include\
-      /opt/local/include\
-      /opt/gnu/include\
+      $BUILDLINK_DIR/include\
     ";;
     esac
     pth="$readline_add $incpth"
-    x=`./locate 'readline.h' '' $pth`
+    x=`./locate 'readline/readline.h' '' $pth`
     CPPF_defined=
     case $x in
      ?:/*|/*) rl_include=`echo $x | sed 's,/readline.h,,'`
@@ -580,7 +532,7 @@
 # in case headers are not installed correctly
       RLINCLUDE="-I$rl_include -DREADLINE_LIBRARY"
     fi
-    RLLIBS="-L$readline -lreadline"
+    RLLIBS="-Wl,-R$readline -L$readline -lreadline"
     if test -n "$rl_ncurses"; then
       echo ..."Library ncurses needed by readline"
       RLLIBS="$RLLIBS -lncurses"
@@ -638,33 +590,7 @@
       # X11 -- Headers
       if test ! -f $Xincroot/X11/Xos.h; then
         x11pth="\
-          /usr/openwin/share/lib\
-          /usr/openwin/lib\
-          /usr/X11R6/lib\
-          /usr/X11R5/lib\
-          /usr/X11R4/lib\
-          /usr/lib/X11R6\
-          /usr/lib/X11R5\
-          /usr/lib/X11R4\
-          /usr/local/X11R6/lib\
-          /usr/local/X11R5/lib\
-          /usr/local/X11R4/lib\
-          /usr/local/lib/X11R6\
-          /usr/local/lib/X11R5\
-          /usr/local/lib/X11R4\
-          /usr/X11/lib\
-          /usr/lib/X11\
-          /usr/local/X11/lib\
-          /usr/local/lib/X11\
-          /usr/X386/lib\
-          /usr/x386/lib\
-          /usr/XFree86/lib/X11\
-          /usr/lib\
-          /usr/local/lib\
-          /usr/unsupported/lib\
-          /usr/athena/lib\
-          /usr/local/x11r5/lib\
-          /usr/lpp/Xamples/lib\
+          $BUILDLINK_DIR/lib\
         ";
         pth=`echo $x11pth | s,/lib,/include,g`
         x=`./locate X11/Xos.h '' $pth`
@@ -806,7 +732,7 @@
 if test -n "$__gnuc__"; then
   __GNUC__="-D__GNUC__"
   warn="-Wall -Wno-implicit"
-  OPTFLAGS="-O3 -DGCC_INLINE $warn"
+  OPTFLAGS="-DGCC_INLINE $warn"
   DBGFLAGS="-g $warn"
   # Some architectures need -fPIC for building dynamic lib
   case "$osname-$arch" in hpux-*) DLCFLAGS=-fPIC;; esac
@@ -926,6 +852,7 @@
   linux-*|cygwin*)
       LD=$CC; LDFLAGS="$cflags -Xlinker -export-dynamic"
       runpathprefix='-Xlinker -rpath -Xlinker ';;
+  netbsd-*)  LD=$CC;;
   osf1-alpha)
       LD=$ld; LIBS="$LIBS -lots -lc"; runpathprefix='-rpath '
       LDFLAGS='-std0 -call_shared /usr/lib/cmplrs/cc/crt0.o'
@@ -970,6 +897,7 @@
 #    aix-*)  DLSUFFIX=a  ;; dynamic linking does not work!
     sunos-*) sodest=$VersionMajor$VersionMinor.$patch
              soname=$sodest;;
+    netbsd-*) DLLD=;;
     *-alpha|solaris-*|linux-*|freebsd-*)
       case $libpari_base in
         pari) sodest=$version.$patch;; # released versions
@@ -1006,6 +934,7 @@
       aix-*)      DLLDFLAGS="-r" ;;
       hpux-*)     DLLDFLAGS="-b -E" ;;
       freebsd-*)  DLLDFLAGS="-Bshareable -x" ;;
+      netbsd-*)   DLLD=;;
       linux-*)    DLLDFLAGS="-shared -soname \$(LIBPARI_SONAME)" ;;
       irix-*)     DLLDFLAGS="-shared -elf -no_unresolved -all" ;;
       *-alpha)    DLLDFLAGS="-shared"; EXTRADLLDFLAGS='${LIBS}'
@@ -1141,11 +1070,9 @@
 dflt=$share_prefix; . ./myread; share_prefix=$ans
 
 if test -z "$share_prefix"; then
-  dfltman=$prefix/man/man1
   dfltall=$prefix/lib/pari
 else
-  dfltman=$share_prefix/man/man1
-  dfltall=$share_prefix/doc/pari
+  dfltall=$share_prefix/pari
 fi
 
 echo $n ..."\"gp\" executable ? $c"
@@ -1158,7 +1085,7 @@
 dflt=$prefix/include/pari; . ./myread; includedir=$ans
 
 echo $n ..."manual pages ? $c"
-dflt=$dfltman; . ./myread; mandir=$ans
+dflt=$prefix/man/man1; . ./myread; mandir=$ans
 
 echo $n ..."documentation, examples, and emacs macros ? $c"
 dflt=$dfltall; . ./myread; miscdir=$ans
@@ -1222,6 +1149,7 @@
 case "$osname" in
   *cygwin*) LDDYN="-L$libdir -lpari_dll" ; runpath="$libdir" ;
 	    DYNLIBS=-lpari_dll ; DYNFLAGS=-Dlibpari_USE_DLL ;;
+  netbsd)   LDDYN="-Wl,-R$libdir -L$libdir -l$libpari_base" ; runpath="$libdir" ;;
   *)        LDDYN="-L$libdir -l$libpari_base" ; runpath="$libdir" ;;
 esac
 
