2001-09-14 15:51:38 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# rdesktop: A Remote Desktop Protocol client
|
|
|
|
# configure script
|
2002-09-26 16:26:46 +02:00
|
|
|
# Copyright (C) Matthew Chapman 1999-2002
|
2001-09-14 15:51:38 +02:00
|
|
|
#
|
|
|
|
|
2002-09-26 16:01:42 +02:00
|
|
|
echo "rdesktop build configuration script"
|
|
|
|
echo
|
|
|
|
|
2001-09-14 15:51:38 +02:00
|
|
|
echo "# Generated by $0 $*" >Makeconf
|
|
|
|
|
2002-09-15 13:36:23 +02:00
|
|
|
|
|
|
|
# Process command line options
|
|
|
|
|
2002-09-24 09:27:43 +02:00
|
|
|
cflags=
|
|
|
|
ldflags=
|
2002-10-10 09:47:29 +02:00
|
|
|
rpath=
|
2002-09-24 09:27:43 +02:00
|
|
|
|
2001-09-14 15:51:38 +02:00
|
|
|
for arg in $*; do
|
2002-10-10 09:25:31 +02:00
|
|
|
optarg=`echo $arg | sed 's/[-a-z]*=//'`
|
2001-09-14 15:51:38 +02:00
|
|
|
case $arg in
|
|
|
|
--prefix=*)
|
2002-09-15 13:36:23 +02:00
|
|
|
echo "prefix = $optarg" >>Makeconf
|
2001-09-14 15:51:38 +02:00
|
|
|
;;
|
|
|
|
--exec-prefix=*)
|
2002-09-15 13:36:23 +02:00
|
|
|
echo "exec_prefix = $optarg" >>Makeconf
|
2001-09-14 15:51:38 +02:00
|
|
|
;;
|
|
|
|
--bindir=*)
|
2002-09-15 13:36:23 +02:00
|
|
|
echo "bindir = $optarg" >>Makeconf
|
2001-09-14 15:51:38 +02:00
|
|
|
;;
|
|
|
|
--mandir=*)
|
2002-09-15 13:36:23 +02:00
|
|
|
echo "mandir = $optarg" >>Makeconf
|
2001-09-15 11:37:17 +02:00
|
|
|
;;
|
2002-08-14 16:43:25 +02:00
|
|
|
--sharedir=*)
|
2002-09-15 13:36:23 +02:00
|
|
|
echo "datadir = $optarg" >>Makeconf
|
2002-08-14 16:43:25 +02:00
|
|
|
;;
|
2002-10-10 09:25:31 +02:00
|
|
|
--with-x*)
|
|
|
|
extraxdir=$optarg
|
|
|
|
;;
|
2001-09-15 11:37:17 +02:00
|
|
|
--with-openssl*)
|
2002-10-10 09:25:31 +02:00
|
|
|
extrassldir=$optarg
|
2001-09-15 11:37:17 +02:00
|
|
|
;;
|
|
|
|
--without-openssl*)
|
2002-11-19 12:06:12 +01:00
|
|
|
withoutopenssl=yes
|
2001-09-14 15:51:38 +02:00
|
|
|
;;
|
2002-10-10 09:25:31 +02:00
|
|
|
--with-egd-socket=*)
|
|
|
|
extraegdpath=$optarg
|
|
|
|
;;
|
2002-07-18 16:44:32 +02:00
|
|
|
--with-debug)
|
2002-09-24 09:27:43 +02:00
|
|
|
cflags="$cflags -g -DWITH_DEBUG"
|
2001-09-14 15:51:38 +02:00
|
|
|
;;
|
2002-07-18 16:44:32 +02:00
|
|
|
--with-debug-kbd)
|
2002-09-24 09:27:43 +02:00
|
|
|
cflags="$cflags -g -DWITH_DEBUG_KBD"
|
2002-07-18 16:44:32 +02:00
|
|
|
;;
|
2001-09-14 15:51:38 +02:00
|
|
|
--without-debug*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Target directories:"
|
2002-10-10 09:25:31 +02:00
|
|
|
echo " --prefix=PREFIX location for architecture-independent files"
|
|
|
|
echo " --exec-prefix=EPREFIX location for architecture-dependent files"
|
|
|
|
echo " --bindir=BINDIR location for program binaries [EPREFIX/bin]"
|
|
|
|
echo " --mandir=MANDIR location for man pages [PREFIX/man]"
|
|
|
|
echo " --sharedir=SHAREDIR location for architecture-independent shared files [PREFIX/share/rdesktop]"
|
2001-09-14 15:51:38 +02:00
|
|
|
echo
|
|
|
|
echo "Build configuration:"
|
2002-10-10 09:25:31 +02:00
|
|
|
echo " --with-x=DIR look for X Window System at DIR/include, DIR/lib"
|
|
|
|
echo " --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib"
|
2002-11-19 12:06:12 +01:00
|
|
|
echo " --without-openssl use in-tree crypto, even if OpenSSL is available"
|
2002-10-10 09:25:31 +02:00
|
|
|
echo " --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH"
|
|
|
|
echo " --with-debug enable protocol debugging output"
|
|
|
|
echo " --with-debug-kbd enable debugging of keyboard handling"
|
2001-09-14 15:51:38 +02:00
|
|
|
echo
|
|
|
|
rm -f Makeconf
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2002-09-24 09:27:43 +02:00
|
|
|
|
2002-11-14 14:56:16 +01:00
|
|
|
# Find compiler
|
|
|
|
|
|
|
|
compilers="$CC gcc cc"
|
|
|
|
|
|
|
|
for compiler in $compilers; do
|
|
|
|
if [ -x "`which $compiler`" ]; then
|
|
|
|
cc=$compiler
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$cc" ]; then
|
|
|
|
echo "ERROR: could not find a C compiler (tried: $compilers)"
|
|
|
|
echo "You probably want to install gcc"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "CC = $cc" >>Makeconf
|
|
|
|
|
|
|
|
if $cc -v 2>&1 |grep '^gcc' >/dev/null; then
|
|
|
|
cflags="$cflags -Wall -O2"
|
|
|
|
else
|
|
|
|
cflags="$cflags -O"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2002-09-24 09:27:43 +02:00
|
|
|
# Find X installation
|
|
|
|
|
2002-10-10 09:25:31 +02:00
|
|
|
xdirs="$extraxdir /usr/X11R6 /usr/X11 /usr/openwin /usr /usr/local/X11R6 /usr/local/X11 /usr/local"
|
2002-09-24 09:27:43 +02:00
|
|
|
|
|
|
|
for dir in $xdirs; do
|
|
|
|
if [ -f $dir/include/X11/Xlib.h ]; then
|
|
|
|
xdir=$dir
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$xdir" ]; then
|
|
|
|
echo "ERROR: could not find X Window System headers"
|
2002-10-10 09:25:31 +02:00
|
|
|
echo "(searched for include/X11/Xlib.h in: $xdirs)"
|
2002-09-24 09:27:43 +02:00
|
|
|
|
|
|
|
# additional helpful information for Linux users
|
|
|
|
if [ -f /etc/redhat_release ]; then
|
|
|
|
echo You probably need to install the XFree86-devel package
|
|
|
|
elif [ -f /etc/debian_version ]; then
|
|
|
|
echo You probably need to install the xlibs-dev package
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2002-09-26 16:01:42 +02:00
|
|
|
echo "X Window System:"
|
|
|
|
echo " includes $xdir/include"
|
|
|
|
echo " libraries $xdir/lib"
|
|
|
|
echo
|
|
|
|
|
2002-09-24 09:27:43 +02:00
|
|
|
if [ $xdir != "/usr" ]; then
|
|
|
|
cflags="$cflags -I$xdir/include"
|
|
|
|
ldflags="$ldflags -L$xdir/lib"
|
2002-10-10 09:47:29 +02:00
|
|
|
rpath="$rpath:$xdir/lib"
|
2002-09-24 09:27:43 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
ldflags="$ldflags -lX11"
|
|
|
|
|
|
|
|
|
2002-11-19 12:06:12 +01:00
|
|
|
if [ -z "$withoutopenssl" ]; then
|
|
|
|
# Find OpenSSL installation if available
|
|
|
|
ssldirs="$extrassldir /usr/openssl /usr/ssl /usr /usr/local/openssl /usr/local/ssl /usr/local"
|
|
|
|
|
|
|
|
for dir in $ssldirs; do
|
|
|
|
if [ -f $dir/include/openssl/rc4.h ]; then
|
|
|
|
ssldir=$dir
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$ssldir" ]; then
|
|
|
|
echo "WARNING: could not find OpenSSL headers"
|
|
|
|
echo "(searched for include/openssl/rc4.h in: $ssldirs)"
|
|
|
|
echo "Using in-tree crypto; installing OpenSSL is recommended."
|
|
|
|
echo
|
|
|
|
else
|
|
|
|
echo "OpenSSL:"
|
|
|
|
echo " includes $ssldir/include"
|
|
|
|
echo " libraries $ssldir/lib"
|
|
|
|
echo
|
|
|
|
|
|
|
|
echo "CRYPTOBJ =" >>Makeconf
|
|
|
|
|
|
|
|
if [ $ssldir != "/usr" ]; then
|
|
|
|
cflags="$cflags -I$ssldir/include"
|
|
|
|
ldflags="$ldflags -L$ssldir/lib"
|
|
|
|
rpath="$rpath:$ssldir/lib"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cflags="$cflags -DWITH_OPENSSL"
|
|
|
|
ldflags="$ldflags -lcrypto"
|
2002-09-24 09:27:43 +02:00
|
|
|
fi
|
|
|
|
fi
|
2002-11-19 12:06:12 +01:00
|
|
|
|
2002-09-24 09:27:43 +02:00
|
|
|
|
2002-10-10 09:25:31 +02:00
|
|
|
# Find EGD socket if we don't have /dev/urandom or /dev/random
|
2002-10-10 09:47:29 +02:00
|
|
|
|
2002-10-10 09:25:31 +02:00
|
|
|
if [ ! -c /dev/random -a ! -c /dev/urandom ]; then
|
|
|
|
egdpaths="$extraegdpath /var/run/egd-pool /dev/egd-pool /etc/egd-pool /etc/entropy"
|
|
|
|
|
|
|
|
for path in $egdpaths; do
|
|
|
|
# -e isn't portable, so we use -r
|
|
|
|
if [ -r $path ]; then
|
|
|
|
egdpath=$path
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$egdpath" ]; then
|
|
|
|
echo "WARNING: could not find /dev/urandom, /dev/random or Entropy Gathering Daemon (EGD) socket"
|
|
|
|
echo "(searched: $egdpaths)"
|
|
|
|
echo "Session keys may be less secure; installing a system randomness source is recommended."
|
|
|
|
echo
|
|
|
|
else
|
|
|
|
echo "Entropy Gathering Daemon (EGD):"
|
|
|
|
echo " socket $egdpath"
|
|
|
|
echo
|
|
|
|
cflags="$cflags -DEGD_SOCKET=\\\"$egdpath\\\""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2002-10-10 09:47:29 +02:00
|
|
|
|
|
|
|
# Platform-specific options
|
|
|
|
|
|
|
|
# strip leading colon from rpath
|
|
|
|
rpath=`echo $rpath |sed 's/^://'`
|
|
|
|
|
|
|
|
case `uname -s` in
|
|
|
|
SunOS)
|
|
|
|
ldflags="$ldflags -lsocket -lnsl -R$rpath"
|
|
|
|
;;
|
|
|
|
OSF1)
|
|
|
|
ldflags="$ldflags -Wl,-rpath,$rpath"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2002-09-24 09:27:43 +02:00
|
|
|
echo "CFLAGS += $cflags" >>Makeconf
|
|
|
|
echo "LDFLAGS += $ldflags" >>Makeconf
|
|
|
|
|
2001-09-14 15:51:38 +02:00
|
|
|
echo "configure complete - now run make"
|
2002-10-10 09:47:29 +02:00
|
|
|
|