Ticket #175: RAT_tcl_m4.patch

File RAT_tcl_m4.patch, 11.2 KB (added by douglask, 6 years ago)

patch to add tcl.m4 support to RAT

  • configure.in

     
    242242AC_SUBST(AUD_INC) 
    243243AC_SUBST(AUD_LIB) 
    244244 
    245 # X  
    246 #------------------------------------------------------------------------------ 
    247 # Use autoconf inbuilt X location.  Works v. nicely.  Substitution of X vars 
    248 # comes after broken X11 header check and attempted fix. 
    249 #------------------------------------------------------------------------------ 
    250 AC_PATH_XTRA 
    251  
    252 #------------------------------------------------------------------------------ 
    253 # Check if X headers are broken.  GCC 2.95 and up reject headers that don't 
    254 # have omit types, X11 headers have implicit int declarations on some systems 
    255 # (e.g. Solaris). 
    256 #------------------------------------------------------------------------------ 
    257 AC_CACHE_CHECK(whether X11 headers are broken, x11_cv_broken_headers, [ 
    258         SAVED_CFLAGS=$CFLAGS 
    259         CFLAGS="$X_CFLAGS $CFLAGS" 
    260         AC_TRY_COMPILE([#include <X11/Xlib.h> 
    261         #include <X11/Xutil.h>], 
    262         return 0, 
    263         x11_cv_broken_headers=no, 
    264         x11_cv_broken_headers=yes) 
    265         CFLAGS=$SAVED_CFLAGS 
    266 ]); 
    267  
    268 #------------------------------------------------------------------------------ 
    269 # If X headers look broken, check if we can use -istdinc.  If so replace  
    270 # -IXDIR with -istdincXDIR to suppress warnings.  NB it is possible to use 
    271 # -fpermissive, but not in conjunction with -Werror since warnings are still 
    272 # generated.  Could pull local headers through: 
    273 #                        's/^\(extern\) \([[A-Za-z0-9]]*($\)/\1 int \2/'  
    274 #------------------------------------------------------------------------------ 
    275 if test $x11_cv_broken_headers = yes -a $GCC = "yes" ; then 
    276         SAVED_X_CFLAGS=$X_CFLAGS 
    277         X_CFLAGS=`echo $X_CFLAGS | sed 's%-I%-istdinc%'` 
    278         AC_CACHE_CHECK(whether -istdinc fixes X11 headers, x11_cv_gcc_istdinc_works, [ 
    279                 SAVED_CFLAGS=$CFLAGS 
    280                 CFLAGS="$X_CFLAGS $CFLAGS" 
    281                 AC_TRY_COMPILE([#include <X11/Xlib.h> 
    282                 #include <X11/Xutil.h>], 
    283                 return 0, 
    284                 x11_cv_gcc_istdinc_works=yes, 
    285                 x11_cv_gcc_istdinc_works=no) 
    286                 CFLAGS=$SAVED_CFLAGS 
    287         ]) 
    288         if test $x11_cv_gcc_istdinc_works = no ; then 
    289                 X_CFLAGS=$SAVED_X_CFLAGS 
    290         fi 
    291 fi 
    292  
    293 AC_SUBST(X_CFLAGS) 
    294 AC_SUBST(X_LIBS) 
    295 AC_SUBST(X_EXTRA_LIBS) 
    296 AC_SUBST(X_PRE_LIBS) 
    297  
    298245# TCL/TK  
    299246#------------------------------------------------------------------------------ 
    300247# We could be dealing with a source installation or a full installation. 
    301 # Expect a source installation to have headers in TCL8_HOME/generic and libs in 
    302 # TCL8_HOME/unix.  A full installation should have headers in  
    303 # INSTDIR/include/tcl8.0, or INSTDIR/include, and have libraries be in  
    304 # INSTDIR/lib. 
    305248#------------------------------------------------------------------------------ 
    306249 
    307 TCLTK_VERSION="8.0" 
    308 AC_ARG_WITH(tcltk-version, 
    309         [  --with-tcltk-version=M.m specify preferred Tcl/Tk version], 
    310         [ 
    311                 if test X${TCL_INC} != "X"  
    312                 then  
    313                         echo "--with-tcltk-version needs settings before --with-tcl" 
    314                         exit 
    315                 fi 
    316                 if test X${TK_INC} != "X"  
    317                 then  
    318                         echo "--with-tcltk-version needs settings before --with-tk" 
    319                         exit 
    320                 fi 
    321                 TCLTK_VERSION=$withval 
    322         ]) 
    323 TCLTK_VERSION_ALT=`echo ${TCLTK_VERSION} | sed 'sX\.XX'` 
     250SC_PATH_TCLCONFIG 
     251SC_LOAD_TCLCONFIG 
    324252 
    325 # Default UCL is ../{tcl,tk}-8.0 
    326 PARENT=`echo $PWD | sed -e 's%/[[^/]]*$%%'` 
    327 TCL_INC=${PARENT}/tcl-${TCLTK_VERSION} 
    328 TCL_LIB=${PARENT}/tcl-${TCLTK_VERSION} 
     253AC_MSG_CHECKING([for a compatible version of Tcl]) 
     254if test "${TCL_MAJOR_VERSION}" -gt 8  \ 
     255  -o \( "${TCL_MAJOR_VERSION}" -eq 8 -a "${TCL_MINOR_VERSION}" -ge 4 \); then 
     256    AC_MSG_RESULT([Tcl ${TCL_VERSION}${TCL_PATCH_LEVEL}]) 
    329257 
    330 AC_ARG_WITH(tcl,            
    331         [  --with-tcl=DIR          specify location of Tcl installation], 
    332         [TCL_INC=$withval 
    333          TCL_LIB=$withval]) 
    334 AC_ARG_WITH(tcllib,            
    335         [  --with-tcllib=DIR       specify location of Tcl library installation], 
    336         [TCL_LIB=$withval]) 
    337 AC_ARG_WITH(tclinc,            
    338         [  --with-tclinc=DIR       specify location of Tcl include installation], 
    339         [TCL_INC=$withval]) 
     258elif test "${TCL_VERSION}" == "8.0" ; then 
     259    if test -f "${TCL_SRC_DIR}/generic/tcl2c.c" ; then 
     260        AC_MSG_RESULT([UCL Tcl ${TCL_VERSION}${TCL_PATCH_LEVEL}]) 
     261    else 
     262        AC_MSG_ERROR([Found Tcl 8.0 which is not UCL Tcl 8.0]) 
     263    fi 
    340264 
    341 #----------------------------------------------------------------------------- 
    342 # Depending on config expect tcl.h to be tcl source dir or include path 
    343 #----------------------------------------------------------------------------- 
    344 for i in $TCL_INC/generic $TCL_INC/include/tcl${TCLTK_VERSION} $TCL_INC/include $TCL_INC /Library/Frameworks/Tcl.framework/Headers /Library/Frameworks/Tcl.framework/PrivateHeaders /System/Library/Frameworks/Tcl.framework/Headers  
    345 do 
    346         if test -d $i ; then 
    347                 TCL_INC=$i 
    348                 break 
    349         fi 
    350 done 
     265else 
     266    AC_MSG_ERROR([Tcl $TCL_VERSION, compatible Tcl for RAT not found 
     267Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl.]) 
     268fi 
    351269 
    352 AC_CHECK_HEADER(${TCL_INC}/tcl.h, 
    353         TCL_INC=-I${TCL_INC}, 
    354         TCL_INC=no) 
     270SC_PATH_TKCONFIG 
     271SC_LOAD_TKCONFIG 
    355272 
    356 if test "$TCL_INC" = no  
    357 then 
    358         echo "Could not find tcl.h.  One of the following halted progress:" 
    359         echo "   (a) Tcl is not installed." 
    360         echo "   (b) Tcl's location was mis-specified, or not specified (--with-tcl=DIR)." 
    361         echo "   (c) this script failed to see it (please inform rat-trap@cs.ucl.ac.uk)." 
    362         exit 
     273AC_MSG_CHECKING([for a compatible version of Tk]) 
     274if test "${TCL_VERSION}" == "${TK_VERSION}"; then 
     275    AC_MSG_RESULT([Tk ${TK_VERSION}${TK_PATCH_LEVEL}]) 
     276 
     277else 
     278    AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. 
     279${TK_BIN_DIR}/tkConfig.sh is for Tk ${TK_VERSION}. 
     280Tk ${TK_VERSION} needs Tcl ${TK_VERSION} 
     281Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl. 
     282Use --with-tk= option to indicate location of tkConfig.sh file for Tk.]) 
    363283fi 
    364284 
    365 #----------------------------------------------------------------------------- 
    366 # Guess most probable tcl lib location 
    367 #----------------------------------------------------------------------------- 
     285if test -f "${TCL_BIN_DIR}/Makefile" ; then 
     286    # dealing with a Tcl source installation 
     287    TCL_INC="-I${TCL_SRC_DIR}/generic" 
     288    TCL_LIB="-L${TCL_SRC_DIR}/unix ${TCL_LIB_FLAG}" 
    368289 
    369 for i in $TCL_LIB/unix $TCL_LIB/lib64 $TCL_LIB/lib $TCL_LIB  
    370 do 
    371         if test -d $i ; then 
    372                 TCL_LIB=$i 
    373                 break 
    374         fi 
    375 done 
     290else 
     291    # dealing with a Tcl full installation 
    376292 
    377 SAVED_LIBS=$LIBS 
    378 LIBS="" 
    379 FOUND_TCL_LIB=no 
    380 AC_SEARCH_LIBS(Tcl_Init, tcl${TCLTK_VERSION} tcl${TCLTK_VERSION_ALT},  
    381         FOUND_TCL_LIB=yes, 
    382         ,  
    383         -L${TCL_LIB} ${SAVED_LIBS} -lpthread -lm) 
    384 TCL_LIB="-L${TCL_LIB} $LIBS" 
    385 LIBS=$SAVED_LIBS 
     293    if test -d "${TK_BIN_DIR}/Headers" ; then 
     294        # Darwin / MacOS X 
     295        TCL_INC=-I${TCL_BIN_DIR}/Headers 
    386296 
    387 if test $FOUND_TCL_LIB = no 
    388 then 
    389   if test "$OSTYPE" = Darwin 
    390   then 
    391     TCL_LIB="-framework Tcl -framework Carbon" 
    392     echo "Using Aqua Tcl" 
    393   else   
    394         echo "Could not find Tcl library.  One of the following halted progess:" 
    395         echo "   (a) Tcl is not installed." 
    396         echo "   (b) Library is not built or not in expected location (--with-tcl=DIR)." 
    397         echo "   (c) this script failed to see it (please inform rat-trap@cs.ucl.ac.uk)." 
    398         exit 
    399   fi 
     297    else 
     298        TCL_INC=$TCL_INCLUDE_SPEC 
     299    fi 
     300 
     301    TCL_LIB=$TCL_LIB_SPEC 
    400302fi 
    401303 
    402 TK_INC=${PARENT}/tk-${TCLTK_VERSION} 
    403 TK_LIB=${PARENT}/tk-${TCLTK_VERSION} 
     304if test -f "${TK_BIN_DIR}/Makefile" ; then 
     305    # dealing with a Tk source installation 
     306    TK_INC="-I${TK_SRC_DIR}/generic" 
     307    TK_LIB="-L${TK_SRC_DIR}/unix ${TK_LIB_FLAG}" 
    404308 
    405 AC_ARG_WITH(tk,            
    406         [  --with-tk=DIR           specify location of Tk installation], 
    407         [TK_INC=$withval 
    408          TK_LIB=$withval]) 
    409 AC_ARG_WITH(tklib,            
    410         [  --with-tklib=DIR        specify location of Tk library installation], 
    411         [TK_LIB=$withval]) 
    412 AC_ARG_WITH(tkinc,            
    413         [  --with-tkinc=DIR        specify location of Tk include installation], 
    414         [TK_INC=$withval]) 
    415 #----------------------------------------------------------------------------- 
    416 # Depending on config expect tk.h to be tk source dir or include path 
    417 # AC_CHECK_HEADER(S) are totally inadequate since it is necessary to 
    418 # include tcl.h, Xlib.h, Xutil.h before tk.h. 
    419 #----------------------------------------------------------------------------- 
    420 FOUND_TK_INC=0 
    421 for i in $TK_INC/generic $TK_INC/include/tk${TCLTK_VERSION} $TK_INC/include $TK_INC /Library/Frameworks/Tk.framework/Headers /Library/Frameworks/Tk.framework/PrivateHeaders /System/Library/Frameworks/Tk.framework/Headers 
    422 do 
    423         AC_MSG_CHECKING(for $i/tk.h) 
    424         if test -r $i/tk.h ; then 
    425                 TK_INC=-I$i 
    426                 FOUND_TK_INC=1 
    427                 AC_MSG_RESULT(yes) 
    428                 break 
    429         fi 
    430         AC_MSG_RESULT(no) 
    431 done 
     309else 
     310    # dealing with a Tk full installation 
    432311 
    433 if test $FOUND_TK_INC = 0 ; then 
    434         echo "Could not find tk.h.  One of the following halted progress:" 
    435         echo "   (a) Tk is not installed." 
    436         echo "   (b) Tk's location was mis-specified, or not specified (--with-tk=DIR)." 
    437         echo "   (c) this script failed to see it (please inform rat-trap@cs.ucl.ac.uk)." 
    438         exit 
    439 fi 
     312    if test -d "${TK_BIN_DIR}/Headers" ; then 
     313        # Darwin / MacOS X 
     314        TK_INC=-I${TK_BIN_DIR}/Headers 
    440315 
    441 # Guess most probable tk lib location 
    442 for i in $TK_LIB/unix $TK_LIB/lib64 $TK_LIB/lib $TK_LIB 
    443 do 
    444         if test -d $i ; then 
    445                 TK_LIB=$i 
    446                 break 
    447         fi 
    448 done 
     316    else 
     317        TK_INC=$TK_INCLUDE_SPEC 
     318    fi 
    449319 
    450 SAVED_LIBS=$LIBS 
    451 LIBS="" 
    452 FOUND_TK_LIB=no 
    453 AC_SEARCH_LIBS(Tk_Init, tk${TCLTK_VERSION} tk${TCLTK_VERSION_ALT}, 
    454         FOUND_TK_LIB=yes, 
    455         , 
    456         -L${TK_LIB} ${TCL_LIB} $X_LIBS $X_PRE_LIBS  -lXext -lX11 $X_EXTRA_LIBS ${SAVED_LIBS} -lpthread -lm) 
    457 TK_LIB="-L${TK_LIB} $LIBS" 
    458 LIBS=$SAVED_LIBS 
    459  
    460 if test $FOUND_TK_LIB = no 
    461 then 
    462   if test "$OSTYPE" = Darwin 
    463   then 
    464     TK_LIB="-framework Tk" 
    465     echo "Using Aqua Tk" 
    466   else   
    467         echo "Could not find Tk library.  One of the following halted progess:" 
    468         echo "   (a) Tk is not installed." 
    469         echo "   (b) Library is not built or not in expected location (--with-tk=DIR)." 
    470         echo "   (c) this script failed to see it (please inform rat-trap@cs.ucl.ac.uk)." 
    471         exit 
    472   fi 
     320    TK_LIB=$TK_LIB_SPEC 
    473321fi 
    474322 
    475323AC_SUBST(TCL_INC) 
     
    477325AC_SUBST(TK_INC) 
    478326AC_SUBST(TK_LIB) 
    479327 
     328AC_SUBST(TK_XINCLUDES) 
     329AC_SUBST(TK_XLIBSW) 
     330 
    480331############################################################################### 
    481332# IPv6 related configuration options (needs to go before common to guarantee 
    482333# linkage). 
     
    495346#----------------------------------------------------------------------------- 
    496347# Check for UCL Multimedia Base (formerly common) library 
    497348#----------------------------------------------------------------------------- 
     349PARENT=`echo $PWD | sed -e 's%/[[^/]]*$%%'` 
    498350DEFAULT_COMMON_INC=${PARENT}/common/src 
    499351DEFAULT_COMMON_LIB=${PARENT}/common/src 
    500352 
  • Makefile.in

     
    2525 
    2626TCL_LIB    = @TCL_LIB@ 
    2727TK_LIB     = @TK_LIB@ 
    28 X_CFLAGS   = @X_CFLAGS@  
    29 X_LIB      = @X_PRE_LIBS@ @X_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@    
     28X_CFLAGS   = @TK_XINCLUDES@  
     29X_LIB      = @TK_XLIBSW@    
    3030COMMON_LIB = @COMMON_LIB@ 
    3131EXTRA_OBJ  = @EXTRA_OBJ@ 
    3232EXTERNAL_DEP = @EXTERNAL_DEP@ 
     
    3838 
    3939prefix      = @prefix@ 
    4040exec_prefix = @exec_prefix@ 
     41datarootdir = @datarootdir@ 
    4142bindir      = @bindir@ 
    4243mandir      = @mandir@ 
    4344sysconfdir  = @sysconfdir@