2007-07-03 04:55:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
echo 'configuring spacenav library...'
|
|
|
|
|
|
|
|
PREFIX=/usr/local
|
|
|
|
OPT=yes
|
|
|
|
DBG=yes
|
|
|
|
X11=yes
|
2022-03-16 04:19:39 +00:00
|
|
|
VER=`git describe --tags 2>/dev/null`
|
|
|
|
|
|
|
|
if [ -z "$VER" ]; then
|
|
|
|
VER=`git rev-parse --short HEAD`
|
|
|
|
if [ -z "$VER" ]; then
|
|
|
|
VER=v`pwd | grep 'libspnav-[0-9]\+\.' | sed 's/.*libspnav-\(\([0-9]\+\.\)\+[0-9]\+\).*$/\1/'`
|
|
|
|
if [ $VER = v ]; then
|
|
|
|
VER='<unknown version>'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "configuring libspnav - $VER"
|
2007-07-03 04:55:59 +00:00
|
|
|
|
2008-08-14 02:10:34 +00:00
|
|
|
srcdir="`dirname "$0"`"
|
|
|
|
libdir=lib
|
|
|
|
|
2009-07-20 22:17:15 +00:00
|
|
|
#if [ "`uname -m`" = 'x86_64' ]; then
|
|
|
|
# libdir=lib64
|
|
|
|
#fi
|
2008-08-14 02:10:34 +00:00
|
|
|
|
2007-07-03 04:55:59 +00:00
|
|
|
for arg; do
|
|
|
|
case "$arg" in
|
|
|
|
--prefix=*)
|
|
|
|
value=`echo $arg | sed 's/--prefix=//'`
|
|
|
|
PREFIX=${value:-$prefix}
|
|
|
|
;;
|
|
|
|
|
|
|
|
--enable-opt)
|
|
|
|
OPT=yes;;
|
|
|
|
--disable-opt)
|
|
|
|
OPT=no;;
|
|
|
|
|
|
|
|
--enable-debug)
|
|
|
|
DBG=yes;;
|
|
|
|
--disable-debug)
|
|
|
|
DBG=no;;
|
|
|
|
|
|
|
|
--enable-x11)
|
|
|
|
X11=yes;;
|
|
|
|
--disable-x11)
|
|
|
|
X11=no;;
|
|
|
|
|
|
|
|
--help)
|
|
|
|
echo 'usage: ./configure [options]'
|
|
|
|
echo 'options:'
|
|
|
|
echo ' --prefix=<path>: installation path (default: /usr/local)'
|
|
|
|
echo ' --enable-x11: enable X11 communication mode (default)'
|
|
|
|
echo ' --disable-x11: disable X11 communication mode'
|
|
|
|
echo ' --enable-opt: enable speed optimizations (default)'
|
|
|
|
echo ' --disable-opt: disable speed optimizations'
|
|
|
|
echo ' --enable-debug: include debugging symbols (default)'
|
|
|
|
echo ' --disable-debug: do not include debugging symbols'
|
|
|
|
echo 'all invalid options are silently ignored'
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
echo " prefix: $PREFIX"
|
|
|
|
echo " optimize for speed: $OPT"
|
|
|
|
echo " include debugging symbols: $DBG"
|
|
|
|
echo " x11 communication method: $X11"
|
2011-11-26 02:36:43 +00:00
|
|
|
if [ -n "$CFLAGS" ]; then
|
|
|
|
echo " cflags: $CFLAGS"
|
|
|
|
fi
|
|
|
|
if [ -n "$LDFLAGS" ]; then
|
|
|
|
echo " ldflags: $LDFLAGS"
|
|
|
|
fi
|
2007-07-03 04:55:59 +00:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
if [ "$X11" = "no" ]; then
|
|
|
|
echo "WARNING: you have disabled the X11 interface, the resulting library won't be compatible with the proprietary 3Dconnexion daemon (3dxserv)!"
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
2008-08-14 02:10:34 +00:00
|
|
|
# create Makefile
|
|
|
|
echo 'creating Makefile ...'
|
2007-07-03 04:55:59 +00:00
|
|
|
echo "PREFIX = $PREFIX" >Makefile
|
2008-08-14 02:10:34 +00:00
|
|
|
echo "srcdir = $srcdir" >>Makefile
|
|
|
|
echo "libdir = $libdir" >>Makefile
|
2007-07-03 04:55:59 +00:00
|
|
|
|
2011-11-26 02:36:43 +00:00
|
|
|
if [ -n "$CFLAGS" ]; then
|
|
|
|
echo "user_cflags = $CFLAGS" >>Makefile
|
|
|
|
fi
|
|
|
|
if [ -n "$LDFLAGS" ]; then
|
|
|
|
echo "user_ldflags = $LDFLAGS" >>Makefile
|
|
|
|
fi
|
|
|
|
|
2007-07-03 04:55:59 +00:00
|
|
|
if [ "$DBG" = 'yes' ]; then
|
|
|
|
echo 'dbg = -g' >>Makefile
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$OPT" = 'yes' ]; then
|
|
|
|
echo 'opt = -O3' >>Makefile
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$X11" = 'yes' ]; then
|
2022-03-25 16:50:29 +00:00
|
|
|
echo 'magellan_obj = src/spnav_magellan.o' >>Makefile
|
2007-07-03 04:55:59 +00:00
|
|
|
echo 'xlib = -lX11' >>Makefile
|
|
|
|
fi
|
|
|
|
|
2008-08-14 02:10:34 +00:00
|
|
|
cat "$srcdir/Makefile.in" >>Makefile
|
2007-07-03 04:55:59 +00:00
|
|
|
|
|
|
|
# create spnav_config.h
|
|
|
|
echo 'creating spnav_config.h ...'
|
2022-03-25 16:50:29 +00:00
|
|
|
echo '#ifndef SPNAV_CONFIG_H_' >src/spnav_config.h
|
|
|
|
echo '#define SPNAV_CONFIG_H_' >>src/spnav_config.h
|
|
|
|
echo '' >>src/spnav_config.h
|
2007-07-03 04:55:59 +00:00
|
|
|
if [ "$X11" = 'yes' ]; then
|
2022-03-25 16:50:29 +00:00
|
|
|
echo '#define USE_X11' >>src/spnav_config.h
|
|
|
|
echo '' >>src/spnav_config.h
|
2007-07-03 04:55:59 +00:00
|
|
|
fi
|
2022-03-25 16:50:29 +00:00
|
|
|
echo '#endif /* SPNAV_CONFIG_H_ */' >>src/spnav_config.h
|
2007-07-03 04:55:59 +00:00
|
|
|
|
2022-03-16 04:19:39 +00:00
|
|
|
# create pkgconfig file
|
|
|
|
echo 'creating spnav.pc ...'
|
|
|
|
pcver=`echo $VER | sed 's/^v//'`
|
|
|
|
echo "PREFIX=$PREFIX" >spnav.pc
|
|
|
|
cat spnav.pc.in | sed "s/@VERSION@/$pcver/; s/@LIBDIR@/$libdir/" >>spnav.pc
|
|
|
|
|
2007-07-03 04:55:59 +00:00
|
|
|
#done
|
|
|
|
echo ''
|
|
|
|
echo 'Done. You can now type make (or gmake) to compile libspnav.'
|
|
|
|
echo ''
|