--- sourceforge.net/trunk/rdesktop/configure 2002/09/24 07:27:43 189 +++ sourceforge.net/trunk/rdesktop/configure 2003/10/04 12:24:56 477 @@ -2,19 +2,23 @@ # # rdesktop: A Remote Desktop Protocol client # configure script -# Copyright (C) Matthew Chapman 1999-2001 +# Copyright (C) Matthew Chapman 1999-2002 # +echo "rdesktop build configuration script" +echo + echo "# Generated by $0 $*" >Makeconf # Process command line options -cflags= -ldflags= +cflags='-DKEYMAP_PATH=\"$(KEYMAP_PATH)\"' +ldflags='' +rpath= for arg in $*; do -optarg=`echo $arg | sed 's/[-a-z]*=//'` +optarg=`echo $arg | sed 's/[-a-z]*=//'` case $arg in --prefix=*) echo "prefix = $optarg" >>Makeconf @@ -31,9 +35,23 @@ --sharedir=*) echo "datadir = $optarg" >>Makeconf ;; + --with-x*) + extraxdir=$optarg + ;; --with-openssl*) + extrassldir=$optarg ;; --without-openssl*) + withoutopenssl=yes + ;; + --with-egd-socket=*) + extraegdpath=$optarg + ;; + --with-libvncserver) + withvncserver=yes + ;; + --with-libvncserver-config=*) + vncserverconfig=$optarg ;; --with-debug) cflags="$cflags -g -DWITH_DEBUG" @@ -41,21 +59,34 @@ --with-debug-kbd) cflags="$cflags -g -DWITH_DEBUG_KBD" ;; + --with-debug-rdp5) + cflags="$cflags -g -DWITH_DEBUG_RDP5" + ;; + --with-debug-clipboard) + cflags="$cflags -g -DWITH_DEBUG_CLIPBOARD" + ;; --without-debug*) ;; *) - echo "rdesktop build configuration script" - echo echo "Target directories:" - 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]" + 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]" echo echo "Build configuration:" - echo " --with-debug enable protocol debugging output" - echo " --with-debug-kbd enable debugging of keyboard handling" + 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" + echo " --without-openssl use in-tree crypto, even if OpenSSL is available" + echo " --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH" + echo " --with-libvncserver make rdp2vnc" + echo " --with-libvncserver-config=CMD" + echo " use CMD as libvncserver-config" + echo " --with-debug enable protocol debugging output" + echo " --with-debug-kbd enable debugging of keyboard handling" + echo " --with-debug-rdp5 enable debugging of RDP5 code" + echo " --with-debug-clipboard enable debugging of clipboard code" echo rm -f Makeconf exit 1 @@ -64,21 +95,35 @@ done -# Platform-specific options +# Find compiler -need_runpath=no +compilers="$CC gcc cc" -case `uname -s` in - SunOS) - ldflags="$ldflags -lsocket -lnsl" - need_runpath=yes - ;; -esac +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 # Find X installation -xdirs="/usr /usr/X11R6 /usr/X11 /usr/openwin /usr/local /usr/local/X11R6 /usr/local/X11" +xdirs="$extraxdir /usr/X11R6 /usr/X11 /usr/openwin /usr /usr/local/X11R6 /usr/local/X11 /usr/local" for dir in $xdirs; do if [ -f $dir/include/X11/Xlib.h ]; then @@ -89,10 +134,10 @@ if [ -z "$xdir" ]; then echo "ERROR: could not find X Window System headers" - echo "(searched for include/X11/Xlib.h in $xdirs)" + echo "(searched for include/X11/Xlib.h in: $xdirs)" # additional helpful information for Linux users - if [ -f /etc/redhat_release ]; then + 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 @@ -100,50 +145,133 @@ exit 1 fi +echo "X Window System:" +echo " includes $xdir/include" +echo " libraries $xdir/lib" +echo + if [ $xdir != "/usr" ]; then cflags="$cflags -I$xdir/include" ldflags="$ldflags -L$xdir/lib" - if [ $need_runpath = "yes" ]; then - ldflags="$ldflags -R$xdir/lib" + rpath="$rpath:$xdir/lib" +fi + +ldflags="$ldflags" +targets="$targets rdesktop" + +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" fi fi + +if [ ! -z "$withvncserver" ]; then + if [ -z "$vncserverconfig" ]; then + vncserverconfig=libvncserver-config + fi -ldflags="$ldflags -lX11" + echo "VNCINC=`$vncserverconfig --cflags`" >> Makeconf + echo "LDVNC=`$vncserverconfig --libs`" >> Makeconf + echo "CCLD=`$vncserverconfig --link`" >> Makeconf + echo >> Makeconf + targets="$targets rdp2vnc" + echo "Found libvncserver: Building rdp2vnc" +fi -# Find OpenSSL installation if available -ssldirs="/usr /usr/openssl /usr/ssl /usr/local /usr/local/openssl /usr/local/ssl" +# Find EGD socket if we don't have /dev/urandom or /dev/random -for dir in $ssldirs; do - if [ -f $dir/include/openssl/rc4.h ]; then - ssldir=$dir - break +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 -done +fi + +# Check for OSS sound support -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." +if [ -f /usr/include/sys/soundcard.h ]; then + echo Sound support enabled: Open Sound System echo + echo "SOUNDOBJ = rdpsnd.o rdpsnd_oss.o" >>Makeconf + cflags="$cflags -DWITH_RDPSND" +elif [ -f /usr/include/sys/audioio.h ]; then + echo Sound support enabled: Sun + echo + echo "SOUNDOBJ = rdpsnd.o rdpsnd_sun.o" >>Makeconf + cflags="$cflags -DWITH_RDPSND" else - echo "CRYPTOBJ =" >>Makeconf + echo "WARNING: sound support disabled (no /usr/include/sys/soundcard.h or /usr/include/sys/audio.h)" + echo "Currently supported systems are Open Sound System and Sun" + echo +fi - if [ $ssldir != "/usr" ]; then - cflags="$cflags -I$ssldir/include" - ldflags="$ldflags -L$ssldir/lib" - if [ $need_runpath = "yes" ]; then - ldflags="$ldflags -R$ssldir/lib" - fi - fi - cflags="$cflags -DWITH_OPENSSL" - ldflags="$ldflags -lcrypto" -fi +# 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 -echo "CFLAGS += $cflags" >>Makeconf -echo "LDFLAGS += $ldflags" >>Makeconf +echo "CFLAGS = $cflags" >>Makeconf +echo "LDFLAGS = $ldflags" >>Makeconf +echo "TARGETS = $targets" >>Makeconf echo "configure complete - now run make" +