comparison m4/acinclude.m4 @ 29746:7f339da6cabd

avoid possible gcc warning about C++ one definition rule (bug #60586) * acinclude.m4 (OCTAVE_PROG_BISON): Also check whether api.prefix applies to yysymbol_kind_t in the files that bison generates. If so, substitute new variables, OCTAVE_PARSER_CPPFLAGS and OCTAVE_TEX_PARSER_CPPFLAGS. * libinterp/corefcn/module.mk (%canon_reldir%_libcorefcn_la_CPPFLAGS): Add $(OCTAVE_TEX_PARSER_CPPFLAGS) to the list. * libinterp/parse-tree/module.mk (%canon_reldir%_libparse_tree_la_CPPFLAGS): Add $(OCTAVE_PARSER_CPPFLAGS) to the list.
author John W. Eaton <jwe@octave.org>
date Tue, 08 Jun 2021 15:49:37 -0400
parents 5811df727e96
children e0fded8bd7bb
comparison
equal deleted inserted replaced
29745:6c76819255cb 29746:7f339da6cabd
3219 break 3219 break
3220 fi 3220 fi
3221 done 3221 done
3222 rm -f conftest.yy y.tab.h y.tab.c 3222 rm -f conftest.yy y.tab.h y.tab.c
3223 ]) 3223 ])
3224
3225 AC_CACHE_CHECK([whether api.prefix applies to yysymbol_kind_t],
3226 [octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t], [
3227 [case "$octave_cv_bison_api_prefix_decl_style" in
3228 "api brace")
3229 def='%define api.prefix {PREFIX_}'
3230 ;;
3231 "api quote")
3232 def='%define api.prefix "PREFIX_"'
3233 ;;
3234 "name brace")
3235 def='%define name-prefix {PREFIX_}'
3236 ;;
3237 "name quote")
3238 def='%define name-prefix "PREFIX_"'
3239 ;;
3240 esac]
3241 cat << EOF > conftest.yy
3242 $def
3243 %start input
3244 %%
3245 input:;
3246 %%
3247 EOF
3248 ## Older versions of bison only warn and exit with success.
3249 $YACC $WARN_YFLAGS conftest.yy
3250 if grep PREFIX_symbol_kind_t y.tab.c > /dev/null; then
3251 octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t=yes
3252 else
3253 octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t=no
3254 fi
3255 rm -f conftest.yy y.tab.h y.tab.c
3256 ])
3224 fi 3257 fi
3225 3258
3226 if test -z "$octave_cv_bison_api_prefix_decl_style" \ 3259 if test -z "$octave_cv_bison_api_prefix_decl_style" \
3227 || test "$octave_cv_bison_api_prefix_decl_style" != "api brace"; then 3260 || test "$octave_cv_bison_api_prefix_decl_style" != "api brace"; then
3228 tmp_have_bison=no 3261 tmp_have_bison=no
3243 support all the features that are required, but it's only a problem 3276 support all the features that are required, but it's only a problem
3244 if you need to reconstruct parse.cc, which is the case if you're 3277 if you need to reconstruct parse.cc, which is the case if you're
3245 building from VCS sources. 3278 building from VCS sources.
3246 " 3279 "
3247 OCTAVE_CONFIGURE_WARNING([warn_bison]) 3280 OCTAVE_CONFIGURE_WARNING([warn_bison])
3248 fi 3281
3282 fi
3283 if test "$octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t" = no; then
3284 OCTAVE_PARSER_CPPFLAGS="-Dyysymbol_kind_t=octave_symbol_kind_t"
3285 OCTAVE_TEX_PARSER_CPPFLAGS="-Dyysymbol_kind_t=octave_tex_symbol_kind_t"
3286 fi
3287 AC_SUBST(OCTAVE_PARSER_CPPFLAGS)
3288 AC_SUBST(OCTAVE_TEX_PARSER_CPPFLAGS)
3249 AC_SUBST(WARN_YFLAGS) 3289 AC_SUBST(WARN_YFLAGS)
3250 ]) 3290 ])
3251 dnl 3291 dnl
3252 dnl Find find program. 3292 dnl Find find program.
3253 dnl 3293 dnl