From 2daf7bfa36f4f44692330e1102ebe004198bbc0f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 5 Sep 2006 22:57:29 +0000 Subject: [PATCH] Modernize bootstrap procedure to match current gnulib. * bootstrap: Sync with coreutils bootstrap, except check that the directory build-aux exists before trying to copy to it. * bootstrap.conf: New file. (gnulib_modules): Add config-h, dup2, extensions, fcntl, fdl, stat-macros, unistd. * configure.ac: Invoke gl_EARLY and gl_INIT rather than GNULIB_AUTOCONF_SNIPPET. (AC_CONFIG_HEADER): Rename config.h to lib/config.h. (AC_CHECK_HEADERS_ONCE): Don't check for fcntl.h, locale.h, sys/file.h, unistd.h. We now use the fcntl and unistd modules, and locale.h can be assumed for any C89 compiler. (DIFFUTILS_PREREQUISITES): Remove. No longer needed now that we use the stdint module. (AC_CHECK_FUNCS_ONCE): Remove dup2, which is no longer needed now that we use the dup2 module. (AM_GNU_GETTEXT): Use need-formatstring-macros, and ... (AM_GNU_GETTEXT_VERSION): specify version 0.15 instead of 0.14.5, to be consistent with coreutils. * lib/Makefile.am (noinst_LIBRARIES): (lib_SOURCES, libdiffutils_a_LIBADD): (libdiffutils_a_DEPENDENCIES, BUILT_SOURCES, EXTRA_DIST): (MOSTLYCLEANFILES): Remove; now computed automatically. (noinst_HEADERS, libdiffutils_a_SOURCES): Just append our special files now. * lib/cmpbuf.c: Include config.h unconditionally, since we no longer define HAVE_CONFIG_H. * lib/prepargs.c: Likewise. * src/Makefile.am (LDADD): Use $(LIBINTL), not @LIBINTL@. (diff_LDADD): Use $(LIB_CLOCK_GETTIME), not @LIB_CLOCK_GETTIME@. * src/dir.c (dir_read): Use _D_EXACT_NAMLEN, not NAMELEN. * src/system.h (volatile): Remove, since we assume C89 or better. Include stat-macros.h. (S_IRWXU, S_IRWXG, S_IRWXO, S_IRUSR, S_IWUSR): Remove, since we now use stat-macros.h. (SEEK_SET, SEEK_CUR): Remove, since we assume C89 or better. Include unistd.h unconditionally, since we use unistd. Likewise for fcntl.h. (dup2): Remove, since we now use dup2. (O_RDONLY, O_RWDR, O_BINARY): Remove, since we now use fcntl. Include dirent.h unconditionally. (NAMLEN): Remove, replacing with.... (_D_EXACT_NAMLEN): New macro. Include inttypes.h unconditionally. (PTRDIFF_MAX, SIZE_MAX, UINTMAX_MAX, strtoumax): Remove, since we now use inttypes. Include locale.h unconditionally. (setlocale): Remove, since we now assume locale.h. --- ChangeLog | 56 ++++++++ bootstrap | 364 +++++++++++++++++++++++++++++++----------------- bootstrap.conf | 53 +++++++ configure.ac | 19 +-- lib/Makefile.am | 17 +-- lib/cmpbuf.c | 4 +- lib/prepargs.c | 8 +- src/Makefile.am | 6 +- src/dir.c | 2 +- src/system.h | 124 ++--------------- 10 files changed, 375 insertions(+), 278 deletions(-) create mode 100644 bootstrap.conf diff --git a/ChangeLog b/ChangeLog index 3af1c19..78ce317 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,59 @@ +2006-09-05 Paul Eggert + + * doc/diff.texi (Detailed Unified): Don't output trailing white + space unless the input data has it. + * src/context.c (pr_unidiff_hunk): Likewise. + + Modernize bootstrap procedure to match current gnulib. + * bootstrap: Sync with coreutils bootstrap, except check that + the directory build-aux exists before trying to copy to it. + * bootstrap.conf: New file. + (gnulib_modules): Add config-h, dup2, extensions, fcntl, fdl, + stat-macros, unistd. + * configure.ac: Invoke gl_EARLY and gl_INIT rather than + GNULIB_AUTOCONF_SNIPPET. + (AC_CONFIG_HEADER): Rename config.h to lib/config.h. + (AC_CHECK_HEADERS_ONCE): Don't check for fcntl.h, locale.h, + sys/file.h, unistd.h. We now use the fcntl and unistd modules, + and locale.h can be assumed for any C89 compiler. + (DIFFUTILS_PREREQUISITES): Remove. No longer needed now that + we use the stdint module. + (AC_CHECK_FUNCS_ONCE): Remove dup2, which is no longer needed + now that we use the dup2 module. + (AM_GNU_GETTEXT): Use need-formatstring-macros, and ... + (AM_GNU_GETTEXT_VERSION): specify version 0.15 instead of 0.14.5, + to be consistent with coreutils. + * lib/Makefile.am (noinst_LIBRARIES): + (lib_SOURCES, libdiffutils_a_LIBADD): + (libdiffutils_a_DEPENDENCIES, BUILT_SOURCES, EXTRA_DIST): + (MOSTLYCLEANFILES): Remove; now computed automatically. + (noinst_HEADERS, libdiffutils_a_SOURCES): Just append + our special files now. + * lib/cmpbuf.c: Include config.h unconditionally, since we + no longer define HAVE_CONFIG_H. + * lib/prepargs.c: Likewise. + * src/Makefile.am (LDADD): Use $(LIBINTL), not @LIBINTL@. + (diff_LDADD): Use $(LIB_CLOCK_GETTIME), not @LIB_CLOCK_GETTIME@. + * src/dir.c (dir_read): Use _D_EXACT_NAMLEN, not NAMELEN. + * src/system.h (volatile): Remove, since we assume C89 or better. + Include stat-macros.h. + (S_IRWXU, S_IRWXG, S_IRWXO, S_IRUSR, S_IWUSR): + Remove, since we now use stat-macros.h. + (SEEK_SET, SEEK_CUR): Remove, since we assume C89 or better. + Include unistd.h unconditionally, since we use unistd. + Likewise for fcntl.h. + (dup2): Remove, since we now use dup2. + (O_RDONLY, O_RWDR, O_BINARY): Remove, since we now use + fcntl. + Include dirent.h unconditionally. + (NAMLEN): Remove, replacing with.... + (_D_EXACT_NAMLEN): New macro. + Include inttypes.h unconditionally. + (PTRDIFF_MAX, SIZE_MAX, UINTMAX_MAX, strtoumax): Remove, since + we now use inttypes. + Include locale.h unconditionally. + (setlocale): Remove, since we now assume locale.h. + 2006-09-04 Jim Meyering * src/context.c (print_context_function): Do not print diff --git a/bootstrap b/bootstrap index 8e9bb89..f895843 100755 --- a/bootstrap +++ b/bootstrap @@ -21,14 +21,76 @@ # Written by Paul Eggert. -package=diffutils +nl=' +' -# Ensure file names are sorted consistently across platforms; -# e.g., m4/ulonglong_gl.m4 should follow m4/ulonglong.m4. +# Ensure file names are sorted consistently across platforms. # Also, ensure diagnostics are in English, e.g., "wget --help" below. LC_ALL=C export LC_ALL + +# Configuration. + +# List of gnulib modules needed. +gnulib_modules= + +# Any extra gnulib files needed. +gnulib_files= + +# Translation Project URL, for the registry of all projects +# and for the translation-team master directory. +TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain=' +TP_PO_URL='http://www.iro.umontreal.ca/translation/teams/PO/' + +extract_package_name=' + /^AC_INIT(/{ + /.*,.*,.*,/{ + s/// + s/[][]//g + p + q + } + s/AC_INIT(\[*// + s/]*,.*// + s/^GNU // + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + s/[^A-Za-z0-9_]/-/g + p + } +' +package=`sed -n "$extract_package_name" configure.ac` || exit + +# Extra files from gnulib, which are not part of any module yet. +gnulib_extra_files=' + build-aux/install-sh + build-aux/missing + build-aux/mdate-sh + build-aux/texinfo.tex + build-aux/depcomp + build-aux/config.guess + build-aux/config.sub + doc/INSTALL +' + +# Other locale categories that need message catalogs. +EXTRA_LOCALE_CATEGORIES= + +# Additional xgettext options to use. Use "\\\newline" to break lines. +XGETTEXT_OPTIONS='\\\ + --flag=_:1:pass-c-format\\\ + --flag=N_:1:pass-c-format\\\ + --flag=error:3:c-format --flag=error_at_line:5:c-format\\\ +' + +# Files we don't want to import. +excluded_files= + +# Override the default configuration, if necessary. +test -r bootstrap.conf && . ./bootstrap.conf + +# Translate configuration into internal form. + # Parse options. for option @@ -88,156 +150,196 @@ case ${GNULIB_SRCDIR--} in GNULIB_SRCDIR=gnulib esac -<$GNULIB_SRCDIR/gnulib-tool || exit - -gnulib_modules=' -c-stack -dirname -error -exclude -exit -exitfail -file-type -fnmatch-gnu -getopt -gettext -gettime -hard-locale -inttostr -mkstemp -regex -sh-quote -stat-time -strcase -strftime -strtoumax -unlocked-io -verify -version-etc -version-etc-fsf -xalloc -xstrtoumax -' - -previous_gnulib_modules= -while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do - previous_gnulib_modules=$gnulib_modules - gnulib_modules=` - (echo "$gnulib_modules" - for gnulib_module in $gnulib_modules; do - $GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module - done) | sort -u - ` -done - -gnulib_files=` - (for gnulib_module in $gnulib_modules; do - $GNULIB_SRCDIR/gnulib-tool --extract-filelist $gnulib_module - done) | sort -u -`' - doc/fdl.texi -' - -gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u` -mkdir -p $gnulib_dirs || exit - -for gnulib_file in $gnulib_files; do - dest=$gnulib_file - - case $gnulib_file in - m4/onceonly_2_57.m4) dest=m4/onceonly.m4;; - # These will be overwritten by autopoint, which still uses - # old jm_.* macro names, so we have to keep both copies. - m4/gettext.m4 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \ - m4/lib-prefix.m4 | m4/longlong.m4 | \ - m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \ - m4/ulonglong.m4) - dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;; - esac - - rm -f $dest && - echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" && - cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit -done - +gnulib_tool=$GNULIB_SRCDIR/gnulib-tool +<$gnulib_tool || exit # Get translations. +get_translations() { + subdir=$1 + domain=$2 + + case $WGET_COMMAND in + '') + echo "$0: wget not available; skipping translations";; + ?*) + echo "$0: getting translations into $subdir for $domain..." && + + (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`) && + $WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" && + + sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" | + sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 | + awk -F. ' + { if (lang && $1 != lang) print lang, ver } + { lang = $1; ver = substr($0, index($0, ".") + 1) } + END { if (lang) print lang, ver } + ' | awk -v domain="$domain" -v subdir="$subdir" ' + { + lang = $1 + ver = $2 + urlfmt = "" + printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang + printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang + printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang + printf " rm -f %s/%s.po; }; } &&\n", subdir, lang + } + END { print ":" } + ' | WGET_COMMAND="$WGET_COMMAND" sh;; + esac && + ls "$subdir"/*.po 2>/dev/null | + sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" && + rm -f "$subdir/$domain.html" +} + case $SKIP_PO in '') case `wget --help` in *'--no-cache'*) - no_cache='--no-cache';; + WGET_COMMAND='wget -nv --no-cache';; *'--cache=on/off'*) - no_cache='--cache=off';; + WGET_COMMAND='wget -nv --cache=off';; + *'--non-verbose'*) + WGET_COMMAND='wget -nv';; *) - no_cache='';; + WGET_COMMAND='';; esac - echo "$0: getting translations into po (please ignore the robots.txt ERROR 404)..." - (cd po && - rm -f dummy `ls | sed -n '/\.gmo$/p; /^en\.po$/d; /\.po/p'` && - wget -nv -nd -r -l 1 -A .po $no_cache \ - http://www.iro.umontreal.ca/translation/maint/$package/ && - ls *.po | sed 's/\.po$//' >LINGUAS - ) || exit;; + get_translations po $package || exit + + if test -d runtime-po; then + get_translations runtime-po $package-runtime || exit + fi;; esac -# Generate autoconf and automake snippets. +slurp() { + for dir in . `(cd $1 && find * -type d -print)`; do + copied= + sep= + for file in `ls $1/$dir`; do + test -d $1/$dir/$file && continue + for excluded_file in $excluded_files; do + test "$dir/$file" = "$excluded_file" && continue 2 + done + test -d $dir || mkdir $dir || exit + if test $file = Makefile.am; then + copied=$copied${sep}gnulib.mk; sep=$nl + echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." && + sed '/^[^#].*\/intl/s/^/#/' $1/$dir/$file >$dir/gnulib.mk + elif test -r ${2-no/such/dir}/$dir/$file || + grep -F "/$file/" $dir/CVS/Entries 2>/dev/null | + grep -q '^/[^/]*/[0-9]'; then + echo "$0: $dir/$file overrides $1/$dir/$file" + else + copied=$copied$sep$file; sep=$nl + if test $file = gettext.m4; then + echo "$0: patching m4/gettext.m4 to remove need for intl/* ..." + sed ' + /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\ + AC_DEFUN([AM_INTL_SUBDIR], [ + /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\ + AC_DEFUN([gt_INTL_SUBDIR_CORE], []) + $a\ + AC_DEFUN([gl_LOCK_EARLY], []) + ' $1/$dir/$file >$dir/$file + else + cp $1/$dir/$file $dir/$file + fi + fi || exit + done -(echo '# This file is generated automatically by "bootstrap".' && - echo 'AC_DEFUN([GNULIB_AUTOCONF_SNIPPET],[' && - $GNULIB_SRCDIR/gnulib-tool --extract-autoconf-snippet $gnulib_modules && - echo '])' -) >m4/gnulib.m4 || exit + ig=$dir/.cvsignore + if test -n "$copied" && test -f $ig; then + echo "$copied" | sort -u - $ig | cmp -s - $ig || + echo "$copied" | sort -u - $ig -o $ig || exit + fi + done +} -(echo '# This file is generated automatically by "bootstrap".' && - $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules -) >lib/gnulib.mk || exit + +# Create boot temporary directories to import from gnulib and gettext. + +bt='.#bootmp' +bt2=${bt}2 +rm -fr $bt $bt2 && +mkdir $bt $bt2 || exit + +# Import from gnulib. + +gnulib_tool_options="\ + --import\ + --no-changelog\ + --aux-dir $bt/build-aux\ + --doc-base $bt/doc\ + --lib lib$package\ + --m4-base $bt/m4/\ + --source-base $bt/lib/\ + --tests-base $bt/tests\ +" +echo "$0: $gnulib_tool $gnulib_tool_options --import ..." +$gnulib_tool $gnulib_tool_options --import $gnulib_modules && +slurp $bt || exit + + +# Import from gettext. + +echo "$0: (cd $bt2; autopoint) ..." +cp configure.ac $bt2 && +(cd $bt2 && autopoint && rm configure.ac) && +slurp $bt2 $bt || exit + +rm -fr $bt $bt2 || exit # Reconfigure, getting other files. -echo "$0: autoreconf --verbose --install --force ..." -autoreconf --verbose --install --force || exit +for command in \ + 'aclocal --force -I m4' \ + 'autoconf --force' \ + 'autoheader --force' \ + 'automake --add-missing --copy --force-missing'; +do + echo "$0: $command ..." + $command || exit +done -# We don't need intl, so remove it. -# Remove aclocal.m4 too, so that it gets rebuilt. -intl_files_to_remove=' - aclocal.m4 - intl - m4/gettext.m4 - m4/glibc2.m4 - m4/glibc21.m4 - m4/intdiv0.m4 - m4/intmax.m4 - m4/inttypes_h.m4 - m4/inttypes.m4 - m4/inttypes-pri.m4 - m4/isc-posix.m4 - m4/lcmessage.m4 - m4/lib-ld.m4 - m4/lib-prefix.m4 - m4/longdouble.m4 - m4/longlong.m4 - m4/po.m4 - m4/printf-posix.m4 - m4/signed.m4 - m4/size_max.m4 - m4/stdint_h.m4 - m4/uintmax_t.m4 - m4/ulonglong.m4 - m4/wchar_t.m4 - m4/wint_t.m4 - m4/xsize.m4 -' -echo $0: rm -fr $intl_files_to_remove ... -rm -fr $intl_files_to_remove || exit +# Get some extra files from gnulib, overriding existing files. -# Put bug-reporting address into po/Makevars. -echo "$0: sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars ..." -sed '/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-bison@gnu.org/' po/Makevars.template >po/Makevars +for file in $gnulib_extra_files; do + src=$GNULIB_SRCDIR/$file + case $file in + */INSTALL) dest=.;; + *) dest=$file;; + esac + echo "$0: cp -fp $GNULIB_SRCDIR/$file $dest" && + cp -fp $GNULIB_SRCDIR/$file $dest || exit +done + + +# Create gettext configuration. +echo "$0: Creating po/Makevars from po/Makevars.template ..." +sed ' + /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/ + /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/ + /^XGETTEXT_OPTIONS *=/{ + s/$/ \\/ + a\ + '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+} + } +' po/Makevars.template >po/Makevars + +if test -d runtime-po; then + # Likewise for runtime-po/Makevars, except also change a few other parameters. + sed ' + s/^\(DOMAIN\) *=.*/\1 = '"$package"'-runtime/ + s/^\(subdir\) *=.*/\1 = runtime-po/ + s/^\(XGETTEXT_OPTIONS\) *=.*/\1 = '"$XGETTEXT_OPTIONS_RUNTIME"'/ + ' runtime-po/Makevars + + # Copy identical files from po to runtime-po. + (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po) +fi echo "$0: done. Now you can run './configure'." diff --git a/bootstrap.conf b/bootstrap.conf new file mode 100644 index 0000000..caad569 --- /dev/null +++ b/bootstrap.conf @@ -0,0 +1,53 @@ +# Bootstrap configuration. + +# Copyright (C) 2006 Free Software Foundation, Inc. + +# 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 2, 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + + +# gnulib modules used by this package. +gnulib_modules=' + c-stack config-h dirname dup2 error exclude exit exitfail + extensions fcntl fdl file-type fnmatch-gnu getopt gettext + gettime hard-locale inttostr mkstemp regex sh-quote + stat-macros stat-time strcase strftime strtoumax unistd + unlocked-io verify version-etc version-etc-fsf xalloc + xstrtoumax +' + +# Additional xgettext options to use. Use "\\\newline" to break lines. +XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\ + --from-code=UTF-8\\\ + --flag=asprintf:2:c-format --flag=vasprintf:2:c-format\\\ + --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\ + --flag=message:1:c-format --flag=message5:1:c-format\\\ + --flag=try_help:1:c-format\\\ +' + +# Gettext supplies these files, but we don't need them since +# we don't have an intl subdirectory. +excluded_files=' + m4/glibc2.m4 + m4/intdiv0.m4 + m4/lcmessage.m4 + m4/lock.m4 + m4/printf-posix.m4 + m4/size_max.m4 + m4/uintmax_t.m4 + m4/ulonglong.m4 + m4/visibility.m4 + m4/xsize.m4 +' diff --git a/configure.ac b/configure.ac index ae153c0..d5769df 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([gnits]) -AC_CONFIG_HEADER([config.h:config.hin]) +AC_CONFIG_HEADER([lib/config.h:lib/config.hin]) gl_USE_SYSTEM_EXTENSIONS AC_PROG_AWK @@ -34,8 +34,9 @@ AC_PROG_CC AM_PROG_CC_STDC AM_MISSING_PROG([HELP2MAN], [help2man]) AC_PROG_RANLIB - +gl_EARLY AC_SYS_LARGEFILE +gl_INIT AC_C_INLINE AC_C_VARARRAYS @@ -46,26 +47,18 @@ AC_DEFINE([DEFAULT_EDITOR_PROGRAM], ["ed"], AC_PATH_PROG([PR_PROGRAM], [pr], [""]) AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR_PROGRAM"], [Name of "pr" program.]) -AC_CHECK_HEADERS_ONCE([fcntl.h locale.h sys/file.h unistd.h]) AC_CHECK_MEMBERS([struct stat.st_blksize]) AC_CHECK_MEMBERS([struct stat.st_rdev]) AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_TYPE_PID_T -AC_DEFUN([DIFFUTILS_PREREQUISITES], [ - AC_REQUIRE([gl_AC_TYPE_INTMAX_T]) - AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) -]) -DIFFUTILS_PREREQUISITES - -AC_CHECK_FUNCS_ONCE([dup2 sigaction sigprocmask strcasecoll stricoll]) +AC_CHECK_FUNCS_ONCE([sigaction sigprocmask strcasecoll stricoll]) AC_FUNC_CLOSEDIR_VOID AC_FUNC_FORK -GNULIB_AUTOCONF_SNIPPET -AM_GNU_GETTEXT([external], [need-ngettext]) -AM_GNU_GETTEXT_VERSION([0.14.5]) +AM_GNU_GETTEXT([external], [need-formatstring-macros]) +AM_GNU_GETTEXT_VERSION([0.15]) XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT" AC_CONFIG_FILES([Makefile doc/Makefile \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 565f28d..01db680 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -17,18 +17,7 @@ ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. -noinst_LIBRARIES = libdiffutils.a - -noinst_HEADERS = cmpbuf.h prepargs.h - -libdiffutils_a_SOURCES = $(lib_SOURCES) -lib_SOURCES = cmpbuf.c prepargs.c - -libdiffutils_a_LIBADD = @ALLOCA@ @LIBOBJS@ -libdiffutils_a_DEPENDENCIES = $(libdiffutils_a_LIBADD) - -BUILT_SOURCES = -EXTRA_DIST = -MOSTLYCLEANFILES = - include gnulib.mk + +noinst_HEADERS += cmpbuf.h prepargs.h +libdiffutils_a_SOURCES += cmpbuf.c prepargs.c diff --git a/lib/cmpbuf.c b/lib/cmpbuf.c index aa110d2..01ae52f 100644 --- a/lib/cmpbuf.c +++ b/lib/cmpbuf.c @@ -18,9 +18,7 @@ If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H -# include -#endif +#include #include #include diff --git a/lib/prepargs.c b/lib/prepargs.c index 34c2856..f788929 100644 --- a/lib/prepargs.c +++ b/lib/prepargs.c @@ -1,6 +1,7 @@ /* Parse arguments from a string and prepend them to an argv. - Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2006 Free Software + Foundation, Inc. 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 @@ -19,9 +20,8 @@ /* Written by Paul Eggert . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include + #include "prepargs.h" #include #include diff --git a/src/Makefile.am b/src/Makefile.am index 2e02be3..fb48b19 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ # Automakefile for GNU diffutils programs. -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. ## 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 @@ -25,8 +25,8 @@ localedir = $(datadir)/locale AM_CPPFLAGS = -I../lib -I$(top_srcdir)/lib -LDADD = ../lib/libdiffutils.a @LIBINTL@ -diff_LDADD = $(LDADD) @LIB_CLOCK_GETTIME@ +LDADD = ../lib/libdiffutils.a $(LIBINTL) +diff_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) cmp_SOURCES = cmp.c diff3_SOURCES = diff3.c diff --git a/src/dir.c b/src/dir.c index 4894c89..12306e1 100644 --- a/src/dir.c +++ b/src/dir.c @@ -92,7 +92,7 @@ dir_read (struct file_data const *dir, struct dirdata *dirdata) while ((errno = 0, (next = readdir (reading)) != 0)) { char *d_name = next->d_name; - size_t d_size = NAMLEN (next) + 1; + size_t d_size = _D_EXACT_NAMLEN (next) + 1; /* Ignore "." and "..". */ if (d_name[0] == '.' diff --git a/src/system.h b/src/system.h index dde3619..91d358e 100644 --- a/src/system.h +++ b/src/system.h @@ -34,36 +34,23 @@ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || __STRICT_ANSI__ # define __attribute__(x) #endif -#if defined const && !defined volatile -# define volatile -#endif #include #include + #include +#include "stat-macros.h" -#ifndef S_IRWXU -# define S_IRWXU 0700 -#endif -#ifndef S_IRWXG -# define S_IRWXG 0070 -#endif -#ifndef S_IRWXO -# define S_IRWXO 0007 -#endif - -#if HAVE_UNISTD_H -# include -#endif - -#ifndef SEEK_SET -# define SEEK_SET 0 -#endif -#ifndef SEEK_CUR -# define SEEK_CUR 1 +#ifndef STAT_BLOCKSIZE +# if HAVE_STRUCT_STAT_ST_BLKSIZE +# define STAT_BLOCKSIZE(s) ((s).st_blksize) +# else +# define STAT_BLOCKSIZE(s) (8 * 1024) +# endif #endif +#include #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif @@ -74,49 +61,9 @@ # define STDERR_FILENO 2 #endif +#include #include -#if HAVE_FCNTL_H -# include -#else -# if HAVE_SYS_FILE_H -# include -# endif -#endif - -#if !HAVE_DUP2 -# define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t)) -#endif - -#ifndef O_RDONLY -# define O_RDONLY 0 -#endif -#ifndef O_RDWR -# define O_RDWR 2 -#endif -#ifndef S_IRUSR -# define S_IRUSR 0400 -#endif -#ifndef S_IWUSR -# define S_IWUSR 0200 -#endif - -/* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in fcntl.h */ -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -#endif - -#ifdef __BEOS__ - /* BeOS 5 has O_BINARY, but it has no effect. */ -# undef O_BINARY -#endif - -#ifndef O_BINARY -# define O_BINARY 0 -#endif - #if HAVE_SYS_WAIT_H # include #endif @@ -127,53 +74,18 @@ # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif -#ifndef STAT_BLOCKSIZE -# if HAVE_STRUCT_STAT_ST_BLKSIZE -# define STAT_BLOCKSIZE(s) ((s).st_blksize) -# else -# define STAT_BLOCKSIZE(s) (8 * 1024) -# endif -#endif - -#if HAVE_DIRENT_H -# include -# define NAMLEN(dirent) strlen ((dirent)->d_name) -#else -# define dirent direct -# define NAMLEN(dirent) ((dirent)->d_namlen) -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif +#include +#ifndef _D_EXACT_NAMLEN +# define _D_EXACT_NAMLEN(dp) strlen ((dp)->d_name) #endif #include #define EXIT_TROUBLE 2 #include - -#if HAVE_INTTYPES_H -# include -#endif -#ifndef PTRDIFF_MAX -# define PTRDIFF_MAX TYPE_MAXIMUM (ptrdiff_t) -#endif -#ifndef SIZE_MAX -# define SIZE_MAX TYPE_MAXIMUM (size_t) -#endif -#ifndef UINTMAX_MAX -# define UINTMAX_MAX TYPE_MAXIMUM (uintmax_t) -#endif -#if ! HAVE_STRTOUMAX && ! defined strtoumax -uintmax_t strtoumax (char const *, char **, int); -#endif - +#include #include +#include #include #if ! HAVE_STRCASECOLL @@ -187,12 +99,6 @@ uintmax_t strtoumax (char const *, char **, int); int strcasecmp (char const *, char const *); #endif -#if HAVE_LOCALE_H -# include -#else -# define setlocale(category, locale) -#endif - #include #define _(msgid) gettext (msgid)