Skip to content

Commit

Permalink
Introduce gnulib related files
Browse files Browse the repository at this point in the history
This approach both gets us more up-to-date files right now and also
give us a cleaner documented approach for updating an maintaining
those file in the future.

The following command was employed:

  gnulib-tool --no-vc-files --source-base=gnulib --import havelib

gnulib was commit 1de03c03215d9919e6b9d768e86027a0a95ea10c
This is a slightly older to avoid the requirement for automake 1.14
(RHEL 7 is still 1.13.X) in the very latest gnulib.
  • Loading branch information
morrone authored and tom95858 committed Sep 14, 2022
1 parent 6e9940b commit e2fda1e
Show file tree
Hide file tree
Showing 14 changed files with 2,373 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST= \
autogen.sh \
m4/Ovis-top.m4 \
m4/gnulib-cache.m4 \
SHA.txt \
README.md

Expand All @@ -27,13 +28,13 @@ nobase_include_HEADERS = ovis-ldms-config.h
docdir = $(datadir)/doc/@PACKAGE@
dist_doc_DATA = COPYING gpl-2.0.txt

SUBDIRS = lib ldms util
SUBDIRS = lib ldms util gnulib

# this definition of DIST_SUBDIRS is unusual. May decide to improve later.
# For now, we ship as we expect to configure.
# Perhaps all should be included all the time but we surround their
# make content for dist with enable conditionals.
DIST_SUBDIRS = lib ldms util
DIST_SUBDIRS = lib ldms util gnulib
# make dist _will_ fail for these unless we mod their .am files
# so not included in dist.
NODIST_SUBDIRS =
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,21 @@ The following LDMS sampler plugins are considered unsupported. Use are your own
* perfevent sampler
* hweventpapi sampler
* switchx

## gnulib

Some m4 files come from the gnulib project. To update these files, first checkout
gnulib:

git clone git://git.savannah.gnu.org/gnulib.git

There is no need to build or install the checked out code. The gnulib/gnulib-tool
program works directly from the checked out tree.

Next look at the comment at the top of the gnulib/Makefile.am file in the _ovis_
source tree. That comment will tell you the full gnulib-tool command to repeat
to install the latest versions of the currently selected components from gnulib.
Additional gnulib components can be added to the command line as more macros are
desired.

After running gnulib-tool, check in the resulting changes.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(config.h)
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_PROG_CC
gl_EARLY
AM_INIT_AUTOMAKE([foreign tar-pax])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AX_PREFIX_CONFIG_H_G(ovis-ldms-config.h,,,[
Expand All @@ -35,6 +36,7 @@ AX_PREFIX_CONFIG_H_G(ovis-ldms-config.h,,,[
#endif
])
AM_PROG_LIBTOOL
gl_INIT
AC_LIB_RPATH

dnl if LEX is not available, the configure still won't fail
Expand Down Expand Up @@ -907,6 +909,7 @@ lib/src/zap/test/Makefile
lib/etc/Makefile
lib/etc/ovis/Makefile
lib/etc/ld.so.conf.d/Makefile
gnulib/Makefile
ldms/Makefile
ldms/src/Makefile
ldms/src/core/Makefile
Expand Down
1 change: 1 addition & 0 deletions gnulib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/libgnu.a
89 changes: 89 additions & 0 deletions gnulib/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in.
# Copyright (C) 2002-2022 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License,
# this file may be distributed as part of a program that
# contains a configuration script generated by Autoconf, under
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by:
# gnulib-tool --import \
# --lib=libgnu \
# --source-base=gnulib \
# --m4-base=m4 \
# --doc-base=doc \
# --tests-base=tests \
# --aux-dir=config \
# --no-conditional-dependencies \
# --no-libtool \
# --macro-prefix=gl \
# --no-vc-files \
# havelib

AUTOMAKE_OPTIONS = 1.11 gnits

SUBDIRS =
noinst_HEADERS =
noinst_LIBRARIES =
noinst_LTLIBRARIES =
EXTRA_DIST =
BUILT_SOURCES =
SUFFIXES =
MOSTLYCLEANFILES = core *.stackdump
MOSTLYCLEANDIRS =
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
# No GNU Make output.

AM_CPPFLAGS =
AM_CFLAGS =

noinst_LIBRARIES += libgnu.a

libgnu_a_SOURCES =
libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS)
libgnu_a_LIBADD = $(gl_LIBOBJS)
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
EXTRA_libgnu_a_SOURCES =

## begin gnulib module havelib


EXTRA_DIST += $(top_srcdir)/config/config.rpath

## end gnulib module havelib

## begin gnulib module dummy

libgnu_a_SOURCES += dummy.c

## end gnulib module dummy


mostlyclean-local: mostlyclean-generic
@for dir in '' $(MOSTLYCLEANDIRS); do \
if test -n "$$dir" && test -d $$dir; then \
echo "rmdir $$dir"; rmdir $$dir; \
fi; \
done; \
:
distclean-local: distclean-gnulib-libobjs
distclean-gnulib-libobjs:
-rm -f @gl_LIBOBJDEPS@
maintainer-clean-local: distclean-gnulib-libobjs
31 changes: 31 additions & 0 deletions gnulib/dummy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* A dummy file, to prevent empty libraries from breaking builds.
Copyright (C) 2004, 2007, 2009-2022 Free Software Foundation, Inc.
This file is in the public domain. */

/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
libraries without any object files. You might get an error like:
> ar cru .libs/libgl.a
> ar: no archive members specified
Compiling this file, and adding its object file to the library, will
prevent the library from being empty. */

/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
that don't export any symbol. You might get an error like:
> cc ... libgnu.a
> ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
Compiling this file, and adding its object file to the library, will
prevent the library from exporting no symbols. */

#ifdef __sun
/* This declaration ensures that the library will export at least 1 symbol. */
int gl_dummy_symbol;
#else
/* This declaration is solely to ensure that after preprocessing
this file is never empty. */
typedef int dummy;
#endif
85 changes: 85 additions & 0 deletions m4/00gnulib.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 00gnulib.m4 serial 8
dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl This file must be named something that sorts before all other
dnl gnulib-provided .m4 files. It is needed until the clang fix has
dnl been included in Autoconf.

# The following definitions arrange to use a compiler option
# -Werror=implicit-function-declaration in AC_CHECK_DECL, when the
# compiler is clang. Without it, clang implicitly declares "known"
# library functions in C mode, but not in C++ mode, which would cause
# Gnulib to omit a declaration and thus later produce an error in C++
# mode. As of clang 9.0, these "known" functions are identified through
# LIBBUILTIN invocations in the LLVM source file
# llvm/tools/clang/include/clang/Basic/Builtins.def.
# It's not possible to AC_REQUIRE the extra tests from AC_CHECK_DECL,
# because AC_CHECK_DECL, like other Autoconf built-ins, is not supposed
# to AC_REQUIRE anything: some configure.ac files have their first
# AC_CHECK_DECL executed conditionally. Therefore append the extra tests
# to AC_PROG_CC.
AC_DEFUN([gl_COMPILER_CLANG],
[
dnl AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether the compiler is clang],
[gl_cv_compiler_clang],
[dnl Use _AC_COMPILE_IFELSE instead of AC_EGREP_CPP, to avoid error
dnl "circular dependency of AC_LANG_COMPILER(C)" if AC_PROG_CC has
dnl not yet been invoked.
_AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#ifdef __clang__
barfbarf
#endif
]],[[]])
],
[gl_cv_compiler_clang=no],
[gl_cv_compiler_clang=yes])
])
])
AC_DEFUN([gl_COMPILER_PREPARE_CHECK_DECL],
[
dnl AC_REQUIRE([AC_PROG_CC])
dnl AC_REQUIRE([gl_COMPILER_CLANG])
AC_CACHE_CHECK([for compiler option needed when checking for declarations],
[gl_cv_compiler_check_decl_option],
[if test $gl_cv_compiler_clang = yes; then
dnl Test whether the compiler supports the option
dnl '-Werror=implicit-function-declaration'.
save_ac_compile="$ac_compile"
ac_compile="$ac_compile -Werror=implicit-function-declaration"
dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a
dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'],
[gl_cv_compiler_check_decl_option=none])
ac_compile="$save_ac_compile"
else
gl_cv_compiler_check_decl_option=none
fi
])
if test "x$gl_cv_compiler_check_decl_option" != xnone; then
ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option"
else
ac_compile_for_check_decl="$ac_compile"
fi
])
dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl
dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC
dnl in zzgnulib.m4 is inactive, use the original ac_compile.
m4_define([_AC_CHECK_DECL_BODY],
[ ac_save_ac_compile="$ac_compile"
if test -n "$ac_compile_for_check_decl"; then
ac_compile="$ac_compile_for_check_decl"
fi]
m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile"
])

# gl_00GNULIB
# -----------
# Witness macro that this file has been included. Needed to force
# Automake to include this file prior to all other gnulib .m4 files.
AC_DEFUN([gl_00GNULIB])
59 changes: 59 additions & 0 deletions m4/gnulib-cache.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (C) 2002-2022 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License,
# this file may be distributed as part of a program that
# contains a configuration script generated by Autoconf, under
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
#
# This file represents the specification of how gnulib-tool is used.
# It acts as a cache: It is written and read by gnulib-tool.
# In projects that use version control, this file is meant to be put under
# version control, like the configure.ac and various Makefile.am files.


# Specification in the form of a command-line invocation:
# gnulib-tool --import \
# --lib=libgnu \
# --source-base=gnulib \
# --m4-base=m4 \
# --doc-base=doc \
# --tests-base=tests \
# --aux-dir=config \
# --no-conditional-dependencies \
# --no-libtool \
# --macro-prefix=gl \
# --no-vc-files \
# havelib

# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([
havelib
])
gl_AVOID([])
gl_SOURCE_BASE([gnulib])
gl_M4_BASE([m4])
gl_PO_BASE([])
gl_DOC_BASE([doc])
gl_TESTS_BASE([tests])
gl_LIB([libgnu])
gl_MAKEFILE_NAME([])
gl_MACRO_PREFIX([gl])
gl_PO_DOMAIN([])
gl_WITNESS_C_MACRO([])
gl_VC_FILES([false])
Loading

0 comments on commit e2fda1e

Please sign in to comment.