[PATCH] Separate CFLAGS and CPPFLAGS

mouring at etoh.eviladmin.org mouring at etoh.eviladmin.org
Thu Dec 7 13:58:48 EST 2000


Ok.. Let me wake up for a few minutes.

=)

Attached should be a patch that splits CFLAGS into CFLAGS and CPPFLAGS.

If anyone knows a better way or sees a problem with it.. Let me know.  If
I don't hear anything I'll apply it in a few days.


On Wed, 6 Dec 2000 mouring at etoh.eviladmin.org wrote:

> 
> Along with breaks most of the ports since they put all the -I entries in
> CFLAGS.
> 
> However it will be noted as something to do.
> 
> - Ben
> 
> On Wed, 6 Dec 2000, Wilfredo Sanchez wrote:
> 
> >   If you want to override CFLAGS on the make line (eg. "make CFLAGS='-O3'"),
> > you lose because you end up stomping preprocessor flags as well.
> > Preprocessor should be in CPPFLAGS.  The following patch takes care of this.
> > 
> > 	-Fred
> > 
> > Index: Makefile.in
> > ===================================================================
> > RCS file: /cvs/Darwin/Services/OpenSSH/openssh/Makefile.in,v
> > retrieving revision 1.1.1.4
> > retrieving revision 1.8
> > diff -u -d -b -w -r1.1.1.4 -r1.8
> > --- Makefile.in 2000/12/06 21:56:06     1.1.1.4
> > +++ Makefile.in 2000/12/06 22:11:15     1.8
> > @@ -20,7 +20,8 @@
> >  CC=@CC@
> >  LD=@LD@
> >  PATHS=-DETCDIR=\"$(sysconfdir)\" -DSSH_PROGRAM=\"$(SSH_PROGRAM)\" -DSSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\"
> > -CFLAGS=@CFLAGS@ $(PATHS) @DEFS@
> > +CFLAGS=@CFLAGS@
> > +CPPFLAGS=@CPPFLAGS@ $(PATHS) @DEFS@ -I. -I$(srcdir)
> >  LIBS=@LIBS@
> >  AR=@AR@
> >  RANLIB=@RANLIB@
> > 
> > Wilfredo Sánchez, wsanchez at apple.com
> > Open Source Engineering Lead
> > Apple Computer, Inc., Core Operating System Group
> > 1 Infinite Loop, Cupertino, CA 94086, 408.974-5174
> > 
> 
> 
-------------- next part --------------
diff -ur openssh/Makefile.in ossh/Makefile.in
--- openssh/Makefile.in	Mon Dec  4 20:06:06 2000
+++ ossh/Makefile.in	Wed Dec  6 20:34:01 2000
@@ -20,7 +20,8 @@
 CC=@CC@
 LD=@LD@
 PATHS=-DETCDIR=\"$(sysconfdir)\" -DSSH_PROGRAM=\"$(SSH_PROGRAM)\" -DSSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\"
-CFLAGS=@CFLAGS@ $(PATHS) @DEFS@
+CFLAGS=@CFLAGS@
+CPPFLAGS=@CPPFLAGS@ -I$(srcdir) $(PATHS) @DEFS@
 LIBS=@LIBS@
 AR=@AR@
 RANLIB=@RANLIB@
Only in ossh: config.h.in
diff -ur openssh/configure.in ossh/configure.in
--- openssh/configure.in	Wed Dec  6 20:09:31 2000
+++ ossh/configure.in	Wed Dec  6 20:41:50 2000
@@ -41,13 +41,11 @@
 	CFLAGS="$CFLAGS -Wall"
 fi
 
-CFLAGS="$CFLAGS -I. -I${srcdir-.}"
-
 # Check for some target-specific stuff
 case "$host" in
 *-*-aix*)
 	AFS_LIBS="-lld"
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	if (test "$LD" != "gcc" && test -z "$blibpath"); then
 		blibpath="/usr/lib:/lib:/usr/local/lib"
@@ -75,9 +73,9 @@
 	;;
 *-*-hpux10*)
 	if test -z "$GCC"; then
-		CFLAGS="$CFLAGS -Ae"
+		CPPFLAGS="$CPPFLAGS -Ae"
 	fi
-	CFLAGS="$CFLAGS -D_HPUX_SOURCE"
+	CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
 	IPADDR_IN_DISPLAY=yes
 	AC_DEFINE(USE_PIPES)
 	AC_DEFINE(DISABLE_SHADOW)
@@ -88,7 +86,7 @@
 	mansubdir=cat
 	;;
 *-*-hpux11*)
-	CFLAGS="$CFLAGS -D_HPUX_SOURCE"
+	CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
 	IPADDR_IN_DISPLAY=yes
 	AC_DEFINE(USE_PIPES)
 	AC_DEFINE(DISABLE_SHADOW)
@@ -99,7 +97,7 @@
 	mansubdir=cat
 	;;
 *-*-irix5*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS"
 	PATH="$PATH:/usr/etc"
 	MANTYPE='$(CATMAN)'
@@ -108,7 +106,7 @@
 	AC_DEFINE(BROKEN_INET_NTOA)
 	;;
 *-*-irix6*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS"
 	PATH="$PATH:/usr/etc"
 	MANTYPE='$(CATMAN)'
@@ -145,10 +143,10 @@
 	AC_DEFINE(HAVE_NEXT)
 	AC_DEFINE(BROKEN_REALPATH)
 	AC_DEFINE(USE_PIPES)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	;;
 *-*-solaris*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
 	need_dash_r=1
 	# hardwire lastlog location (can't detect it on some versions)
@@ -164,7 +162,7 @@
 	fi
 	;;
 *-*-sunos4*)
-	CFLAGS="$CFLAGS -DSUNOS4"
+	CPPFLAGS="$CPPFLAGS -DSUNOS4"
 	AC_CHECK_FUNCS(getpwanam)
 	conf_utmp_location=/etc/utmp
 	conf_wtmp_location=/var/adm/wtmp
@@ -174,7 +172,7 @@
 	mansubdir=cat
 	;;
 *-sni-sysv*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
 	MANTYPE='$(CATMAN)'
 	AC_DEFINE(IP_TOS_IS_BROKEN)
@@ -182,7 +180,7 @@
 	LIBS="$LIBS -lgen -lnsl -lucb"
 	;;
 *-*-sysv4.2*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	MANTYPE='$(CATMAN)'
 	mansubdir=cat
@@ -190,7 +188,7 @@
 	enable_suid_ssh=no
 	;;
 *-*-sysv5*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	MANTYPE='$(CATMAN)'
 	mansubdir=cat
@@ -198,7 +196,7 @@
 	enable_suid_ssh=no
 	;;
 *-*-sysv*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	MANTYPE='$(CATMAN)'
 	mansubdir=cat
@@ -206,7 +204,7 @@
 	;;
 *-*-sco3.2v4*)
 	AC_DEFINE(USE_PIPES)
-	CFLAGS="$CFLAGS -Dftruncate=chsize -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	MANTYPE='$(CATMAN)'
 	mansubdir=cat
@@ -219,7 +217,7 @@
 	AC_DEFINE(DISABLE_SHADOW)
 	;;
 *-*-sco3.2v5*)
-	CFLAGS="$CFLAGS -I/usr/local/include"
+	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib"
 	MANTYPE='$(CATMAN)'
 	mansubdir=cat
@@ -250,7 +248,7 @@
 	[  --with-cflags           Specify additional flags to pass to compiler],
 	[
 		if test "x$withval" != "xno" ; then
-			CFLAGS="$CFLAGS $withval"
+			CPPFLAGS="$CPPFLAGS $withval"
 		fi
 	]	
 )
@@ -396,7 +394,7 @@
 
 saved_LIBS="$LIBS"
 saved_LDFLAGS="$LDFLAGS"
-saved_CFLAGS="$CFLAGS"
+saved_CPPFLAGS="$CPPFLAGS"
 if test "x$prefix" != "xNONE" ; then
 	tryssldir="$tryssldir $prefix"
 fi
@@ -405,7 +403,7 @@
 	for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
 		if test ! -z "$ssldir" ; then
 			LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
-			CFLAGS="$saved_CFLAGS -I$ssldir/include"
+			CPPFLAGS="$saved_CPPFLAGS -I$ssldir/include"
 			if test ! -z "$need_dash_r" ; then
 				LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
 			fi
@@ -454,7 +452,7 @@
 	AC_DEFINE(HAVE_OPENSSL)
 	dnl Need to recover ssldir - test above runs in subshell
 	ssldir=$ac_cv_openssldir
-	CFLAGS="$saved_CFLAGS -I$ssldir/include"
+	CPPFLAGS="$saved_CPPFLAGS -I$ssldir/include"
 	LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
 	if test ! -z "$need_dash_r" ; then
 		LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
@@ -1057,7 +1055,7 @@
 		if test "x$withval" != "xno" ; then
 	
 			if test "x$withval" != "xyes" ; then
-				CFLAGS="$CFLAGS -I${withval}/include"
+				CPPFLAGS="$CPPFLAGS -I${withval}/include"
 				LDFLAGS="$LDFLAGS -L${withval}/lib"
 				if test ! -z "$need_dash_r" ; then
 					LDFLAGS="$LDFLAGS -R${withval}/lib"
@@ -1067,7 +1065,7 @@
 				fi
 			else
 				if test -d /usr/include/kerberosIV ; then
-					CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
+					CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
 				fi
 			fi
 
@@ -1097,7 +1095,7 @@
 		if test "x$withval" != "xno" ; then
 
 			if test "x$withval" != "xyes" ; then
-				CFLAGS="$CFLAGS -I${withval}/include"
+				CPPFLAGS="$CPPFLAGS -I${withval}/include"
 				LDFLAGS="$LDFLAGS -L${withval}/lib"
 			fi
 
@@ -1124,7 +1122,7 @@
 		if test "x$withval" != "xno" ; then
 
 			if test "x$withval" != "xyes" ; then
-				CFLAGS="$CFLAGS -I${withval}/include"
+				CPPFLAGS="$CPPFLAGS -I${withval}/include"
 				LDFLAGS="$LDFLAGS -L${withval}/lib"
 			fi
 
@@ -1599,11 +1597,12 @@
 
 echo ""
 
-echo "             Host: ${host}"
-echo "         Compiler: ${CC}"
-echo "   Compiler flags: ${CFLAGS}"
-echo "     Linker flags: ${LDFLAGS}"
-echo "        Libraries: ${LIBS}"
+echo "              Host: ${host}"
+echo "          Compiler: ${CC}"
+echo "    Compiler flags: ${CFLAGS}"
+echo "Preprocessor flags: ${CPPFLAGS}"
+echo "      Linker flags: ${LDFLAGS}"
+echo "         Libraries: ${LIBS}"
 
 echo ""
 


More information about the openssh-unix-dev mailing list