Commit f6611731 authored by Francis Dupont's avatar Francis Dupont

[441-make-distcheck-fails-on-fedora-29-automake-1-16] Some updates

parent c5ecc2be
......@@ -64,21 +64,6 @@ if test "$sep" = "__NONE__"; then
fi
AC_SUBST(SEP)
# If cross compiling assume the message compiler executable was
# magically already in place...
if test "$cross_compiling" = "yes"; then
AC_MSG_CHECKING("build (vs. host) compiled message compiler")
if test -x "${srcdir}/src/lib/log/compiler/message"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN("you must install a message compiler in:")
AC_MSG_WARN(" ${srcdir}/src/lib/log/compiler/message")
AC_MSG_WARN("compiled for build ($build).")
fi
fi
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = "yes"])
# pkg-config can be required.
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
......@@ -1376,6 +1361,13 @@ AC_ARG_ENABLE(generate_messages, [AC_HELP_STRING([--enable-generate-messages],
AM_CONDITIONAL([GENERATE_MESSAGES], [test x$enable_generate_messages != xno])
# cross compiling is not compatible with enable-generate-messages.
if test "$cross_compiling" = "yes"; then
if test "$enable_generate_messages" != "no"; then
AC_MSG_WARN([To build the message compiler is not compatible with cross compiling])
fi
fi
AC_ARG_ENABLE(generate_parser, [AC_HELP_STRING([--enable-generate-parser],
[indicates that the parsers will be regenerated. This implies that the
bison and flex are required [default=no]])],
......@@ -1974,15 +1966,16 @@ fi
cat >> config.report << END
Developer:
Enable Debugging: $debug_enabled
Google Tests: $enable_gtest
Valgrind: $found_valgrind
C++ Code Coverage: $USE_LCOV
Logger checks: $enable_logger_checks
Generate Documentation: $enable_generate_docs
Parser Generation: $enable_generate_parser
Perfdhcp: $enable_perfdhcp
Kea-shell: $enable_shell
Enable Debugging: $debug_enabled
Google Tests: $enable_gtest
Valgrind: $found_valgrind
C++ Code Coverage: $USE_LCOV
Logger checks: $enable_logger_checks
Generate Documentation: $enable_generate_docs
Parser Generation: $enable_generate_parser
Messages Files Generation: $enable_generate_messages
Perfdhcp: $enable_perfdhcp
Kea-shell: $enable_shell
END
......
......@@ -474,6 +474,21 @@ Debian and Ubuntu:
</listitem>
</varlistentry>
<varlistentry>
<term>--enable-generate-messages</term>
<listitem>
<simpara>Enable the regeneration of messages files from
their messages source files, e.g. regenerate xxx_messages.h
and xxx_messages.cc from xxx_messages.mes using the Kea
message compiler. By default Kea is built using these .h
and .cc files from the distribution. However, if you change
anything in a .mes file (such as add new message), you will
need to build and use the Kea message compiler. This option
lets you do that.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>--with-benchmark, --with-benchmark-source</term>
<listitem>
......
......@@ -107,7 +107,7 @@ ca_messages.h ca_messages.cc: ca_messages.mes
else
messages ca_messages.h ca_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -122,7 +122,7 @@ d2_messages.h d2_messages.cc: d2_messages.mes
else
messages d2_messages.h d2_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -136,7 +136,7 @@ dhcp4_messages.h dhcp4_messages.cc: dhcp4_messages.mes
else
messages dhcp4_messages.h dhcp4_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -136,7 +136,7 @@ dhcp6_messages.h dhcp6_messages.cc: dhcp6_messages.mes
else
messages dhcp6_messages.h dhcp6_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -116,6 +116,6 @@ lfc_messages.h lfc_messages.cc: lfc_messages.mes
else
messages lfc_messages.h lfc_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......@@ -109,7 +109,7 @@ netconf_messages.h netconf_messages.cc: netconf_messages.mes
else
messages netconf_messages.h netconf_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -82,12 +82,12 @@ messages: ha_messages.h ha_messages.cc
@echo Message files regenerated
ha_messages.h ha_messages.cc: ha_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/ha/ha_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/high_availability/ha_messages.mes
else
messages ha_messages.h ha_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......@@ -76,12 +76,12 @@ messages: lease_cmds_messages.h lease_cmds_messages.cc
@echo Message files regenerated
lease_cmds_messages.h lease_cmds_messages.cc: lease_cmds_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/lease_cmds/lease_cmds_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/lease_cmds/lease_cmds_messages.mes
else
messages lease_cmds_messages.h lease_cmds_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......@@ -75,12 +75,12 @@ messages: mysql_cb_messages.h mysql_cb_messages.cc
@echo Message files regenerated
mysql_cb_messages.h mysql_cb_messages.cc: mysql_cb_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/mysql_cb/mysql_cb_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/mysql_cb/mysql_cb_messages.mes
else
messages mysql_cb_messages.h mysql_cb_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......@@ -74,12 +74,12 @@ messages: stat_cmds_messages.h stat_cmds_messages.cc
@echo Message files regenerated
stat_cmds_messages.h stat_cmds_messages.cc: stat_cmds_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/stat_cmds/stat_cmds_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/stat_cmds/stat_cmds_messages.mes
else
messages stat_cmds_messages.h stat_cmds_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......@@ -71,12 +71,12 @@ messages: user_chk_messages.h user_chk_messages.cc
@echo Message files regenerated
user_chk_messages.h user_chk_messages.cc: user_chk_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/user_chk/user_chk_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/user_chk/user_chk_messages.mes
else
messages user_chk_messages.h user_chk_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......@@ -60,7 +60,7 @@ asiodns_messages.h asiodns_messages.cc: asiodns_messages.mes
else
messages asiodns_messages.h asiodns_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -64,7 +64,7 @@ config_messages.h config_messages.cc: config_messages.mes
else
messages config_messages.h config_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -59,7 +59,7 @@ db_messages.h db_messages.cc: db_messages.mes
else
messages db_messages.h db_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -66,7 +66,7 @@ dhcp_ddns_messages.h dhcp_ddns_messages.cc: dhcp_ddns_messages.mes
else
messages dhcp_ddns_messages.h dhcp_ddns_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -53,10 +53,6 @@ EXTRA_DIST += parsers/dhcp_queue_control_parser.h
# Devel guide diagrams
EXTRA_DIST += images/pgsql_host_data_source.svg
BUILT_SOURCES = alloc_engine_messages.h alloc_engine_messages.cc
BUILT_SOURCES += dhcpsrv_messages.h dhcpsrv_messages.cc
BUILT_SOURCES += hosts_messages.h hosts_messages.cc
CLEANFILES = *.gcno *.gcda
# Remove CSV files created by the CSVLeaseFile6 and CSVLeaseFile4 unit tests.
CLEANFILES += *.csv
......@@ -65,6 +61,7 @@ lib_LTLIBRARIES = libkea-dhcpsrv.la
libkea_dhcpsrv_la_SOURCES =
libkea_dhcpsrv_la_SOURCES += alloc_engine.cc alloc_engine.h
libkea_dhcpsrv_la_SOURCES += alloc_engine_log.cc alloc_engine_log.h
libkea_dhcpsrv_la_SOURCES += alloc_engine_messages.h alloc_engine_messages.cc
libkea_dhcpsrv_la_SOURCES += assignable_network.h
libkea_dhcpsrv_la_SOURCES += base_host_data_source.h
libkea_dhcpsrv_la_SOURCES += cache_host_data_source.h
......@@ -101,11 +98,13 @@ libkea_dhcpsrv_la_SOURCES += db_type.h
libkea_dhcpsrv_la_SOURCES += dhcp4o6_ipc.cc dhcp4o6_ipc.h
libkea_dhcpsrv_la_SOURCES += dhcpsrv_exceptions.h
libkea_dhcpsrv_la_SOURCES += dhcpsrv_log.cc dhcpsrv_log.h
libkea_dhcpsrv_la_SOURCES += dhcpsrv_messages.h dhcpsrv_messages.cc
libkea_dhcpsrv_la_SOURCES += host.cc host.h
libkea_dhcpsrv_la_SOURCES += host_container.h
libkea_dhcpsrv_la_SOURCES += host_data_source_factory.cc host_data_source_factory.h
libkea_dhcpsrv_la_SOURCES += host_mgr.cc host_mgr.h
libkea_dhcpsrv_la_SOURCES += hosts_log.cc hosts_log.h
libkea_dhcpsrv_la_SOURCES += hosts_messages.h hosts_messages.cc
libkea_dhcpsrv_la_SOURCES += key_from_key.h
libkea_dhcpsrv_la_SOURCES += lease.cc lease.h
libkea_dhcpsrv_la_SOURCES += lease_file_loader.h
......@@ -176,10 +175,6 @@ libkea_dhcpsrv_la_SOURCES += parsers/simple_parser4.h
libkea_dhcpsrv_la_SOURCES += parsers/simple_parser6.cc
libkea_dhcpsrv_la_SOURCES += parsers/simple_parser6.h
libkea_dhcpsrv_la_SOURCES += alloc_engine_messages.h alloc_engine_messages.cc
libkea_dhcpsrv_la_SOURCES += dhcpsrv_messages.h dhcpsrv_messages.cc
libkea_dhcpsrv_la_SOURCES += hosts_messages.h hosts_messages.cc
libkea_dhcpsrv_la_CXXFLAGS = $(AM_CXXFLAGS)
libkea_dhcpsrv_la_CPPFLAGS = $(AM_CPPFLAGS)
libkea_dhcpsrv_la_LIBADD = $(top_builddir)/src/lib/eval/libkea-eval.la
......@@ -269,7 +264,7 @@ else
messages: alloc_engine_messages.h alloc_engine_messages.cc \
dhcpsrv_messages.h dhcpsrv_messages.cc \
hosts_messages.h hosts_messages.cc
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -46,22 +46,14 @@ EXTRA_DIST += lexer.ll parser.yy
CLEANFILES = *.gcno *.gcda
# If we want to get rid of all generated messages files, we need to use
# make maintainer-clean. The proper way to introduce custom commands for
# that operation is to define maintainer-clean-local target. However,
# make maintainer-clean also removes Makefile, so running configure script
# is required. To make it easy to rebuild messages without going through
# reconfigure, a new target messages-clean has been added.
maintainer-clean-local:
rm -f eval_messages.h eval_messages.cc
# To regenerate messages files, one can do:
#
# make messages-clean
# make messages
#
# This is needed only when a .mes file is modified.
messages-clean: maintainer-clean-local
messages-clean:
rm -f eval_messages.h eval_messages.cc
if GENERATE_MESSAGES
......@@ -75,10 +67,17 @@ eval_messages.h eval_messages.cc: eval_messages.mes
else
messages eval_messages.h eval_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
# If we want to get rid of all generated messages files, we need to use
# make maintainer-clean. The proper way to introduce custom commands for
# that operation is to define maintainer-clean-local target. However,
# make maintainer-clean also removes Makefile, so running configure script
# is required. To make it easy to rebuild messages without going through
# reconfigure, a new target messages-clean has been added.
#
# If we want to get rid of all flex/bison generated files, we need to use
# make maintainer-clean. The proper way to introduce custom commands for
# that operation is to define maintainer-clean-local target. However,
......@@ -86,6 +85,7 @@ endif
# is required. To make it easy to rebuild flex/bison without going through
# reconfigure, a new target parser-clean has been added.
maintainer-clean-local:
rm -f eval_messages.h eval_messages.cc
rm -f location.hh lexer.cc parser.cc parser.h position.hh stack.hh
# To regenerate flex/bison files, one can do:
......@@ -95,7 +95,8 @@ maintainer-clean-local:
#
# This is needed only when the lexer.ll or parser.yy files are modified.
# Make sure you have both flex and bison installed.
parser-clean: maintainer-clean-local
parser-clean:
rm -f location.hh lexer.cc parser.cc parser.h position.hh stack.hh
if GENERATE_PARSER
......
......@@ -77,7 +77,7 @@ hooks_messages.h hooks_messages.cc: hooks_messages.mes
else
messages hooks_messages.h hooks_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
......@@ -79,7 +79,7 @@ http_messages.h http_messages.cc: http_messages.mes
else
messages http_messages.h http_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
SUBDIRS = interprocess .
if !CROSS_COMPILING
SUBDIRS += compiler
endif
SUBDIRS += tests
SUBDIRS = interprocess . compiler tests
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
......
......@@ -11,6 +11,8 @@ endif
CLEANFILES = *.gcno *.gcda
if GENERATE_MESSAGES
bin_PROGRAMS = kea-msg-compiler
kea_msg_compiler_SOURCES = message.cc
......@@ -19,3 +21,5 @@ kea_msg_compiler_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.l
kea_msg_compiler_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
kea_msg_compiler_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
kea_msg_compiler_LDADD += $(LOG4CPLUS_LIBS)
endif
// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -415,49 +415,58 @@ included in the Makefile.am for each component that uses logging.
The following segment from the "hooks" Makefile.am illustrates
the entries needed.
@code
# Ensure that the message file is included in the distribution
EXTRA_DIST = hooks_messages.mes
# If we want to get rid of all generated messages files, we need to use
# make maintainer-clean. The proper way to introduce custom commands for
# that operation is to define maintainer-clean-local target. However,
# make maintainer-clean also removes Makefile, so running configure script
# is required. To make it easy to rebuild messages without going through
# reconfigure, a new target messages-clean has been added.
maintainer-clean-local:
rm -f hooks_messages.h hooks_messages.cc
# To regenerate messages files, one can do:
#
# make messages-clean
# make messages
#
# This is needed only when a .mes file is modified.
messages-clean: maintainer-clean-local
if GENERATE_MESSAGES
# Define rule to build logging source files from message file
hooks_messages.h hooks_messages.cc: s-messages
messages: hooks_messages.h hooks_messages.cc
@echo Message files regenerated
s-messages: hooks_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/hooks/hooks_messages.mes
touch $@
hooks_messages.h hooks_messages.cc: hooks_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/hooks/hooks_messages.mes
# Tell automake that the message files are built as part of the build process
# (so that they are built before the main library is built).
BUILT_SOURCES = hooks_messages.h hooks_messages.cc
else
# Ensure that the message file is included in the distribution
EXTRA_DIST = hooks_messages.mes
messages hooks_messages.h hooks_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
# Get rid of generated message files on a clean
CLEANFILES = *.gcno *.gcda hooks_messages.h hooks_messages.cc s-messages
endif
@endcode
The first two rules relate the output .h and .cc files produced by the
message compiler to the input .mes file. The intermediate "s-messages"
file is used to overcome synchronization issues with parallel builds
(where "make" uses multiple processes running in parallel). Note that the
reference to both the compiler and the input message file are via absolute
paths defined in terms of Automake macros. In particular it is important
that the message compiler - which is created during the build process - is
referred to via the "top_builddir" macro, whereas the input message file -
which is in the repository - is accessed through the "top_srcdir" macro.
The BUILT_SOURCES line notifies the Automake that the .h and .cc files
need to be created before they can be used in the compilation, so
instructs it to organize things so that the message compiler is run first.
As the .mes file is not directly included in any compilation, it will
not be automatically copied into a distribution created through this
Makefile.am. The EXTRA_DIST line informs Automake that this file does
need to be included.
Finally, the intermediate files - the .cc and .h file, as well as the
intermediate s-messages file - need to be removed when "make clean" is run.
These files are therefore included in the definition of the CLEANFILES macro.
The first rule adds a hook to make maintainer-clean which is the standard
way to regenerate all messages files. The second rule adds the new
messages-clean target to regenerate local messages files.
The GENERATE_MESSAGES conditional part is the (re)generation of
the messages files. When configured with --enable-generate-messages
and the source (.mes file) is newer these files are generated using
the Kea message compiler. When configured without --enable-generate-messages
(the default) and the source (.mes file) is newer a message is emitted.
Not shown are the Makefile.am lines where the .h and .cc file are used. These
are the same as other lines specifying .h and .cc source files.
And finally please note the message header (e.g. hooks_messages.h)
should be installed, i.e. in the include_HEADERS list.
@subsection logUsage Using Logging Files in Program Development
@subsubsection logCppUsage Use in a C++ Program or Module
......
......@@ -166,6 +166,6 @@ log_test_messages.h log_test_messages.cc: log_test_messages.mes
else
messages log_test_messages.h log_test_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......@@ -75,7 +75,7 @@ process_messages.h process_messages.cc: process_messages.mes
else
messages process_messages.h process_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate=,essages to enable it.
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment