From 18f84280995ed81cea2d33c3ff3ec463b411e1cf Mon Sep 17 00:00:00 2001 From: "Agustin F. Pozuelo" Date: Thu, 18 May 2023 10:38:41 +0100 Subject: [PATCH] Add version and origin URL to binary and generated sources --- asn1c/asn1c.c | 2 +- configure.ac | 10 +++++++--- libasn1compiler/asn1c_save.c | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c index 54af7b5a3..048b77dea 100644 --- a/asn1c/asn1c.c +++ b/asn1c/asn1c.c @@ -241,7 +241,7 @@ main(int ac, char **av) { skeletons_dir = optarg; break; case 'v': - fprintf(stderr, "ASN.1 Compiler, v" VERSION "\n" COPYRIGHT); + fprintf(stderr, "ASN.1 Compiler, v" VERSION " from " PACKAGE_BUGREPORT "\n" COPYRIGHT); exit(0); break; case 'W': diff --git a/configure.ac b/configure.ac index 4dde95140..8aff4135f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,9 @@ -AC_INIT([asn1c],[0.9.29],[vlm@lionet.info]) +AC_INIT([asn1c], \ + m4_esyscmd([echo -n `git describe --long --always --dirty`-`git log -1 --format=%ad --date=short`]), \ + m4_esyscmd([git remote get-url origin|sed s/.git$//])) AC_CONFIG_AUX_DIR(config) -AC_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign tar-pax]) AC_CONFIG_MACRO_DIR([m4]) @@ -261,7 +263,9 @@ AC_SUBST(SKELETONS_CFLAGS) AC_SUBST(ASAN_ENV_FLAGS) dnl Checks for header files. -AC_HEADER_STDC +AC_CHECK_INCLUDES_DEFAULT +AC_PROG_EGREP + AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(netinet/in.h) diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c index 35379c51a..865d9b3fb 100644 --- a/libasn1compiler/asn1c_save.c +++ b/libasn1compiler/asn1c_save.c @@ -678,7 +678,7 @@ static int generate_preamble(arg_t *arg, FILE *fp, int optc, char **argv) { safe_fprintf(fp, "/*\n" - " * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n" + " * Generated by asn1c-" VERSION " from " PACKAGE_BUGREPORT "\n" " * From ASN.1 module \"%s\"\n" " * \tfound in \"%s\"\n", arg->expr->module->ModuleName, @@ -848,7 +848,7 @@ generate_pdu_collection(arg_t *arg) { abuf *buf = abuf_new(); abuf_printf(buf, "/*\n * Generated by asn1c-" VERSION - " (http://lionet.info/asn1c)\n */\n\n"); + " from " PACKAGE_BUGREPORT "\n */\n\n"); abuf_printf(buf, "struct asn_TYPE_descriptor_s;\t" "/* Forward declaration */\n\n"); @@ -1022,7 +1022,7 @@ generate_constant_collection(arg_t *arg) { int empty_file = 1; abuf_printf(buf, "/*\n * Generated by asn1c-" VERSION - " (http://lionet.info/asn1c)\n */\n\n"); + " from " PACKAGE_BUGREPORT "\n */\n\n"); abuf_printf(buf, "#ifndef _%sASN_CONSTANT_H\n#define _%sASN_CONSTANT_H\n\n", asn1c_prefix(), asn1c_prefix()); abuf_printf(buf, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");