public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: egcs needs a system.h?
@ 1998-02-04 11:11 Kaveh R. Ghazi
  1998-02-12  1:55 ` Jeffrey A Law
  0 siblings, 1 reply; 15+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-04 11:11 UTC (permalink / raw)
  To: law; +Cc: egcs

 > From: Jeffrey A Law <law@hurl.cygnus.com>
 > 
 >   In message < 199802031901.OAA05382@caip.rutgers.edu >you write:
 >   > Jeff,
 >   > 
 >   > 	Would it be useful to create a system.h file for egcs/gcc which
 >   > includes the standard system headers and checks various other autoconf
 >   > macros like the NEED_DECLARATION_* stuff, then have all C files include
 >   > "system.h" instead of doing all that work individually?
 >   > 
 >   > 	(Or does such a file already exist and I'm missing it?
 >   > The gansidecl.h file seems close but not quite.  There's some autoconf
 >   > cruft at the bottom, but I think this file should really only check
 >   > __STDC__ and nothing autoconf'ish.)
 > Well, there's config.h and hconfig.h, which would probably be the
 > natural places, except that they're auto-generated.
 > 
 > It's probably a good idea.


	Okay, here's a first cut at one (mostly plagiarized from
fileutils.)

		--Kaveh



Wed Feb  4 13:50:51 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
	* system.h: New file to get common systems includes and various
	definitions and declarations based on autoconf macros.

 
--cut-here------------------------------------------------------------------
/* system.h - Get common system includes and various definitions and
   declarations based on autoconf macros.
   Copyright (C) 1998 Free Software Foundation, Inc.

 */

#ifndef __GCC_SYSTEM_H__
#define __GCC_SYSTEM_H__

#include <stdio.h>
#include <ctype.h>

/* Jim Meyering writes:
 
   "... Some ctype macros are valid only for character codes that
   isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
   using /bin/cc or gcc but without giving an ansi option).  So, all
   ctype uses should be through macros like ISPRINT...  If
   STDC_HEADERS is defined, then autoconf has verified that the ctype
   macros don't need to be guarded with references to isascii. ...
   Defining isascii to 1 should let any compiler worth its salt
   eliminate the && through constant folding."
 
   Bruno Haible adds:
 
   "... Furthermore, isupper(c) etc. have an undefined result if c is
   outside the range -1 <= c <= 255. One is tempted to write isupper(c)
   with c being of type `char', but this is wrong if c is an 8-bit
   character >= 128 which gets sign-extended to a negative value.
   The macro ISUPPER protects against this as well."  */
 
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
#else
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
 
#ifdef isblank
# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
#else
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c))
#else
# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c))
#endif
 
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
 
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
   - Its arg may be any int or unsigned int; it need not be an unsigned char.
   - It's guaranteed to evaluate its argument exactly once.
   - It's typically faster.
   Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
   only '0' through '9' are digits.  Prefer ISDIGIT to ISDIGIT_LOCALE unless
   it's important to use the locale's definition of `digit' even when the
   host does not conform to Posix.  */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)


#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>

#ifndef errno
extern int errno;
#endif

#ifdef HAVE_STRING_H
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
#  include <strings.h>
# endif
#endif

#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif

#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif

#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif

#if HAVE_LIMITS_H
# include <limits.h>
#endif

#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
#  include <time.h>
#endif
#endif

#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/file.h>
#endif

#ifndef SEEK_SET
# define SEEK_SET 0
# define SEEK_CUR 1
# define SEEK_END 2
#endif
#ifndef F_OK
# define F_OK 0
# define X_OK 1
# define W_OK 2
# define R_OK 4
#endif



#ifndef bcopy
# ifdef HAVE_BCOPY
#  ifdef NEED_DECLARATION_BCOPY
void bcopy ();
#  endif
# else /* ! HAVE_BCOPY */
#  define bcopy(src,dst,len) memcpy ((dst),(src),(len))
# endif
#endif

#ifndef bcmp
# ifdef HAVE_BCMP
#  ifdef NEED_DECLARATION_BCMP
void bcmp ();
#  endif
# else /* ! HAVE_BCMP */
#  define bcmp(left,right,len) memcmp ((left),(right),(len))
# endif
#endif

#ifndef bzero
# ifdef HAVE_BZERO
#  ifdef NEED_DECLARATION_BZERO
void bzero ();
#  endif
# else /* ! HAVE_BZERO */
#  define bzero(dst,len) memset ((dst),0,(len))
# endif
#endif

#ifndef index
# ifdef HAVE_INDEX
#  ifdef NEED_DECLARATION_INDEX
extern char *index ();
#  endif
# else /* ! HAVE_INDEX */
#  define index strchr
# endif
#endif

#ifndef rindex
# ifdef HAVE_RINDEX
#  ifdef NEED_DECLARATION_RINDEX
extern char *rindex ();
#  endif
# else /* ! HAVE_RINDEX */
#  define rindex strrchr
# endif
#endif

#ifdef NEED_DECLARATION_FREE
extern void free ();
#endif

#endif /* __GCC_SYSTEM_H__ */

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-04 11:11 egcs needs a system.h? Kaveh R. Ghazi
@ 1998-02-12  1:55 ` Jeffrey A Law
  1998-02-12  6:42   ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Jeffrey A Law @ 1998-02-12  1:55 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

  In message < 199802041911.OAA10745@caip.rutgers.edu >you write:
  > 	Okay, here's a first cut at one (mostly plagiarized from
  > fileutils.)
  > 
  > 		--Kaveh
  > 
  > 
  > 
  > Wed Feb  4 13:50:51 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
  >  
  > 	* system.h: New file to get common systems includes and various
  > 	definitions and declarations based on autoconf macros.
Looks like a reasonable start.  Now, what file includes it? :-)  You might
want to have "config.h" include "system.h".  

jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-12  1:55 ` Jeffrey A Law
@ 1998-02-12  6:42   ` H.J. Lu
  0 siblings, 0 replies; 15+ messages in thread
From: H.J. Lu @ 1998-02-12  6:42 UTC (permalink / raw)
  To: law; +Cc: ghazi, egcs

> 
>   In message < 199802041911.OAA10745@caip.rutgers.edu >you write:
>   > 	Okay, here's a first cut at one (mostly plagiarized from
>   > fileutils.)
>   > 
>   > 		--Kaveh
>   > 
>   > 
>   > 
>   > Wed Feb  4 13:50:51 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
>   >  
>   > 	* system.h: New file to get common systems includes and various
>   > 	definitions and declarations based on autoconf macros.
> Looks like a reasonable start.  Now, what file includes it? :-)  You might
> want to have "config.h" include "system.h".  
> 

We still need to fix the cross build. There may be 3 different sets of
config.h/system.h, one for the host machine, one for the target
machine and one for the build machine. They may be totally different.
I have sent in a patch to address the part of the problem. But I
haven't heard anything back.


-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-13 10:58     ` H.J. Lu
@ 1998-02-13 15:13       ` Jeffrey A Law
  0 siblings, 0 replies; 15+ messages in thread
From: Jeffrey A Law @ 1998-02-13 15:13 UTC (permalink / raw)
  To: H.J. Lu; +Cc: ghazi, egcs

  In message < m0y3Oxm-0004eeC@ocean.lucon.org >you write:
  > I guess you haven't tried build != host.
Yes I have.  Not in the last couple months, but I've done
canadian crosses before.

  > As far as I know, at least
  > rtl.c, print-rtl.c, rtlanal.c, obstack.c and alloca.c have
  > to be compiled twice, one for host and one for build if
  > build != host.
Good point.  I forgot those got sucked into the gen* programs.

Note that the makefile has some provisions for building these
differently for host/target.  See HOST_RTL and other definitions.


jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
@ 1998-02-13 10:58 Kaveh R. Ghazi
  1998-02-13 10:58 ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-13 10:58 UTC (permalink / raw)
  To: hjl; +Cc: egcs

 > Any binaries generated during the stage 0 and executed during the
 > stage 0 are for the build machine. Some binaries may have
 > 2 copies, one for the host machine and the other for the
 > build machine. They have to be compiled twice. It is very tricky.
 > It took me a while to get it working. Read gcc/build-make may
 > help a little bit.
 >  
 > Here is my old patch.
 >  
 > -- 
 > H.J. Lu (hjl@gnu.org)
 > ---
 > Fri Aug 15 17:47:14 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)
 >  
 >         * configure.in (--with-auto-config.h): New argument. Create
 >         auto-config.h and exit.
 >         (build-auto-config.h): Create it if the build machine is not
 >         the same as the host machine.
 >         (hconfig.h): Include build-auto-config.h if the build machine
 >         is not the same as the host machine. Otherwise include
 >         auto-config.h.

HJ,

	I read gcc/build-make and I'm still not sure how a system.h
would conflict with anything you've mentioned.  Let me be more explicit
about what I propose.  Given any source file in gcc, they could do the
following:

#include "the-appropriate-gcc-config-file.h"
#include "gansidecl.h"
#include "system.h"
#include "whatever-local-gcc-includes-you-want.h"

	I don't see this conflicting with your patch.  Remember I'm not
proposing any *config.h file (host or build) include system.h directly,
(is that possibility what bothered you?) I'm saying that each individual
C source file would include the appropriate *config.h file and after
that would include system.h.  I hope this allays your concerns. 

		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-13 10:58 Kaveh R. Ghazi
@ 1998-02-13 10:58 ` H.J. Lu
  0 siblings, 0 replies; 15+ messages in thread
From: H.J. Lu @ 1998-02-13 10:58 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

> 
>  > Any binaries generated during the stage 0 and executed during the
>  > stage 0 are for the build machine. Some binaries may have
>  > 2 copies, one for the host machine and the other for the
>  > build machine. They have to be compiled twice. It is very tricky.
>  > It took me a while to get it working. Read gcc/build-make may
>  > help a little bit.
>  >  
>  > Here is my old patch.
>  >  
>  > -- 
>  > H.J. Lu (hjl@gnu.org)
>  > ---
>  > Fri Aug 15 17:47:14 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)
>  >  
>  >         * configure.in (--with-auto-config.h): New argument. Create
>  >         auto-config.h and exit.
>  >         (build-auto-config.h): Create it if the build machine is not
>  >         the same as the host machine.
>  >         (hconfig.h): Include build-auto-config.h if the build machine
>  >         is not the same as the host machine. Otherwise include
>  >         auto-config.h.
> 
> HJ,
> 
> 	I read gcc/build-make and I'm still not sure how a system.h
> would conflict with anything you've mentioned.  Let me be more explicit
> about what I propose.  Given any source file in gcc, they could do the
> following:
> 
> #include "the-appropriate-gcc-config-file.h"
> #include "gansidecl.h"
> #include "system.h"
> #include "whatever-local-gcc-includes-you-want.h"
> 
> 	I don't see this conflicting with your patch.  Remember I'm not
> proposing any *config.h file (host or build) include system.h directly,
> (is that possibility what bothered you?) I'm saying that each individual
> C source file would include the appropriate *config.h file and after
> that would include system.h.  I hope this allays your concerns. 
> 

It can work.

H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-13  2:04   ` Jeffrey A Law
@ 1998-02-13 10:58     ` H.J. Lu
  1998-02-13 15:13       ` Jeffrey A Law
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 1998-02-13 10:58 UTC (permalink / raw)
  To: law; +Cc: ghazi, egcs

> 
> 
>   In message < m0y39gR-0004ecC@ocean.lucon.org >you write:
>   > Any binaries generated during the stage 0 and executed during the
>   > stage 0 are for the build machine. Some binaries may have
>   > 2 copies, one for the host machine and the other for the
>   > build machine. They have to be compiled twice. It is very tricky.
>   > It took me a while to get it working. Read gcc/build-make may
>   > help a little bit.
> Sorry, I don't get it either.
> 
> The gen* programs are for the build machine.
> 
> Everything else is built for the host environment.

I guess you haven't tried build != host. As far as I know, at least
rtl.c, print-rtl.c, rtlanal.c, obstack.c and alloca.c have
to be compiled twice, one for host and one for build if
build != host. They are used by both the gen* programs on
build and gcc on target. FYI, the gcc on target may or may
not be a cross-compiler.

It will be very helpful to understand the issues involved
if you can do it once just for fun. Try target != host != build.
It took me several weeks to get it working without doing it
by hand. Did I mention where to get libc/as/ld/nm/ar? That
is entirely another topic :-).


-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-12 19:36 ` H.J. Lu
@ 1998-02-13  2:04   ` Jeffrey A Law
  1998-02-13 10:58     ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Jeffrey A Law @ 1998-02-13  2:04 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Kaveh R. Ghazi, egcs

  In message < m0y39gR-0004ecC@ocean.lucon.org >you write:
  > Any binaries generated during the stage 0 and executed during the
  > stage 0 are for the build machine. Some binaries may have
  > 2 copies, one for the host machine and the other for the
  > build machine. They have to be compiled twice. It is very tricky.
  > It took me a while to get it working. Read gcc/build-make may
  > help a little bit.
Sorry, I don't get it either.

The gen* programs are for the build machine.

Everything else is built for the host environment.



jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-12 19:36 Kaveh R. Ghazi
@ 1998-02-12 20:07 ` H.J. Lu
  0 siblings, 0 replies; 15+ messages in thread
From: H.J. Lu @ 1998-02-12 20:07 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

> 
>  > We still need to fix the cross build. There may be 3 different sets of
>  > config.h/system.h, one for the host machine, one for the target
>  > machine and one for the build machine. They may be totally different.
>  > I have sent in a patch to address the part of the problem. But I
>  > haven't heard anything back.
>  > -- 
>  > H.J. Lu (hjl@gnu.org)
> 
> 	System.h is strictly a host machine issue.  Ie, just like
> putting #ifdef HAVE_STDLIB_H in a source file.  It just consolidates
> these into one file so we don't have to repeat it 200 times.
> 

That is not true if host != build. Give it a try and you will see
what I meant. It is kind of tricky.

> 	So I'm not sure what target or build machine issues arise.

Some files in gcc are compiled for the build machine. But most
of time, build == host. Basically "hconfig.h" should contain the
build machine stuff. The name of hconfig.h is misleading. It should
be renamed to bconfig.h. I had to deal with it when I first built
gcc binaries running on linux/x86 for linux/x86 under Ultrix.


H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
@ 1998-02-12 20:07 Kaveh R. Ghazi
  0 siblings, 0 replies; 15+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-12 20:07 UTC (permalink / raw)
  To: law; +Cc: egcs

 > From: Jeffrey A Law <law@hurl.cygnus.com>
 > 
 >   In message < 199802041911.OAA10745@caip.rutgers.edu >you write:
 >   > 	Okay, here's a first cut at one (mostly plagiarized from
 >   > fileutils.)
 >   > 
 >   > 		--Kaveh
 >   > 
 >   > 
 >   > 
 >   > Wed Feb  4 13:50:51 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 >   >  
 >   > 	* system.h: New file to get common systems includes and various
 >   > 	definitions and declarations based on autoconf macros.
 > 
 > Looks like a reasonable start.  Now, what file includes it? :-)  You might
 > want to have "config.h" include "system.h".  
 > jeff

	I'd rather each C source file include it separately.  That
leaves control in the individual file.  Once system.h appears in a
snapshot, I'll try converting one source file to use it.  If it goes
smoothly, I'll do more (or submit patches to clean up the problem.)

		--Kaveh

--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-12 18:02 Kaveh R. Ghazi
@ 1998-02-12 19:36 ` H.J. Lu
  1998-02-13  2:04   ` Jeffrey A Law
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 1998-02-12 19:36 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

> 
> 
> 	Sorry to be so thick :-), but I still don't see the problem.
> Would you please help me understand without having me go off and try a
> build != host cross build?

Any binaries generated during the stage 0 and executed during the
stage 0 are for the build machine. Some binaries may have
2 copies, one for the host machine and the other for the
build machine. They have to be compiled twice. It is very tricky.
It took me a while to get it working. Read gcc/build-make may
help a little bit.

> 
> Eg, currently calls.c in the top level directory includes <stdio.h>.
> If I instead have calls.c include "system.h" and system.h includes
> <stdio.h> there is no difference in the end result, right?
> 
> 	And if all these includes are in one file, when you come up
> with a solution to your build != host problem (whatever it is), you
> only have to fix it in one file.  So isn't this a step in the right
> direction?
> 

Here is my old patch.

-- 
H.J. Lu (hjl@gnu.org)
---
Fri Aug 15 17:47:14 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)

	* configure.in (--with-auto-config.h): New argument. Create
	auto-config.h and exit.
	(build-auto-config.h): Create it if the build machine is not
	the same as the host machine.
	(hconfig.h): Include build-auto-config.h if the build machine
	is not the same as the host machine. Otherwise include
	auto-config.h.

Index: configure.in
===================================================================
RCS file: /home/work/cvs/gnu/gcc/configure.in,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 configure.in
--- configure.in	1998/01/09 20:45:30	1.1.1.16
+++ configure.in	1998/01/20 21:05:22
@@ -32,6 +32,12 @@
 
 # Check for additional parameters
 
+# Generate auto-config.h only.
+AC_ARG_WITH(auto-config-h,
+[  --with-auto-config-h        generate auto-config.h only.],
+auto_config_h_only=yes,
+auto_config_h_only=no)
+
 # With GNU ld
 AC_ARG_WITH(gnu-ld,
 [  --with-gnu-ld           arrange to work with GNU ld.],
@@ -2838,6 +2870,20 @@
 	done
 done
 
+if [[ -f hconfig.h ]]
+then
+  rm -f hconfig.h.tmp
+  if [[ x$build != x$host ]]
+  then
+    echo "#include \"build-auto-config.h\"" > hconfig.h.tmp  
+  else
+    echo "#include \"auto-config.h\"" > hconfig.h.tmp  
+  fi
+  cat hconfig.h >> hconfig.h.tmp
+  rm -f hconfig.h
+  mv hconfig.h.tmp hconfig.h
+fi
+
 # Truncate the target if necessary
 if [[ x$host_truncate_target != x ]]; then
 	target=`echo $target | sed -e 's/\(..............\).*/\1/'`
@@ -3269,3 +3315,22 @@
 cross_overrides='${cross_overrides}'
 build_overrides='${build_overrides}'
 ])
+
+# We need to create auto-config.h for the build machine if it is not the
+# same as host.
+if [[ $auto_config_h_only != yes -a x$build != x$host ]]
+then
+	tempdir=build.$$
+	rm -rf $tempdir
+	mkdir $tempdir
+	cd $tempdir
+	case ${srcdir} in
+	/*) realsrcdir=${srcdir};;
+	*) realsrcdir=../${srcdir};;
+	esac
+	CC=${BUILD_CC-cc} ${realsrcdir}/configure --with-auto-config-h \
+		--target=$target --host=$host --build=$build
+	mv auto-config.h ../build-auto-config.h
+	cd ..
+	rm -rf $tempdir
+fi

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
@ 1998-02-12 19:36 Kaveh R. Ghazi
  1998-02-12 20:07 ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-12 19:36 UTC (permalink / raw)
  To: hjl, law; +Cc: egcs

 > We still need to fix the cross build. There may be 3 different sets of
 > config.h/system.h, one for the host machine, one for the target
 > machine and one for the build machine. They may be totally different.
 > I have sent in a patch to address the part of the problem. But I
 > haven't heard anything back.
 > -- 
 > H.J. Lu (hjl@gnu.org)

	System.h is strictly a host machine issue.  Ie, just like
putting #ifdef HAVE_STDLIB_H in a source file.  It just consolidates
these into one file so we don't have to repeat it 200 times.

	So I'm not sure what target or build machine issues arise.

		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
@ 1998-02-12 18:02 Kaveh R. Ghazi
  1998-02-12 19:36 ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-12 18:02 UTC (permalink / raw)
  To: hjl; +Cc: egcs

 > From: hjl@lucon.org (H.J. Lu)
 > 
 > > 	System.h is strictly a host machine issue.  Ie, just like
 > > putting #ifdef HAVE_STDLIB_H in a source file.  It just consolidates
 > > these into one file so we don't have to repeat it 200 times.
 > > 
 > 
 > That is not true if host != build. Give it a try and you will see
 > what I meant. It is kind of tricky.
 > 
 > > 	So I'm not sure what target or build machine issues arise.
 > 
 > Some files in gcc are compiled for the build machine. But most
 > of time, build == host. Basically "hconfig.h" should contain the
 > build machine stuff. The name of hconfig.h is misleading. It should
 > be renamed to bconfig.h. I had to deal with it when I first built
 > gcc binaries running on linux/x86 for linux/x86 under Ultrix.
 > 
 > H.J.


	Sorry to be so thick :-), but I still don't see the problem.
Would you please help me understand without having me go off and try a
build != host cross build?

Eg, currently calls.c in the top level directory includes <stdio.h>.
If I instead have calls.c include "system.h" and system.h includes
<stdio.h> there is no difference in the end result, right?

	And if all these includes are in one file, when you come up
with a solution to your build != host problem (whatever it is), you
only have to fix it in one file.  So isn't this a step in the right
direction?

		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: egcs needs a system.h?
  1998-02-03 11:01 Kaveh R. Ghazi
@ 1998-02-03 23:22 ` Jeffrey A Law
  0 siblings, 0 replies; 15+ messages in thread
From: Jeffrey A Law @ 1998-02-03 23:22 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

  In message < 199802031901.OAA05382@caip.rutgers.edu >you write:
  > Jeff,
  > 
  > 	Would it be useful to create a system.h file for egcs/gcc which
  > includes the standard system headers and checks various other autoconf
  > macros like the NEED_DECLARATION_* stuff, then have all C files include
  > "system.h" instead of doing all that work individually?
  > 
  > 	(Or does such a file already exist and I'm missing it?
  > The gansidecl.h file seems close but not quite.  There's some autoconf
  > cruft at the bottom, but I think this file should really only check
  > __STDC__ and nothing autoconf'ish.)
Well, there's config.h and hconfig.h, which would probably be the
natural places, except that they're auto-generated.

It's probably a good idea.

jef

^ permalink raw reply	[flat|nested] 15+ messages in thread

* egcs needs a system.h?
@ 1998-02-03 11:01 Kaveh R. Ghazi
  1998-02-03 23:22 ` Jeffrey A Law
  0 siblings, 1 reply; 15+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-03 11:01 UTC (permalink / raw)
  To: law; +Cc: egcs

Jeff,

	Would it be useful to create a system.h file for egcs/gcc which
includes the standard system headers and checks various other autoconf
macros like the NEED_DECLARATION_* stuff, then have all C files include
"system.h" instead of doing all that work individually?

	(Or does such a file already exist and I'm missing it?
The gansidecl.h file seems close but not quite.  There's some autoconf
cruft at the bottom, but I think this file should really only check
__STDC__ and nothing autoconf'ish.)

		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~1998-02-13 15:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-04 11:11 egcs needs a system.h? Kaveh R. Ghazi
1998-02-12  1:55 ` Jeffrey A Law
1998-02-12  6:42   ` H.J. Lu
  -- strict thread matches above, loose matches on Subject: below --
1998-02-13 10:58 Kaveh R. Ghazi
1998-02-13 10:58 ` H.J. Lu
1998-02-12 20:07 Kaveh R. Ghazi
1998-02-12 19:36 Kaveh R. Ghazi
1998-02-12 20:07 ` H.J. Lu
1998-02-12 18:02 Kaveh R. Ghazi
1998-02-12 19:36 ` H.J. Lu
1998-02-13  2:04   ` Jeffrey A Law
1998-02-13 10:58     ` H.J. Lu
1998-02-13 15:13       ` Jeffrey A Law
1998-02-03 11:01 Kaveh R. Ghazi
1998-02-03 23:22 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).