[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [patch 2/5] port of Joe's backup-files.c over my nftw/ftw/ft
From: |
Gary V. Vaughan |
Subject: |
[Quilt-dev] [patch 2/5] port of Joe's backup-files.c over my nftw/ftw/fts replacement |
Date: |
Thu, 15 Sep 2005 16:13:10 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20050305) |
Use gcc builtin alloca on platforms without alloca.h
Makefile.in | 2 +-
configure.ac | 1 +
lib/backup-files.c | 15 ++++++++++++++-
3 files changed, 16 insertions(+), 2 deletions(-)
Index: quilt-HEAD/configure.ac
===================================================================
--- quilt-HEAD.orig/configure.ac
+++ quilt-HEAD/configure.ac
@@ -9,6 +9,7 @@ AC_SUBST(PACKAGE_RELEASE)
dnl Setup for backup-files compilation
AC_HEADER_STDC
+AC_CHECK_HEADERS([alloca.h])
AC_CHECK_FUNCS([mkdir])
AC_CHECK_FUNCS([rmdir])
AC_CHECK_FUNCS([strchr])
Index: quilt-HEAD/lib/backup-files.c
===================================================================
--- quilt-HEAD.orig/lib/backup-files.c
+++ quilt-HEAD/lib/backup-files.c
@@ -27,6 +27,10 @@
#define _GNU_SOURCE
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <utime.h>
@@ -36,9 +40,18 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include <alloca.h>
#include <dirent.h>
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#else /* !HAVE_ALLOCA_H */
+# ifdef __GNUC__
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+# endif
+#endif /* !HAVE_ALLOCA_H */
+
const char *progname;
enum { what_noop, what_backup, what_restore, what_remove };
Index: quilt-HEAD/Makefile.in
===================================================================
--- quilt-HEAD.orig/Makefile.in
+++ quilt-HEAD/Makefile.in
@@ -39,7 +39,7 @@ MAKE_NLS := $(MAKE)
endif
CC := @CC@
-CPPFLAGS += @CPPFLAGS@
+CPPFLAGS += @DEFS@ @CPPFLAGS@ -I.
CFLAGS += @CFLAGS@
LDFLAGS += @LDFLAGS@
LIBS := @LIBS@
--
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
signature.asc
Description: OpenPGP digital signature