summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile1
-rw-r--r--config.h10
-rwxr-xr-xconfigure20
4 files changed, 22 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index bde10bc..3db1940 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ Makefile
# Ignore build config generated by configure
Config
+config.h
# Other documentation ignores
*.md
diff --git a/Makefile b/Makefile
index f1a75a9..cb18177 100644
--- a/Makefile
+++ b/Makefile
@@ -214,6 +214,7 @@ toolkit: $(TOOLS)
clean: $(foreach tool,$(TOOLS),$(tool)_clean)
distclean: clean
$(Q)$(call RM,Config)
+ $(Q)$(call RM,config.h)
mrproper: distclean
$(Q)$(GIT_REM)
diff --git a/config.h b/config.h
deleted file mode 100644
index a73edd5..0000000
--- a/config.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef CONFIG_H
-#define CONFIG_H
-
-#define FILE_CLIENTS ".curvetun/clients"
-#define FILE_SERVERS ".curvetun/servers"
-#define FILE_PRIVKEY ".curvetun/priv.key"
-#define FILE_PUBKEY ".curvetun/pub.key"
-#define FILE_USERNAM ".curvetun/username"
-
-#endif /* CONFIG_H */
diff --git a/configure b/configure
index 6a5a83e..7998572 100755
--- a/configure
+++ b/configure
@@ -419,6 +419,24 @@ EOF
fi
}
+gen_config_hdr()
+{
+ local _version="`git describe --always`"
+ echo "[*] Generating config.h ... "
+
+ cat > config.h << EOF
+#ifndef CONFIG_H
+#define CONFIG_H
+#define FILE_CLIENTS ".curvetun/clients"
+#define FILE_SERVERS ".curvetun/servers"
+#define FILE_PRIVKEY ".curvetun/priv.key"
+#define FILE_PUBKEY ".curvetun/pub.key"
+#define FILE_USERNAM ".curvetun/username"
+#define GITVERSION "$_version"
+#endif /* CONFIG_H */
+EOF
+}
+
echo "# This file is autogenerated by the configure script" > Config
check_pkg_config
@@ -442,6 +460,8 @@ check_libpcap
check_libcli
check_libnet
+gen_config_hdr
+
if [ "$MISSING_DEFS" == "1" ] ; then
echo "[!] Some libraries or header definitions are missing or too old."
echo " Thus certain tools will not be built (see below). Please"