Added libspnav configure option and support to the Autotools build system

pull/3/head
Daniel Richard G 2013-11-13 16:04:47 -05:00
parent 4dffdb20e2
commit 174ed76ef9
2 changed files with 47 additions and 2 deletions

View File

@ -111,6 +111,51 @@ then
fi
fi
##
## Libspnav
##
AC_ARG_WITH([libspnav],
[AS_HELP_STRING([[--with-libspnav[=PRFX]]],
[Enable SpaceNavigator (3D mouse) support via libspnav driver installed in PRFX])])
case "$with_libspnav" in
no|'') want_libspnav=no ;;
yes) want_libspnav=yes ;;
*)
want_libspnav=yes
LIBSPNAV_CPPFLAGS="-I$with_libspnav/include"
LIBSPNAV_LDFLAGS="-L$with_libspnav/lib"
;;
esac
if test "$want_libspnav" = yes
then
save_CPPFLAGS="$CPPFLAGS"
save_LDFLAGS="$LDFLAGS"
save_LIBS="$LIBS"
CPPFLAGS="$LIBSPNAV_CPPFLAGS"
LDFLAGS="$LIBSPNAV_LDFLAGS"
LIBS="-lspnav"
AC_MSG_CHECKING([for libspnav])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <spnav.h>],
[if (spnav_open() < 0) return 1 /* ; */])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_LIBSPNAV], [1], [Define to 1 if you have the SpaceNav driver.])
LIBSPNAV_LIBS="$LDFLAGS $LIBS"],
[AC_MSG_ERROR([cannot find libspnav])])
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"
fi
AC_SUBST([LIBSPNAV_CPPFLAGS])
AC_SUBST([LIBSPNAV_LIBS])
##
## Wrap it up
##

View File

@ -1,6 +1,6 @@
## src/Makefile.am
AM_CPPFLAGS = $(FLTK_CXXFLAGS)
AM_CPPFLAGS = $(FLTK_CXXFLAGS) $(LIBSPNAV_CPPFLAGS)
if WIN32
AM_CPPFLAGS += \
@ -77,7 +77,7 @@ solvespace_SOURCES += \
fltk/fltkmain.cpp \
fltk/fltkutil.cpp
solvespace_LDADD = $(FLTK_LDSTATICFLAGS) -lGLU
solvespace_LDADD = $(FLTK_LDSTATICFLAGS) -lGLU $(LIBSPNAV_LIBS)
endif
if WIN32