From 3cd8c5cc1834d849b8ca37d4f3a54ecc2ef45586 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 1 Jul 2008 00:57:44 +0000 Subject: [PATCH] STABLE14-cpp-fixes-20080630 LICENSE BSD When probing in configure for cpp, use the user's PATH first and then the /lib and /usr/ccs/lib directories. Set PATH_CPP instead of CPP, since the latter is just overwritten by Autoconf. Use PATH_CPP by preference in rxgen and when pre-processing assembly, since otherwise newer gcc will treat the input file as linker input and not do anything with it. Don't assume that cpp writes to the second argument; gcc apparently doesn't always do this. Instead, redirect standard output. (cherry picked from commit 1ec104280d4a4b0a7544a99a7366f59cd3a2cc5f) --- configure.in | 3 ++- src/config/Makefile.config.in | 1 + src/libafsrpc/Makefile.in | 2 +- src/rxgen/Makefile.in | 2 +- src/rxgen/rpc_main.c | 4 ++-- src/shlibafsrpc/Makefile.in | 2 +- src/sys/Makefile.in | 4 ++-- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/configure.in b/configure.in index 06c0c3691..eb95f0fe2 100644 --- a/configure.in +++ b/configure.in @@ -11,7 +11,8 @@ AC_SUBST(LINUX_PKGVER) AC_SUBST(LINUX_PKGREL) AC_PROG_CC -AC_CHECK_PROGS(CPP,[/lib/cpp /usr/bin/cpp /usr/ccs/lib/cpp cpp],,[$PATH:/]) +AC_PATH_PROGS([PATH_CPP], [cpp], , [$PATH:/lib:/usr/ccs/lib]) +AC_SUBST([PATH_CPP]) OPENAFS_CONFIGURE_COMMON if test -d 'doc/man-pages' ; then diff --git a/src/config/Makefile.config.in b/src/config/Makefile.config.in index ebdf35a1b..9f7e93ec0 100644 --- a/src/config/Makefile.config.in +++ b/src/config/Makefile.config.in @@ -65,6 +65,7 @@ PAM_CFLAGS = @PAM_CFLAGS@ PAM_LIBS = @PAM_LIBS@ PINSTALL_LIBS = @PINSTALL_LIBS@ RANLIB = @RANLIB@ +PATH_CPP = @PATH_CPP@ REGEX_OBJ = @REGEX_OBJ@ RM = @RM@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ diff --git a/src/libafsrpc/Makefile.in b/src/libafsrpc/Makefile.in index c74f4cfaa..bb00a74f4 100644 --- a/src/libafsrpc/Makefile.in +++ b/src/libafsrpc/Makefile.in @@ -366,7 +366,7 @@ syscall.o: ${SYS}/syscall.s *bsd* ) \ touch syscall.o ;; \ *) \ - $(CPP) ${SFLAGS} ${SYS}/syscall.s syscall.ss; \ + $(PATH_CPP) ${SFLAGS} ${SYS}/syscall.s > syscall.ss; \ as -o syscall.o syscall.ss; \ $(RM) syscall.ss;; \ esac diff --git a/src/rxgen/Makefile.in b/src/rxgen/Makefile.in index a9cd97e2c..e635f561e 100644 --- a/src/rxgen/Makefile.in +++ b/src/rxgen/Makefile.in @@ -19,7 +19,7 @@ rxgen: $(OBJS) AFS_component_version_number.c $(HDRS) $(CC) $(CFLAGS) $(OBJS) $(XLIBS) -o $@ rpc_main.o: rpc_main.c - $(CCOBJ) $(CFLAGS) -c $< -D__PROG_CPP__="\"$(CPP)\"" + $(CCOBJ) $(CFLAGS) -c $< -DPATH_CPP="\"$(PATH_CPP)\"" # # Install targets diff --git a/src/rxgen/rpc_main.c b/src/rxgen/rpc_main.c index f82a3bf96..8872a0a80 100644 --- a/src/rxgen/rpc_main.c +++ b/src/rxgen/rpc_main.c @@ -94,8 +94,8 @@ char xflag = 0; /* if set, add stats code to stubs */ char yflag = 0; /* if set, only emit function name arrays to xdr file */ int debug = 0; static char *cmdname; -#ifdef __PROG_CPP__ -static char CPP[] = __PROG_CPP__; +#ifdef PATH_CPP +static char CPP[] = PATH_CPP; #else static char CPP[] = "/lib/cpp"; #endif diff --git a/src/shlibafsrpc/Makefile.in b/src/shlibafsrpc/Makefile.in index 2ad554545..1196eaff7 100644 --- a/src/shlibafsrpc/Makefile.in +++ b/src/shlibafsrpc/Makefile.in @@ -378,7 +378,7 @@ syscall.o: ${SYS}/syscall.s *fbsd* ) \ touch syscall.o ;; \ *) \ - $(CPP) ${SFLAGS} ${SYS}/syscall.s syscall.ss; \ + $(PATH_CPP) ${SFLAGS} ${SYS}/syscall.s > syscall.ss; \ as -o syscall.o syscall.ss; \ $(RM) syscall.ss;; \ esac diff --git a/src/sys/Makefile.in b/src/sys/Makefile.in index 70835b921..12b7206bc 100644 --- a/src/sys/Makefile.in +++ b/src/sys/Makefile.in @@ -88,7 +88,7 @@ tests: pagsh pagsh.krb fixit iinc idec icreate iopen istat rmtsysd syscall.o: syscall.s @set -x; case "$(SYS_NAME)" in \ sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5? | sun4x_5?? | sunx86_5? | sunx86_5?? ) \ - $(CPP) -P ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \ + $(PATH_CPP) -P ${SFLAGS} ${srcdir}/syscall.s > syscall.ss; \ as -o syscall.o syscall.ss; \ $(RM) syscall.ss;; \ sgi_* |*_darwin* ) \ @@ -104,7 +104,7 @@ syscall.o: syscall.s ${AS} syscall.S -o syscall.o ; \ $(RM) -f syscall.S ;;\ *) \ - $(CPP) -P ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \ + $(PATH_CPP) -P ${SFLAGS} ${srcdir}/syscall.s > syscall.ss; \ as -o syscall.o syscall.ss; \ $(RM) syscall.ss;; \ esac -- 2.39.5