From 1a5850f8ccb916e3bc3c4504f528b25a0c422c86 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 5 May 2025 22:19:37 +0300 Subject: automatically use the current date when building with Autotools * It's actually the time of running ./configure that will be used. * On OpenWatcom, it does not seem to be possible to set variables based on external processes, so you will still have to update AUTO_DATE in teco.h when releasing for DOS. --- configure.ac | 2 ++ tecbuf.c | 4 ++-- teco.h | 53 +++++++++++++++++++++++++++++------------------------ 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index ff6117e..2f4d334 100644 --- a/configure.ac +++ b/configure.ac @@ -77,5 +77,7 @@ AC_CHECK_MEMBERS([struct termios.c_cflag, struct termios.c_ospeed, struct termio #endif ]) +AC_DEFINE_UNQUOTED([AUTO_DATE], ["`date '+$Date: %Y/%m/%d %T $'`"], [Configuration time]) + AC_CONFIG_FILES([Makefile doc/Doxyfile]) AC_OUTPUT diff --git a/tecbuf.c b/tecbuf.c index 03c1983..1bdfb13 100644 --- a/tecbuf.c +++ b/tecbuf.c @@ -34,7 +34,7 @@ struct buff_header *buff_create( char *name, char internal_flag ); #include "teco.h" #include "tecparse.h" -char rcs_date[] = AUTO_DATE; +static const char rcs_date[] = AUTO_DATE; /* * Global Storage is defined here for lack of a better place. @@ -1075,7 +1075,7 @@ register struct buff_header *hbp; char tmp_buffer[LINE_BUFFER_SIZE],padd_buffer[LINE_BUFFER_SIZE]; register int i; int count; -register char *cp; +register const char *cp; int max_length; PREAMBLE(); diff --git a/teco.h b/teco.h index eec13c1..713ee9a 100644 --- a/teco.h +++ b/teco.h @@ -41,38 +41,22 @@ #define BLOCKED 2 #define INVALIDATE 3 -#define VMAJOR 7 -#define VMINOR 0 -#define AUTO_DATE "$Date: 2007/12/10 22:13:07 $" - /* - * Immediately start insertion after the first escape in FS. + * There is redundancy with PACKAGE_VERSION, but this + * is preferred, as it will work with the OpenWatcom build system as well. */ -#define INTERACTIVE_FS - -/** - * We define unix except for the really different operating systems, like - * vms. It lets us write our own version of functions which simply do not - * exist outside of unix. - */ -#if !defined(VMS) && !defined(MSDOS) -#define UNIX -#define JOB_CONTROL -#endif +#define VMAJOR 7 +#define VMINOR 0 /* * Include Files From GNU Autoconf/Autoheader - * - * FIXME: The Autoconf build system does not pass down -DHAVE_CONFIG_H. - * This should be fixed by rewriting it as the original sources - * are missing. */ -//#ifdef HAVE_CONFIG_H -#ifndef __WATCOMC__ +#ifdef HAVE_CONFIG_H + #include "config.h" -#endif -#ifdef MSDOS +#elif defined(MSDOS) + #define __WATCOM_LFN__ #define STDC_HEADERS 1 #define HAVE_STDIO_H 1 @@ -95,8 +79,29 @@ #define HAVE_SBRK 1 #define HAVE_STRCHR 1 #define TERMCAP 1 + #endif /* MSDOS */ +#ifndef AUTO_DATE +/* should be passed in from the build system */ +#define AUTO_DATE "$Date: 2007/12/10 22:13:07 $" +#endif + +/* + * Immediately start insertion after the first escape in FS. + */ +#define INTERACTIVE_FS + +/** + * We define unix except for the really different operating systems, like + * vms. It lets us write our own version of functions which simply do not + * exist outside of unix. + */ +#if !defined(VMS) && !defined(MSDOS) +#define UNIX +#define JOB_CONTROL +#endif + #ifdef HAVE_SYS_IOCTL_H #include #endif -- cgit v1.2.3