From dba57a312c77841b3940fc1a20cc52cc629afe0f Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Wed, 28 Apr 1999 05:40:17 +0000
Subject: [PATCH] Add mkversion script to generate version.c files.  mkversion
 generates identification strings compatible with ident(1) and what(1). Uses
 $(VERSION) generated from configure.in.  rm build/version rm old version .c
 files

---
 build/top.mk                             |  4 +--
 build/version                            |  1 -
 clients/fax500/Makefile.in               | 16 +++------
 clients/fax500/Version.c                 | 13 --------
 clients/fax500/Versionrp.c               | 13 --------
 clients/finger/Makefile.in               |  8 ++---
 clients/finger/Version.c                 | 13 --------
 clients/gopher/Makefile.in               | 16 +++------
 clients/gopher/Version.c                 | 13 --------
 clients/gopher/Versiongw.c               | 13 --------
 clients/mail500/Makefile.in              |  8 ++---
 clients/mail500/Version.c                | 13 --------
 clients/rcpt500/Makefile.in              |  8 ++---
 clients/rcpt500/Version.c                | 13 --------
 clients/tools/Makefile.in                | 42 +++++++++---------------
 clients/tools/Versionldd.c               | 13 --------
 clients/tools/Versionldm.c               | 13 --------
 clients/tools/Versionldr.c               | 13 --------
 clients/tools/Versionlds.c               | 13 --------
 clients/ud/Makefile.in                   |  8 ++---
 clients/ud/Version.c                     | 13 --------
 configure.in                             |  4 ++-
 servers/ldapd/Makefile.in                |  6 +---
 servers/slapd/Makefile.in                | 10 ++----
 servers/slapd/back-bdb2/Makefile.in      |  9 ++---
 servers/slapd/back-ldbm/Makefile.in      |  9 ++---
 servers/slapd/back-passwd/Makefile.in    |  8 ++---
 servers/slapd/back-perl/Makefile.in      |  9 ++---
 servers/slapd/back-shell/Makefile.in     |  8 ++---
 servers/slapd/back-tcl/Makefile.in       |  8 ++---
 servers/slapd/shell-backends/Makefile.in |  8 ++---
 servers/slapd/tools/Makefile.in          |  8 ++---
 servers/slurpd/Makefile.in               |  8 ++---
 33 files changed, 57 insertions(+), 305 deletions(-)
 delete mode 100644 build/version
 delete mode 100644 clients/fax500/Version.c
 delete mode 100644 clients/fax500/Versionrp.c
 delete mode 100644 clients/finger/Version.c
 delete mode 100644 clients/gopher/Version.c
 delete mode 100644 clients/gopher/Versiongw.c
 delete mode 100644 clients/mail500/Version.c
 delete mode 100644 clients/rcpt500/Version.c
 delete mode 100644 clients/tools/Versionldd.c
 delete mode 100644 clients/tools/Versionldm.c
 delete mode 100644 clients/tools/Versionldr.c
 delete mode 100644 clients/tools/Versionlds.c
 delete mode 100644 clients/ud/Version.c

diff --git a/build/top.mk b/build/top.mk
index 3c40070f2c..d91aa6ab8d 100644
--- a/build/top.mk
+++ b/build/top.mk
@@ -44,6 +44,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 LINT = lint
 5LINT = 5lint
 MKDEP = $(top_srcdir)/build/mkdep $(MKDEPFLAG) -d "$(srcdir)" -c "$(CC)"
+MKVERSION = $(top_srcdir)/build/mkversion -v "$(VERSION)"
 
 LIBTOOL = @LIBTOOL@
 LIBVERSION = 0:0:0
@@ -82,9 +83,6 @@ SENDMAIL = @SENDMAIL@
 MANCOMPRESS=$(CAT)
 MANCOMPRESSSUFFIX=
 
-# Version
-VERSIONFILE = $(top_srcdir)/build/version
-
 INCLUDEDIR= $(top_srcdir)/include
 LDAP_INCPATH= -I$(LDAP_INCDIR) -I$(INCLUDEDIR)
 LDAP_LIBADIR= $(top_builddir)/libraries
diff --git a/build/version b/build/version
deleted file mode 100644
index 4736714fb4..0000000000
--- a/build/version
+++ /dev/null
@@ -1 +0,0 @@
-2.0-devel
diff --git a/clients/fax500/Makefile.in b/clients/fax500/Makefile.in
index a571ba1770..5dd41e3447 100644
--- a/clients/fax500/Makefile.in
+++ b/clients/fax500/Makefile.in
@@ -19,20 +19,12 @@ fax500 : fax5version.o
 	$(LTLINK) -o $@ $(RPOBJS) fax5version.o $(LIBS)
 
 rpversion.c: ${RPOBJS} $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Versionrp.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) rp500 > $@
 
 fax5version.c: ${FAX5OBJS} $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) fax500 > $@
 
 xrpcomp.tmp: xrpcomp
 	$(SED) -e 's%\%LIBEXECDIR\%%$(libexecdir)%' $(srcdir)/xrpcomp > xrpcomp.tmp
diff --git a/clients/fax500/Version.c b/clients/fax500/Version.c
deleted file mode 100644
index 8bc6c81799..0000000000
--- a/clients/fax500/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1993 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  fax500 v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/fax500/Versionrp.c b/clients/fax500/Versionrp.c
deleted file mode 100644
index 75d8dd79a7..0000000000
--- a/clients/fax500/Versionrp.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1993 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  rp500 v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/finger/Makefile.in b/clients/finger/Makefile.in
index 20a1e0334b..a17ce4c89a 100644
--- a/clients/finger/Makefile.in
+++ b/clients/finger/Makefile.in
@@ -13,12 +13,8 @@ in.xfingerd : version.o
 	$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
 
 version.c: ${OBJS} ${LDAP_LIBDEPEND}
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) in.xfingerd > $@
 
 install-local: $(PROGRAMS) FORCE
 	-$(MKDIR) $(libexecdir)
diff --git a/clients/finger/Version.c b/clients/finger/Version.c
deleted file mode 100644
index 90456ee53f..0000000000
--- a/clients/finger/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1991 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  in.xfingerd v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/gopher/Makefile.in b/clients/gopher/Makefile.in
index 588d958f20..47ee0ba161 100644
--- a/clients/gopher/Makefile.in
+++ b/clients/gopher/Makefile.in
@@ -21,20 +21,12 @@ go500gw : gwversion.o
 	$(LTLINK) -o $@ $(GWOBJS) gwversion.o $(LIBS)
 
 goversion.c: ${GOOBJS} $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) go500 > $@
 
 gwversion.c: ${GWOBJS} $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Versiongw.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) go500gw > $@
 
 install-local: $(PROGRAMS) go500gw.help FORCE
 	-$(MKDIR) $(libexecdir) $(datadir)
diff --git a/clients/gopher/Version.c b/clients/gopher/Version.c
deleted file mode 100644
index a973d7d886..0000000000
--- a/clients/gopher/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1991 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  go500 v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/gopher/Versiongw.c b/clients/gopher/Versiongw.c
deleted file mode 100644
index a3f814261b..0000000000
--- a/clients/gopher/Versiongw.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1991 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  go500gw 1.0 (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/mail500/Makefile.in b/clients/mail500/Makefile.in
index 0ee8742bfb..3f8f35a6be 100644
--- a/clients/mail500/Makefile.in
+++ b/clients/mail500/Makefile.in
@@ -14,12 +14,8 @@ mail500 : version.o
 	$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
 
 version.c: ${OBJS} $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) mail500 > $@
 
 install-local: $(PROGRAMS) FORCE
 	-$(MKDIR) $(libexecdir)
diff --git a/clients/mail500/Version.c b/clients/mail500/Version.c
deleted file mode 100644
index 633c9274bd..0000000000
--- a/clients/mail500/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1991 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  mail500 v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/rcpt500/Makefile.in b/clients/rcpt500/Makefile.in
index d81d5327e3..f5f36a93d0 100644
--- a/clients/rcpt500/Makefile.in
+++ b/clients/rcpt500/Makefile.in
@@ -14,12 +14,8 @@ rcpt500 : version.o
 	$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
 
 version.c: ${OBJS} $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) rcpt500 > $@
 
 install-local: $(PROGRAMS) rcpt500.help FORCE
 	-$(MKDIR) $(libexecdir) $(datadir)
diff --git a/clients/rcpt500/Version.c b/clients/rcpt500/Version.c
deleted file mode 100644
index 62c9a6cdac..0000000000
--- a/clients/rcpt500/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1992 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  rcpt500 v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/tools/Makefile.in b/clients/tools/Makefile.in
index f70d899308..f41c17620e 100644
--- a/clients/tools/Makefile.in
+++ b/clients/tools/Makefile.in
@@ -26,44 +26,32 @@ ldapdelete:	lddversion.o
 ldapmodrdn:	ldrversion.o
 	$(LTLINK) -o $@ ldapmodrdn.o ldrversion.o $(LIBS)
 
-ldappasswd:	ldappasswd.o
-	$(LTLINK) -o $@ ldappasswd.o $(LIBS)
+ldappasswd:	ldpversion.o
+	$(LTLINK) -o $@ ldappasswd.o ldpversion.o $(LIBS)
 
 ldapadd:	ldapmodify
-	$(RM) $@
+	@-$(RM) $@
 	$(LN_H) ldapmodify ldapadd
 
 ldsversion.c: ldapsearch.o $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Versionlds.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) ldapsearch > $@
 
 ldmversion.c: ldapmodify.o $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Versionldm.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) ldapmodify > $@
 
 lddversion.c: ldapdelete.o $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Versionldd.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) ldapdelete > $@
+
+ldpversion.c: ldappasswd.o $(LDAP_LIBDEPEND)
+	@-$(RM) $@
+	$(MKVERSION) ldappasswd > $@
 
 ldrversion.c: ldapmodrdn.o $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Versionldr.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) ldapmodrdn > $@
 
 install-local:	FORCE
 	-$(MKDIR) $(bindir)
diff --git a/clients/tools/Versionldd.c b/clients/tools/Versionldd.c
deleted file mode 100644
index dab7a09421..0000000000
--- a/clients/tools/Versionldd.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1994 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  ldapdelete v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/tools/Versionldm.c b/clients/tools/Versionldm.c
deleted file mode 100644
index aaec274116..0000000000
--- a/clients/tools/Versionldm.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1994 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  ldapmodify v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/tools/Versionldr.c b/clients/tools/Versionldr.c
deleted file mode 100644
index 95730d489c..0000000000
--- a/clients/tools/Versionldr.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1994 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  ldapmodrdn v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/tools/Versionlds.c b/clients/tools/Versionlds.c
deleted file mode 100644
index fd68714405..0000000000
--- a/clients/tools/Versionlds.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1994 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "  ldapsearch v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/clients/ud/Makefile.in b/clients/ud/Makefile.in
index a6b94a0ae4..be1dd4aa22 100644
--- a/clients/ud/Makefile.in
+++ b/clients/ud/Makefile.in
@@ -16,12 +16,8 @@ ud : version.o
 	$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
 
 version.c: ${OBJS} $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	    t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	    -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	    -e "s|%VERSION%|$${v}|" \
-	    < $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) ud > $@
 
 install-local: FORCE
 	-$(MKDIR) $(bindir)
diff --git a/clients/ud/Version.c b/clients/ud/Version.c
deleted file mode 100644
index ddcc5db7dc..0000000000
--- a/clients/ud/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1991, 1992 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-char Version[] = "LDAP UserDirectory %VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/configure.in b/configure.in
index 956cec6f8c..3e59d8ad01 100644
--- a/configure.in
+++ b/configure.in
@@ -14,7 +14,9 @@ define([AC_CACHE_SAVE], )dnl
 dnl Configure.in for OpenLDAP
 AC_INIT(include/ldap.h)dnl
 AC_CONFIG_AUX_DIR(build)dnl
-AM_INIT_AUTOMAKE(OpenLDAP,[2.0-devel], [no ac_define])dnl
+AM_INIT_AUTOMAKE(OpenLDAP,[2.0-devel])dnl
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
 
 dnl We use autoconf features new to 2.13.
 dnl 	aclocal.m4 should be built using aclocal from automake 1.4
diff --git a/servers/ldapd/Makefile.in b/servers/ldapd/Makefile.in
index 628df68605..1db9b2aad0 100644
--- a/servers/ldapd/Makefile.in
+++ b/servers/ldapd/Makefile.in
@@ -33,11 +33,7 @@ sldapd:	version.o
 
 version.c: $(OBJS) $(LDAP_LIBLBER_DEPEND)
 	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	 t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Version.c > $@)
+	$(MKVERSION) ldapd > $@
 
 request.o:	LDAP-types.h
 
diff --git a/servers/slapd/Makefile.in b/servers/slapd/Makefile.in
index 2a9a0fbe17..a136598e1a 100644
--- a/servers/slapd/Makefile.in
+++ b/servers/slapd/Makefile.in
@@ -79,13 +79,9 @@ libbackends.a: .backend
 	@ls -l libbackends.a
 
 version.c: libbackends.a $(OBJS) $(SLAPD_LIBDEPEND) 
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Version.c > $@)
-
+	@-$(RM) $@
+	$(MKVERSION) slapd > $@
+	
 depend-local-srv: FORCE
 	@for i in back-* shell-backends tools; do \
 		if [ -d $$i ]; then \
diff --git a/servers/slapd/back-bdb2/Makefile.in b/servers/slapd/back-bdb2/Makefile.in
index 28b47b0bd5..e11f276a45 100644
--- a/servers/slapd/back-bdb2/Makefile.in
+++ b/servers/slapd/back-bdb2/Makefile.in
@@ -29,10 +29,5 @@ libback-bdb2.a:	version.o
 	@touch ../.backend
 
 version.c:	$(OBJS) $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` \
-	 h=`$(HOSTNAME)` t=`$(DATE)`; \
-	 $(SED) -e "s|%WHEN%|$${t}|" \
-		-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-		-e "s|%VERSION%|$${v}|" \
-		< $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) back-bdb2 > $@
diff --git a/servers/slapd/back-ldbm/Makefile.in b/servers/slapd/back-ldbm/Makefile.in
index 2aa1e6a8e0..ef2aa3c07d 100644
--- a/servers/slapd/back-ldbm/Makefile.in
+++ b/servers/slapd/back-ldbm/Makefile.in
@@ -27,10 +27,5 @@ libback-ldbm.a:	version.o
 	@touch ../.backend
 
 version.c:	$(OBJS) $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` \
-	 h=`$(HOSTNAME)` t=`$(DATE)`; \
-	 $(SED) -e "s|%WHEN%|$${t}|" \
-		-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-		-e "s|%VERSION%|$${v}|" \
-		< $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) back-ldbm > $@
diff --git a/servers/slapd/back-passwd/Makefile.in b/servers/slapd/back-passwd/Makefile.in
index 11e66e089d..2b796e5923 100644
--- a/servers/slapd/back-passwd/Makefile.in
+++ b/servers/slapd/back-passwd/Makefile.in
@@ -21,10 +21,6 @@ libback-passwd.a:	version.o
 	@touch ../.backend
 
 version.c: $(OBJS) $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	 t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) back-passwd > $@
 
diff --git a/servers/slapd/back-perl/Makefile.in b/servers/slapd/back-perl/Makefile.in
index 71979534d9..36618cdd47 100644
--- a/servers/slapd/back-perl/Makefile.in
+++ b/servers/slapd/back-perl/Makefile.in
@@ -35,10 +35,5 @@ libback-perl.a:	version.o
 	@touch ../.backend
 
 version.c: $(OBJS) $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Version.c > $@)
-
+	@-$(RM) $@
+	$(MKVERSION) back-perl > $@
diff --git a/servers/slapd/back-shell/Makefile.in b/servers/slapd/back-shell/Makefile.in
index d17e442cb4..525c17d01a 100644
--- a/servers/slapd/back-shell/Makefile.in
+++ b/servers/slapd/back-shell/Makefile.in
@@ -23,10 +23,6 @@ libback-shell.a:	version.o
 	@touch ../.backend
 
 version.c: $(OBJS) $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) back-shell > $@
 
diff --git a/servers/slapd/back-tcl/Makefile.in b/servers/slapd/back-tcl/Makefile.in
index a26ca1210d..79bf98bf93 100644
--- a/servers/slapd/back-tcl/Makefile.in
+++ b/servers/slapd/back-tcl/Makefile.in
@@ -36,10 +36,6 @@ libback-tcl.a:	version.o
 	@touch ../.backend
 
 version.c: $(OBJS) $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) back-tcl > $@
 
diff --git a/servers/slapd/shell-backends/Makefile.in b/servers/slapd/shell-backends/Makefile.in
index 75064b3404..7865e3700e 100644
--- a/servers/slapd/shell-backends/Makefile.in
+++ b/servers/slapd/shell-backends/Makefile.in
@@ -16,9 +16,5 @@ passwd-shell:	pwd-version.o
 	$(CC) $(LDFLAGS) -o $@ $(OBJS) pwd-version.o $(LIBS)
 
 pwd-version.c: $(OBJS) $(LDAP_LIBDEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/pwd-Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) passwd-shell > $@
diff --git a/servers/slapd/tools/Makefile.in b/servers/slapd/tools/Makefile.in
index 52d38fb380..b04b875837 100644
--- a/servers/slapd/tools/Makefile.in
+++ b/servers/slapd/tools/Makefile.in
@@ -80,12 +80,8 @@ edb2ldif:	edb2-vers.o
 	$(CC) $(LDFLAGS) -o $@ $(EDB2LDIFOBJS) edb2-vers.o $(LIBS)
 
 edb2-vers.c: $(EDB2LDIFOBJS)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< Vers-edb2.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) ebd2ldif > $@
 
 build-chlog2replog: FORCE
 	@if [ "$(HAVE_ISODE)" = "yes" ]; then \
diff --git a/servers/slurpd/Makefile.in b/servers/slurpd/Makefile.in
index 9ca6c0044f..70690cdfb4 100644
--- a/servers/slurpd/Makefile.in
+++ b/servers/slurpd/Makefile.in
@@ -34,12 +34,8 @@ sslurpd:	version.o
 	$(LTLINK) -static -o $@ $(OBJS) version.o $(LIBS)
 
 version.c: $(OBJS) $(LDAP_LIBDEPEND) $(LDAP_LIBTHREAD_DEPEND)
-	$(RM) $@
-	(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
-	t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< $(srcdir)/Version.c > $@)
+	@-$(RM) $@
+	$(MKVERSION) slurpd > $@
 
 install-local-srv: FORCE
 	@-$(MKDIR) $(libexecdir)
-- 
GitLab