Browse code

Add comile time information/settings from ./configure to --version

This patch will create ./configure.h which will contain two new #define
strings. CONFIGURE_DEFINES will contain all USE, ENABLED, DISABLED and
DEPRECATED defines from ./config.h. CONFIGURE_CALL will contain the
complete ./configure line which was used when configuring the package
for building.

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: James Yonan <james@openvpn.net>

David Sommerseth authored on 2010/04/09 03:31:01
Showing 4 changed files
... ...
@@ -6,6 +6,7 @@
6 6
 #             packet compression.
7 7
 #
8 8
 #  Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
9
+#  Copyright (C) 2010      David Sommerseth <dazo@users.sourceforge.net>
9 10
 #
10 11
 #  This program is free software; you can redistribute it and/or modify
11 12
 #  it under the terms of the GNU General Public License version 2
... ...
@@ -141,6 +142,12 @@ openvpn_SOURCES = \
141 141
 	win32.h win32.c \
142 142
 	cryptoapi.h cryptoapi.c
143 143
 
144
+configure.h: Makefile
145
+	awk -f configure_h.awk config.h > $@
146
+	awk -f configure_log.awk config.log >> $@
147
+
148
+clean-local:
149
+	-rm -f configure.h
144 150
 
145 151
 dist-hook:
146 152
 	cd $(distdir) && for i in $(EXTRA_DIST) $(SUBDIRS) ; do find $$i -name .svn -type d -prune -exec rm -rf '{}' ';' ; rm -f `find $$i -type f | grep -E '(^|\/)\.?\#|\~$$|\.s?o$$'` ; done
147 153
new file mode 100644
... ...
@@ -0,0 +1,39 @@
0
+#
1
+#  OpenVPN -- An application to securely tunnel IP networks
2
+#             over a single UDP port, with support for SSL/TLS-based
3
+#             session authentication and key exchange,
4
+#             packet encryption, packet authentication, and
5
+#             packet compression.
6
+#
7
+#  Copyright (C) 2010  David Sommerseth <dazo@users.sourceforge.net>
8
+#
9
+#  This program is free software; you can redistribute it and/or modify
10
+#  it under the terms of the GNU General Public License version 2
11
+#  as published by the Free Software Foundation.
12
+#
13
+#  This program is distributed in the hope that it will be useful,
14
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+#  GNU General Public License for more details.
17
+#
18
+#  You should have received a copy of the GNU General Public License
19
+#  along with this program (see the file COPYING included with this
20
+#  distribution); if not, write to the Free Software Foundation, Inc.,
21
+#  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
+#
23
+#
24
+#  This script will build up a line which can be included into a C program.
25
+#  The line will contain all interesting #define statements from f.ex. ./config.h
26
+#
27
+
28
+BEGIN {
29
+	printf ("#define CONFIGURE_DEFINES \"")
30
+}
31
+
32
+/^#define (ENABLE|DISABLE|DEPRECATED|USE)_/ {
33
+	printf (" %s", $2)
34
+}
35
+
36
+END {
37
+	printf ("\"\n")
38
+}
0 39
new file mode 100644
... ...
@@ -0,0 +1,36 @@
0
+#
1
+#  OpenVPN -- An application to securely tunnel IP networks
2
+#             over a single UDP port, with support for SSL/TLS-based
3
+#             session authentication and key exchange,
4
+#             packet encryption, packet authentication, and
5
+#             packet compression.
6
+#
7
+#  Copyright (C) 2010  David Sommerseth <dazo@users.sourceforge.net>
8
+#
9
+#  This program is free software; you can redistribute it and/or modify
10
+#  it under the terms of the GNU General Public License version 2
11
+#  as published by the Free Software Foundation.
12
+#
13
+#  This program is distributed in the hope that it will be useful,
14
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+#  GNU General Public License for more details.
17
+#
18
+#  You should have received a copy of the GNU General Public License
19
+#  along with this program (see the file COPYING included with this
20
+#  distribution); if not, write to the Free Software Foundation, Inc.,
21
+#  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
+#
23
+#
24
+#  This script will build up a line which can be included into a C program.
25
+#  The line will only contain the first entry of the ./configure line from
26
+#  ./config.log.
27
+#
28
+
29
+BEGIN {
30
+	printf ("#define CONFIGURE_CALL \"")
31
+}
32
+/\$ .\/configure/ {
33
+	print $0,"\""
34
+	exit 0
35
+}
... ...
@@ -48,6 +48,7 @@
48 48
 #include "pool.h"
49 49
 #include "helper.h"
50 50
 #include "manage.h"
51
+#include "configure.h"
51 52
 
52 53
 #include "memdbg.h"
53 54
 
... ...
@@ -2920,6 +2921,8 @@ usage_version (void)
2920 2920
   msg (M_INFO|M_NOPREFIX, "%s", title_string);
2921 2921
   msg (M_INFO|M_NOPREFIX, "Originally developed by James Yonan");
2922 2922
   msg (M_INFO|M_NOPREFIX, "Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>");
2923
+  msg (M_INFO|M_NOPREFIX, "\n%s\n", CONFIGURE_CALL);
2924
+  msg (M_INFO|M_NOPREFIX, "Compile time defines: %s", CONFIGURE_DEFINES);
2923 2925
   openvpn_exit (OPENVPN_EXIT_STATUS_USAGE); /* exit point */
2924 2926
 }
2925 2927