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>
This commit is contained in:
Alon Bar-Lev 2012-04-08 22:21:47 +03:00 committed by David Sommerseth
parent 4025a59575
commit 88f3a4026c
4 changed files with 17 additions and 7 deletions

View File

@ -598,6 +598,16 @@ AC_CHECK_HEADERS(
], ],
[have_tap_header="yes"] [have_tap_header="yes"]
) )
AC_CHECK_DECLS(
[TUNSETPERSIST],
[AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])],
,
[[
#ifdef HAVE_LINUX_IF_TUN_H
#include <linux/if_tun.h>
#endif
]]
)
CFLAGS="${old_CFLAGS}" CFLAGS="${old_CFLAGS}"
test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found]) test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])

View File

@ -954,7 +954,7 @@ do_genkey (const struct options * options)
bool bool
do_persist_tuntap (const struct options *options) do_persist_tuntap (const struct options *options)
{ {
#ifdef TUNSETPERSIST #ifdef ENABLE_FEATURE_TUN_PERSIST
if (options->persist_config) if (options->persist_config)
{ {
/* sanity check on options for --mktun or --rmtun */ /* sanity check on options for --mktun or --rmtun */

View File

@ -725,7 +725,7 @@ static const char usage_message[] =
" for use with the --secret option.\n" " for use with the --secret option.\n"
"--secret file : Write key to file.\n" "--secret file : Write key to file.\n"
#endif /* ENABLE_CRYPTO */ #endif /* ENABLE_CRYPTO */
#ifdef TUNSETPERSIST #ifdef ENABLE_FEATURE_TUN_PERSIST
"\n" "\n"
"Tun/tap config mode (available with linux 2.4+):\n" "Tun/tap config mode (available with linux 2.4+):\n"
"--mktun : Create a persistent tunnel.\n" "--mktun : Create a persistent tunnel.\n"
@ -791,7 +791,7 @@ init_options (struct options *o, const bool init_gc)
o->management_echo_buffer_size = 100; o->management_echo_buffer_size = 100;
o->management_state_buffer_size = 100; o->management_state_buffer_size = 100;
#endif #endif
#ifdef TUNSETPERSIST #ifdef ENABLE_FEATURE_TUN_PERSIST
o->persist_mode = 1; o->persist_mode = 1;
#endif #endif
#ifndef WIN32 #ifndef WIN32
@ -1420,7 +1420,7 @@ show_settings (const struct options *o)
SHOW_INT (mode); SHOW_INT (mode);
#ifdef TUNSETPERSIST #ifdef ENABLE_FEATURE_TUN_PERSIST
SHOW_BOOL (persist_config); SHOW_BOOL (persist_config);
SHOW_INT (persist_mode); SHOW_INT (persist_mode);
#endif #endif
@ -6788,7 +6788,7 @@ add_option (struct options *options,
options->pkcs11_id_management = true; options->pkcs11_id_management = true;
} }
#endif #endif
#ifdef TUNSETPERSIST #ifdef ENABLE_FEATURE_TUN_PERSIST
else if (streq (p[0], "rmtun")) else if (streq (p[0], "rmtun"))
{ {
VERIFY_PERMISSION (OPT_P_GENERAL); VERIFY_PERMISSION (OPT_P_GENERAL);

View File

@ -1517,7 +1517,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
#endif /* HAVE_LINUX_IF_TUN_H */ #endif /* HAVE_LINUX_IF_TUN_H */
#ifdef TUNSETPERSIST #ifdef ENABLE_FEATURE_TUN_PERSIST
/* /*
* This can be removed in future * This can be removed in future
@ -1567,7 +1567,7 @@ tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist
msg (M_INFO, "Persist state set to: %s", (persist_mode ? "ON" : "OFF")); msg (M_INFO, "Persist state set to: %s", (persist_mode ? "ON" : "OFF"));
} }
#endif /* TUNSETPERSIST */ #endif /* ENABLE_FEATURE_TUN_PERSIST */
void void
close_tun (struct tuntap *tt) close_tun (struct tuntap *tt)