Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Nov 1996 15:37:51 -0600 (CST)
From:      Dave Bodenstab <imdave@synet.net>
To:        freebsd-questions@freebsd.org, steve@edmweb.com
Subject:   Re: Gnu dc 1.03 compile problems
Message-ID:  <199611212137.PAA08190@base486.synet.net>

next in thread | raw e-mail | index | archive | help

> Has anyone been able to get GNU dc v1.03 to compile on a 2.1.0-RELEASE
> system? I've tried, but it produces a bunch of warnings and errors (see
> below). 

Here are the changes I made... there's more here than
you need to fix your problem, but it's been a while
and I don't remember all the particulars.  I'm still
running 2.0.5, but I don't think that makes any real
difference wrt the problem.

Your problem is caused by the -D_POSIX_SOURCE in the
Makefile, so if you don't want to blindly apply these
patches, you can start by just removing that.  Beware;
watch out for the mailer possiblly mangling the tabs in
the following patch.  I also use a modified autoconf to
generate the configure script, so you might need a few
more tweeks here and there.

Now, whether or not this just skirts an actual problem
with the headers... I don't know.  This is just a brute
force way to get it to compile.

Good luck.

Dave Bodenstab
imdave@synet.net

===================================================================
diff -u -r1.3 -r1.3.1.1
--- Makefile.in	1996/07/29 03:50:46	1.3
+++ Makefile.in	1996/07/29 03:50:47	1.3.1.1
@@ -66,7 +66,7 @@
 
 # stuff for cflags
 
-STDDEFS = -D_POSIX_SOURCE -DDOT_IS_LAST
+STDDEFS = -DDOT_IS_LAST
 INCDIR = -I. -I$(srcdir)
 
 #
@@ -76,7 +76,7 @@
 #  README file for more details.
 #
 O=o
-CFLAGS = -O $(INCDIR) $(STDDEFS) @CFLAGS@
+CFLAGS = $(INCDIR) $(STDDEFS) @CFLAGS@
 LDFLAGS = 
 #
 # For the PC version of MINIX (K&R compiler), use the following lines.
@@ -146,7 +146,7 @@
 	rm -f ./fbc
 
 fbc: $(BCOFILES) bc.$O
-	echo \"\" > libmath.h
+	echo  > libmath.h
 	$(CC) -c $(CFLAGS) global.c
 	$(CC) -o fbc $(LDFLAGS) bc.$O $(BCOFILES) global.$O $(LEXLIB)
 
@@ -154,7 +154,6 @@
 	rm -f $(bindir)/bc $(bindir)/dc
 	$(INSTALL_PROGRAM) bc $(bindir)
 	$(INSTALL_PROGRAM) dc $(bindir)
-	chmod 555 $(bindir)/bc $(bindir)/dc
 	if grep -s "define BC_MATH_FILE" config.h; \
 	  then rm -f $(libdir)/libmath.b; \
 	  $(INSTALL_DATA) $(srcdir)/libmath.b $(libdir); \
@@ -162,14 +161,16 @@
 	  else true; \
 	fi
 	$(INSTALL_DATA) $(srcdir)/bc.1 $(mandir)
+	gzip -9nf ${mandir}/bc.1
 	$(INSTALL_DATA) $(srcdir)/dc.1 $(mandir)
+	gzip -9nf ${mandir}/dc.1
 	$(INSTALL_DATA) $(srcdir)/dc.info $(infodir)
 
 installdirs:
 	-mkdir $(prefix)
 	-mkdir $(bindir)
 	-if grep -s "define BC_MATH_FILE" config.h; \
-	  then mkdir $(libdir)
+	  then mkdir $(libdir); \
 	  else true; \
 	fi
 	-mkdir $(mandir)
@@ -178,7 +179,7 @@
 uninstall: 
 	rm -f $(bindir)/bc $(bindir)/dc
 	if grep -s "define BC_MATH_FILE" config.h; \
-	  then rm -f $(libdir)/libmath.b;
+	  then rm -f $(libdir)/libmath.b; \
 	  else true; \
 	fi
 	rm -f $(mandir)/bc1 $(mandir)/dc.1
@@ -248,7 +249,9 @@
 	cp $(srcdir)/y.tab.h.dist y.tab.h
 
 clean:
-	rm -f *.$O core ERRS *~ *.bak *.Z 
+	rm -f *.$O core ERRS *~ *.bak *.Z
+	rm -f bc.c scan.c y.tab.h bc dc
+	rm -f Makefile config.h config.log config.cache libmath.h dc.info
 
 distclean: clean
 	rm -f scan.c y.tab.h bc.c sbc.c bc sbc bc-dist* config.h  bc-*.* \
===================================================================
diff -u -r1.3 -r1.3.1.1
--- bc.y	1996/07/29 03:50:49	1.3
+++ bc.y	1996/07/29 03:50:50	1.3.1.1
@@ -64,7 +64,7 @@
 %token <i_value> NEWLINE AND OR NOT
 %token <s_value> STRING NAME NUMBER
 /*     '-', '+' are tokens themselves		*/
-%token <c_value> MUL_OP
+%token <c_value> MUL_OP '+' '-' 
 /*     '*', '/', '%' 				*/
 %token <c_value> ASSIGN_OP
 /*     '=', '+=',  '-=', '*=', '/=', '%=', '^=' */
@@ -83,7 +83,6 @@
 
 /* Types of all other things. */
 %type <i_value> expression return_expression named_expression opt_expression
-%type <c_value> '+' '-' 
 %type <a_value> opt_parameter_list opt_auto_define_list define_list
 %type <a_value> opt_argument_list argument_list
 %type <i_value> program input_item semicolon_list statement_list
@@ -105,11 +104,6 @@
 program			: /* empty */
 			    {
 			      $$ = 0;
-			      if (interactive)
-				{
-				  printf ("%s\n", BC_VERSION);
-				  welcome ();
-				}
 			    }
 			| program input_item
 			;
===================================================================
diff -u -r1.3 -r1.3.1.1
--- const.h	1996/07/29 03:51:02	1.3
+++ const.h	1996/07/29 03:51:02	1.3.1.1
@@ -38,13 +38,25 @@
 /* Define constants in some reasonable size.  The next 4 constants are
    POSIX constants. */
 
+#ifdef BC_BASE_MAX
+#undef BC_BASE_MAX
+#endif
 #define BC_BASE_MAX   INT_MAX
+#ifdef BC_SCALE_MAX
+#undef BC_SCALE_MAX
+#endif
 #define BC_SCALE_MAX  INT_MAX
+#ifdef BC_STRING_MAX
+#undef BC_STRING_MAX
+#endif
 #define BC_STRING_MAX INT_MAX
 
 
 /* Definitions for arrays. */
 
+#ifdef BC_DIM_MAX
+#undef BC_DIM_MAX
+#endif
 #define BC_DIM_MAX    65535       /* this should be NODE_SIZE^NODE_DEPTH-1 */
 
 #define   NODE_SIZE        16     /* Must be a power of 2. */
===================================================================
diff -u -r1.3 -r1.3.1.1
--- fix_libmath.h	1996/07/29 03:51:00	1.3
+++ fix_libmath.h	1996/07/29 03:51:00	1.3.1.1
@@ -1,8 +1,5 @@
 ed libmath.h <<EOS-EOS
-1,1s/^/"/
-1,\$s/\$/\\\\/
-\$,\$d
-\$,\$s/\\\\\$/"/
+,s/./'&',/g
 w
 q
 EOS-EOS
===================================================================
diff -u -r1.3 -r1.3.1.1
--- global.c	1996/07/29 03:50:52	1.3
+++ global.c	1996/07/29 03:50:53	1.3.1.1
@@ -36,7 +36,7 @@
 #include "global.h"
 
 #ifndef BC_MATH_FILE
-CONST char libmath[] = 
+CONST char libmath[] = {
 #include "libmath.h"
-;
+0 };
 #endif 
===================================================================
diff -u -r1.3 -r1.3.1.1
--- main.c	1996/07/29 03:50:55	1.3
+++ main.c	1996/07/29 03:50:55	1.3.1.1
@@ -77,6 +77,7 @@
 	  break;
 	case 'v':  /* Print the version. */
 	  printf ("%s\n", BC_VERSION);
+	  welcome ();
 	  break;
 	}
       ch = getopt (argc, argv, "lcisvw");
===================================================================
diff -u -r1.3 -r1.3.1.1
--- proto.h	1996/07/29 03:51:04	1.3
+++ proto.h	1996/07/29 03:51:05	1.3.1.1
@@ -161,6 +161,3 @@
 _PROTOTYPE(int yyparse, (void));
 _PROTOTYPE(int yylex, (void)); 
 
-/* Other things... */
-_PROTOTYPE (int getopt, (int, char *[], CONST char *));
-
===================================================================
diff -u -r1.3 -r1.3.1.1
--- scan.l	1996/07/29 03:50:57	1.3
+++ scan.l	1996/07/29 03:50:58	1.3.1.1
@@ -69,7 +69,9 @@
 sqrt   return(Sqrt);
 scale  return(Scale);
 ibase  return(Ibase);
+ib     return(Ibase);
 obase  return(Obase);
+ob     return(Obase);
 auto   return(Auto);
 else   return(Else);
 read   return(Read);
@@ -178,9 +180,9 @@
 	    yyerror ("illegal character: ^%c",yytext[0] + '@');
 	  else
 	    if (yytext[0] > '~')
-	      yyerror ("illegal character: \\%3d", (int) yytext[0]);
+	      yyerror ("illegal character: 0x%2x", (int) yytext[0]);
 	    else
-	      yyerror ("illegal character: %s",yytext);
+	      yyerror ("illegal character: '%s'",yytext);
 	}
 %%
 
=============== end of patch ======================================




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611212137.PAA08190>