Browse code

build: tap: search for tap header

Windows and solaris has something in common, in both
the tap header is external. So make the Windows tap-windows.h
search common to all platform.

Display an error if we cannot find tap header.

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/03/27 06:26:36
Showing 2 changed files
... ...
@@ -365,11 +365,9 @@ AC_CHECK_HEADERS([ \
365 365
 AC_CHECK_HEADERS([ \
366 366
 	sys/time.h sys/un.h sys/ioctl.h sys/stat.h \
367 367
 	sys/mman.h sys/file.h \
368
-	unistd.h signal.h libgen.h \
368
+	unistd.h signal.h libgen.h stropts.h \
369 369
 	syslog.h pwd.h grp.h \
370
-	net/if_tun.h net/tun/if_tun.h stropts.h \
371
-	sys/sockio.h \
372
-	sys/uio.h linux/if_tun.h linux/sockios.h \
370
+	sys/sockio.h sys/uio.h linux/sockios.h \
373 371
 	linux/types.h sys/poll.h sys/epoll.h err.h \
374 372
 ])
375 373
 
... ...
@@ -586,6 +584,20 @@ else
586 586
 fi
587 587
 LIBS="${old_LIBS}"
588 588
 
589
+AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap])
590
+old_CFLAGS="${CFLAGS}"
591
+CFLAGS="${CFLAGS} ${TAP_CFLAGS}"
592
+AC_CHECK_HEADERS(
593
+	[ \
594
+		net/if_tun.h net/tun/if_tun.h \
595
+		linux/if_tun.h \
596
+		tap-windows.h \
597
+	],
598
+	[have_tap_header="yes"]
599
+)
600
+CFLAGS="${old_CFLAGS}"
601
+test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])
602
+
589 603
 AC_CHECK_LIB(
590 604
 	[selinux],
591 605
 	[setcon],
... ...
@@ -672,18 +684,6 @@ PKG_CHECK_MODULES(
672 672
 	)]
673 673
 )
674 674
 
675
-AC_ARG_VAR([TAP_WINDOWS_CFLAGS], [C compiler flags for TAP-Windows])
676
-if test "${WIN32}" = "yes"; then
677
-	old_CFLAGS="${CFLAGS}"
678
-	CFLAGS="${CFLAGS} ${TAP_WINDOWS_CFLAGS}"
679
-	AC_CHECK_HEADERS(
680
-		[tap-windows.h],
681
-		,
682
-		[AC_MSG_ERROR([tap-windows.h is required but missing])]
683
-	)
684
-	CFLAGS="${old_CFLAGS}"
685
-fi
686
-
687 675
 if test "${have_openssl_crypto}" = "yes"; then
688 676
 	saved_CFLAGS="${CFLAGS}"
689 677
 	saved_LIBS="${LIBS}"
... ...
@@ -22,7 +22,7 @@ INCLUDES = \
22 22
 	-I$(top_srcdir)/src/compat
23 23
 
24 24
 AM_CFLAGS = \
25
-	$(TAP_WINDOWS_CFLAGS) \
25
+	$(TAP_CFLAGS) \
26 26
 	$(OPTIONAL_CRYPTO_CFLAGS) \
27 27
 	$(OPTIONAL_LZO_CFLAGS) \
28 28
 	$(OPTIONAL_PKCS11_HELPER_CFLAGS)