vlog: Generate vlog-modules.def automatically.
authorBen Pfaff <blp@nicira.com>
Mon, 1 Nov 2010 19:22:47 +0000 (12:22 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 30 Nov 2010 18:30:30 +0000 (10:30 -0800)
Makefile.am
build-aux/check-vlog-modules [deleted file]
lib/automake.mk
lib/vlog-modules.def [deleted file]
m4/openvswitch.m4

index da4c1b3..8517b2b 100644 (file)
@@ -12,6 +12,7 @@ SUBDIRS = datapath
 AM_CPPFLAGS = $(SSL_CFLAGS)
 AM_CPPFLAGS += -I $(top_srcdir)/include
 AM_CPPFLAGS += -I $(top_srcdir)/lib
+AM_CPPFLAGS += -I $(top_builddir)/lib
 
 AM_CFLAGS = -Wstrict-prototypes
 AM_CFLAGS += $(WARNING_FLAGS)
diff --git a/build-aux/check-vlog-modules b/build-aux/check-vlog-modules
deleted file mode 100755 (executable)
index d6efaa4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#! /bin/sh
-
-if test "$1" = --help; then
-    cat <<EOF
-$0: cross-check declared and defined vlog modules
-usage: $0 [--help]
-
-Must be run from the top-level source directory.
-
-On systems that don't support user-defined section names, the 'vlog'
-logging subsystem requires the list of modules in lib/vlog-modules.def
-to match the set of vlog modules actually used by the source files.
-However, most Open vSwitch development happens on systems that do
-support user-defined section names and don't have this requirement.
-This utility runs automatically at build time to check this
-requirement "by hand", so that Open vSwitch developers don't
-accidentally break the build for others.
-EOF
-    exit 0
-elif test "$#" != 0; then
-    echo "no arguments accepted (use --help for help)"
-    exit 1
-elif test ! -e lib/vlog-modules.def; then
-    echo "must run from the top-level source directory (use --help for help)"
-    exit 1
-fi
-
-# We can only get a list of source files if this is a Git checkout.
-if test -e .git && (git --version) >/dev/null 2>&1; then
-    :
-else
-    exit 0
-fi
-
-# Get the list of modules declared in lib/vlog-modules.def.
-vlog_modules=`
-    sed -n 's/^VLOG_MODULE(\([_a-zA-Z0-9]\{1,\}\)).*$/\1/p' \
-    lib/vlog-modules.def \
-    | LC_ALL=C sort -u | xargs echo`
-
-# Get the list of modules defined in some source file.
-src_modules=`
-    git grep -h -E '^[         ]*VLOG_DEFINE(_THIS)?_MODULE\([_a-zA-Z0-9]+\);[         ]*$' \
-    | sed 's/.*(\([_a-zA-Z0-9]\{1,\}\)).*/\1/' \
-    | LC_ALL=C sort -u \
-    | xargs echo`
-
-rc=0
-
-for module in $vlog_modules; do
-    case " $src_modules " in
-        *" $module "*) ;;
-        *) echo "vlog module $module is declared in lib/vlog-modules.def but not defined by any source file";
-            rc=1 ;;
-    esac
-done
-
-for module in $src_modules; do
-    case " $vlog_modules " in
-        *" $module "*) ;;
-        *) echo "vlog module $module is defined in a source file but not declared in lib/vlog-modules.def";
-            rc=1 ;;
-    esac
-done
-
-exit $rc
index 0750910..6555661 100644 (file)
@@ -156,7 +156,6 @@ lib_libopenvswitch_a_SOURCES = \
        lib/vconn-stream.c \
        lib/vconn.c \
        lib/vconn.h \
-       lib/vlog-modules.def \
        lib/vlog.c \
        lib/vlog.h
 nodist_lib_libopenvswitch_a_SOURCES = \
@@ -247,6 +246,17 @@ lib-install-data-local:
        $(MKDIR_P) $(DESTDIR)$(PKIDIR)
        $(MKDIR_P) $(DESTDIR)$(LOGDIR)
 
+# All distributed sources, with names adjust properly for referencing
+# from $(builddir).
+all_sources = \
+       `for file in $(DIST_SOURCES); do \
+               if test -f $$file; then \
+                       echo $$file; \
+               else \
+                       echo $(VPATH)/$$file; \
+               fi; \
+        done`
+
 # All the source files that have coverage counters.
 COVERAGE_FILES = \
        lib/dpif.c \
@@ -277,8 +287,9 @@ lib/coverage-counters.c: $(COVERAGE_FILES) lib/coverage-scan.pl
        mv $@.tmp $@
 EXTRA_DIST += lib/coverage-scan.pl
 
-ALL_LOCAL += check-vlog-modules
-check-vlog-modules:
-       cd $(srcdir) && build-aux/check-vlog-modules
-.PHONY: check-vlog-modules
-EXTRA_DIST += build-aux/check-vlog-modules
+if !USE_LINKER_SECTIONS
+lib/vlog.$(OBJEXT): lib/vlog-modules.def
+lib/vlog-modules.def: $(DIST_SOURCES)
+       sed -n 's|^VLOG_DEFINE_\(THIS_\)\{0,1\}MODULE(\([_a-zA-Z0-9]\{1,\}\)).*$$|VLOG_MODULE(\2)|p' $(all_sources) | LC_ALL=C sort -u > $@
+CLEANFILES += lib/vlog-modules.def
+endif
diff --git a/lib/vlog-modules.def b/lib/vlog-modules.def
deleted file mode 100644 (file)
index f891613..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* Modules that can emit log messages. */
-VLOG_MODULE(backtrace)
-VLOG_MODULE(brcompatd)
-VLOG_MODULE(bridge)
-VLOG_MODULE(cfm)
-VLOG_MODULE(collectors)
-VLOG_MODULE(controller)
-VLOG_MODULE(coverage)
-VLOG_MODULE(daemon)
-VLOG_MODULE(dhcp)
-VLOG_MODULE(dhcp_client)
-VLOG_MODULE(discovery)
-VLOG_MODULE(dpif)
-VLOG_MODULE(dpif_linux)
-VLOG_MODULE(dpif_netdev)
-VLOG_MODULE(dpctl)
-VLOG_MODULE(entropy)
-VLOG_MODULE(fail_open)
-VLOG_MODULE(fatal_signal)
-VLOG_MODULE(flow)
-VLOG_MODULE(in_band)
-VLOG_MODULE(jsonrpc)
-VLOG_MODULE(leak_checker)
-VLOG_MODULE(learning_switch)
-VLOG_MODULE(lockfile)
-VLOG_MODULE(mac_learning)
-VLOG_MODULE(netdev)
-VLOG_MODULE(netdev_dummy)
-VLOG_MODULE(netdev_linux)
-VLOG_MODULE(netdev_vport)
-VLOG_MODULE(netflow)
-VLOG_MODULE(netlink)
-VLOG_MODULE(nx_match)
-VLOG_MODULE(ofctl)
-VLOG_MODULE(ofp_parse)
-VLOG_MODULE(ofp_util)
-VLOG_MODULE(ovs_discover)
-VLOG_MODULE(ofproto)
-VLOG_MODULE(openflowd)
-VLOG_MODULE(ovsdb_client)
-VLOG_MODULE(ovsdb_error)
-VLOG_MODULE(ovsdb_file)
-VLOG_MODULE(ovsdb_idl)
-VLOG_MODULE(ovsdb_log)
-VLOG_MODULE(ovsdb_jsonrpc_server)
-VLOG_MODULE(ovsdb_server)
-VLOG_MODULE(ovsdb_tool)
-VLOG_MODULE(pktbuf)
-VLOG_MODULE(pcap)
-VLOG_MODULE(poll_loop)
-VLOG_MODULE(proc_net_compat)
-VLOG_MODULE(process)
-VLOG_MODULE(rconn)
-VLOG_MODULE(reconnect)
-VLOG_MODULE(rtnetlink)
-VLOG_MODULE(sflow)
-VLOG_MODULE(stream_fd)
-VLOG_MODULE(stream_ssl)
-VLOG_MODULE(stream_tcp)
-VLOG_MODULE(stream_unix)
-VLOG_MODULE(stream)
-VLOG_MODULE(status)
-VLOG_MODULE(svec)
-VLOG_MODULE(timeval)
-VLOG_MODULE(socket_util)
-VLOG_MODULE(system_stats)
-VLOG_MODULE(unixctl)
-VLOG_MODULE(util)
-VLOG_MODULE(vconn_stream)
-VLOG_MODULE(vconn)
-VLOG_MODULE(vsctl)
-VLOG_MODULE(vlog)
-VLOG_MODULE(vswitchd)
-VLOG_MODULE(xenserver)
-
-#undef VLOG_MODULE
index fe30eec..6dda350 100644 (file)
@@ -348,4 +348,6 @@ AC_DEFUN([OVS_CHECK_LINKER_SECTIONS],
                 into sections with user-defined names and the linker
                 automatically defines __start_SECNAME and __stop_SECNAME
                 symbols that designate the start and end of the section.])
-   fi])
+   fi
+   AM_CONDITIONAL(
+     [USE_LINKER_SECTIONS], [test $ovs_cv_use_linker_sections = yes])])