aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2021-02-03 14:02:30 +0000
committerNick Alcock <nick.alcock@oracle.com>2021-02-10 15:26:57 +0000
commitcbd8f5bbcc81ffe6c84bd6439c9a22976867e4ad (patch)
tree69084a263c2db6ce7cfe73dc4610c0143fcb7b48 /libctf
parent95148614026da7353721411dd020d024667e3482 (diff)
downloadgdb-cbd8f5bbcc81ffe6c84bd6439c9a22976867e4ad.zip
gdb-cbd8f5bbcc81ffe6c84bd6439c9a22976867e4ad.tar.gz
gdb-cbd8f5bbcc81ffe6c84bd6439c9a22976867e4ad.tar.bz2
libctf: require a Tcl capable of try/catch to run tests
The run_native_host_cmd implementation in testsuite/lib/ctf-lib.exp uses try/catch, which are new in Tcl 8.6. Require a Tcl that knows that try exists, as suggested by Jan Beulich. libctf/ChangeLog 2021-02-03 Nick Alcock <nick.alcock@oracle.com> * configure.ac (EXPECT): Check for, in order to define... (TCL_TRY): ... this, if Tcl supports try/catch. * Makefile.am (TCL_TRY): Run the testsuite only if set. * configure: Regenerated. * Makefile.in: Likewise.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ChangeLog8
-rw-r--r--libctf/Makefile.am2
-rw-r--r--libctf/Makefile.in84
-rwxr-xr-xlibctf/configure73
-rw-r--r--libctf/configure.ac9
5 files changed, 138 insertions, 38 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index c7f3da1..135add5 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,11 @@
+2021-02-03 Nick Alcock <nick.alcock@oracle.com>
+
+ * configure.ac (EXPECT): Check for, in order to define...
+ (TCL_TRY): ... this, if Tcl supports try/catch.
+ * Makefile.am (TCL_TRY): Run the testsuite only if set.
+ * configure: Regenerated.
+ * Makefile.in: Likewise.
+
2021-02-02 Nick Alcock <nick.alcock@oracle.com>
* configure.ac (CTF_LIBADD): Remove explicit -lintl population in
diff --git a/libctf/Makefile.am b/libctf/Makefile.am
index 908564c..03fd6cc 100644
--- a/libctf/Makefile.am
+++ b/libctf/Makefile.am
@@ -62,6 +62,7 @@ EXPECT = expect
RUNTEST = runtest
RUNTESTFLAGS =
+if TCL_TRY
CC_FOR_TARGET = ` \
if [ -f $$r/../gcc/xgcc ] ; then \
if [ -f $$r/../newlib/Makefile ] ; then \
@@ -100,3 +101,4 @@ CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
EXTRA_DEJAGNU_SITE_CONFIG = development.exp
DISTCLEANFILES = site.exp development.exp
+endif
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index 17a9a7f..7e0dd09 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -330,6 +330,9 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+
+# Setup the testing framework, if you have one
+EXPECT = expect
FGREP = @FGREP@
GENCAT = @GENCAT@
GMSGFMT = @GMSGFMT@
@@ -468,31 +471,28 @@ libctf_la_LIBADD = ../bfd/libbfd.la $(libctf_nobfd_la_LIBADD)
libctf_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=0
libctf_la_LDFLAGS = $(libctf_nobfd_la_LDFLAGS)
libctf_la_SOURCES = $(libctf_nobfd_la_SOURCES) ctf-open-bfd.c
-
-# Setup the testing framework, if you have one
-EXPECT = expect
RUNTEST = runtest
RUNTESTFLAGS =
-CC_FOR_TARGET = ` \
- if [ -f $$r/../gcc/xgcc ] ; then \
- if [ -f $$r/../newlib/Makefile ] ; then \
- echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
- else \
- echo $$r/../gcc/xgcc -B$$r/../gcc/; \
- fi; \
- else \
- if [ "@host@" = "@target@" ] ; then \
- echo $(CC); \
- else \
- echo gcc | sed '$(transform)'; \
- fi; \
- fi`
+@TCL_TRY_TRUE@CC_FOR_TARGET = ` \
+@TCL_TRY_TRUE@ if [ -f $$r/../gcc/xgcc ] ; then \
+@TCL_TRY_TRUE@ if [ -f $$r/../newlib/Makefile ] ; then \
+@TCL_TRY_TRUE@ echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
+@TCL_TRY_TRUE@ else \
+@TCL_TRY_TRUE@ echo $$r/../gcc/xgcc -B$$r/../gcc/; \
+@TCL_TRY_TRUE@ fi; \
+@TCL_TRY_TRUE@ else \
+@TCL_TRY_TRUE@ if [ "@host@" = "@target@" ] ; then \
+@TCL_TRY_TRUE@ echo $(CC); \
+@TCL_TRY_TRUE@ else \
+@TCL_TRY_TRUE@ echo gcc | sed '$(transform)'; \
+@TCL_TRY_TRUE@ fi; \
+@TCL_TRY_TRUE@ fi`
# development.sh is used to determine -Werror default.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
-EXTRA_DEJAGNU_SITE_CONFIG = development.exp
-DISTCLEANFILES = site.exp development.exp
+@TCL_TRY_TRUE@CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
+@TCL_TRY_TRUE@EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+@TCL_TRY_TRUE@DISTCLEANFILES = site.exp development.exp
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -995,6 +995,18 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+@TCL_TRY_FALSE@check-DEJAGNU: site.exp
+@TCL_TRY_FALSE@ srcdir='$(srcdir)'; export srcdir; \
+@TCL_TRY_FALSE@ EXPECT=$(EXPECT); export EXPECT; \
+@TCL_TRY_FALSE@ if $(SHELL) -c "$(RUNTEST) --version" > /dev/null 2>&1; then \
+@TCL_TRY_FALSE@ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
+@TCL_TRY_FALSE@ if $(RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+@TCL_TRY_FALSE@ then :; else exit_status=1; fi; \
+@TCL_TRY_FALSE@ done; \
+@TCL_TRY_FALSE@ else echo "WARNING: could not find '$(RUNTEST)'" 1>&2; :;\
+@TCL_TRY_FALSE@ fi; \
+@TCL_TRY_FALSE@ exit $$exit_status
site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@@ -1327,22 +1339,22 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
.PRECIOUS: Makefile
-check-DEJAGNU: site.exp development.exp
- srcroot=`cd $(srcdir) && pwd`; export srcroot; \
- r=`pwd`; export r; \
- LC_ALL=C; export LC_ALL; \
- EXPECT=$(EXPECT); export EXPECT; \
- runtest=$(RUNTEST); \
- if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
- $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
- CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
- CC_FOR_HOST="$(CC)" LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
- else echo "WARNING: could not find \`runtest'" 1>&2; :;\
- fi
-
-development.exp: $(BFDDIR)/development.sh
- $(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh \
- | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+@TCL_TRY_TRUE@check-DEJAGNU: site.exp development.exp
+@TCL_TRY_TRUE@ srcroot=`cd $(srcdir) && pwd`; export srcroot; \
+@TCL_TRY_TRUE@ r=`pwd`; export r; \
+@TCL_TRY_TRUE@ LC_ALL=C; export LC_ALL; \
+@TCL_TRY_TRUE@ EXPECT=$(EXPECT); export EXPECT; \
+@TCL_TRY_TRUE@ runtest=$(RUNTEST); \
+@TCL_TRY_TRUE@ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+@TCL_TRY_TRUE@ $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+@TCL_TRY_TRUE@ CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
+@TCL_TRY_TRUE@ CC_FOR_HOST="$(CC)" LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
+@TCL_TRY_TRUE@ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+@TCL_TRY_TRUE@ fi
+
+@TCL_TRY_TRUE@development.exp: $(BFDDIR)/development.sh
+@TCL_TRY_TRUE@ $(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh \
+@TCL_TRY_TRUE@ | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libctf/configure b/libctf/configure
index bef55bb..902eadd 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -636,6 +636,9 @@ am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
VERSION_FLAGS
+TCL_TRY_FALSE
+TCL_TRY_TRUE
+EXPECT
CTF_LIBADD
SHARED_LDFLAGS
NEED_CTF_QSORT_R_FALSE
@@ -11539,7 +11542,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11542 "configure"
+#line 11545 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11645,7 +11648,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11648 "configure"
+#line 11651 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13391,6 +13394,68 @@ fi
+# Extract the first word of "expect", so it can be a program name with args.
+set dummy expect; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_EXPECT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $EXPECT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_EXPECT="$EXPECT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_EXPECT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+EXPECT=$ac_cv_path_EXPECT
+if test -n "$EXPECT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPECT" >&5
+$as_echo "$EXPECT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl supporting try/catch" >&5
+$as_echo_n "checking for Tcl supporting try/catch... " >&6; }
+if ${ac_cv_libctf_tcl_try+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_libctf_tcl_try=`if test -z $EXPECT; then echo no; else $EXPECT << EOF
+if [llength [info commands try]] then { puts yes } else { puts no }
+EOF
+fi`
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libctf_tcl_try" >&5
+$as_echo "$ac_cv_libctf_tcl_try" >&6; }
+ if test "${ac_cv_libctf_tcl_try}" = yes; then
+ TCL_TRY_TRUE=
+ TCL_TRY_FALSE='#'
+else
+ TCL_TRY_TRUE='#'
+ TCL_TRY_FALSE=
+fi
+
+
# Use a version script, if possible, or an -export-symbols-regex otherwise.
VERSION_FLAGS='-export-symbols-regex ctf_.*'
if $LD --help 2>&1 | grep -- --version-script >/dev/null; then
@@ -13552,6 +13617,10 @@ if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; th
as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${TCL_TRY_TRUE}" && test -z "${TCL_TRY_FALSE}"; then
+ as_fn_error $? "conditional \"TCL_TRY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libctf/configure.ac b/libctf/configure.ac
index ef00efe..c6b8044 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -205,6 +205,15 @@ fi
AC_SUBST(SHARED_LDFLAGS)
AC_SUBST(CTF_LIBADD)
+AC_PATH_PROG([EXPECT], [expect])
+AC_CACHE_CHECK([for Tcl supporting try/catch], [ac_cv_libctf_tcl_try],
+ [ac_cv_libctf_tcl_try=`if test -z $EXPECT; then echo no; else $EXPECT << EOF
+if @<:@llength @<:@info commands try@:>@@:>@ then { puts yes } else { puts no }
+EOF
+fi`
+])
+AM_CONDITIONAL(TCL_TRY, test "${ac_cv_libctf_tcl_try}" = yes)
+
# Use a version script, if possible, or an -export-symbols-regex otherwise.
VERSION_FLAGS='-export-symbols-regex ctf_.*'
if $LD --help 2>&1 | grep -- --version-script >/dev/null; then