From 18ed4edee4d753bc8ea7d260669334d43ff9127d Mon Sep 17 00:00:00 2001 From: Korbinian Rosenegger Date: Thu, 13 Nov 2014 02:09:31 +0100 Subject: [PATCH] Find TCL with /usr/lib/tclConfig.sh if possible. This fixes the problem that configure doesn't find the tcl libs. --- configure | 33 +++++++++++++++++++++++++++++---- src/Makefile.in | 7 ++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/configure b/configure index bac5360..f9dd26f 100755 --- a/configure +++ b/configure @@ -716,13 +716,34 @@ has_tcl=no if [ ! "$ft_tcl" = no ]; then echo $ac_n "checking for tcl ... "$ac_c TESTC=config/tcl.c + tclconfig= + if [ -f /usr/lib/tclConfig.sh ]; then + tclconfig=tclconfig + . /usr/lib/tclConfig.sh + fi libtcl= - for tclver in empty 8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 + inctcl= + for tclver in $tclconfig empty 8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 do if [ -z "$libtcl" ]; then - test "$tclver" = "empty" && TCLLIB=-ltcl || TCLLIB=-ltcl$tclver - if $CC -o $TESTP $TESTC $TCLLIB 1> /dev/null 2> /dev/null; then + case "$tclver" in + "tclconfig") + TCLLIB=$TCL_LIB_FLAG + TCLINCLUDE=$TCL_INCLUDE_SPEC + tclver=$TCL_VERSION + ;; + "empty") + TCLLIB=-ltcl + TCLINCLUDE= + ;; + *) + TCLLIB=-ltcl$tclver + TCLINCLUDE= + ;; + esac + if $CC -o $TESTP $TESTC $TCLLIB $TCLINCLUDE 1> /dev/null 2> /dev/null; then libtcl=$TCLLIB + inctcl=$TCLINCLUDE has_tcl=$TCLLIB test "$tclver" = "empty" && echo $ac_t "yes" || echo $ac_t "yes (version $tclver)" fi @@ -1027,7 +1048,10 @@ else test -z "$ft_tcl" && read ans test "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_tcl='#define TCL' fi -test "$def_tcl" = '#undef TCL' && libtcl='' +if [ "$def_tcl" = '#undef TCL' ]; then + libtcl= + inctcl= +fi def_telnet='#undef TELNET' unset ans @@ -1080,6 +1104,7 @@ s%@gdbflag@%$cc_g_flag%; /@W_FLAGS@/ { s/@W_FLAGS@/$W_FLAGS/; }; /@O_FLAGS@/ { s/@O_FLAGS@/$O_FLAGS/; }; /@PYINCLUDE@/ { s,@PYINCLUDE@,$incpython,; }; +/@TCLINCLUDE@/ { s,@TCLINCLUDE@,$inctcl,; }; s|@MD5_O@|$MD5_O|; s%@oc@%$objcomment%; s%@sz@%$sizecomment%; diff --git a/src/Makefile.in b/src/Makefile.in index f93cb55..ef114c9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -30,6 +30,7 @@ GDBFLAG = @gdbflag@ WARNFLAG = @W_FLAGS@ OPTIMIZE = @O_FLAGS@ PYINCLUDE = @PYINCLUDE@ +TCLINCLUDE = @TCLINCLUDE@ CFLAGS = $(PIPEFLAG) $(GDBFLAG) $(WARNFLAG) $(OPTIMIZE) LFLAGS = $(PIPEFLAG) $(GDBFLAG) @@ -74,7 +75,7 @@ $(INSTALLNAME): $(OFILES) @sz@ size $(INSTALLNAME) mega: $(SRCFILES) $(INCS) usage.h - $(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) + $(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) @oc@ objcopy -R .note -R .comment $(INSTALLNAME) @sz@ size $(INSTALLNAME) @@ -88,7 +89,7 @@ $(INSTALLNAME)-static: $(OFILES) @sz@ size $(INSTALLNAME) mega-static: $(SRCFILES) $(INCS) usage.h - $(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) -static + $(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) -static @oc@ objcopy -R .note -R .comment $(INSTALLNAME) @sz@ size $(INSTALLNAME) @@ -193,7 +194,7 @@ stats.o: stats.c $(INCS) $(CC) $(CFLAGS) -c $< $(CPROF) tcl.o: tcl.c $(INCS) - $(CC) $(CFLAGS) -c $< $(CPROF) + $(CC) $(CFLAGS) -c $< $(CPROF) $(TCLINCLUDE) telnet.o: telnet.c $(INCS) $(CC) $(CFLAGS) -c $< $(CPROF)