📄 aclocal.m4
字号:
AC_DEFUN(CY_AC_PATH_TKH, [## Ok, lets find the tk source trees so we can use the headers# If the directory (presumably symlink) named "tk" exists, use that one# in preference to any others. Same logic is used when choosing library# and again with Tcl. The search order is the best place to look first, then in# decreasing significance. The loop breaks if the trigger file is found.# Note the gross little conversion here of srcdir by cd'ing to the found# directory. This converts the path from a relative to an absolute, so# recursive cache variables for the path will work right. We check all# the possible paths in one loop rather than many seperate loops to speed# things up.# the alternative search directory is invoked by --with-tkinclude#AC_MSG_CHECKING(for Tk private headers)AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where the tk private headers are], with_tkinclude=${withval})no_tk=trueAC_CACHE_VAL(ac_cv_c_tkh,[# first check to see if --with-tkinclude was specifiedif test x"${with_tkinclude}" != x ; then if test -f ${with_tkinclude}/tk.h ; then ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)` else AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers]) fifi# next check in private source directory## since ls returns lowest version numbers first, reverse the entire list# and search for the worst fit, overwriting it with better fits as we find themif test x"${ac_cv_c_tkh}" = x ; then for i in \ ${srcdir}/../tk \ `ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` \ ${srcdir}/../../tk \ `ls -dr ${srcdir}/../../tk[[0-9]]* 2>/dev/null` \ ${srcdir}/../../../tk \ `ls -dr ${srcdir}/../../../tk[[0-9]]* 2>/dev/null ` ; do if test -f $i/tk.h ; then ac_cv_c_tkh=`(cd $i; pwd)` break fi # Tk 4.1 and greater puts this in a subdir. if test -f $i/generic/tk.h; then ac_cv_c_tkh=`(cd $i; pwd)`/generic fi donefi# finally check in a few common install locations## since ls returns lowest version numbers first, reverse the entire list# and search for the worst fit, overwriting it with better fits as we find themif test x"${ac_cv_c_tkh}" = x ; then for i in \ `ls -dr /usr/local/src/tk[[0-9]]* 2>/dev/null` \ `ls -dr /usr/local/lib/tk[[0-9]]* 2>/dev/null` \ /usr/local/src/tk \ /usr/local/lib/tk \ ${prefix}/include ; do if test -f $i/tk.h ; then ac_cv_c_tkh=`(cd $i; pwd)` break fi donefi# see if one is installedif test x"${ac_cv_c_tkh}" = x ; then AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed)fi])if test x"${ac_cv_c_tkh}" != x ; then no_tk="" if test x"${ac_cv_c_tkh}" = x"installed" ; then AC_MSG_RESULT([is installed]) TKHDIR="" else AC_MSG_RESULT([found in $ac_cv_c_tkh]) # this hack is cause the TKHDIR won't print if there is a "-I" in it. TKHDIR="-I${ac_cv_c_tkh}" fielse TKHDIR="# no Tk directory found" AC_MSG_WARN([Can't find Tk private headers]) no_tk=truefi# if Tk is installed, extract the major/minor versionif test x"${no_tk}" = x ; thenAC_MSG_CHECKING([Tk version])orig_includes="$CPPFLAGS"if test x"${TCLHDIR}" != x ; then CPPFLAGS="$CPPFLAGS $TCLHDIR"fiif test x"${TKHDIR}" != x ; then CPPFLAGS="$CPPFLAGS $TKHDIR"fiif test x"${x_includes}" != x -a x"${x_includes}" != xNONE ; then CPPFLAGS="$CPPFLAGS -I$x_includes"fi# Get major and minor versions of Tk. Use funny names to avoid# clashes with eg SunOS.cat > conftest.c <<'EOF'#include "tk.h"MaJor = TK_MAJOR_VERSIONMiNor = TK_MINOR_VERSIONEOFtkmajor=tkminor=if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then # Success. tkmajor=`egrep '^MaJor = ' conftest.out | sed -e 's/^MaJor = *//' -e 's/ *$//'` tkminor=`egrep '^MiNor = ' conftest.out | sed -e 's/^MiNor = *//' -e 's/ *$//'`firm -f conftest.c conftest.outif test -z "$tkmajor" || test -z "$tkminor"; then AC_MSG_RESULT([fatal error: could not find major or minor version number of Tk]) exit 1fiAC_MSG_RESULT(${tkmajor}.${tkminor})CPPFLAGS="${orig_includes}"fiAC_PROVIDE([$0])AC_SUBST(TKHDIR)])AC_DEFUN(CY_AC_PATH_TKLIB, [AC_REQUIRE([CY_AC_PATH_TCL])## Ok, lets find the tk library# First, look for the latest private (uninstalled) copy# Notice that the destinations in backwards priority since the tests have# no break.# Then we look for either .a, .so, or Makefile. A Makefile is acceptable# is it indicates the target has been configured and will (probably)# soon be built. This allows an entire tree of Tcl software to be# configured at once and then built.# the alternative search directory is invoked by --with-tklib#if test x"${no_tk}" = x ; then # reset no_tk incase something fails here no_tk="true" if test $tkmajor -ge 4 ; then installedtklibroot=tk$tkversion else installedtkllibroot=tk fi AC_ARG_WITH(tklib, [ --with-tklib directory where the tk library is], with_tklib=${withval}) AC_MSG_CHECKING([for Tk library]) AC_CACHE_VAL(ac_cv_c_tklib,[ # first check to see if --with-tklib was specified # This requires checking for both the installed and uninstalled name-styles # since we have no idea if it's installed or not. if test x"${with_tklib}" != x ; then if test -f "${with_tklib}/lib$installedtklibroot.so" ; then ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.so no_tk="" elif test -f "${with_tklib}/libtk.so" ; then ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.so no_tk="" # then look for a freshly built statically linked library # if Makefile exists we assume its configured and libtk will be built elif test -f "${with_tklib}/lib$installedtklibroot.a" ; then ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.a no_tk="" elif test -f "${with_tklib}/libtk.a" ; then ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.a no_tk="" else AC_MSG_ERROR([${with_tklib} directory doesn't contain libraries]) fi fi # then check for a private Tk library # Since these are uninstalled, use the simple lib name root. if test x"${ac_cv_c_tklib}" = x ; then for i in \ ../tk \ `ls -dr ../tk[[0-9]]* 2>/dev/null` \ ../../tk \ `ls -dr ../../tk[[0-9]]* 2>/dev/null` \ ../../../tk \ `ls -dr ../../../tk[[0-9]]* 2>/dev/null` ; do # Tk 4.1 and greater puts things in subdirs. Check these first. if test -f "$i/unix/libtk.so" ; then ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so no_tk= break elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.a no_tk= break # look for a freshly built dynamically linked library elif test -f "$i/libtk.so" ; then ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so no_tk= break # then look for a freshly built statically linked library # if Makefile exists we assume its configured and libtk will be built elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a no_tk="" break fi done fi # finally check in a few common install locations if test x"${ac_cv_c_tklib}" = x ; then for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do # first look for a freshly built dynamically linked library if test -f "$i/lib$installedtklibroot.so" ; then ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.so no_tk="" break # then look for a freshly built statically linked library # if Makefile exists, we assume it's configured and libtcl will be built elif test -f "$i/lib$installedtklibroot.a" -o -f "$i/Makefile" ; then ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.a no_tk="" break fi done fi # check in a few other private locations if test x"${ac_cv_c_tklib}" = x ; then for i in \ ${srcdir}/../tk \ `ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` ; do # Tk 4.1 and greater puts things in subdirs. Check these first. if test -f "$i/unix/libtk.so" ; then ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so no_tk= break elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtk.a no_tk= break # look for a freshly built dynamically linked library elif test -f "$i/libtk.so" ; then ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so no_tk="" break # then look for a freshly built statically linked library # if Makefile exists, we assume it's configured and libtcl will be built elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a no_tk="" break fi done fi # see if one is conveniently installed with the compiler if test x"${ac_cv_c_tklib}" = x ; then AC_REQUIRE([AC_PATH_X]) orig_libs="$LIBS" LIBS="$LIBS -l$installedtklibroot $x_libraries $ac_cv_c_tcllib -lm" AC_TRY_RUN([ Tcl_AppInit() { exit(0); }], ac_cv_c_tklib="-l$installedtklibroot", ac_cv_c_tklib="" , ac_cv_c_tklib="-l$installedtklibroot") LIBS="${orig_libs}" fi ]) if test x"${ac_cv_c_tklib}" = x ; then TKLIB="# no Tk library found" AC_MSG_WARN(Can't find Tk library) else TKLIB=$ac_cv_c_tklib AC_MSG_RESULT(found $TKLIB) no_tk= fifiAC_PROVIDE([$0])AC_SUBST(TKLIB)])AC_DEFUN(CY_AC_PATH_TK, [ CY_AC_PATH_TKH CY_AC_PATH_TKLIB])AC_DEFUN(CY_AC_PATH_TCL, [ CY_AC_PATH_TCLH CY_AC_PATH_TCLLIB])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -