cpp-fixes-20080630
authorRuss Allbery <rra@stanford.edu>
Tue, 1 Jul 2008 00:00:40 +0000 (00:00 +0000)
committerRuss Allbery <rra@stanford.edu>
Tue, 1 Jul 2008 00:00:40 +0000 (00:00 +0000)
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.

configure.in
src/config/Makefile.config.in
src/libafsrpc/Makefile.in
src/rxgen/Makefile.in
src/rxgen/rpc_main.c
src/shlibafsrpc/Makefile.in
src/sys/Makefile.in

index e380f7e..db1806f 100644 (file)
@@ -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
index 81e6198..5f13085 100644 (file)
@@ -65,6 +65,7 @@ PAM_CFLAGS = @PAM_CFLAGS@
 PAM_LIBS = @PAM_LIBS@
 PAM_OPTMZ = @PAM_OPTMZ@
 PAM_DBG = @PAM_DBG@
+PATH_CPP = @PATH_CPP@
 RANLIB = @RANLIB@
 REGEX_OBJ = @REGEX_OBJ@
 RM = @RM@
index 478eb3f..a541c91 100644 (file)
@@ -372,7 +372,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
index c528811..9240f2f 100644 (file)
@@ -26,7 +26,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
index facdba9..e2d2b56 100644 (file)
@@ -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
index e632eac..62c4170 100644 (file)
@@ -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
index a3580d0..a7b5a2a 100644 (file)
@@ -99,7 +99,7 @@ syscall.o: syscall.s
                 ${CC} ${CFLAGS} -c ${SYS}/syscall.s; \
                ;; \
        rs_aix* | hp_ux10*) \
-               $(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; \
                ;; \