$NetBSD: patch-at,v 1.19 2010/08/19 08:06:53 asau Exp $

--- configure.orig	2010-07-28 17:18:22.000000000 +0400
+++ configure	2010-08-12 14:49:14.000000000 +0400
@@ -520,7 +520,7 @@
       mksharedlib="$flexlink"
       mkmaindll="$flexlink -maindll"
       shared_libraries_supported=true;;
-    *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-openbsd*|*-*-netbsd*|*-*-gnu*)
+    *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-openbsd*|*-*-netbsd*|*-*-gnu*|*-*-dragonfly)
       sharedcccompopts="-fPIC"
       mksharedlib="$bytecc -shared"
       bytecclinkopts="$bytecclinkopts -Wl,-E"
@@ -620,7 +620,7 @@
     i[3456]86-*-linux*)           natdynlink=true;;
     x86_64-*-linux*)              natdynlink=true;;
     i[3456]86-*-darwin10.*)
-      if test $arch64 == true; then
+      if test $arch64 = true; then
         natdynlink=true
       fi;;
     i[3456]86-*-darwin[89]*)      natdynlink=true;;
@@ -653,12 +653,13 @@
   alpha*-*-netbsd*)             arch=alpha; system=netbsd;;
   alpha*-*-openbsd*)            arch=alpha; system=openbsd;;
   sparc*-*-sunos4.*)            arch=sparc; system=sunos;;
-  sparc*-*-solaris2.*)          arch=sparc; system=solaris;;
+  sparc*-*-solaris2*)           arch=sparc; system=solaris;;
   sparc*-*-*bsd*)               arch=sparc; system=bsd;;
   sparc*-*-linux*)              arch=sparc; system=linux;;
   sparc*-*-gnu*)                arch=sparc; system=gnu;;
   i[3456]86-*-linux*)           arch=i386; system=linux_`sh ./runtest elf.c`;;
   i[3456]86-*-*bsd*)            arch=i386; system=bsd_`sh ./runtest elf.c`;;
+  i[3456]86-*-dragonfly*)       arch=i386; system=bsd_`sh ./runtest elf.c`;;
   i[3456]86-*-nextstep*)        arch=i386; system=nextstep;;
   i[3456]86-*-solaris*)         if $arch64; then
                                   arch=amd64; system=solaris
@@ -667,6 +668,7 @@
                                 fi;;
   i[3456]86-*-beos*)            arch=i386; system=beos;;
   i[3456]86-*-cygwin*)          arch=i386; system=cygwin;;
+  i[3456]86-*-interix3*)        arch=i386; system=interix3;;
   i[3456]86-*-darwin*)          if $arch64; then
                                   arch=amd64; system=macosx
                                 else
@@ -693,7 +695,9 @@
   x86_64-*-freebsd*)            arch=amd64; system=freebsd;;
   x86_64-*-netbsd*)             arch=amd64; system=netbsd;;
   x86_64-*-openbsd*)            arch=amd64; system=openbsd;;
+  x86_64-*-solaris*)            arch=amd64; system=solaris;;
   x86_64-*-darwin9.5)           arch=amd64; system=macosx;;
+  x86_64-*-darwin1[0-9]*)       arch=amd64; system=macosx;;
 esac
 
 # Some platforms exist both in 32-bit and 64-bit variants, not distinguished
@@ -794,6 +798,7 @@
     case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
   amd64,*,linux) profiling='prof';;
   amd64,*,gnu) profiling='prof';;
+  power,*,bsd) profiling='prof';;
   *) profiling='noprof';;
 esac
 
@@ -1198,6 +1203,8 @@
                    pthread_caml_link="-cclib -lpthread -cclib -lposix4";;
     *-*-freebsd*)  pthread_link="-pthread"
                    pthread_caml_link="-cclib -pthread";;
+    *-*-dragonfly*) pthread_link="-pthread"
+                   pthread_caml_link="-cclib -pthread";;
     *-*-openbsd*)  pthread_link="-pthread"
                    pthread_caml_link="-cclib -pthread";;
     *)             pthread_link="-lpthread"
@@ -1249,6 +1256,7 @@
 x11_include="not found"
 x11_link="not found"
 
+if test "$disable_x11" != "yes"; then
 for dir in \
     $x11_include_dir          \
                               \
@@ -1301,6 +1309,7 @@
     break
   fi
 done
+fi
 
 if test "$x11_include" = "not found"; then
   x11_try_lib_dir=''
@@ -1395,31 +1404,8 @@
 dbm_link="not found"
 use_gdbm_ndbm=no
 
-for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
-  if test -f $dir/ndbm.h; then
-    dbm_include=$dir
-    if sh ./hasgot dbm_open; then
-      dbm_link=""
-    elif sh ./hasgot -lndbm dbm_open; then
-      dbm_link="-lndbm"
-    elif sh ./hasgot -ldb1 dbm_open; then
-      dbm_link="-ldb1"
-    elif sh ./hasgot -lgdbm dbm_open; then
-      dbm_link="-lgdbm"
-    elif sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
-      dbm_link="-lgdbm_compat -lgdbm"
-    fi
-    break
-  fi
-  if test -f $dir/gdbm-ndbm.h; then
-    dbm_include=$dir
-    use_gdbm_ndbm=yes
-    if sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
-      dbm_link="-lgdbm_compat -lgdbm"
-    fi
-    break
-  fi
-done
+dbm_include=/usr/include
+dbm_link=${BDB_LIBS}
 if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then
   echo "NDBM not found, the \"dbm\" library will not be supported."
 else
@@ -1429,8 +1415,8 @@
   else
     dbm_include="-I$dbm_include"
   fi
-  if test "$use_gdbm_ndbm" = "yes"; then
-    echo "#define DBM_USES_GDBM_NDBM" >> s.h
+  if test ${BDB_BUILTIN} = "yes"; then
+    echo "#define DBM_USES_DB" >> s.h
   fi
   otherlibraries="$otherlibraries dbm"
 fi
