I can configure, compile and run this tclfftw package (https://gitlab.com/teclabtcltk/tclfftw) unless I enable TCL stubs.
Environment: Windows msys2 mingw64 Tcl86
As a workaround I had to do some nasty things:
configure.ac
if test "${TEA_PLATFORM}" = "windows" ; then
# Use full Tcl DLL instead of stub library
TCL_LIB_FILE="libtcl86.dll.a"
TCL_LIB_PATH="${TCL_BIN_DIR}/${TCL_LIB_FILE}"
SHLIB_LD_LIBS="\${LIBS} \"`\${CYGPATH} \${TCL_LIB_PATH}`\" -static-libgcc"
# Remove -static flag from LDFLAGS (keep -static-libgcc -static-libstdc++)
LDFLAGS=`echo "$LDFLAGS" | sed 's/ -static$//'`
fi
Makefile.in
# Original DEFS from configure with stubs
DEFS_WITH_STUBS = @DEFS@ $(PKG_CFLAGS)
# Remove stubs defines for direct Tcl linking
DEFS = $(filter-out -DUSE_TCL_STUBS=1 -DUSE_TCLOO_STUBS=1,$(DEFS_WITH_STUBS))
For simplicity I added the fftw3 library and header into a subfolder, so one can run:
autoconf
./configure --with-fftw3=./fftw
make
make install
All this works fine, and the tests also pass. However, as I already mentioned, when I use stubs, it fails with library initialisation failed.
I have some C code that works fine with stubs, but this C++ code does not. Perhaps someone has the patience to look into this and support me on this matter.
BR
The answer from Donal is fully correct, but I had all those changes and it still was failing.
What finally was missing, was the config.h.in file (See https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/autoheader-Invocation.html)
The configure.ac has this lines inside:
AC_CONFIG_HEADERS([config.h])
So the config.h gets generatated with the configure command.
The .cpp file must include the config.h file, like:
...
#include "tcl.h"
#include "../config.h"
...
An then the build succeeded.
PS: Since I am not a C/CPP developer this whole build system is very hard to grasp for me. But today I learned a lot!