@@ -4,10 +4,11 @@ dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL AC_GNU_SOURCE +AC_LANG(C) dnl Determine system information DC_CHK_OS_INFO dnl Determine if a shared or static build is requested @@ -33,14 +34,37 @@ if test "${TCC4TCL_TARGET}" = "shared"; then dnl Determine how to make shared objects DC_GET_SHOBJFLAGS dnl Only export symbols we wish to expose - DC_SETVERSIONSCRIPT([tcc4tcl.syms], [tcc4tcl.vers]) - DC_FIND_STRIP_AND_REMOVESYMS([tcc4tcl.syms]) - TARGET="tcc4tcl.${SHOBJEXT}" + + AC_CHECK_HEADERS(windows.h) + AC_CHECK_HEADERS(psapi.h,,, [ +#ifdef HAVE_WINDOWS_H +# include +#endif +]) + + AC_MSG_CHECKING([for EnumProcessModules in -lpsapi]) + SAVE_LIBS="$LIBS" + LIBS="-lpsapi $LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#ifdef HAVE_WINDOWS_H +# include +#endif +#ifdef HAVE_PSAPI_H +# include +#endif +], [ + EnumProcessModules(NULL, NULL, 0, NULL); +])], [ + AC_MSG_RESULT([found]) +], [ + AC_MSG_RESULT([not found]) + LIBS="$SAVE_LIBS" +]) else TARGET="tcc4tcl-static.a" fi AC_SUBST(TARGET) AC_SUBST(TCC4TCL_TARGET) @@ -54,8 +78,14 @@ dnl Look for appropriate headers AC_CHECK_HEADERS(unistd.h stdlib.h string.h strings.h dlfcn.h dl.h) dnl Perform Tcl Extension required stuff TCLEXT_INIT + +dnl This must be done last since it breaks the compilation +if test "${TCC4TCL_TARGET}" = "shared"; then + DC_SETVERSIONSCRIPT([tcc4tcl.syms], [tcc4tcl.vers]) + DC_FIND_STRIP_AND_REMOVESYMS([tcc4tcl.syms]) +fi dnl Produce output AC_OUTPUT(Makefile pkgIndex.tcl tcc4tcl.syms)