From fd55a09493ff6021f4a00c88966374d7200e6575 Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Sat, 23 Jul 2011 17:19:07 +1000 Subject: [PATCH] Add support for the Gnulib portability library In particular, the gnulib-tool utility now maintains lib/Makefile.am, as well as many files in the m4 and lib directories. The file m4/gnulib-cache.m4 allows the Gnulib files to be refreshed. See http://www.gnu.org/software/gnulib/. --- .gitignore | 7 +++++ configure.ac | 5 +++- lib/.gitignore | 71 ++++++++++++++++++++++++++++++++++++++++++++++ lib/Makefile.am | 27 ------------------ m4/.gitignore | 69 ++++++++++++++++++++++++++++++++++++++++++++ m4/Makefile.am | 3 +- m4/gnulib-cache.m4 | 56 ++++++++++++++++++++++++++++++++++++ src/Makefile.am | 3 +- src/system.h | 4 +-- 9 files changed, 212 insertions(+), 33 deletions(-) create mode 100644 lib/.gitignore delete mode 100644 lib/Makefile.am create mode 100644 m4/.gitignore create mode 100644 m4/gnulib-cache.m4 diff --git a/.gitignore b/.gitignore index 9612976..c02e834 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,15 @@ Makefile.in /configure /stamp-h1 +/build-aux/config.guess +/build-aux/config.sub /build-aux/depcomp /build-aux/install-sh /build-aux/missing +/build-aux/snippet/arg-nonnull.h +/build-aux/snippet/c++defs.h +/build-aux/snippet/warn-on-use.h +/build-aux/snippet/_Noreturn.h + /src/trader diff --git a/configure.ac b/configure.ac index 53be816..34ca23b 100644 --- a/configure.ac +++ b/configure.ac @@ -37,14 +37,17 @@ AC_CONFIG_LIBOBJ_DIR([lib]) AC_PROG_CC AC_PROG_CC_STDC +gl_EARLY + AX_CFLAGS_WARN_ALL AC_C_RESTRICT AC_C_VOLATILE AX_C___ATTRIBUTE__ - AC_TYPE_SIZE_T AC_TYPE_SSIZE_T +gl_INIT + AX_WITH_CURSES AS_IF([test "x$ax_cv_curses" != "xyes"], AC_MSG_ERROR([requires an X/Open-compatible Curses library.]), diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..b52ce32 --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1,71 @@ +Makefile.am +alloca.in.h +asnprintf.c +ctype.in.h +dosname.h +errno.in.h +float.c +float.in.h +float+.h +fprintf.c +fpucw.h +frexp.c +frexpl.c +fseterr.c +fseterr.h +getopt.c +getopt.in.h +getopt1.c +getopt_int.h +gettext.h +gettimeofday.c +isnan.c +isnand.c +isnand-nolibm.h +isnanf.c +isnanf-nolibm.h +isnanl.c +isnanl-nolibm.h +locale.in.h +malloc.c +math.in.h +memchr.c +memchr.valgrind +printf.c +printf-args.c +printf-args.h +printf-frexp.c +printf-frexp.h +printf-frexpl.c +printf-frexpl.h +printf-parse.c +printf-parse.h +signbitd.c +signbitf.c +signbitl.c +size_max.h +snprintf.c +stat.c +stdarg.in.h +stdbool.in.h +stddef.in.h +stdint.in.h +stdio.in.h +stdio-impl.h +stdlib.in.h +strdup.c +string.in.h +strncat.c +strstr.c +str-two-way.h +sys_stat.in.h +sys_time.in.h +time.in.h +unistd.in.h +vasnprintf.c +vasnprintf.h +verify.h +vfprintf.c +vsnprintf.c +wchar.in.h +xsize.h diff --git a/lib/Makefile.am b/lib/Makefile.am deleted file mode 100644 index f70dd55..0000000 --- a/lib/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -######################################################################### -# # -# Star Traders: A Game of Interstellar Trading # -# Copyright (C) 1990-2011, John Zaitseff # -# # -######################################################################### - -# Author: John Zaitseff -# $Id$ -# -# This file, lib/Makefile.am, contains the library directory Makefile for -# Star Traders. It needs to be processed by automake to produce the -# corresponding Makefile.in. -# -# -# This program 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 program 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 program. If not, see http://www.gnu.org/licenses/. diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..c08a797 --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,69 @@ +00gnulib.m4 +alloca.m4 +asm-underscore.m4 +assert.m4 +config-h.m4 +ctype.m4 +errno_h.m4 +exponentd.m4 +exponentf.m4 +exponentl.m4 +extensions.m4 +float_h.m4 +fpieee.m4 +fprintf-posix.m4 +frexp.m4 +frexpl.m4 +getopt.m4 +gettimeofday.m4 +gnulib-common.m4 +gnulib-comp.m4 +gnulib-tool.m4 +include_next.m4 +intmax_t.m4 +inttypes_h.m4 +isnand.m4 +isnanf.m4 +isnanl.m4 +ldexpl.m4 +locale_h.m4 +longlong.m4 +malloc.m4 +math_h.m4 +memchr.m4 +mmap-anon.m4 +multiarch.m4 +nocrash.m4 +printf.m4 +printf-frexp.m4 +printf-frexpl.m4 +printf-posix-rpl.m4 +signbit.m4 +size_max.m4 +snprintf.m4 +snprintf-posix.m4 +stat.m4 +stdarg.m4 +stdbool.m4 +stddef_h.m4 +stdint.m4 +stdint_h.m4 +stdio_h.m4 +stdlib_h.m4 +strdup.m4 +string_h.m4 +strncat.m4 +strstr.m4 +sys_stat_h.m4 +sys_time_h.m4 +time_h.m4 +unistd_h.m4 +vasnprintf.m4 +vfprintf-posix.m4 +vsnprintf.m4 +vsnprintf-posix.m4 +warn-on-use.m4 +wchar_h.m4 +wchar_t.m4 +wint_t.m4 +xsize.m4 diff --git a/m4/Makefile.am b/m4/Makefile.am index 1a07e14..cc4c328 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -31,4 +31,5 @@ EXTRA_DIST = \ ax_append_flag.m4 \ ax_cflags_warn_all.m4 \ ax_c___attribute__.m4 \ - ax_with_curses.m4 + ax_with_curses.m4 \ + gnulib-cache.m4 diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 new file mode 100644 index 0000000..7eb8d0d --- /dev/null +++ b/m4/gnulib-cache.m4 @@ -0,0 +1,56 @@ +# Copyright (C) 2002-2011 Free Software Foundation, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. 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 --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl assert config-h ctype fprintf-posix getopt-gnu gettimeofday locale printf-posix snprintf-posix stat stdarg stdbool stdio strdup-posix string strncat strstr sys_stat sys_time unistd vfprintf-posix vsnprintf-posix + +# Specification in the form of a few gnulib-tool.m4 macro invocations: +gl_LOCAL_DIR([]) +gl_MODULES([ + assert + config-h + ctype + fprintf-posix + getopt-gnu + gettimeofday + locale + printf-posix + snprintf-posix + stat + stdarg + stdbool + stdio + strdup-posix + string + strncat + strstr + sys_stat + sys_time + unistd + vfprintf-posix + vsnprintf-posix +]) +gl_AVOID([]) +gl_SOURCE_BASE([lib]) +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_DOMAIN([]) diff --git a/src/Makefile.am b/src/Makefile.am index f20e63a..13a2b16 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,6 +41,7 @@ trader_SOURCES = \ utils.c utils.h \ system.h -trader_LDADD = @CURSES_LIB@ +AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib +trader_LDADD = @LIBINTL@ @CURSES_LIB@ $(top_builddir)/lib/libgnu.a EXTRA_DIST = README diff --git a/src/system.h b/src/system.h index 4126e28..36ff005 100644 --- a/src/system.h +++ b/src/system.h @@ -36,9 +36,7 @@ * Portability definitions * ************************************************************************/ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" // Generated by configure /************************************************************************