2010-09-21 00:08:53 +04:00
|
|
|
# config/tcl.m4
|
2000-09-26 02:23:01 +04:00
|
|
|
|
|
|
|
# Autoconf macros to check for Tcl related things
|
|
|
|
|
|
|
|
|
|
|
|
AC_DEFUN([PGAC_PATH_TCLSH],
|
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 18:40:00 +03:00
|
|
|
[PGAC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84])
|
2019-01-18 10:29:42 +03:00
|
|
|
AC_ARG_VAR(TCLSH, [Tcl interpreter program (tclsh)])dnl
|
2008-07-23 21:07:50 +04:00
|
|
|
if test x"$TCLSH" = x""; then
|
|
|
|
AC_MSG_ERROR([Tcl shell not found])
|
|
|
|
fi
|
|
|
|
])
|
2000-09-26 02:23:01 +04:00
|
|
|
|
|
|
|
|
|
|
|
# PGAC_PATH_TCLCONFIGSH([SEARCH-PATH])
|
|
|
|
# ------------------------------------
|
2018-09-25 20:23:29 +03:00
|
|
|
# If the user doesn't specify $TCL_CONFIG_SH directly, search for it in
|
|
|
|
# the list of directories passed as parameter (from --with-tclconfig).
|
|
|
|
# If no list is given, try the Tcl shell's $auto_path.
|
|
|
|
|
2000-09-26 02:23:01 +04:00
|
|
|
AC_DEFUN([PGAC_PATH_TCLCONFIGSH],
|
|
|
|
[AC_REQUIRE([PGAC_PATH_TCLSH])[]dnl
|
|
|
|
AC_BEFORE([$0], [PGAC_PATH_TKCONFIGSH])[]dnl
|
|
|
|
AC_MSG_CHECKING([for tclConfig.sh])
|
|
|
|
# Let user override test
|
|
|
|
if test -z "$TCL_CONFIG_SH"; then
|
|
|
|
pgac_test_dirs="$1"
|
|
|
|
|
|
|
|
set X $pgac_test_dirs; shift
|
|
|
|
if test $[#] -eq 0; then
|
|
|
|
test -z "$TCLSH" && AC_MSG_ERROR([unable to locate tclConfig.sh because no Tcl shell was found])
|
2018-09-25 20:23:29 +03:00
|
|
|
pgac_test_dirs=`echo 'puts $auto_path' | $TCLSH`
|
|
|
|
# On newer macOS, $auto_path frequently doesn't include the place
|
|
|
|
# where tclConfig.sh actually lives. Append that to the end, so as not
|
|
|
|
# to break cases where a non-default Tcl installation is being used.
|
|
|
|
if test -d "$PG_SYSROOT/System/Library/Frameworks/Tcl.framework" ; then
|
|
|
|
pgac_test_dirs="$pgac_test_dirs $PG_SYSROOT/System/Library/Frameworks/Tcl.framework"
|
|
|
|
fi
|
|
|
|
set X $pgac_test_dirs; shift
|
2000-09-26 02:23:01 +04:00
|
|
|
fi
|
|
|
|
|
2000-09-30 14:45:17 +04:00
|
|
|
for pgac_dir do
|
2000-09-26 02:23:01 +04:00
|
|
|
if test -r "$pgac_dir/tclConfig.sh"; then
|
|
|
|
TCL_CONFIG_SH=$pgac_dir/tclConfig.sh
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$TCL_CONFIG_SH"; then
|
|
|
|
AC_MSG_RESULT(no)
|
2002-03-29 20:32:55 +03:00
|
|
|
AC_MSG_ERROR([file 'tclConfig.sh' is required for Tcl])
|
2000-09-26 02:23:01 +04:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$TCL_CONFIG_SH])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST([TCL_CONFIG_SH])
|
|
|
|
])# PGAC_PATH_TCLCONFIGSH
|
|
|
|
|
|
|
|
|
|
|
|
# PGAC_PATH_TKCONFIGSH([SEARCH-PATH])
|
|
|
|
# ------------------------------------
|
|
|
|
AC_DEFUN([PGAC_PATH_TKCONFIGSH],
|
|
|
|
[AC_REQUIRE([PGAC_PATH_TCLSH])[]dnl
|
|
|
|
AC_MSG_CHECKING([for tkConfig.sh])
|
|
|
|
# Let user override test
|
|
|
|
if test -z "$TK_CONFIG_SH"; then
|
|
|
|
pgac_test_dirs="$1"
|
|
|
|
|
|
|
|
set X $pgac_test_dirs; shift
|
|
|
|
if test $[#] -eq 0; then
|
|
|
|
test -z "$TCLSH" && AC_MSG_ERROR([unable to locate tkConfig.sh because no Tcl shell was found])
|
|
|
|
set X `echo 'puts $auto_path' | $TCLSH`; shift
|
|
|
|
fi
|
|
|
|
|
2000-09-30 14:45:17 +04:00
|
|
|
for pgac_dir do
|
2000-09-26 02:23:01 +04:00
|
|
|
if test -r "$pgac_dir/tkConfig.sh"; then
|
|
|
|
TK_CONFIG_SH=$pgac_dir/tkConfig.sh
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$TK_CONFIG_SH"; then
|
|
|
|
AC_MSG_RESULT(no)
|
2002-03-29 20:32:55 +03:00
|
|
|
AC_MSG_ERROR([file 'tkConfig.sh' is required for Tk])
|
2000-09-26 02:23:01 +04:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$TK_CONFIG_SH])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST([TK_CONFIG_SH])
|
|
|
|
])# PGAC_PATH_TKCONFIGSH
|
2002-05-24 22:10:17 +04:00
|
|
|
|
|
|
|
|
|
|
|
# PGAC_EVAL_TCLCONFIGSH(FILE, WANTED-VARS)
|
|
|
|
# ----------------------------------------
|
|
|
|
# Assigns variables listed in WANTED-VARS by reading FILE and
|
|
|
|
# evaluating it according to the quoting scheme of tclConfig.sh and
|
|
|
|
# tkConfig.sh. Calls AC_SUBST for each variable.
|
|
|
|
|
|
|
|
AC_DEFUN([PGAC_EVAL_TCLCONFIGSH],
|
|
|
|
[. "$1"
|
|
|
|
m4_foreach([pgac_item], [$2],
|
|
|
|
[eval pgac_item=\"[$]pgac_item\"
|
|
|
|
AC_SUBST(pgac_item)])])
|