quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] no-need-to-depend-on-autoheader.diff


From: Gary V. Vaughan
Subject: [Quilt-dev] [PATCH] no-need-to-depend-on-autoheader.diff
Date: Sun, 18 Sep 2005 12:43:56 +0100

There is no need to add a requirement for developers to run autoheader,
when for a single C file with a few defines, passing the configure results
is just as easy. (btw config.h.in is not portable to 8.3 filesystems -
AC_CONFIG_HEADERS(config.h:config-h.in) is idiomatic)

$ rm -rf config.h*
$ autoconf
$ configure
...
$ make
...
gcc -g -O2 -Wall -I. -DPACKAGE_NAME=\"quilt\" -DPACKAGE_TARNAME=\"quilt\"
-DPACKAGE_VERSION=\"0.42\" -DPACKAGE_STRING=\"quilt\ 0.42\"
-DPACKAGE_BUGREPORT=\"address@hidden" -DSTDC_HEADERS=1 -DHAVE_MKSTEMP=1
-DHAVE_MKDIR=1 -DHAVE_RMDIR=1 -DHAVE_STRCHR=1 -DHAVE_STRERROR=1
-DHAVE_STRRCHR=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1   -c -o lib/backup-files.o
lib/backup-files.c
gcc -o lib/backup-files  lib/backup-files.o
...

Cheers,
        Gary.

 config.h.in        |   78 -----------------------------------------------------
 Makefile.in        |   14 ++++-----
 configure.ac       |    1
 lib/backup-files.c |   17 ++++++-----
 4 files changed, 17 insertions(+), 93 deletions(-)

Index: quilt-HEAD/Makefile.in
===================================================================
--- quilt-HEAD.orig/Makefile.in
+++ quilt-HEAD/Makefile.in
@@ -56,7 +56,7 @@ MAKE_NLS :=   $(MAKE)
 endif
 
 CC :=          @CC@
-CPPFLAGS +=    @CPPFLAGS@ -I.
+CPPFLAGS +=    @CPPFLAGS@ -I. @DEFS@
 CFLAGS +=      @CFLAGS@
 LDFLAGS +=     @LDFLAGS@
 LIBS :=                @LIBS@
@@ -102,7 +102,7 @@ LIB :=              backup-files$(EXEEXT)
 SRC +=         $(LIB_SRC:%=lib/%)
 DIRT +=                lib/backup-files$(EXEEXT) $(LIB_SRC:%.c=lib/%.o)
 
-DOC_IN :=      README 
+DOC_IN :=      README
 DOC_SRC :=     $(DOC_IN:%=doc/%.in)
 DOC :=         $(DOC_IN)
 SRC +=         $(DOC_SRC)
@@ -113,7 +113,7 @@ DIRT +=             $(DOC_IN:%=doc/%) doc/quilt.1
 MAN1 :=                bin/guards.1 doc/quilt.1
 DIRT +=                $(MAN1)
 
-#DEBIAN :=     changelog control copyright rules 
+#DEBIAN :=     changelog control copyright rules
 #
 #SRC +=                $(DEBIAN:%=debian/%)
 
@@ -157,7 +157,7 @@ doc/README : doc/README.in $(QUILT:%=qui
                        ;; \
                esac ; \
        done 2>&1 < $< > $@
-       
+
 doc/quilt.1: doc/quilt.1.in $(QUILT:%=quilt/%)
        @echo "quilt.1.in -> quilt.1"
        @here=`pwd`;                                     \
@@ -261,7 +261,7 @@ install-main: scripts
 
        $(INSTALL) -d $(BUILD_ROOT)$(QUILT_DIR)
        $(INSTALL) -m 755 $(QUILT:%=quilt/%) $(BUILD_ROOT)$(QUILT_DIR)/
-       
+
        $(INSTALL) -d $(BUILD_ROOT)$(SCRIPTS_DIR)
        $(INSTALL) -m 755 $(patsubst %,scripts/%, \
                             $(filter-out patchfns,$(SCRIPTS))) \
@@ -279,7 +279,7 @@ install-main: scripts
 
        $(INSTALL) -d $(BUILD_ROOT)$(mandir)/man1
        $(INSTALL) -m 644 $(MAN1) $(BUILD_ROOT)$(mandir)/man1/
-       
+
        $(MAKE_NLS) -C po install BUILD_ROOT=$(BUILD_ROOT) \
                LINGUAS="$(LINGUAS)" localedir=$(localedir)
 
@@ -313,7 +313,7 @@ uninstall:
 
 clean :
        rm -f $(DIRT)
-       
+
 distclean : clean
        rm -f config.log config.status Makefile
        rm -rf autom4te.cache/
Index: quilt-HEAD/config.h.in
===================================================================
--- quilt-HEAD.orig/config.h.in
+++ /dev/null
@@ -1,78 +0,0 @@
-/* config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `mkdir' function. */
-#undef HAVE_MKDIR
-
-/* Define to 1 if you have the `mkstemp' function. */
-#undef HAVE_MKSTEMP
-
-/* Define to 1 if you have the `mktemp' function. */
-#undef HAVE_MKTEMP
-
-/* Define to 1 if you have the `rmdir' function. */
-#undef HAVE_RMDIR
-
-/* Define to 1 if `stat' has the bug that it succeeds when given the
-   zero-length file name argument. */
-#undef HAVE_STAT_EMPTY_STRING_BUG
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strrchr' function. */
-#undef HAVE_STRRCHR
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
-   slash. */
-#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
Index: quilt-HEAD/configure.ac
===================================================================
--- quilt-HEAD.orig/configure.ac
+++ quilt-HEAD/configure.ac
@@ -224,7 +224,6 @@ AC_SUBST(RPMBUILD)
 AC_SUBST(COMPAT_SYMLINKS)
 AC_SUBST(COMPAT_PROGRAMS)
 
-AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_FILES(Makefile)
 AC_OUTPUT
 
Index: quilt-HEAD/lib/backup-files.c
===================================================================
--- quilt-HEAD.orig/lib/backup-files.c
+++ quilt-HEAD/lib/backup-files.c
@@ -27,7 +27,10 @@
 
 #define _GNU_SOURCE
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <utime.h>
@@ -123,7 +126,7 @@ remove_parents(char *filename)
                        *g = '/';
                g = f;
                *f= '\0';
-               
+
                rmdir(filename);
        }
        if (g != NULL)
@@ -200,7 +203,7 @@ ensure_nolinks(const char *filename)
                from_fd = open(filename, O_RDONLY);
                if (from_fd == -1)
                        goto fail;
-               
+
                /* Temp file name is "path/to/.file.XXXXXX" */
                strcpy(tmpname, filename);
                strcat(tmpname, ".XXXXXX");
@@ -211,7 +214,7 @@ ensure_nolinks(const char *filename)
                        c++;
                memmove(c + 1, c, strlen(c) + 1);
                *c = '.';
-               
+
                to_fd = mkstemp(tmpname);
                if (to_fd == -1)
                        goto fail;
@@ -361,7 +364,7 @@ int
 main(int argc, char *argv[])
 {
        int opt, status=0;
-       
+
        progname = argv[0];
 
        while ((opt = getopt(argc, argv, "brxB:z:f:shLt")) != -1) {
@@ -381,7 +384,7 @@ main(int argc, char *argv[])
                        case 'B':
                                opt_prefix = optarg;
                                break;
-                               
+
                        case 'f':
                                opt_file = optarg;
                                break;
@@ -435,7 +438,7 @@ main(int argc, char *argv[])
                                *(l-1) = '\0';
                        if (*line == '\0')
                                continue;
-                               
+
                        if ((status = process_file(line)) != 0)
                                return status;
                }
-- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook




reply via email to

[Prev in Thread] Current Thread [Next in Thread]