]> git.proxmox.com Git - mirror_ovs.git/commitdiff
Makefile: Compile Linux-specific files based on __linux__ macro.
authorBen Pfaff <blp@nicira.com>
Thu, 23 Jan 2014 23:35:22 +0000 (15:35 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 5 Mar 2014 15:51:56 +0000 (07:51 -0800)
We want to conditionally compile several files based on whether we're
building for a Linux host, so we need some Automake conditional for that.
Previously this was based on whether Netlink is available and we're not
on ESX (since ESX has Netlink but isn't Linux), but it's more
straightforward to just test for Linux directly.

CC: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Ben Pfaff <blp@nicira.com>
acinclude.m4
configure.ac
lib/automake.mk
utilities/automake.mk

index 8ff58280e9d7694819d8841898ba1accabe4283a..830fd3f0d0b16bcb30a60a58d6f42942398b82e5 100644 (file)
@@ -1,6 +1,6 @@
 # -*- autoconf -*-
 
-# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -579,3 +579,18 @@ AC_DEFUN([OVS_CHECK_PTHREAD_SET_NAME],
          ;;
      esac
    fi])
+
+dnl OVS_CHECK_LINUX_HOST.
+dnl
+dnl Checks whether we're building for a Linux host, based on the presence of
+dnl the __linux__ preprocessor symbol, and sets up an Automake conditional
+dnl LINUX based on the result.
+AC_DEFUN([OVS_CHECK_LINUX_HOST],
+  [AC_CACHE_CHECK(
+     [whether __linux__ is defined],
+     [ovs_cv_linux],
+     [AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([enum { LINUX = __linux__};], [])],
+        [ovs_cv_linux=true],
+        [ovs_cv_linux=false])])
+   AM_CONDITIONAL([LINUX], [$ovs_cv_linux])])
index 2fccc648ffcbdbecd972aeafd0c66bd3771c3bbf..09e01fbc2a34d3324de64e91dfe91e85d839b0d7 100644 (file)
@@ -90,6 +90,7 @@ OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(4)
 OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(8)
 OVS_CHECK_POSIX_AIO
 OVS_CHECK_PTHREAD_SET_NAME
+OVS_CHECK_LINUX_HOST
 
 OVS_CHECK_INCLUDE_NEXT([stdio.h string.h])
 AC_CONFIG_FILES([lib/stdio.h lib/string.h])
@@ -132,11 +133,6 @@ AC_CONFIG_COMMANDS([include/openflow/openflow.h.stamp])
 
 AC_CONFIG_COMMANDS([utilities/bugtool/dummy], [:])
 
-AM_CONDITIONAL([LINUX_DATAPATH], [test "$HAVE_NETLINK" = yes && test "$ESX" = no])
-if test "$HAVE_NETLINK" = yes && test "$ESX" = no; then
-    AC_DEFINE([LINUX_DATAPATH], [1], [System uses the linux datapath module.])
-fi
-
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
 
 AC_OUTPUT
index 9c345e7f904f7821a632c2e2344897fd7dc4371d..476421c3d1d4ada9bc8fd32e52a243fa10d0e1bb 100644 (file)
@@ -274,7 +274,7 @@ if HAVE_WNO_UNUSED_PARAMETER
 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
 endif
 
-if LINUX_DATAPATH
+if LINUX
 lib_libopenvswitch_la_SOURCES += \
        lib/dpif-linux.c \
        lib/dpif-linux.h \
index d6de6a3773fe727d69cccd8d4f21cd8e8a8a4f9a..ce1c8b23241326d11dd8752aff01256e83971bf5 100644 (file)
@@ -110,7 +110,7 @@ utilities_ovs_ofctl_LDADD = \
 utilities_ovs_vsctl_SOURCES = utilities/ovs-vsctl.c
 utilities_ovs_vsctl_LDADD = lib/libopenvswitch.la
 
-if LINUX_DATAPATH
+if LINUX
 sbin_PROGRAMS += utilities/ovs-vlan-bug-workaround
 utilities_ovs_vlan_bug_workaround_SOURCES = utilities/ovs-vlan-bug-workaround.c
 utilities_ovs_vlan_bug_workaround_LDADD = lib/libopenvswitch.la