From f228da9594290408ee03ffddbd01eadefbf06f1d Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 3 Feb 2010 21:28:29 -0500 Subject: [PATCH] gnulib: Use getopt-gnu module for increased tool portability. --- .gitignore | 4 ++++ .gitmodules | 3 +++ Makefile.am | 9 ++++++++- autogen.sh | 10 +++++++++- configure.ac | 5 +++++ gnulib | 1 + m4/.gitignore | 12 ++++++++++++ m4/gnulib-cache.m4 | 36 ++++++++++++++++++++++++++++++++++++ src/Makefile.inc | 4 ++-- src/lbximg.c | 1 + src/lbxtool.c | 1 + 11 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 .gitmodules create mode 160000 gnulib create mode 100644 m4/gnulib-cache.m4 diff --git a/.gitignore b/.gitignore index 5537131..fbef222 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,10 @@ ltmain.sh aclocal.m4 autom4te.cache +arg-nonnull.h +warn-on-use.h +lib + missing depcomp install-sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..009ae43 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gnulib"] + path = gnulib + url = git://git.savannah.gnu.org/gnulib.git diff --git a/Makefile.am b/Makefile.am index 6830ab5..13f6354 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Nick Bowler +# Copyright (C) 2009-2010 Nick Bowler # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, @@ -6,6 +6,11 @@ ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = m4/gnulib-cache.m4 + +AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib +AM_LDFLAGS = -L$(top_builddir)/lib + dist_man_MANS = dist_doc_DATA = noinst_HEADERS = @@ -14,3 +19,5 @@ bin_PROGRAMS = include doc/Makefile.inc include src/Makefile.inc + +SUBDIRS = lib . diff --git a/autogen.sh b/autogen.sh index 9db4e70..66a90e8 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,7 +6,15 @@ die() exit 1 } -test -d m4 || mkdir m4 +test -d m4 || mkdir m4 +test -d lib || mkdir lib + +git submodule update --init || echo "Failed to update Gnulib sources from git." +if test -x gnulib/gnulib-tool; then + gnulib/gnulib-tool --update || die "Failed to update gnulib." +else + die "Gnulib sources are not properly installed in gnulib/" +fi aclocal -I m4 || die "Failed to run aclocal." autoheader || die "Failed to run autoheader." diff --git a/configure.ac b/configure.ac index 758b1c8..eb4ff46 100644 --- a/configure.ac +++ b/configure.ac @@ -14,16 +14,21 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_PROG_CC_C99 +gl_EARLY + AC_HEADER_ASSERT AC_C_BIGENDIAN LT_INIT +gl_INIT + CHECK_LIBPNG([1.2], [have_libpng=yes], [have_libpng=no]) AM_CONDITIONAL([BUILD_LBXIMG], [test x"$have_libpng" = x"yes"]) AC_CONFIG_FILES([ Makefile + lib/Makefile ]) AC_OUTPUT diff --git a/gnulib b/gnulib new file mode 160000 index 0000000..9d0ad65 --- /dev/null +++ b/gnulib @@ -0,0 +1 @@ +Subproject commit 9d0ad652de159d08e5f679842f8a2a5658196361 diff --git a/m4/.gitignore b/m4/.gitignore index f6749fb..f8a4997 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -3,3 +3,15 @@ ltoptions.m4 ltsugar.m4 ltversion.m4 libtool.m4 +00gnulib.m4 +argz.m4 +extensions.m4 +getopt.m4 +gnulib-common.m4 +gnulib-comp.m4 +gnulib-tool.m4 +include_next.m4 +stddef_h.m4 +unistd_h.m4 +warn-on-use.m4 +wchar_t.m4 diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 new file mode 100644 index 0000000..f2f0300 --- /dev/null +++ b/m4/gnulib-cache.m4 @@ -0,0 +1,36 @@ +# Copyright (C) 2002-2010 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 using CVS, this file is meant to be stored in CVS, +# 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=. --libtool --macro-prefix=gl --no-vc-files getopt-gnu + +# Specification in the form of a few gnulib-tool.m4 macro invocations: +gl_LOCAL_DIR([]) +gl_MODULES([ + getopt-gnu +]) +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_LIBTOOL +gl_MACRO_PREFIX([gl]) +gl_PO_DOMAIN([]) +gl_VC_FILES([false]) diff --git a/src/Makefile.inc b/src/Makefile.inc index dee2958..1c109f6 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -14,11 +14,11 @@ liblbx_la_SOURCES = src/misc.c src/lbx.c src/fops.c src/image.c src/pack.c bin_PROGRAMS += lbxtool lbxtool_SOURCES = src/lbxtool.c -lbxtool_LDADD = liblbx.la +lbxtool_LDADD = liblbx.la -lgnu if BUILD_LBXIMG bin_PROGRAMS += lbximg lbximg_SOURCES = src/lbximg.c -lbximg_LDADD = liblbx.la $(LIBPNG_LIBS) +lbximg_LDADD = liblbx.la $(LIBPNG_LIBS) -lgnu lbximg_CFLAGS = $(LIBPNG_CFLAGS) endif diff --git a/src/lbximg.c b/src/lbximg.c index 64f5a5a..50dff07 100644 --- a/src/lbximg.c +++ b/src/lbximg.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ #define _GNU_SOURCE +#include #include #include #include diff --git a/src/lbxtool.c b/src/lbxtool.c index d070e8f..e702587 100644 --- a/src/lbxtool.c +++ b/src/lbxtool.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ #define _GNU_SOURCE +#include #include #include #include -- 2.43.2