public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] gdb: AC_INIT should be called with package and version arguments
@ 2021-11-23 14:16 Enze Li
  2021-11-23 15:06 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Enze Li @ 2021-11-23 14:16 UTC (permalink / raw)
  To: gdb-patches, brobecker, simon.marchi

This patch adds package and version parameters to AC_INIT and
regenerates the configure script.

When we execute the ". /configure --version",

Before the patch:
--------------------------------------------------------------------
configure
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
--------------------------------------------------------------------

With the patch:
--------------------------------------------------------------------
gdb configure 12.0.50.20211123-git
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
--------------------------------------------------------------------

Tested on x86_64-linux.

gdb/
	* version.m4: New file.
	* configure.ac: Include version.m4.
	(AC_INIT): Update.
	* configure: Regenerate.
---
 gdb/configure    | 33 ++++++++++++++++++---------------
 gdb/configure.ac |  4 +++-
 gdb/version.m4   |  3 +++
 3 files changed, 24 insertions(+), 16 deletions(-)
 create mode 100644 gdb/version.m4

diff --git a/gdb/configure b/gdb/configure
index fe685f2d3d5..b827af0ca12 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69.
+# Generated by GNU Autoconf 2.69 for gdb 12.0.50.20211123-git.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -575,12 +575,12 @@ MFLAGS=
 MAKEFLAGS=
 
 # Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
+PACKAGE_NAME='gdb'
+PACKAGE_TARNAME='gdb'
+PACKAGE_VERSION='12.0.50.20211123-git'
+PACKAGE_STRING='gdb 12.0.50.20211123-git'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
 
 ac_unique_file="main.c"
 # Factoring default headers for most tests.
@@ -1000,7 +1000,7 @@ sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
 infodir='${datarootdir}/info'
 htmldir='${docdir}'
 dvidir='${docdir}'
@@ -1500,7 +1500,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
+\`configure' configures gdb 12.0.50.20211123-git to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1548,7 +1548,7 @@ Fine tuning of the installation directories:
   --infodir=DIR           info documentation [DATAROOTDIR/info]
   --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
-  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/gdb]
   --htmldir=DIR           html documentation [DOCDIR]
   --dvidir=DIR            dvi documentation [DOCDIR]
   --pdfdir=DIR            pdf documentation [DOCDIR]
@@ -1574,7 +1574,9 @@ _ACEOF
 fi
 
 if test -n "$ac_init_help"; then
-
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of gdb 12.0.50.20211123-git:";;
+   esac
   cat <<\_ACEOF
 
 Optional Features:
@@ -1784,7 +1786,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-configure
+gdb configure 12.0.50.20211123-git
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2640,7 +2642,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by $as_me, which was
+It was created by gdb $as_me 12.0.50.20211123-git, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2996,6 +2998,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
 ac_config_headers="$ac_config_headers config.h:config.in"
 
 
@@ -20493,7 +20496,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by $as_me, which was
+This file was extended by gdb $as_me 12.0.50.20211123-git, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20563,7 +20566,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-config.status
+gdb config.status 12.0.50.20211123-git
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 56e8a2d8044..9ed129cabcd 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -18,7 +18,9 @@ dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT
+m4_include(version.m4)
+AC_INIT([gdb], GDB_VERSION)
+
 AC_CONFIG_MACRO_DIRS([../config])
 AC_CONFIG_SRCDIR([main.c])
 AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
diff --git a/gdb/version.m4 b/gdb/version.m4
new file mode 100644
index 00000000000..e7a4226dd39
--- /dev/null
+++ b/gdb/version.m4
@@ -0,0 +1,3 @@
+m4_define([DAY], m4_esyscmd(date "+%Y%m%d" | tr -d "\n"))
+m4_define([GDB_VERSION], m4_esyscmd(cat version.in | sed "s/DATE/DAY/g" | tr -d "\n"))
+m4_undefine([DAY])
-- 
2.33.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] gdb: AC_INIT should be called with package and version arguments
  2021-11-23 14:16 [PATCH v2] gdb: AC_INIT should be called with package and version arguments Enze Li
@ 2021-11-23 15:06 ` Andreas Schwab
  2021-11-25 16:20   ` Enze Li
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2021-11-23 15:06 UTC (permalink / raw)
  To: Enze Li via Gdb-patches; +Cc: brobecker, simon.marchi, Enze Li

On Nov 23 2021, Enze Li via Gdb-patches wrote:

> diff --git a/gdb/version.m4 b/gdb/version.m4
> new file mode 100644
> index 00000000000..e7a4226dd39
> --- /dev/null
> +++ b/gdb/version.m4
> @@ -0,0 +1,3 @@
> +m4_define([DAY], m4_esyscmd(date "+%Y%m%d" | tr -d "\n"))
> +m4_define([GDB_VERSION], m4_esyscmd(cat version.in | sed "s/DATE/DAY/g" | tr -d "\n"))
> +m4_undefine([DAY])

That should produce the same version as written in gdb/version.c.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] gdb: AC_INIT should be called with package and version arguments
  2021-11-23 15:06 ` Andreas Schwab
@ 2021-11-25 16:20   ` Enze Li
  2021-11-25 17:30     ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Enze Li @ 2021-11-25 16:20 UTC (permalink / raw)
  To: Andreas Schwab, Enze Li via Gdb-patches; +Cc: brobecker, simon.marchi

Hi Andreas,

Thanks for the review.

I thought I'd do some explaining.

The version info that will be generated by this patch and the version
info generated in gdb/version.c are both from the version.in file. The
difference is that the patch is generated before compilation, while the
version info generated in the version.c file is generated during the
compilation process. Note that the version.c file is dynamically
generated by the create-version.sh script.

This is my understanding. I'm not sure I've articulated that clearly.

If there is a demand, I think we can modify it a bit more, we can use
the macros in the config.h header file automatically generated by this
patch and embed them directly into the c code.

It's just a thought.

If I'm going in the wrong direction, please feel free to point it out.
I would be happy to ask for your advice.

Thanks,
Enze

On Tue, 2021-11-23 at 16:06 +0100, Andreas Schwab wrote:
> 
> That should produce the same version as written in gdb/version.c.
> 
> Andreas.
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] gdb: AC_INIT should be called with package and version arguments
  2021-11-25 16:20   ` Enze Li
@ 2021-11-25 17:30     ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2021-11-25 17:30 UTC (permalink / raw)
  To: Enze Li; +Cc: Enze Li via Gdb-patches, brobecker, simon.marchi

On Nov 26 2021, Enze Li wrote:

> Note that the version.c file is dynamically generated by the
> create-version.sh script.

That's the point.  It uses a different source for the date.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-25 18:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 14:16 [PATCH v2] gdb: AC_INIT should be called with package and version arguments Enze Li
2021-11-23 15:06 ` Andreas Schwab
2021-11-25 16:20   ` Enze Li
2021-11-25 17:30     ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).