Browse code

build: properly detect TUNSETPERSIST

Do not rely on system symbol throught sources
but on autoconf detection.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>

Alon Bar-Lev authored on 2012/04/09 04:21:47
Showing 4 changed files
... ...
@@ -598,6 +598,16 @@ AC_CHECK_HEADERS(
598 598
 	],
599 599
 	[have_tap_header="yes"]
600 600
 )
601
+AC_CHECK_DECLS(
602
+	[TUNSETPERSIST],
603
+	[AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])],
604
+	,
605
+	[[
606
+		#ifdef HAVE_LINUX_IF_TUN_H
607
+		#include <linux/if_tun.h>
608
+		#endif
609
+	]]
610
+)
601 611
 CFLAGS="${old_CFLAGS}"
602 612
 test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])
603 613
 
... ...
@@ -954,7 +954,7 @@ do_genkey (const struct options * options)
954 954
 bool
955 955
 do_persist_tuntap (const struct options *options)
956 956
 {
957
-#ifdef TUNSETPERSIST
957
+#ifdef ENABLE_FEATURE_TUN_PERSIST
958 958
   if (options->persist_config)
959 959
     {
960 960
       /* sanity check on options for --mktun or --rmtun */
... ...
@@ -725,7 +725,7 @@ static const char usage_message[] =
725 725
   "                  for use with the --secret option.\n"
726 726
   "--secret file   : Write key to file.\n"
727 727
 #endif				/* ENABLE_CRYPTO */
728
-#ifdef TUNSETPERSIST
728
+#ifdef ENABLE_FEATURE_TUN_PERSIST
729 729
   "\n"
730 730
   "Tun/tap config mode (available with linux 2.4+):\n"
731 731
   "--mktun         : Create a persistent tunnel.\n"
... ...
@@ -791,7 +791,7 @@ init_options (struct options *o, const bool init_gc)
791 791
   o->management_echo_buffer_size = 100;
792 792
   o->management_state_buffer_size = 100;
793 793
 #endif
794
-#ifdef TUNSETPERSIST
794
+#ifdef ENABLE_FEATURE_TUN_PERSIST
795 795
   o->persist_mode = 1;
796 796
 #endif
797 797
 #ifndef WIN32
... ...
@@ -1420,7 +1420,7 @@ show_settings (const struct options *o)
1420 1420
   
1421 1421
   SHOW_INT (mode);
1422 1422
 
1423
-#ifdef TUNSETPERSIST
1423
+#ifdef ENABLE_FEATURE_TUN_PERSIST
1424 1424
   SHOW_BOOL (persist_config);
1425 1425
   SHOW_INT (persist_mode);
1426 1426
 #endif
... ...
@@ -6788,7 +6788,7 @@ add_option (struct options *options,
6788 6788
       options->pkcs11_id_management = true;
6789 6789
     }
6790 6790
 #endif
6791
-#ifdef TUNSETPERSIST
6791
+#ifdef ENABLE_FEATURE_TUN_PERSIST
6792 6792
   else if (streq (p[0], "rmtun"))
6793 6793
     {
6794 6794
       VERIFY_PERMISSION (OPT_P_GENERAL);
... ...
@@ -1517,7 +1517,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
1517 1517
 
1518 1518
 #endif /* HAVE_LINUX_IF_TUN_H */
1519 1519
 
1520
-#ifdef TUNSETPERSIST
1520
+#ifdef ENABLE_FEATURE_TUN_PERSIST
1521 1521
 
1522 1522
 /*
1523 1523
  * This can be removed in future
... ...
@@ -1567,7 +1567,7 @@ tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist
1567 1567
   msg (M_INFO, "Persist state set to: %s", (persist_mode ? "ON" : "OFF"));
1568 1568
 }
1569 1569
 
1570
-#endif /* TUNSETPERSIST */
1570
+#endif /* ENABLE_FEATURE_TUN_PERSIST */
1571 1571
 
1572 1572
 void
1573 1573
 close_tun (struct tuntap *tt)