diff --git a/Makefile.am b/Makefile.am index 647b571cf..2230e628f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,8 @@ AM_CPPFLAGS = $(HOST_CPPFLAGS)\ if INTERNAL_JIMTCL AM_CPPFLAGS += -I$(top_srcdir)/jimtcl \ -I$(top_builddir)/jimtcl +else +AM_CPPFLAGS += $(JIMTCL_CFLAGS) endif EXTRA_DIST += \ BUGS \ diff --git a/configure.ac b/configure.ac index becc531b0..b7aed245e 100644 --- a/configure.ac +++ b/configure.ac @@ -594,6 +594,15 @@ AS_IF([test "x$use_internal_jimtcl" = "xyes"], [ ], [ AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.]) ]) +], [ + PKG_CHECK_MODULES([JIMTCL], [jimtcl >= 0.79], [ + have_jimtcl_pkg_config=yes + ], [ + have_jimtcl_pkg_config=no + AC_CHECK_HEADER([jim.h], [], [ + AC_MSG_ERROR([jimtcl is required but not found via pkg-config and system includes]) + ]) + ]) ]) AS_IF([test "x$build_remote_bitbang" = "xyes"], [ @@ -781,6 +790,7 @@ AM_CONDITIONAL([DMEM], [test "x$build_dmem" = "xyes"]) AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"]) AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"]) +AM_CONDITIONAL([HAVE_JIMTCL_PKG_CONFIG], [test "x$have_jimtcl_pkg_config" = "xyes"]) AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"]) # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h? diff --git a/src/Makefile.am b/src/Makefile.am index 6d79cd631..4d1c1a250 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,8 +17,12 @@ bin_PROGRAMS += %D%/openocd if INTERNAL_JIMTCL %C%_openocd_LDADD += $(top_builddir)/jimtcl/libjim.a else +if HAVE_JIMTCL_PKG_CONFIG +%C%_openocd_LDADD += $(JIMTCL_LIBS) +else %C%_openocd_LDADD += -ljim endif +endif %C%_libopenocd_la_CPPFLAGS =