* [PATCH 1/8] intl: Allow building both with old bison and bison >= 3 [PR92008]
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
2021-02-10 8:03 ` Alan Modra
2021-02-08 11:16 ` [PATCH 2/8] intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] Nick Alcock
` (6 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils; +Cc: Jakub Jelinek
From: Jakub Jelinek <jakub@redhat.com>
bison 3 apparently made a backwards incompatible change, dropped
YYLEX_PARAM/YYPARSE_PARAM support and instead needs %param or %lex-param
and %parse-param. Furthermore, there is no easy way to conditionalize
on bison version in the *.y files.
While e.g. glibc bumped bison requirement and just has the bison 3
compatible version, Richi said there are still systems with older bison
where we want to build gcc.
So, this patch instead determines during configure bison version, and
depending on that when building plural.c (if building it at all) tweaks
what is passed over to bison if needed.
Tested with both bison 3 and bison 1.35, in each case with reconfiguring
intl and building with make all-yes (as in my setup intl isn't normally
used).
[nca: sync from gcc]
intl/ChangeLog
2020-04-16 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/92008
* configure.ac: Add check for bison >= 3, AC_DEFINE HAVE_BISON3
and AC_SUBST BISON3_YES and BISON3_NO.
* Makefile.in (.y.c): Prefix $(YACC) invocation with @BISON3_NO@,
add @BISON3_YES@ prefixed rule to adjust the *.y source using sed
and adjust output afterwards.
* plural-exp.h (PLURAL_PARSE): If HAVE_BISON3 is defined, use
struct parse_args * type for arg instead of void *.
* plural.y: Add magic /* BISON3 ... */ comments with bison >= 3
directives.
(YYLEX_PARAM, YYPARSE_PARAM): Don't define if HAVE_BISON3 is defined.
(yylex, yyerror): Adjust prototypes and definitions if HAVE_BISON3
is defined.
* plural.c: Regenerated.
* config.h.in: Regenerated.
* configure: Regenerated.
---
intl/Makefile.in | 6 ++++-
intl/config.h.in | 3 +++
intl/configure | 27 +++++++++++++++++++++
intl/configure.ac | 23 ++++++++++++++++++
intl/plural-exp.h | 6 ++++-
intl/plural.c | 62 ++++++++++++++++++++++++++++++++---------------
intl/plural.y | 27 ++++++++++++++++++++-
7 files changed, 131 insertions(+), 23 deletions(-)
diff --git a/intl/Makefile.in b/intl/Makefile.in
index 3dd0b7fe8fd..bdb74ebb78c 100644
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -133,7 +133,11 @@ libintl.h: $(srcdir)/libgnuintl.h
$(COMPILE) $<
.y.c:
- $(YACC) $(YFLAGS) --output $@ $<
+@BISON3_YES@ sed 's,%pure_parser,,;s,^/\* BISON3 \(.*\) \*/$$,\1,' $< > $@.y
+@BISON3_YES@ $(YACC) $(YFLAGS) --output $@.c $@.y
+@BISON3_YES@ sed 's/\.c\.y"/.y"/' $@.c > $@
+@BISON3_YES@ rm -f $@.c $@.y $@.h
+@BISON3_NO@ $(YACC) $(YFLAGS) --output $@ $<
rm -f $*.h
INCLUDES = -I. -I$(srcdir)
diff --git a/intl/config.h.in b/intl/config.h.in
index 9c9b53dc0ea..87738c0aad2 100644
--- a/intl/config.h.in
+++ b/intl/config.h.in
@@ -28,6 +28,9 @@
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
+/* Define if bison 3 or later is used. */
+#undef HAVE_BISON3
+
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
diff --git a/intl/configure b/intl/configure
index 870b29f7d3f..58cee2983a5 100755
--- a/intl/configure
+++ b/intl/configure
@@ -622,6 +622,8 @@ ac_unique_file="gettext.c"
ac_header_list=
ac_subst_vars='LTLIBOBJS
LIBOBJS
+BISON3_NO
+BISON3_YES
INCINTL
LIBINTL_DEP
MAINT
@@ -6791,6 +6793,31 @@ case $USE_INCLUDED_LIBINTL in
;;
esac
+BISON3_YES='#'
+BISON3_NO=
+if test "$INTLBISON" != :; then
+ ac_bison3=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking bison 3 or later" >&5
+$as_echo_n "checking bison 3 or later... " >&6; }
+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ [3-9].*)
+ ac_prog_version="$ac_prog_version, bison3"; ac_bison3=yes;;
+ *) ac_prog_version="$ac_prog_version, old";;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
+$as_echo "$ac_prog_version" >&6; }
+ if test $ac_bison3 = yes; then
+
+$as_echo "#define HAVE_BISON3 1" >>confdefs.h
+
+ BISON3_YES=
+ BISON3_NO='#'
+ fi
+fi
+
+
+
ac_config_files="$ac_config_files Makefile config.intl"
cat >confcache <<\_ACEOF
diff --git a/intl/configure.ac b/intl/configure.ac
index 48832b98f1a..b11033712bc 100644
--- a/intl/configure.ac
+++ b/intl/configure.ac
@@ -47,5 +47,28 @@ case $USE_INCLUDED_LIBINTL in
;;
esac
+BISON3_YES='#'
+BISON3_NO=
+if test "$INTLBISON" != :; then
+ ac_bison3=no
+ AC_MSG_CHECKING([bison 3 or later])
+changequote(<<,>>)dnl
+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ [3-9].*)
+changequote([,])dnl
+ ac_prog_version="$ac_prog_version, bison3"; ac_bison3=yes;;
+ *) ac_prog_version="$ac_prog_version, old";;
+ esac
+ AC_MSG_RESULT([$ac_prog_version])
+ if test $ac_bison3 = yes; then
+ AC_DEFINE(HAVE_BISON3, 1, [Define if bison 3 or later is used.])
+ BISON3_YES=
+ BISON3_NO='#'
+ fi
+fi
+AC_SUBST(BISON3_YES)
+AC_SUBST(BISON3_NO)
+
AC_CONFIG_FILES(Makefile config.intl)
AC_OUTPUT
diff --git a/intl/plural-exp.h b/intl/plural-exp.h
index cedc0db6882..e27c2805093 100644
--- a/intl/plural-exp.h
+++ b/intl/plural-exp.h
@@ -1,5 +1,5 @@
/* Expression parsing and evaluation for plural form selection.
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000-2020 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This program is free software; you can redistribute it and/or modify it
@@ -111,7 +111,11 @@ struct parse_args
extern void FREE_EXPRESSION PARAMS ((struct expression *exp))
internal_function;
+#ifdef HAVE_BISON3
+extern int PLURAL_PARSE PARAMS ((struct parse_args *arg));
+#else
extern int PLURAL_PARSE PARAMS ((void *arg));
+#endif
extern struct expression GERMANIC_PLURAL attribute_hidden;
extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry,
struct expression **pluralp,
diff --git a/intl/plural.c b/intl/plural.c
index 951303a16f5..ad86faa89ce 100644
--- a/intl/plural.c
+++ b/intl/plural.c
@@ -19,7 +19,7 @@
#line 1 "plural.y"
/* Expression parsing for plural form selection.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000-2020 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This program is free software; you can redistribute it and/or modify it
@@ -59,10 +59,12 @@
# define __gettextparse PLURAL_PARSE
#endif
+#ifndef HAVE_BISON3
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
#define YYPARSE_PARAM arg
+#endif
-#line 49 "plural.y"
+#line 54 "plural.y"
#ifndef YYSTYPE
typedef union {
unsigned long int num;
@@ -72,7 +74,7 @@ typedef union {
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
-#line 55 "plural.y"
+#line 60 "plural.y"
/* Prototypes for local functions. */
static struct expression *new_exp PARAMS ((int nargs, enum operator op,
@@ -87,8 +89,13 @@ static inline struct expression *new_exp_3 PARAMS ((enum operator op,
struct expression *bexp,
struct expression *tbranch,
struct expression *fbranch));
+#ifdef HAVE_BISON3
+static int yylex PARAMS ((YYSTYPE *lval, struct parse_args *arg));
+static void yyerror PARAMS ((struct parse_args *arg, const char *str));
+#else
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
static void yyerror PARAMS ((const char *str));
+#endif
/* Allocation of expressions. */
@@ -236,8 +243,8 @@ static const short yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
- 0, 174, 182, 186, 190, 194, 198, 202, 206, 210,
- 214, 218, 223
+ 0, 184, 192, 196, 200, 204, 208, 212, 216, 220,
+ 224, 228, 233
};
#endif
@@ -339,8 +346,8 @@ static const short yycheck[] =
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
@@ -1027,7 +1034,7 @@ yyreduce:
switch (yyn) {
case 1:
-#line 175 "plural.y"
+#line 185 "plural.y"
{
if (yyvsp[0].exp == NULL)
YYABORT;
@@ -1035,68 +1042,68 @@ case 1:
}
break;
case 2:
-#line 183 "plural.y"
+#line 193 "plural.y"
{
yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
}
break;
case 3:
-#line 187 "plural.y"
+#line 197 "plural.y"
{
yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
}
break;
case 4:
-#line 191 "plural.y"
+#line 201 "plural.y"
{
yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
}
break;
case 5:
-#line 195 "plural.y"
+#line 205 "plural.y"
{
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
}
break;
case 6:
-#line 199 "plural.y"
+#line 209 "plural.y"
{
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
}
break;
case 7:
-#line 203 "plural.y"
+#line 213 "plural.y"
{
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
}
break;
case 8:
-#line 207 "plural.y"
+#line 217 "plural.y"
{
yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
}
break;
case 9:
-#line 211 "plural.y"
+#line 221 "plural.y"
{
yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
}
break;
case 10:
-#line 215 "plural.y"
+#line 225 "plural.y"
{
yyval.exp = new_exp_0 (var);
}
break;
case 11:
-#line 219 "plural.y"
+#line 229 "plural.y"
{
if ((yyval.exp = new_exp_0 (num)) != NULL)
yyval.exp->val.num = yyvsp[0].num;
}
break;
case 12:
-#line 224 "plural.y"
+#line 234 "plural.y"
{
yyval.exp = yyvsp[-1].exp;
}
@@ -1334,7 +1341,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 229 "plural.y"
+#line 239 "plural.y"
void
@@ -1365,11 +1372,20 @@ FREE_EXPRESSION (exp)
}
+#ifdef HAVE_BISON3
+static int
+yylex (lval, arg)
+ YYSTYPE *lval;
+ struct parse_args *arg;
+{
+ const char **pexp = &arg->cp;
+#else
static int
yylex (lval, pexp)
YYSTYPE *lval;
const char **pexp;
{
+#endif
const char *exp = *pexp;
int result;
@@ -1510,8 +1526,14 @@ yylex (lval, pexp)
}
+#ifdef HAVE_BISON3
+static void
+yyerror (arg, str)
+ struct parse_args *arg;
+#else
static void
yyerror (str)
+#endif
const char *str;
{
/* Do nothing. We don't print error messages here. */
diff --git a/intl/plural.y b/intl/plural.y
index 3f75cf3dbbe..c97f09a6f69 100644
--- a/intl/plural.y
+++ b/intl/plural.y
@@ -1,6 +1,6 @@
%{
/* Expression parsing for plural form selection.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000-2020 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This program is free software; you can redistribute it and/or modify it
@@ -40,10 +40,15 @@
# define __gettextparse PLURAL_PARSE
#endif
+#ifndef HAVE_BISON3
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
#define YYPARSE_PARAM arg
+#endif
%}
%pure_parser
+/* BISON3 %parse-param {struct parse_args *arg} */
+/* BISON3 %lex-param {struct parse_args *arg} */
+/* BISON3 %define api.pure full */
%expect 7
%union {
@@ -66,8 +71,13 @@ static inline struct expression *new_exp_3 PARAMS ((enum operator op,
struct expression *bexp,
struct expression *tbranch,
struct expression *fbranch));
+#ifdef HAVE_BISON3
+static int yylex PARAMS ((YYSTYPE *lval, struct parse_args *arg));
+static void yyerror PARAMS ((struct parse_args *arg, const char *str));
+#else
static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
static void yyerror PARAMS ((const char *str));
+#endif
/* Allocation of expressions. */
@@ -256,11 +266,20 @@ FREE_EXPRESSION (exp)
}
+#ifdef HAVE_BISON3
+static int
+yylex (lval, arg)
+ YYSTYPE *lval;
+ struct parse_args *arg;
+{
+ const char **pexp = &arg->cp;
+#else
static int
yylex (lval, pexp)
YYSTYPE *lval;
const char **pexp;
{
+#endif
const char *exp = *pexp;
int result;
@@ -401,8 +420,14 @@ yylex (lval, pexp)
}
+#ifdef HAVE_BISON3
+static void
+yyerror (arg, str)
+ struct parse_args *arg;
+#else
static void
yyerror (str)
+#endif
const char *str;
{
/* Do nothing. We don't print error messages here. */
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/8] intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008]
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
2021-02-08 11:16 ` [PATCH 1/8] intl: Allow building both with old bison and bison >= 3 [PR92008] Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
2021-02-10 8:04 ` Alan Modra
2021-02-08 11:16 ` [PATCH 3/8] intl: always picify Nick Alcock
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils; +Cc: Jakub Jelinek
From: Jakub Jelinek <jakub@redhat.com>
As Iain reported, my change broke the case when one has bison >= 3,
but make decides there is no reason to regenerate plural.c, unfortunately
that seems to be a scenario I haven't tested. The problem is that
the pregenerated plural.c has been generated with bison 1.35, but when
config.h says HAVE_BISON3, the code assumes it is the bison3 variant.
What used to work fine is when one has bison >= 3 and plural.c has been
regenerated (e.g. do touch intl/plural.y and it will work), or when
one doesn't have any bison (then nothing is regenerated, but HAVE_BISON3
isn't defined either), or when one has bison < 3 and doesn't need to
regenerate, or when one has bison < 3 and it is regenerated.
The following patch fixes this, by killing the HAVE_BISON3 macro from
config.h, and instead remembering the fact whether plural.c has been created
with bison < 3 or bison >= 3 in a separate new plural-config.h header.
The way this works:
- user doesn't have bison
- user has bison >= 3, but intl/{plural-config.h,plural.c} aren't older than intl/plural.y
- user has bison < 3, but intl/{plural-config.h,plural.c} aren't older than intl/plural.y
pregenerated !USE_BISON3 plural.c and plural-config.h from source
dir is used, nothing in the objdir
- user has bison >= 3 and intl/plural.y is newer
Makefile generates plural.c and USE_BISON3 plural-config.h in the
objdir, which is then used in preference to srcdir copies
- user has bison < 3 and intl/plural.y is newer
Makefile generates plural.c and !USE_BISON3 plural-config.h in the
objdir, which is then used in preference to srcdir copies
I have tested all these cases and make all-yes worked in all the cases.
If one uses the unsupported ./configure where srcdir == objdir, I guess
(though haven't tested) that it should still work, just it would be nice
if such people didn't try to check in the plural{.c,-config.h} they have
regenerated.
What doesn't work, but didn't work before either (just tested gcc-9 branch
too) is when one doesn't have bison and plural.y is newer than plural.c.
Don't do that ;)
[nca: sync from gcc]
intl/ChangeLog
2020-04-16 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/92008
* configure.ac: Remove HAVE_BISON3 AC_DEFINE.
* Makefile.in (HEADERS): Add plural-config.h.
(.y.c): Also create plural-config.h.
(dcigettext.o loadmsgcat.o plural.o plural-exp.o): Also depend
on plural-config.h.
(plural-config.h): Depend on plural.c.
* plural-exp.h: Include plural-config.h. Use USE_BISON3 instead
of HAVE_BISON3.
* plural.y: Use USE_BISON3 instead of HAVE_BISON3.
* configure: Regenerated.
* plural.c: Regenerated.
* config.h.in: Regenerated.
* plural-config.h: Generated.
---
intl/Makefile.in | 7 ++++++-
intl/config.h.in | 3 ---
intl/configure | 3 ---
intl/configure.ac | 1 -
intl/plural-config.h | 1 +
intl/plural-exp.h | 4 +++-
intl/plural.c | 8 ++++----
intl/plural.y | 8 ++++----
8 files changed, 18 insertions(+), 17 deletions(-)
create mode 100644 intl/plural-config.h
diff --git a/intl/Makefile.in b/intl/Makefile.in
index bdb74ebb78c..356c8ab9b65 100644
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -57,6 +57,7 @@ HEADERS = \
gettextP.h \
hash-string.h \
loadinfo.h \
+ plural-config.h \
plural-exp.h \
eval-plural.h \
localcharset.h \
@@ -133,10 +134,12 @@ libintl.h: $(srcdir)/libgnuintl.h
$(COMPILE) $<
.y.c:
+@BISON3_YES@ echo '#define USE_BISON3' > $(patsubst %.c,%-config.h,$@)
@BISON3_YES@ sed 's,%pure_parser,,;s,^/\* BISON3 \(.*\) \*/$$,\1,' $< > $@.y
@BISON3_YES@ $(YACC) $(YFLAGS) --output $@.c $@.y
@BISON3_YES@ sed 's/\.c\.y"/.y"/' $@.c > $@
@BISON3_YES@ rm -f $@.c $@.y $@.h
+@BISON3_NO@ echo '/* #define USE_BISON3 */' > $(patsubst %.c,%-config.h,$@)
@BISON3_NO@ $(YACC) $(YFLAGS) --output $@ $<
rm -f $*.h
@@ -165,7 +168,7 @@ dngettext.o finddomain.o gettext.o intl-compat.o loadmsgcat.o \
localealias.o ngettext.o textdomain.o: gettextP.h gmo.h loadinfo.h
dcigettext.o loadmsgcat.o: hash-string.h
explodename.o l10nflist.o: loadinfo.h
-dcigettext.o loadmsgcat.o plural.o plural-exp.o: plural-exp.h
+dcigettext.o loadmsgcat.o plural.o plural-exp.o: plural-exp.h plural-config.h
dcigettext.o: eval-plural.h
localcharset.o: localcharset.h
localealias.o localcharset.o relocatable.o: relocatable.h
@@ -242,6 +245,8 @@ $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
config.h: stamp-h1
test -f config.h || (rm -f stamp-h1 && $(MAKE) stamp-h1)
+plural-config.h: plural.c
+
stamp-h1: $(srcdir)/config.h.in config.status
-rm -f stamp-h1
$(SHELL) ./config.status config.h
diff --git a/intl/config.h.in b/intl/config.h.in
index 87738c0aad2..9c9b53dc0ea 100644
--- a/intl/config.h.in
+++ b/intl/config.h.in
@@ -28,9 +28,6 @@
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
-/* Define if bison 3 or later is used. */
-#undef HAVE_BISON3
-
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
diff --git a/intl/configure b/intl/configure
index 58cee2983a5..d69767b7d21 100755
--- a/intl/configure
+++ b/intl/configure
@@ -6808,9 +6808,6 @@ $as_echo_n "checking bison 3 or later... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
$as_echo "$ac_prog_version" >&6; }
if test $ac_bison3 = yes; then
-
-$as_echo "#define HAVE_BISON3 1" >>confdefs.h
-
BISON3_YES=
BISON3_NO='#'
fi
diff --git a/intl/configure.ac b/intl/configure.ac
index b11033712bc..6363e55e68a 100644
--- a/intl/configure.ac
+++ b/intl/configure.ac
@@ -62,7 +62,6 @@ changequote([,])dnl
esac
AC_MSG_RESULT([$ac_prog_version])
if test $ac_bison3 = yes; then
- AC_DEFINE(HAVE_BISON3, 1, [Define if bison 3 or later is used.])
BISON3_YES=
BISON3_NO='#'
fi
diff --git a/intl/plural-config.h b/intl/plural-config.h
new file mode 100644
index 00000000000..53bbd11078e
--- /dev/null
+++ b/intl/plural-config.h
@@ -0,0 +1 @@
+/* #define USE_BISON3 */
diff --git a/intl/plural-exp.h b/intl/plural-exp.h
index e27c2805093..2dbb104099e 100644
--- a/intl/plural-exp.h
+++ b/intl/plural-exp.h
@@ -20,6 +20,8 @@
#ifndef _PLURAL_EXP_H
#define _PLURAL_EXP_H
+#include <plural-config.h>
+
#ifndef PARAMS
# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
# define PARAMS(args) args
@@ -111,7 +113,7 @@ struct parse_args
extern void FREE_EXPRESSION PARAMS ((struct expression *exp))
internal_function;
-#ifdef HAVE_BISON3
+#ifdef USE_BISON3
extern int PLURAL_PARSE PARAMS ((struct parse_args *arg));
#else
extern int PLURAL_PARSE PARAMS ((void *arg));
diff --git a/intl/plural.c b/intl/plural.c
index ad86faa89ce..f9a8faa7838 100644
--- a/intl/plural.c
+++ b/intl/plural.c
@@ -59,7 +59,7 @@
# define __gettextparse PLURAL_PARSE
#endif
-#ifndef HAVE_BISON3
+#ifndef USE_BISON3
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
#define YYPARSE_PARAM arg
#endif
@@ -89,7 +89,7 @@ static inline struct expression *new_exp_3 PARAMS ((enum operator op,
struct expression *bexp,
struct expression *tbranch,
struct expression *fbranch));
-#ifdef HAVE_BISON3
+#ifdef USE_BISON3
static int yylex PARAMS ((YYSTYPE *lval, struct parse_args *arg));
static void yyerror PARAMS ((struct parse_args *arg, const char *str));
#else
@@ -1372,7 +1372,7 @@ FREE_EXPRESSION (exp)
}
-#ifdef HAVE_BISON3
+#ifdef USE_BISON3
static int
yylex (lval, arg)
YYSTYPE *lval;
@@ -1526,7 +1526,7 @@ yylex (lval, pexp)
}
-#ifdef HAVE_BISON3
+#ifdef USE_BISON3
static void
yyerror (arg, str)
struct parse_args *arg;
diff --git a/intl/plural.y b/intl/plural.y
index c97f09a6f69..7531da5a7b2 100644
--- a/intl/plural.y
+++ b/intl/plural.y
@@ -40,7 +40,7 @@
# define __gettextparse PLURAL_PARSE
#endif
-#ifndef HAVE_BISON3
+#ifndef USE_BISON3
#define YYLEX_PARAM &((struct parse_args *) arg)->cp
#define YYPARSE_PARAM arg
#endif
@@ -71,7 +71,7 @@ static inline struct expression *new_exp_3 PARAMS ((enum operator op,
struct expression *bexp,
struct expression *tbranch,
struct expression *fbranch));
-#ifdef HAVE_BISON3
+#ifdef USE_BISON3
static int yylex PARAMS ((YYSTYPE *lval, struct parse_args *arg));
static void yyerror PARAMS ((struct parse_args *arg, const char *str));
#else
@@ -266,7 +266,7 @@ FREE_EXPRESSION (exp)
}
-#ifdef HAVE_BISON3
+#ifdef USE_BISON3
static int
yylex (lval, arg)
YYSTYPE *lval;
@@ -420,7 +420,7 @@ yylex (lval, pexp)
}
-#ifdef HAVE_BISON3
+#ifdef USE_BISON3
static void
yyerror (arg, str)
struct parse_args *arg;
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/8] intl: always picify
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
2021-02-08 11:16 ` [PATCH 1/8] intl: Allow building both with old bison and bison >= 3 [PR92008] Nick Alcock
2021-02-08 11:16 ` [PATCH 2/8] intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
2021-02-08 11:16 ` [PATCH 4/8] intl: turn LIBINTL into -L / -l form Nick Alcock
` (4 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils; +Cc: gcc-patches
libintl is included in several shared libraries (at least
libinproctrace.so and libctf.so): unconditionally picify with code
borrowed from libiberty configure. (It's not performance-critical, so
don't bother making separate PIC and non-PIC libraries like libiberty
does.)
Cc: gcc-patches@gnu.org
intl/ChangeLog
2021-02-02 Nick Alcock <nick.alcock@oracle.com>
* aclocal.m4: include picflag.m4.
* configure.ac (PICFLAG): Add and substitute.
* Makefile.in (PICFLAG): New.
(COMPILE): Use it.
* configure: Regenerate.
---
intl/Makefile.in | 3 +-
intl/aclocal.m4 | 1 +
intl/configure | 86 +++++++++++++++++++++++++++++++++++++++++++++++
intl/configure.ac | 5 +++
4 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/intl/Makefile.in b/intl/Makefile.in
index 356c8ab9b65..96df727baea 100644
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -49,8 +49,9 @@ CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
DEFS = -DHAVE_CONFIG_H
+PICFLAG = @PICFLAG@
-COMPILE = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(DEFS-$@) $(INCLUDES)
+COMPILE = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PICFLAG) $(DEFS) $(DEFS-$@) $(INCLUDES)
HEADERS = \
gmo.h \
diff --git a/intl/aclocal.m4 b/intl/aclocal.m4
index 473ec622323..0a42b42ea8c 100644
--- a/intl/aclocal.m4
+++ b/intl/aclocal.m4
@@ -26,6 +26,7 @@ m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
m4_include([../config/nls.m4])
m4_include([../config/override.m4])
+m4_include([../config/picflag.m4])
m4_include([../config/po.m4])
m4_include([../config/progtest.m4])
m4_include([../config/stdint_h.m4])
diff --git a/intl/configure b/intl/configure
index d69767b7d21..6498a392570 100755
--- a/intl/configure
+++ b/intl/configure
@@ -624,6 +624,7 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS
BISON3_NO
BISON3_YES
+PICFLAG
INCINTL
LIBINTL_DEP
MAINT
@@ -6793,6 +6794,91 @@ case $USE_INCLUDED_LIBINTL in
;;
esac
+# intl is sometimes linked into shared libraries even without --enable-shared
+# (e.g. gdbsupport's inprocess agent): so always PICify, just in case.
+
+
+
+
+case "${host}" in
+ # PIC is the default on some targets or must not be used.
+ *-*-darwin*)
+ # For darwin, common symbols are not allowed in MH_DYLIB files
+ case "${CFLAGS}" in
+ # If we are using a compiler supporting mdynamic-no-pic
+ # and the option has been tested as safe to add, then cancel
+ # it here, since the code generated is incompatible with shared
+ # libs.
+ *-mdynamic-no-pic*) PICFLAG='-fno-common -mno-dynamic-no-pic' ;;
+ *) PICFLAG=-fno-common ;;
+ esac
+ ;;
+ alpha*-dec-osf5*)
+ # PIC is the default.
+ ;;
+ hppa*64*-*-hpux*)
+ # PIC is the default for 64-bit PA HP-UX.
+ ;;
+ i[34567]86-*-cygwin* | x86_64-*-cygwin*)
+ ;;
+ i[34567]86-*-mingw* | x86_64-*-mingw*)
+ ;;
+ i[34567]86-*-interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ i[34567]86-*-nto-qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ PICFLAG='-fPIC -shared'
+ ;;
+ i[34567]86-pc-msdosdjgpp*)
+ # DJGPP does not support shared libraries at all.
+ ;;
+ ia64*-*-hpux*)
+ # On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ PICFLAG=-fPIC
+ ;;
+ mips-sgi-irix6*)
+ # PIC is the default.
+ ;;
+ rs6000-ibm-aix* | powerpc-ibm-aix*)
+ # All AIX code is PIC.
+ ;;
+
+ # Some targets support both -fPIC and -fpic, but prefer the latter.
+ # FIXME: Why?
+ i[34567]86-*-* | x86_64-*-*)
+ PICFLAG=-fpic
+ ;;
+ # FIXME: Override -fPIC default in libgcc only?
+ sh-*-linux* | sh[2346lbe]*-*-linux*)
+ PICFLAG=-fpic
+ ;;
+ # FIXME: Simplify to sh*-*-netbsd*?
+ sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+ sh64-*-netbsd* | sh64l*-*-netbsd*)
+ PICFLAG=-fpic
+ ;;
+ # Default to -fPIC unless specified otherwise.
+ *)
+ PICFLAG=-fPIC
+ ;;
+esac
+
+# If the user explicitly uses -fpic/-fPIC, keep that.
+case "${CFLAGS}" in
+ *-fpic*)
+ PICFLAG=-fpic
+ ;;
+ *-fPIC*)
+ PICFLAG=-fPIC
+ ;;
+esac
+
+
+
BISON3_YES='#'
BISON3_NO=
if test "$INTLBISON" != :; then
diff --git a/intl/configure.ac b/intl/configure.ac
index 6363e55e68a..5ec7b0944e2 100644
--- a/intl/configure.ac
+++ b/intl/configure.ac
@@ -47,6 +47,11 @@ case $USE_INCLUDED_LIBINTL in
;;
esac
+# intl is sometimes linked into shared libraries even without --enable-shared
+# (e.g. gdbsupport's inprocess agent): so always PICify, just in case.
+GCC_PICFLAG
+AC_SUBST(PICFLAG)
+
BISON3_YES='#'
BISON3_NO=
if test "$INTLBISON" != :; then
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 4/8] intl: turn LIBINTL into -L / -l form
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
` (2 preceding siblings ...)
2021-02-08 11:16 ` [PATCH 3/8] intl: always picify Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
2021-02-10 8:05 ` Alan Modra
2021-02-08 11:16 ` [PATCH 5/8] bfd, opcodes, libctf: support --with-included-gettext Nick Alcock
` (3 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils; +Cc: gcc-patches
This variable currently refers directly, not to a .la file, but to an .a
file. This produces wrong results when building into a library on some
platforms: so convert it to the general form "-L${top_builddir}../intl
-lintl ..." ... so that both libtool and non-libtool builds will always
do the right thing for both static and shared links.
Cc: gcc-patches@gnu.org
intl/ChangeLog
2021-02-04 Nick Alcock <nick.alcock@oracle.com>
* configure.ac (LIBINTL): Transform into -L/-lintl form.
* configure: Regenerate.
---
intl/configure | 3 +--
intl/configure.ac | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/intl/configure b/intl/configure
index 6498a392570..7ddb624249d 100755
--- a/intl/configure
+++ b/intl/configure
@@ -6787,8 +6787,7 @@ LIBINTL_DEP=
INCINTL=
case $USE_INCLUDED_LIBINTL in
yes)
- LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},&/..,' `
- LTLIBINTL=`echo $LTLIBINTL | sed 's,${top_builddir},&/..,' `
+ LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},-L&/..,; s,\.\./intl/libintl\.a,../intl -lintl,' `
LIBINTL_DEP='${top_builddir}/../intl/libintl.a'
INCINTL='-I${top_builddir}/../intl'
;;
diff --git a/intl/configure.ac b/intl/configure.ac
index 5ec7b0944e2..77e2fd2d8c5 100644
--- a/intl/configure.ac
+++ b/intl/configure.ac
@@ -40,8 +40,7 @@ LIBINTL_DEP=
INCINTL=
case $USE_INCLUDED_LIBINTL in
yes)
- LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},&/..,' `
- LTLIBINTL=`echo $LTLIBINTL | sed 's,${top_builddir},&/..,' `
+ LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},-L&/..,; s,\.\./intl/libintl\.a,../intl -lintl,' `
LIBINTL_DEP='${top_builddir}/../intl/libintl.a'
INCINTL='-I${top_builddir}/../intl'
;;
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 5/8] bfd, opcodes, libctf: support --with-included-gettext
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
` (3 preceding siblings ...)
2021-02-08 11:16 ` [PATCH 4/8] intl: turn LIBINTL into -L / -l form Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
2021-02-10 8:06 ` Alan Modra
2021-02-08 11:16 ` [PATCH 6/8] gdbserver: explicitly include gettext, etc in inprocess agent Nick Alcock
` (2 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils
Right now, these libraries hardwire -L../intl -lintl on a few fixed
platforms, which works fine on those platforms but on other platforms
leads to shared libraries that lack libintl_* symbols when configured
--with-included-gettext, and/or static libraries that contain libintl as
*another* static library. If we instead use the LIBINTL variable
defined in ../intl/config.intl, this gives us the right thing on all
three classes of platform (gettext in libc, gettext in system libintl,
gettext in ../intl/libintl.a).. This also means we can rip out some
Darwin-specific machinery from configure.ac and also simplify the Cygwin
side.
This also means that the libctf testsuite (and other places that include
libbfd, libopcodes or libctf) don't need to grow libintl dependencies
just on account of those libraries (though they still need such
dependencies if they themselves use gettext machinery).
bfd/ChangeLog
2021-02-03 Nick Alcock <nick.alcock@oracle.com>
* configure.ac (SHARED_LIBADD): Remove explicit -lintl population in
favour of LIBINTL.
* configure: Regenerated.
libctf/ChangeLog
2021-02-02 Nick Alcock <nick.alcock@oracle.com>
* configure.ac (CTF_LIBADD): Remove explicit -lintl population in
favour of LIBINTL.
* Makefile.am (libctf_nobfd_la_LIBADD): No longer explicitly
include $(LIBINTL).
(check-DEJAGNU): Pass down to tests as well.
* configure: Regenerated.
* Makefile.in: Likewise.
opcodes/ChangeLog
2021-02-04 Nick Alcock <nick.alcock@oracle.com>
* configure.ac (SHARED_LIBADD): Remove explicit -lintl population in
favour of LIBINTL.
* configure: Regenerated.
---
bfd/configure | 11 +++++------
bfd/configure.ac | 11 +++++------
libctf/Makefile.am | 4 ++--
libctf/Makefile.in | 9 ++++-----
libctf/configure | 17 +++++++++++------
libctf/configure.ac | 17 +++++++++++------
opcodes/configure | 8 +++++++-
opcodes/configure.ac | 8 +++++++-
8 files changed, 52 insertions(+), 33 deletions(-)
diff --git a/bfd/configure b/bfd/configure
index ed328de6e9f..271e19b41ad 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14632,17 +14632,16 @@ if test "$enable_shared" = "yes"; then
if test -n "$x"; then
SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
fi
+fi
+
+SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
+if test "$enable_shared" = "yes"; then
case "${host}" in
# More hacks to build DLLs on Windows.
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
- ;;
-
- # Use built-in libintl on macOS, since it is not provided by libc.
- *-*-darwin*)
- SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl"
+ SHARED_LIBADD="-L`pwd`/../libiberty -liberty $SHARED_LIBADD -lcygwin -lkernel32"
;;
esac
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 102a22171f6..7fcccf9b4b3 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -317,17 +317,16 @@ changequote([,])dnl
if test -n "$x"; then
SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
fi
+fi
+
+SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
+if test "$enable_shared" = "yes"; then
case "${host}" in
# More hacks to build DLLs on Windows.
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
- ;;
-
- # Use built-in libintl on macOS, since it is not provided by libc.
- *-*-darwin*)
- SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl"
+ SHARED_LIBADD="-L`pwd`/../libiberty -liberty $SHARED_LIBADD -lcygwin -lkernel32"
;;
esac
diff --git a/libctf/Makefile.am b/libctf/Makefile.am
index f45433483c0..908564c35cb 100644
--- a/libctf/Makefile.am
+++ b/libctf/Makefile.am
@@ -41,7 +41,7 @@ include_HEADERS =
noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
endif
-libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(LIBINTL) $(ZLIB)
+libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
libctf_nobfd_la_LDFLAGS = -version-info 0:0:0 @SHARED_LDFLAGS@ @VERSION_FLAGS@
libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
@@ -86,7 +86,7 @@ check-DEJAGNU: site.exp development.exp
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="$(LIBS)" $(RUNTESTFLAGS); \
+ CC_FOR_HOST="$(CC)" LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index 4fc351c011c..17a9a7f32ba 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -164,8 +164,7 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
-libctf_nobfd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+libctf_nobfd_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am__libctf_nobfd_la_SOURCES_DIST = ctf-archive.c ctf-dump.c \
ctf-create.c ctf-decl.c ctf-error.c ctf-hash.c ctf-labels.c \
ctf-dedup.c ctf-link.c ctf-lookup.c ctf-open.c ctf-sha1.c \
@@ -191,7 +190,7 @@ libctf_nobfd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-o $@
@INSTALL_LIBBFD_FALSE@am_libctf_nobfd_la_rpath =
@INSTALL_LIBBFD_TRUE@am_libctf_nobfd_la_rpath = -rpath $(libdir)
-am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
libctf_la_DEPENDENCIES = ../bfd/libbfd.la $(am__DEPENDENCIES_2)
am__libctf_la_SOURCES_DIST = ctf-archive.c ctf-dump.c ctf-create.c \
ctf-decl.c ctf-error.c ctf-hash.c ctf-labels.c ctf-dedup.c \
@@ -458,7 +457,7 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
@INSTALL_LIBBFD_FALSE@include_HEADERS =
@INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
-libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(LIBINTL) $(ZLIB)
+libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
libctf_nobfd_la_LDFLAGS = -version-info 0:0:0 @SHARED_LDFLAGS@ @VERSION_FLAGS@
libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
@@ -1337,7 +1336,7 @@ check-DEJAGNU: site.exp development.exp
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="$(LIBS)" $(RUNTESTFLAGS); \
+ CC_FOR_HOST="$(CC)" LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
diff --git a/libctf/configure b/libctf/configure
index 544bca2b104..bef55bb8cc5 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -13357,29 +13357,34 @@ $as_echo "#define HAVE_O_CLOEXEC 1" >>confdefs.h
fi
-# Horrible hacks to build DLLs on Windows and a shared library elsewhere.
-
CTF_LIBADD="-L`pwd`/../libiberty -liberty"
SHARED_LDFLAGS=
+
+# Horrible hacks to build DLLs on Windows and a shared library elsewhere.
if test "$enable_shared" = "yes"; then
# When building a shared libctf, link against the pic version of libiberty
# so that apps that use libctf won't need libiberty just to satisfy any
-# libctf references.
-# We can't do that if a pic libiberty is unavailable since including non-pic
-# code would insert text relocations into libctf.
+# libctf references. We can't do that if a pic libiberty is unavailable
+# since including non-pic # code would insert text relocations into libctf.
# Note that linking against libbfd as we do here, which is itself linked
# against libiberty, may not satisfy all the libctf libiberty references
# since libbfd may not pull in the entirety of libiberty.
+# Also, jam libintl into the right place in all of this: after libiberty,
+# which uses it, but before -lcygwin, which it uses.
x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
if test -n "$x"; then
CTF_LIBADD="-L`pwd`/../libiberty/pic -liberty"
fi
+fi
+
+CTF_LIBADD="$CTF_LIBADD $LIBINTL"
+if test "$enable_shared" = "yes"; then
case "${host}" in
# More hacks to build DLLs on Windows.
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- CTF_LIBADD="$CTF_LIBADD -L`pwd`/../intl -lintl -lcygwin"
+ CTF_LIBADD="$CTF_LIBADD -lcygwin"
;;
esac
fi
diff --git a/libctf/configure.ac b/libctf/configure.ac
index c3fea731ea8..ef00efe1fe1 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -169,31 +169,36 @@ if test $ac_cv_libctf_macro_O_CLOEXEC = yes; then
[Whether the platform has a definition of O_CLOEXEC.])
fi
-# Horrible hacks to build DLLs on Windows and a shared library elsewhere.
-
CTF_LIBADD="-L`pwd`/../libiberty -liberty"
SHARED_LDFLAGS=
+
+# Horrible hacks to build DLLs on Windows and a shared library elsewhere.
if test "$enable_shared" = "yes"; then
# When building a shared libctf, link against the pic version of libiberty
# so that apps that use libctf won't need libiberty just to satisfy any
-# libctf references.
-# We can't do that if a pic libiberty is unavailable since including non-pic
-# code would insert text relocations into libctf.
+# libctf references. We can't do that if a pic libiberty is unavailable
+# since including non-pic # code would insert text relocations into libctf.
# Note that linking against libbfd as we do here, which is itself linked
# against libiberty, may not satisfy all the libctf libiberty references
# since libbfd may not pull in the entirety of libiberty.
+# Also, jam libintl into the right place in all of this: after libiberty,
+# which uses it, but before -lcygwin, which it uses.
changequote(,)dnl
x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
changequote([,])dnl
if test -n "$x"; then
CTF_LIBADD="-L`pwd`/../libiberty/pic -liberty"
fi
+fi
+
+CTF_LIBADD="$CTF_LIBADD $LIBINTL"
+if test "$enable_shared" = "yes"; then
case "${host}" in
# More hacks to build DLLs on Windows.
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- CTF_LIBADD="$CTF_LIBADD -L`pwd`/../intl -lintl -lcygwin"
+ CTF_LIBADD="$CTF_LIBADD -lcygwin"
;;
esac
fi
diff --git a/opcodes/configure b/opcodes/configure
index a0934e14421..d17d2543fb7 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -12798,15 +12798,21 @@ if test "$enable_shared" = "yes"; then
# Note that linking against libbfd as we do here, which is itself linked
# against libiberty, may not satisfy all the libopcodes libiberty references
# since libbfd may not pull in the entirety of libiberty.
+# Also, jam libintl into the right place in all of this: after libiberty,
+# which uses it, but before -lcygwin, which it uses.
x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
if test -n "$x"; then
SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
fi
+fi
+
+SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
+if test "$enable_shared" = "yes"; then
case "${host}" in
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
+ SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
;;
*-*-darwin*)
SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"
diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index 21929796fef..c19d2f8c958 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -166,17 +166,23 @@ if test "$enable_shared" = "yes"; then
# Note that linking against libbfd as we do here, which is itself linked
# against libiberty, may not satisfy all the libopcodes libiberty references
# since libbfd may not pull in the entirety of libiberty.
+# Also, jam libintl into the right place in all of this: after libiberty,
+# which uses it, but before -lcygwin, which it uses.
changequote(,)dnl
x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
changequote([,])dnl
if test -n "$x"; then
SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
fi
+fi
+
+SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
+if test "$enable_shared" = "yes"; then
case "${host}" in
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
+ SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
;;
*-*-darwin*)
SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 5/8] bfd, opcodes, libctf: support --with-included-gettext
2021-02-08 11:16 ` [PATCH 5/8] bfd, opcodes, libctf: support --with-included-gettext Nick Alcock
@ 2021-02-10 8:06 ` Alan Modra
0 siblings, 0 replies; 16+ messages in thread
From: Alan Modra @ 2021-02-10 8:06 UTC (permalink / raw)
To: Nick Alcock; +Cc: binutils
On Mon, Feb 08, 2021 at 11:16:32AM +0000, Nick Alcock via Binutils wrote:
> bfd/ChangeLog
> 2021-02-03 Nick Alcock <nick.alcock@oracle.com>
>
> * configure.ac (SHARED_LIBADD): Remove explicit -lintl population in
> favour of LIBINTL.
> * configure: Regenerated.
>
> libctf/ChangeLog
> 2021-02-02 Nick Alcock <nick.alcock@oracle.com>
>
> * configure.ac (CTF_LIBADD): Remove explicit -lintl population in
> favour of LIBINTL.
> * Makefile.am (libctf_nobfd_la_LIBADD): No longer explicitly
> include $(LIBINTL).
> (check-DEJAGNU): Pass down to tests as well.
> * configure: Regenerated.
> * Makefile.in: Likewise.
>
> opcodes/ChangeLog
> 2021-02-04 Nick Alcock <nick.alcock@oracle.com>
>
> * configure.ac (SHARED_LIBADD): Remove explicit -lintl population in
> favour of LIBINTL.
> * configure: Regenerated.
OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 6/8] gdbserver: explicitly include gettext, etc in inprocess agent
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
` (4 preceding siblings ...)
2021-02-08 11:16 ` [PATCH 5/8] bfd, opcodes, libctf: support --with-included-gettext Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
2021-02-08 19:51 ` Tom Tromey
2021-02-08 11:16 ` [PATCH 7/8] libctf: require a Tcl capable of try/catch to run tests Nick Alcock
2021-02-08 11:16 ` [PATCH 8/8] libctf: add missing header in BFD ELF check Nick Alcock
7 siblings, 1 reply; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils; +Cc: gdb-patches
The IPA uses gettext functionality, but does not link to $(LIBINTL), so
fails to link when --with-included-gettext is specified.
Now we are unconditionally building a PIC libintl, linking to $(LIBINTL)
gives us the right result even if a non-system libintl is in use.
Cc: gdb-patches@sourceware.org
gdbserver/ChangeLog
2021-02-02 Nick Alcock <nick.alcock@oracle.com>
* Makefile.in (IPA_LIB): Link with libintl.
---
gdbserver/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index a14d3a7bc18..4a5ceab085a 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -404,7 +404,7 @@ $(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
$(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
-Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
$(CXXFLAGS) \
- -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread
+ -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) $(INTL) -ldl -pthread
# Put the proper machine-specific files first, so M-. on a machine
# specific routine gets the one for the correct machine.
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/8] gdbserver: explicitly include gettext, etc in inprocess agent
2021-02-08 11:16 ` [PATCH 6/8] gdbserver: explicitly include gettext, etc in inprocess agent Nick Alcock
@ 2021-02-08 19:51 ` Tom Tromey
2021-02-08 20:51 ` Nick Alcock
0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2021-02-08 19:51 UTC (permalink / raw)
To: Nick Alcock via Binutils; +Cc: Nick Alcock, gdb-patches
>>>>> "Nick" == Nick Alcock via Binutils <binutils@sourceware.org> writes:
Nick> The IPA uses gettext functionality, but does not link to $(LIBINTL), so
Nick> fails to link when --with-included-gettext is specified.
This seems strange to me.
IIUC, IPA is intended to be a small library that is injected into the
inferior. So, it seems to me that it should probably not use gettext.
Tom
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/8] gdbserver: explicitly include gettext, etc in inprocess agent
2021-02-08 19:51 ` Tom Tromey
@ 2021-02-08 20:51 ` Nick Alcock
2021-02-10 13:33 ` Nick Alcock
0 siblings, 1 reply; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 20:51 UTC (permalink / raw)
To: Tom Tromey; +Cc: Nick Alcock via Binutils, gdb-patches
On 8 Feb 2021, Tom Tromey stated:
>>>>>> "Nick" == Nick Alcock via Binutils <binutils@sourceware.org> writes:
>
> Nick> The IPA uses gettext functionality, but does not link to $(LIBINTL), so
> Nick> fails to link when --with-included-gettext is specified.
>
> This seems strange to me.
>
> IIUC, IPA is intended to be a small library that is injected into the
> inferior. So, it seems to me that it should probably not use gettext.
CXXLD libinproctrace.so
/usr/bin/ld: ax-ipa.o: in function `ax_printf(unsigned long, unsigned long, char const*, int, unsigned long*) [clone .constprop.0]':
/home/oranix/oracle/private/binutils-gdb/x86_64-loom/gdbserver/../../gdbserver/ax.cc:928: undefined reference to `libintl_gettext'
/usr/bin/ld: /home/oranix/oracle/private/binutils-gdb/x86_64-loom/gdbserver/../../gdbserver/ax.cc:837: undefined reference to `libintl_gettext'
/usr/bin/ld: /home/oranix/oracle/private/binutils-gdb/x86_64-loom/gdbserver/../../gdbserver/ax.cc:889: undefined reference to `libintl_gettext'
/usr/bin/ld: ax-ipa.o: in function `gdb_eval_agent_expr(eval_agent_expr_context*, agent_expr*, unsigned long*)':
/home/oranix/oracle/private/binutils-gdb/x86_64-loom/gdbserver/../../gdbserver/ax.cc:1334: undefined reference to `libintl_gettext'
/usr/bin/ld: gdbsupport/common-utils-ipa.o: in function `xstrvprintf(char const*, __va_list_tag*)':
/home/oranix/oracle/private/binutils-gdb/x86_64-loom/gdbserver/../../gdbserver/../gdbsupport/common-utils.cc:57: undefined reference to `libintl_gettext'
/usr/bin/ld: gdbsupport/common-utils-ipa.o:/home/oranix/oracle/private/binutils-gdb/x86_64-loom/gdbserver/../../gdbserver/../gdbsupport/common-utils.cc:57: more undefined references to `libintl_gettext' follow
collect2: error: ld returned 1 exit status
There are four translated errors in ax.cc... but if you fix those you
find more uses in ../gdbsupport/common-utils.cc and then that calls
gdb_assert which also translates the assertion string and this is
starting to feel like a tail-chasing nightmare where fixing it would do
significant damage to the translatability of GDB itself.
Maybe some sort of -include hackery that redefines _ to nothing would do
the trick, or something to unconditionally disable NLS and recompile
everything it calls upon out of gdbsupport similarly just for the IPA...
but I tried for a while and haven't succeeded yet.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/8] gdbserver: explicitly include gettext, etc in inprocess agent
2021-02-08 20:51 ` Nick Alcock
@ 2021-02-10 13:33 ` Nick Alcock
0 siblings, 0 replies; 16+ messages in thread
From: Nick Alcock @ 2021-02-10 13:33 UTC (permalink / raw)
To: binutils; +Cc: Tom Tromey, gdb-patches
On 8 Feb 2021, Nick Alcock via Binutils verbalised:
> On 8 Feb 2021, Tom Tromey stated:
>
>>>>>>> "Nick" == Nick Alcock via Binutils <binutils@sourceware.org> writes:
>>
>> Nick> The IPA uses gettext functionality, but does not link to $(LIBINTL), so
>> Nick> fails to link when --with-included-gettext is specified.
>>
>> This seems strange to me.
>>
>> IIUC, IPA is intended to be a small library that is injected into the
>> inferior. So, it seems to me that it should probably not use gettext.
FYI: I do agree with this, but it seems to me that this is a distinct
(and much larger) patch from this one, which is merely making its
existing use of gettext explicit (so it doesn't break the build under
--with-included-gettext).
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 7/8] libctf: require a Tcl capable of try/catch to run tests
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
` (5 preceding siblings ...)
2021-02-08 11:16 ` [PATCH 6/8] gdbserver: explicitly include gettext, etc in inprocess agent Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
2021-02-08 11:16 ` [PATCH 8/8] libctf: add missing header in BFD ELF check Nick Alcock
7 siblings, 0 replies; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils
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.
---
libctf/Makefile.am | 2 ++
libctf/Makefile.in | 84 ++++++++++++++++++++++++++-------------------
libctf/configure | 66 +++++++++++++++++++++++++++++++++++
libctf/configure.ac | 9 +++++
4 files changed, 125 insertions(+), 36 deletions(-)
diff --git a/libctf/Makefile.am b/libctf/Makefile.am
index 908564c35cb..03fd6cce0e0 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 17a9a7f32ba..7e0dd0912bc 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 bef55bb8cc5..fcd555ab1e3 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -13391,6 +13391,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 +13614,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 ef00efe1fe1..c6b80442e07 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
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 8/8] libctf: add missing header in BFD ELF check
2021-02-08 11:16 [PATCH 0/8 RFC] unbreak --with-included-gettext, and other configury stuff Nick Alcock
` (6 preceding siblings ...)
2021-02-08 11:16 ` [PATCH 7/8] libctf: require a Tcl capable of try/catch to run tests Nick Alcock
@ 2021-02-08 11:16 ` Nick Alcock
7 siblings, 0 replies; 16+ messages in thread
From: Nick Alcock @ 2021-02-08 11:16 UTC (permalink / raw)
To: binutils
Without this, GCC warns:
In file included from conftest.c:36:
../../libctf/../bfd/elf-bfd.h: In function 'bfd_section_is_ctf':
../../libctf/../bfd/elf-bfd.h:3089:10: warning: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration]
3089 | return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.');
| ^~~~~~~
../../libctf/../bfd/elf-bfd.h:3089:33: warning: 'strncmp' argument 3 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
3089 | return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.');
| ^
<built-in>: note: built-in 'strncmp' declared here
These warnings do not currently throw off the result of the configure
check, but it's better to squash them anyway.
libctf/ChangeLog
2021-02-03 Nick Alcock <nick.alcock@oracle.com>
* configure.ac (ac_cv_libctf_bfd_elf): Include string.h.
* configure: Regenerated.
---
libctf/configure | 8 ++++++--
libctf/configure.ac | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/libctf/configure b/libctf/configure
index fcd555ab1e3..d5b78611574 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
@@ -12872,6 +12875,7 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
+ #include <string.h>
#include "bfd.h"
#include "elf-bfd.h"
int
diff --git a/libctf/configure.ac b/libctf/configure.ac
index c6b80442e07..90e3c437d60 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -88,6 +88,7 @@ intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
LIBS="-lbfd -liberty -lz $intl $LIBS"
AC_CACHE_CHECK([for ELF support in BFD], ac_cv_libctf_bfd_elf,
[AC_TRY_LINK([#include <stdlib.h>
+ #include <string.h>
#include "bfd.h"
#include "elf-bfd.h"],
[(void) bfd_section_from_elf_index (NULL, 0);
--
2.30.0.252.gc27e85e57d
^ permalink raw reply [flat|nested] 16+ messages in thread