From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by sourceware.org (Postfix) with ESMTPS id 33A533857C43 for ; Fri, 21 Aug 2020 13:07:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 33A533857C43 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x343.google.com with SMTP id c19so1235335wmd.1 for ; Fri, 21 Aug 2020 06:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=brT0E/hs5euBwHiOmxf/M5sergBOK1KRP2J8L3QfXJw=; b=CTPPEZ6ndylAzKogPQgfxTmzV+TfJuSDqxpCWHvzoXRfv5Kn/6ZlY0y/KagaCIZnH3 fEL/6vUu4FKsLQCmUD9mgHJhD5serfhuVp9JiHqzX7JPNL8hPLr4irrkqJbVJM5LkBp5 Bp+zOPW9EfGP8MnjdnJuuPDzoIjBeDU6RgWZrQcMXhaPoIq8rpFGxqIBaoGvMGqzWBWg UJ2kh0LrvQ9uM0Y4SwqMjUlE60CyiSRtrwM+KwKvPh5v/W6vB+bPzbr+6M6gUtkjOGdE sHl+TLMLSiIQ8hAiOsMyPWwc6/Pfrt75kCpbs9+0iziFuXAnpxs7ig0e2RiIf4Rh5aOS lo2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=brT0E/hs5euBwHiOmxf/M5sergBOK1KRP2J8L3QfXJw=; b=XKtrU7eT5bG8jS2fzIJUh08w1qIo4+3/arjas566mInPnEdA6l/Cy7MQdxL2Cuksz1 B6fEZWqXR3X4ulffYhrV/x6+8rmbAvgkDlHeE5CDH6NHFaTpjKEJMT366LGOrY66v2F+ inYAOX37AXV9SFz1qzYmeA6HOFgGeP2ah3l/sMXUIoHSczvb3b+J0p3oFvZS4TnstoW0 GhjSDbzUb2TYgJD5oH6mzuiGDkXFOQvXgh4iKEKAFby/pbbMWVfd8JgABriYR/byl3ZW y+i8CtUmXoi63f+L/RgoPMsYFjDZFnPqlT8SSR+GDKVsBE5BRfq7mz+T4VRFmqqOdklm NPhQ== X-Gm-Message-State: AOAM5337sgZkvOj5OTllatK3MfEB07WwPEO/RqmNP+jBrbQCW/a03JNB v3JbCrmKxILjnPpe1ka7Uwl2nw== X-Google-Smtp-Source: ABdhPJyP5Is/WnxU2l6uzAWnS1OmFYPg5VLvPTtP5z3uBS3OhksY5516LS7dXEY2OP39cJFNREqX9w== X-Received: by 2002:a1c:a74e:: with SMTP id q75mr278592wme.81.1598015242830; Fri, 21 Aug 2020 06:07:22 -0700 (PDT) Received: from localhost (host86-140-92-120.range86-140.btcentralplus.com. [86.140.92.120]) by smtp.gmail.com with ESMTPSA id n12sm4588819wrq.63.2020.08.21.06.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 06:07:21 -0700 (PDT) Date: Fri, 21 Aug 2020 14:07:20 +0100 From: Andrew Burgess To: Simon Marchi Cc: Simon Marchi , Andreas Schwab , Sebastian Huber , gdb@sourceware.org Subject: Re: [PATCH] sim/bfin: include config/pkg.m4 in configure.ac (was: Patch "Run `autoreconf -vf` throughout" broke the rtems-bfin build on FreeBSD) Message-ID: <20200821130720.GB1774844@embecosm.com> References: <3db0603d-659f-40c5-d61d-d94fabfd646e@embedded-brains.de> <1701e3af-7bcd-e268-65d3-dbd5f37e9bce@embedded-brains.de> <2666e1b8-9b16-b988-aefb-22af4a969240@simark.ca> <87pn7ll9f7.fsf@igel.home> <6088a876-225e-151c-afe1-afa4255314bf@simark.ca> <2f448bb2-849c-6df0-b3c5-322f34417887@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f448bb2-849c-6df0-b3c5-322f34417887@efficios.com> X-Operating-System: Linux/5.6.15-200.fc31.x86_64 (x86_64) X-Uptime: 14:06:53 up 33 days, 22:21, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 13:07:28 -0000 * Simon Marchi [2020-08-20 10:04:33 -0400]: > On 2020-08-20 9:45 a.m., Simon Marchi wrote: > > On 2020-08-20 9:43 a.m., Andreas Schwab wrote: > >> That's because aclocal cannot find a definition of PKG_CHECK_MODULES. > >> You need to run autoreconf with -I ../../config. > > > > Indeed, that's what I found in the end. Though I'll propose a patch that > > adds the required include to configure.ac. > > Here's the patch: > > From 45dce782e0a999efb892588885fc4c7f7e2e0868 Mon Sep 17 00:00:00 2001 > From: Simon Marchi > Date: Thu, 20 Aug 2020 09:31:49 -0400 > Subject: [PATCH] sim/bfin: include config/pkg.m4 in configure.ac > > When trying to re-generate configure in sim/bfin, I get: > > $ autoreconf -vf > autoreconf: Entering directory `.' > autoreconf: configure.ac: not using Gettext > autoreconf: running: aclocal --force > autoreconf: configure.ac: tracing > autoreconf: configure.ac: not running libtoolize: --install not given > autoreconf: running: /opt/autostuff/bin/autoconf --force > configure.ac:57: error: possibly undefined macro: AC_CHECK_LIB > If this token and others are legitimate, please use m4_pattern_allow. > See the Autoconf documentation. > autoreconf: /opt/autostuff/bin/autoconf failed with exit status: 1 > > This happens since commit f693213d126a ("Run `autoreconf -vf` throughout"). > > The problem (not clear from the error message) is that the > PKG_CHECK_MODULES macro used in configure.ac is undefined. In the past, I > suppose that it relied on the person running autoconf having pkg.m4 (from > pkg-config) in their include path. That's not my case. > > Since we recently added a local version of PKG_CHECK_MODULES to our tree, > we can just make sim/bfin/configure.ac use it. This patch makes > configure.ac include config/pkg.m4, and re-generates configure. With this, > the configure script appears to be generated correctly, I am able to > configure and build the bfin simulator. > > Note: using sinclude to include the required m4 files makes no sense to > me. These files contain macros we need, if they are not defined then > the resulting file is unusable. And sinclude fails silently if the file > is not found. So, better use include/m4_include. > > sim/bfin/ChangeLog: > > * configure.ac: Include config/pkg.m4. > > Change-Id: I7d8012e5ed510cd7746b94e918f0feb1c701cd83 > --- > sim/bfin/configure | 305 ++++++++++++++++++++++++++++++++++++++++-- > sim/bfin/configure.ac | 1 + > 2 files changed, 298 insertions(+), 8 deletions(-) I'm no autoconf expert, but it looks reasonable to me. Thanks, Andrew > > diff --git a/sim/bfin/configure b/sim/bfin/configure > index d3aed28eaca2..9f0b46e11110 100755 > --- a/sim/bfin/configure > +++ b/sim/bfin/configure > @@ -634,6 +634,9 @@ LIBOBJS > cgen_breaks > SDL_LIBS > SDL_CFLAGS > +PKG_CONFIG_LIBDIR > +PKG_CONFIG_PATH > +PKG_CONFIG > REPORT_BUGS_TEXI > REPORT_BUGS_TO > PKGVERSION > @@ -797,7 +800,12 @@ CFLAGS > LDFLAGS > LIBS > CPPFLAGS > -CPP' > +CPP > +PKG_CONFIG > +PKG_CONFIG_PATH > +PKG_CONFIG_LIBDIR > +SDL_CFLAGS > +SDL_LIBS' > > > # Initialize some variables set by options. > @@ -1471,6 +1479,13 @@ Some influential environment variables: > CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if > you have headers in a nonstandard directory > CPP C preprocessor > + PKG_CONFIG path to pkg-config utility > + PKG_CONFIG_PATH > + directories to add to pkg-config's search path > + PKG_CONFIG_LIBDIR > + path overriding pkg-config's built-in search path > + SDL_CFLAGS C compiler flags for SDL, overriding pkg-config > + SDL_LIBS linker flags for SDL, overriding pkg-config > > Use these variables to override the choices made by `configure' or to help > it to find libraries and programs with nonstandard names/locations. > @@ -4171,6 +4186,26 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu > > > > + > + > + > + > +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- > +# serial 12 (pkg-config-0.29.2) > + > + > + > + > + > + > + > + > + > + > + > + > + > + > > > > @@ -12887,7 +12922,7 @@ else > lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 > lt_status=$lt_dlunknown > cat > conftest.$ac_ext <<_LT_EOF > -#line 12890 "configure" > +#line 12925 "configure" > #include "confdefs.h" > > #if HAVE_DLFCN_H > @@ -12993,7 +13028,7 @@ else > lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 > lt_status=$lt_dlunknown > cat > conftest.$ac_ext <<_LT_EOF > -#line 12996 "configure" > +#line 13031 "configure" > #include "confdefs.h" > > #if HAVE_DLFCN_H > @@ -13926,13 +13961,267 @@ fi > done > > > -PKG_PROG_PKG_CONFIG > -PKG_CHECK_MODULES(SDL, sdl, > - AC_CHECK_LIB(dl, dlopen, [ > + > + > + > + > + > + > + > +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then > + if test -n "$ac_tool_prefix"; then > + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. > +set dummy ${ac_tool_prefix}pkg-config; 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_PKG_CONFIG+:} false; then : > + $as_echo_n "(cached) " >&6 > +else > + case $PKG_CONFIG in > + [\\/]* | ?:[\\/]*) > + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # 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_PKG_CONFIG="$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 > +PKG_CONFIG=$ac_cv_path_PKG_CONFIG > +if test -n "$PKG_CONFIG"; then > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 > +$as_echo "$PKG_CONFIG" >&6; } > +else > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > +$as_echo "no" >&6; } > +fi > + > + > +fi > +if test -z "$ac_cv_path_PKG_CONFIG"; then > + ac_pt_PKG_CONFIG=$PKG_CONFIG > + # Extract the first word of "pkg-config", so it can be a program name with args. > +set dummy pkg-config; 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_ac_pt_PKG_CONFIG+:} false; then : > + $as_echo_n "(cached) " >&6 > +else > + case $ac_pt_PKG_CONFIG in > + [\\/]* | ?:[\\/]*) > + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # 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_ac_pt_PKG_CONFIG="$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 > +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG > +if test -n "$ac_pt_PKG_CONFIG"; then > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 > +$as_echo "$ac_pt_PKG_CONFIG" >&6; } > +else > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > +$as_echo "no" >&6; } > +fi > + > + if test "x$ac_pt_PKG_CONFIG" = x; then > + PKG_CONFIG="" > + else > + case $cross_compiling:$ac_tool_warned in > +yes:) > +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 > +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} > +ac_tool_warned=yes ;; > +esac > + PKG_CONFIG=$ac_pt_PKG_CONFIG > + fi > +else > + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" > +fi > + > +fi > +if test -n "$PKG_CONFIG"; then > + _pkg_min_version=0.9.0 > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 > +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } > + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > + else > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > +$as_echo "no" >&6; } > + PKG_CONFIG="" > + fi > +fi > + > +pkg_failed=no > +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl" >&5 > +$as_echo_n "checking for sdl... " >&6; } > + > +if test -n "$SDL_CFLAGS"; then > + pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" > + elif test -n "$PKG_CONFIG"; then > + if test -n "$PKG_CONFIG" && \ > + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl\""; } >&5 > + ($PKG_CONFIG --exists --print-errors "sdl") 2>&5 > + ac_status=$? > + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > + test $ac_status = 0; }; then > + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl" 2>/dev/null` > + test "x$?" != "x0" && pkg_failed=yes > +else > + pkg_failed=yes > +fi > + else > + pkg_failed=untried > +fi > +if test -n "$SDL_LIBS"; then > + pkg_cv_SDL_LIBS="$SDL_LIBS" > + elif test -n "$PKG_CONFIG"; then > + if test -n "$PKG_CONFIG" && \ > + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl\""; } >&5 > + ($PKG_CONFIG --exists --print-errors "sdl") 2>&5 > + ac_status=$? > + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > + test $ac_status = 0; }; then > + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl" 2>/dev/null` > + test "x$?" != "x0" && pkg_failed=yes > +else > + pkg_failed=yes > +fi > + else > + pkg_failed=untried > +fi > + > +if test $pkg_failed = no; then > + pkg_save_LDFLAGS="$LDFLAGS" > + LDFLAGS="$LDFLAGS $pkg_cv_SDL_LIBS" > + cat confdefs.h - <<_ACEOF >conftest.$ac_ext > +/* end confdefs.h. */ > + > +int > +main () > +{ > + > + ; > + return 0; > +} > +_ACEOF > +if ac_fn_c_try_link "$LINENO"; then : > + > +else > + pkg_failed=yes > +fi > +rm -f core conftest.err conftest.$ac_objext \ > + conftest$ac_exeext conftest.$ac_ext > + LDFLAGS=$pkg_save_LDFLAGS > +fi > + > + > + > +if test $pkg_failed = yes; then > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > +$as_echo "no" >&6; } > + > +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then > + _pkg_short_errors_supported=yes > +else > + _pkg_short_errors_supported=no > +fi > + if test $_pkg_short_errors_supported = yes; then > + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sdl" 2>&1` > + else > + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sdl" 2>&1` > + fi > + # Put the nasty error message in config.log where it belongs > + echo "$SDL_PKG_ERRORS" >&5 > + > + : > +elif test $pkg_failed = untried; then > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > +$as_echo "no" >&6; } > + : > +else > + SDL_CFLAGS=$pkg_cv_SDL_CFLAGS > + SDL_LIBS=$pkg_cv_SDL_LIBS > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > + > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 > +$as_echo_n "checking for dlopen in -ldl... " >&6; } > +if ${ac_cv_lib_dl_dlopen+:} false; then : > + $as_echo_n "(cached) " >&6 > +else > + ac_check_lib_save_LIBS=$LIBS > +LIBS="-ldl $LIBS" > +cat confdefs.h - <<_ACEOF >conftest.$ac_ext > +/* end confdefs.h. */ > + > +/* Override any GCC internal prototype to avoid an error. > + Use char because int might match the return type of a GCC > + builtin and then its argument prototype would still apply. */ > +#ifdef __cplusplus > +extern "C" > +#endif > +char dlopen (); > +int > +main () > +{ > +return dlopen (); > + ; > + return 0; > +} > +_ACEOF > +if ac_fn_c_try_link "$LINENO"; then : > + ac_cv_lib_dl_dlopen=yes > +else > + ac_cv_lib_dl_dlopen=no > +fi > +rm -f core conftest.err conftest.$ac_objext \ > + conftest$ac_exeext conftest.$ac_ext > +LIBS=$ac_check_lib_save_LIBS > +fi > +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 > +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } > +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : > + > SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL" > SDL_LIBS="-ldl" > - ], [SDL_CFLAGS= SDL_LIBS=]) > - , :) > + > +else > + SDL_CFLAGS= SDL_LIBS= > +fi > + > + > +fi > > > > diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac > index 44b9952c75b8..47bacb1c0d2e 100644 > --- a/sim/bfin/configure.ac > +++ b/sim/bfin/configure.ac > @@ -1,6 +1,7 @@ > dnl Process this file with autoconf to produce a configure script. > AC_INIT(Makefile.in) > sinclude(../common/acinclude.m4) > +m4_include([../../config/pkg.m4]) > > SIM_AC_COMMON > > -- > 2.28.0 > >