diff --git a/bindings/Makefile.am b/bindings/Makefile.am index 8e669c231..08a853a06 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -12,6 +12,9 @@ SWGDEP=$(top_srcdir)/include/hamlib/rig.h $(top_srcdir)/include/hamlib/riglist.h $(top_srcdir)/include/hamlib/rotator.h $(top_srcdir)/include/hamlib/rotlist.h \ $(SWGFILES) +BUILT_SOURCES= +MOSTLYCLEANFILES= + AM_CFLAGS = -fno-strict-aliasing ########################################## # Perl binding @@ -57,9 +60,13 @@ uninstall-perl: ## Hamlib-pl.mk ## $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk uninstall +if ENABLE_TCL ########################################## # Tcl binding +BUILT_SOURCES+= hamlibtcl_wrap.c +MOSTLYCLEANFILES+= hamlibtcl_wrap.c pkgIndex.tcl + tcl_ltlib = hamlibtcl.la tcldir = $(prefix)/lib/tcl @@ -91,6 +98,8 @@ clean-tcl: distclean-tcl: clean-tcl uninstall-tcl: +endif + ########################################## # Python binding @@ -139,13 +148,12 @@ uninstall-local: @BINDING_UNINSTALL@ EXTRA_DIST = $(SWGFILES) \ Makefile.PL perltest.pl tcltest.tcl pytest.py -BUILT_SOURCES = hamlibperl_wrap.c hamlibtcl_wrap.c hamlibpy_wrap.c Hamlib.py +BUILT_SOURCES += hamlibperl_wrap.c hamlibpy_wrap.c Hamlib.py ## DISTCLEANFILES = Hamlib-pl.mk Hamlib-pl.mk.old DISTCLEANFILES = Hamlib-pl.mk.old -MOSTLYCLEANFILES = hamlibperl_wrap.c Hamlib.pm Hamlib.bs \ - hamlibtcl_wrap.c pkgIndex.tcl \ +MOSTLYCLEANFILES+= hamlibperl_wrap.c Hamlib.pm Hamlib.bs \ hamlibpy_wrap.c Hamlib.py *.pyc noinst_SCRIPTS = perltest.pl tcltest.tcl pytest.py hamlibvb.bas diff --git a/configure.ac b/configure.ac index 89c10fa39..08fa903df 100644 --- a/configure.ac +++ b/configure.ac @@ -301,27 +301,24 @@ fi dnl Kylix binding has been removed because unmaintained. Volunteers welcome. -dnl Check for tcl-dev availability, so we can enable HamlibTCL - +# Tcl bindings +AC_MSG_CHECKING([Whether to build Tcl bindings and demos]) +AC_ARG_ENABLE([tcl-binding], + [AS_HELP_STRING([--enable-tcl-binding], + [Build Tcl binding and demo (default: no)])], + [build_tcl=$enableval], + [build_tcl=no]) +AC_MSG_RESULT($build_tcl) SC_PATH_TCLCONFIG -if test x"${no_tcl}" = x; then +if test x"${build_tcl}" = "xyes"; then SC_LOAD_TCLCONFIG tcl_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" AC_CHECK_HEADERS([tcl.h], - [cf_with_tcl=yes]) + [], + [AC_MSG_ERROR([Unable to find Tcl headers])]) CPPFLAGS=$tcl_save_CPPFLAGS -else - cf_with_tcl=no -fi -AC_MSG_CHECKING(whether to build tcl binding and demo) -AC_ARG_WITH(tcl-binding, - [ --with-tcl-binding build tcl binding and demo], - [cf_with_tcl_binding=$withval], - [cf_with_tcl_binding=$cf_with_tcl]) -AC_MSG_RESULT($cf_with_tcl_binding) -if test "${cf_with_tcl_binding}" = "yes" ; then BINDING_LIST="${BINDING_LIST} tcl" BINDING_ALL="${BINDING_ALL} all-tcl" BINDING_CHECK="${BINDING_CHECK} check-tcl" @@ -331,6 +328,7 @@ if test "${cf_with_tcl_binding}" = "yes" ; then BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl" BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)" fi +AM_CONDITIONAL(ENABLE_TCL, test x"${build_tcl}" = "xyes") AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_SHLIB_SUFFIX) diff --git a/macros/tcl.m4 b/macros/tcl.m4 index e5450cf17..feed05ce3 100644 --- a/macros/tcl.m4 +++ b/macros/tcl.m4 @@ -27,7 +27,7 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true - AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) + AC_ARG_WITH(tcl, [ --with-tcl=PATH directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[