diff --git a/Makefile.in b/Makefile.in index 6ff2a06..76a121d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,7 +8,10 @@ CFLAGS = -pedantic -Wall $(dbg) $(opt) $(x11) LDFLAGS = $(xlib) -lm $(bin): $(obj) - $(CC) $(CFLAGS) -o $@ $(obj) $(LDFLAGS) + $(CC) -o $@ $(obj) $(LDFLAGS) + +%.o: $(srcdir)/%.c + $(CC) $(CFLAGS) -c $< -o $@ .PHONY: clean clean: @@ -18,11 +21,11 @@ clean: install: $(bin) $(INSTALL) -d $(PREFIX)/bin $(INSTALL) -m 755 $(bin) $(PREFIX)/bin/$(bin) - $(INSTALL) -m 755 $(ctl) $(PREFIX)/bin/$(ctl) - ./setup_init + $(INSTALL) -m 755 $(srcdir)/$(ctl) $(PREFIX)/bin/$(ctl) + cd $(srcdir) && ./setup_init --no-install .PHONY: uninstall uninstall: rm -f $(PREFIX)/bin/$(bin) rm -f $(PREFIX)/bin/$(ctl) - ./setup_init remove +# cd $(srcdir) && ./setup_init remove diff --git a/configure b/configure index e8cd18e..c0e3a7e 100755 --- a/configure +++ b/configure @@ -7,6 +7,8 @@ OPT=yes DBG=yes X11=yes +srcdir="`dirname "$0"`" + for arg; do case "$arg" in --prefix=*) @@ -58,9 +60,10 @@ daemon (3dxserv)!" echo fi -# create makefile -echo 'creating makefile ...' +# create Makefile +echo 'creating Makefile ...' echo "PREFIX = $PREFIX" >Makefile +echo "srcdir = $srcdir" >>Makefile if [ "$DBG" = 'yes' ]; then echo 'dbg = -g' >>Makefile @@ -75,7 +78,7 @@ if [ "$X11" = 'yes' ]; then echo 'xlib = -lX11' >>Makefile fi -cat Makefile.in >>Makefile +cat "$srcdir/Makefile.in" >>Makefile echo '' echo 'Done. You can now type make (or gmake) to compile spacenavd.' diff --git a/setup_init b/setup_init index b38b295..1ec596b 100755 --- a/setup_init +++ b/setup_init @@ -26,6 +26,18 @@ setup_bsd_init() { echo "BSD init setup not implemented yet, you'll have to do it manually." } + +if [ "$1" = '--no-install' ]; then + echo + echo --- Spacenavd installation complete --- + echo To have spacenavd start automatically at bootup, you must add an appropriate + echo "init script. Refer to your system's manual for details on how to do that." + echo An example init script is available in the spacenavd source directory. + echo If you wish to attempt and install an init script automatically, run ./setup_init + echo + exit 0 +fi + (stat /etc/init.d && stat /etc/rc0.d) >/dev/null 2>/dev/null if [ $? = 0 ]; then setup_sysv_init @@ -33,7 +45,7 @@ if [ $? = 0 ]; then fi (stat /etc/rc && stat /etc/rc.d) >/dev/null 2>/dev/null -if [ $? = 0]; then +if [ $? = 0 ]; then setup_bsd_init exit 0 fi diff --git a/spnavd.c b/spnavd.c index c49f452..71843a9 100644 --- a/spnavd.c +++ b/spnavd.c @@ -688,6 +688,10 @@ void close_x11(void) if(!dpy) return; + if(verbose) { + printf("closing X11 connection to display \"%s\"\n", getenv("DISPLAY")); + } + /* first delete all the CommandEvent properties from all root windows */ scr_count = ScreenCount(dpy); for(i=0; i/dev/null 2>/dev/null @@ -23,7 +23,7 @@ if [ $2 = 'start' ]; then fi sig=-usr1 -elif [ $2 = "stop" ]; then +elif [ "$2" = "stop" ]; then sig=-usr2 else @@ -46,7 +46,7 @@ if [ $? = 0 ]; then if [ $sig = '-usr1' ]; then echo 'signalled spacenavd, it should now start sending X events.' else - echo 'signalled spacenavd, stopped sending X events.' + echo 'signalled spacenavd to stop sending X events.' fi else echo 'sending signal to spacenavd failed.'