Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!uwvax!husc6!ut-sally!ut-ngp!jjhnsn From: jjhnsn@ut-ngp.UUCP (James Lee Johnson) Newsgroups: comp.lang.c++ Subject: Re: installing C++ under 4.3BSD Message-ID: <4307@ut-ngp.UUCP> Date: Fri, 14-Nov-86 17:38:43 EST Article-I.D.: ut-ngp.4307 Posted: Fri Nov 14 17:38:43 1986 Date-Received: Sat, 15-Nov-86 04:59:56 EST References: <4278@ut-ngp.UUCP> <1183@tekcrl.UUCP> Reply-To: jjhnsn@ngp.UUCP (James Lee Johnson) Organization: Univ. of Texas at Austin Lines: 115 Todd Brunhoff is correct in his diagnosis of the CC problem under 4.3. However, his fix is a little severe. Replacing $X with $C on the compile command lines will get rid of the offending -o option. Unfortunately, it will also eliminate any valid compile options (e.g. -O) that the C++ user may have specified. Enclosed is a diff of mods to make the CC script more discriminating about passing cc options. This patch also includes Todd Brunhoff's fix to make the tests for a null string work under 4.2BSD. I believe that these mods will work under 4.?BSD and System V. However, they have only been tested under 4.3BSD. Please let me know if you find a problem with them. Technical Details The problem is that "CC" is passing the -o option to the compile only invocation of "cc". While the 4.2BSD C compiler ignored it, it is actually incorrect. It appears that the $X shell variable holds arguments for the compile step. My solution was to not put -o and its argument in the $X variable. Similarly, I handled "*.o" arguments as a special case, copying them to $Z (the shell variable for loader arguments), but not to $X. Conversely, "-O" is handled a a special case that is copied to the $X variable, but not to $Z. Also, it seemed to me that the $LIBRARY shell variable should not be passed to the compile only invocations of "cc". -- James Lee Johnson, UTexas Computation Center, Austin, Texas 78712 ARPA: jjhnsn@ngp.cc.utexas.edu jjhnsn@ut-ngp.ARPA UUCP: allegra!ut-ngp!jjhnsn gatech!ut-ngp!jjhnsn ihnp4!ut-ngp!jjhnsn seismo!ut-sally!jjhnsn harvard!ut-sally!jjhnsn -- *** CC.dst Mon Aug 11 10:21:41 1986 --- CC Fri Nov 14 15:42:15 1986 *************** *** 19,22 **** --- 19,27 ---- cfrontC=${cfrontC-cfront} cppC=${cppC-/lib/cpp} + # + # $Y is C preprocessor arguments (for $cppC) + # $X is C compiler arguments (for $ccC -c) + # $Z is C loader arguments (for $ccC) + # G=0 for A do *************** *** 54,59 **** -c) CF=1 ;; ! -o) X="$X $A" ! Z="$Z $A" OX=1 ;; --- 59,65 ---- -c) CF=1 ;; ! -O) X="$X $A" ! ;; ! -o) Z="$Z $A" OX=1 ;; *************** *** 62,65 **** --- 68,74 ---- -.*) SUF=`expr "$A" : '-\(.*\)'` ;; + *.o) Z="$Z $A" + G=1 + ;; *.c) if test -f $A then *************** *** 128,132 **** XON="" else - X="$X $A" Z="$Z $A" if test $OX --- 137,140 ---- *************** *** 135,138 **** --- 143,147 ---- OX="" else + X="$X $A" G=1 fi *************** *** 156,161 **** if test $CF # -c: skip link edit then ! echo "$ccC $P -c $X $LIBRARY" 1>&2 ! $ccC $P -c $X $LIBRARY EE=$? for A in $MVLIST --- 165,170 ---- if test $CF # -c: skip link edit then ! echo "$ccC $P -c $X" 1>&2 ! $ccC $P -c $X EE=$? for A in $MVLIST *************** *** 197,201 **** esac ! if test "$R" -a ! "$PLUSI" then rm $C --- 206,210 ---- esac ! if test "$R" != "" -a "$PLUSI" = "" then rm $C