From dabc4c7abcba043e206745bdb101aafb48c00c71 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 15 May 2005 21:06:38 +0000 Subject: [Modularization/autotooling project] Add support for building with autoconf #ifdefs if present. #include "makedepend-config.h" if HAVE_CONFIG_H is defined. --- main.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index a6c4883..ad4383c 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,5 @@ /* $Xorg: main.c,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $ */ +/* $XdotOrg: $ */ /* Copyright (c) 1993, 1994, 1998 The Open Group @@ -47,10 +48,6 @@ in this Software without prior written authorization from The Open Group. #include -#ifdef MINIX -#define USE_CHMOD 1 -#endif - #ifdef DEBUG int _debugmask; #endif @@ -118,10 +115,14 @@ static void setfile_cmdinc(struct filepointer *filep, long count, char **list); static void redirect(char *line, char *makefile); static -#ifdef SIGNALRETURNSINT -int +#ifdef RETSIGTYPE +RETSIGTYPE #else +# ifdef SIGNALRETURNSINT +int +# else void +# endif #endif catch (int sig) { @@ -143,6 +144,12 @@ catch (int sig) struct sigaction sig_act; #endif /* USGISH */ +#ifndef USING_AUTOCONF +# if !defined(USGISH) && !defined(_SEQUENT_) && !defined(MINIX) +# define HAVE_FCHMOD 1 +# endif +#endif + int main(int argc, char *argv[]) { @@ -738,7 +745,17 @@ char *base_name(char *file) return(file); } -#if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__UNIXOS2__) && !defined(clipper) && !defined(__clipper__) +#ifdef USING_AUTOCONF +# ifndef HAVE_RENAME +# define NEED_RENAME +# endif +#else /* Imake configured, check known OS'es without rename() */ +# if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__UNIXOS2__) && !defined(clipper) && !defined(__clipper__) +# define NEED_RENAME +# endif +#endif + +#ifdef NEED_RENAME int rename (char *from, char *to) { (void) unlink (to); @@ -749,7 +766,7 @@ int rename (char *from, char *to) return -1; } } -#endif /* USGISH */ +#endif /* NEED_RENAME */ void redirect(char *line, char *makefile) @@ -814,11 +831,11 @@ redirect(char *line, char *makefile) } } fflush(fdout); -#if defined(USGISH) || defined(_SEQUENT_) || defined(USE_CHMOD) +#ifndef HAVE_FCHMOD chmod(makefile, st.st_mode); #else fchmod(fileno(fdout), st.st_mode); -#endif /* USGISH */ +#endif /* HAVE_FCHMOD */ } void -- cgit v1.2.1