--- configure.orig	Sat Aug  9 16:12:30 2003
+++ configure	Mon Mar 15 20:51:21 2004
@@ -300,7 +300,7 @@
 
 
 # 1st pass checking for vital options
-_install=install
+_install=@${BSD_INSTALL_PROGRAM}
 _ranlib=ranlib
 _cc=gcc
 test "$CC" && _cc="$CC"
@@ -392,6 +392,7 @@
       i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686) host_arch=i386 ;;
       ia64) host_arch=ia64 ;;
       x86_64) host_arch=x86_64 ;;
+      amd64) host_arch=x86_64 ;;
       ppc) host_arch=ppc ;;
       alpha) host_arch=alpha ;;
       sparc*) host_arch=sparc ;;
@@ -539,19 +540,10 @@
 
 # Try to find the available options for the current CPU
 if x86 || ppc; then
-  if test -r /proc/cpuinfo ; then
-    # Linux with /proc mounted, extract CPU information from it
-    _cpuinfo="cat /proc/cpuinfo"
-  elif test -r /compat/linux/proc/cpuinfo ; then
-    # FreeBSD with Linux emulation /proc mounted,
-    # extract CPU information from it
-    _cpuinfo="cat /compat/linux/proc/cpuinfo"
-  elif x86; then
     # all other OSes try to extract CPU information from a small helper
     # program TOOLS/cpuinfo instead
     $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c
     _cpuinfo="TOOLS/cpuinfo"
-  fi
 
   pname=`$_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
   pvendor=`$_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2  | cut -d ' ' -f 2 | head -1`
@@ -1423,8 +1415,8 @@
     ;;
 
   *)
-    echo "Unknown parameter: $ac_option"
-    exit 1
+    echo -n "Unknown parameter: $ac_option"
+    echo " (ignoring)"
     ;;
 
   esac
@@ -1434,7 +1426,7 @@
 test -z "$_bindir" && _bindir="$_prefix/bin"
 test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
 test -z "$_mandir" && _mandir="$_prefix/man"
-test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
+test -z "$_confdir" && _confdir="$_prefix/share/mplayer"
 test -z "$_libdir" && _libdir="$_prefix/lib"
 test -z "$_mlibdir" && _mlibdir="$MLIBHOME"
 
@@ -1866,13 +1858,7 @@
 
 
 echocheck "memalign()"
-# XXX restrict to x86 ? extend to other CPUs/cacheline sizes ?
-cat > $TMPC << EOF
-#include <malloc.h>
-int main (void) { (void) memalign(64, sizeof(char)); return 0; }
-EOF
 _memalign=no
-cc_check && _memalign=yes
 if test "$_memalign" = yes ; then
  _def_memalign='#define HAVE_MEMALIGN 1'
 else
@@ -1961,31 +1947,7 @@
 
 
 echocheck "pthread"
-cat > $TMPC << EOF
-#include <pthread.h>
-void* func(void *arg) { return arg; }
-int main(void) { pthread_t tid; return pthread_create (&tid, 0, func, 0) == 0 ? 0 : 1; }
-EOF
-if ( cc_check && $TMPO ) ; then              # QNX
-  _ld_pthread=''
-elif ( cc_check -lpthread && $TMPO ) ; then
-  _ld_pthread='-lpthread'
-elif ( cc_check -pthread && $TMPO ) ; then
-  _ld_pthread='-pthread'
-else
-  if test "$_ld_static" ; then
-    # for crosscompilation, we cannot execute the program, be happy if we can link statically
-    if ( cc_check -lpthread ) ; then
-      _ld_pthread='-lpthread'
-    elif ( cc_check -pthread ) ; then
-     _ld_pthread='-pthread'
-    else
-      die "Static lib pthread not found (needed by Windows and networking stufff)."
-    fi
-  else
-    die "Lib pthread not found (needed by Windows and networking stuff)."
-  fi
-fi
+_ld_pthread="${PTHREAD_LIBS}"
 echores "yes (using $_ld_pthread)"
 
 
@@ -3819,11 +3781,11 @@
 
 
 echocheck "RTC"
-if linux ; then
+if freebsd ; then
   if test "$_rtc" = auto ; then
     cat > $TMPC << EOF
 #include <sys/ioctl.h>
-#include <linux/rtc.h>
+#include <rtc.h>
 int main(void) { return RTC_IRQP_READ; }
 EOF
     _rtc=no
@@ -4848,7 +4810,7 @@
   CFLAGS="$CFLAGS -D_REENTRANT"
 elif bsd ; then
   # FIXME bsd needs this so maybe other OS'es
-  CFLAGS="$CFLAGS -D_THREAD_SAFE"
+  CFLAGS="$CFLAGS ${PTHREAD_CFLAGS}"
 fi
 # 64 bit file offsets?
 if test "$_largefiles" = yes || freebsd ; then
