public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix libiberty to detect new cygwin exports
@ 2001-08-15 15:06 Christopher Faylor
  2001-08-15 15:24 ` Christopher Faylor
  2001-08-15 15:24 ` Richard Henderson
  0 siblings, 2 replies; 9+ messages in thread
From: Christopher Faylor @ 2001-08-15 15:06 UTC (permalink / raw)
  To: gcc-patches

Newer cygwins export sys_errlist and sys_nerr.  Configure.in was not
expecting this and has a hard time detecting this situation.  It is one
of those chicken/egg headaches that is common when building cygwin.

The patch below adds detection to configure.in so that it will know when
libiberty is being configured in an environment that uses a newer
cygwin.

cgf

Wed Aug 15 18:00:49 2001  Christopher Faylor <cgf@cygnus.com>
 
 	* configure.in: Under cygwin, add checks for newly exported sys_errlist
 	and sys_nerr.  Collapse two identical if/cases into one.
 	* configure: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/uberbaum/libiberty/configure.in,v
retrieving revision 1.33
diff -p -r1.33 configure.in
*** configure.in	2001/07/05 17:24:39	1.33
--- configure.in	2001/08/15 22:01:53
*************** if test -n "${with_target_subdir}"; then
*** 177,184 ****
      # Of the functions in $checkfuncs, newlib only has strerror.
      AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
  
!     setobjs=yes
! 
    fi
  
  else
--- 177,186 ----
      # Of the functions in $checkfuncs, newlib only has strerror.
      AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
  
!     case "$host" in
! 	*-*-cygwin*) ;;
! 	*) setobjs=yes ;;
!     esac
    fi
  
  else
*************** if test -z "${setobjs}"; then
*** 221,233 ****
      setobjs=yes
      ;;
  
-   esac
- fi
- 
- if test -z "${setobjs}"; then
- 
-   case "${host}" in
- 
    *-*-cygwin*)
      # The Cygwin library actually uses a couple of files from
      # libiberty when it is built.  If we are building a native
--- 223,228 ----
*************** if test -z "${setobjs}"; then
*** 247,252 ****
--- 242,272 ----
        funcs="`echo $funcs | sed -e 's/random//'`"
        LIBOBJS="$LIBOBJS random.o"
        vars="`echo $vars | sed -e 's/sys_siglist//'`"
+       # Newer cygwins define sys_errlist and sys_nerr.
+       # We have a chicken/egg situation here, though.  How do we know that
+       # the toolchain being built contains a newer cygwin?
+       # The code below checks for the existence of sys_errlist in the
+       # winsup/cygwin/cygwin.din file.  The assumption is that you are going
+       # to be building a dll which contains this global.
+       # If this is not found then check if the export is in the library
+       # that is used by GCC.  Define the appropriate libiberty_cv_var variables
+       # if so.
+       if test -z "$libiberty_cv_var_sys_errlist"
+       then
+ 	  eval `sed -n -e 's/^sys_errlist.*/libiberty_cv_var_sys_errlist=yes/p' \
+ 		       -e 's/^sys_nerr .*/libiberty_cv_var_sys_nerr=yes/p' \
+ 		    "$srcdir/../winsup/cygwin/cygwin.din" 2>/dev/null`
+ 	  if test -z "$libiberty_cv_var_sys_errlist"
+ 	  then
+ 	      for v in sys_errlist sys_nerr; do
+ 		  AC_TRY_LINK([int *p;], [extern int _imp__$v; p = &_imp__$v;],
+ 			       [eval "libiberty_cv_var_$v=yes"],
+ 			       [eval "libiberty_cv_var_$v=no"])
+ 	      done
+ 	  fi
+       fi
+       test -z "$libiberty_cv_var_sys_errlist" && libiberty_cv_var_sys_errlist=no
+       test -z "$libiberty_cv_var_sys_nerr" && libiberty_cv_var_sys_nerr=no
        checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
      fi
      ;;

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

* Re: [PATCH] Fix libiberty to detect new cygwin exports
  2001-08-15 15:06 [PATCH] Fix libiberty to detect new cygwin exports Christopher Faylor
  2001-08-15 15:24 ` Christopher Faylor
@ 2001-08-15 15:24 ` Richard Henderson
  2001-08-15 15:24   ` Christopher Faylor
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2001-08-15 15:24 UTC (permalink / raw)
  To: gcc-patches

On Wed, Aug 15, 2001 at 06:06:21PM -0400, Christopher Faylor wrote:
> Newer cygwins export sys_errlist and sys_nerr.

Why?  strerror provides equivalent functionality, and its
use requires fewer runtime relocations.


r~

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

* Re: [PATCH] Fix libiberty to detect new cygwin exports
  2001-08-15 15:06 [PATCH] Fix libiberty to detect new cygwin exports Christopher Faylor
@ 2001-08-15 15:24 ` Christopher Faylor
  2001-08-15 15:24 ` Richard Henderson
  1 sibling, 0 replies; 9+ messages in thread
From: Christopher Faylor @ 2001-08-15 15:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: DJ Delorie

On Wed, Aug 15, 2001 at 06:06:21PM -0400, Christopher Faylor wrote:
>Wed Aug 15 18:00:49 2001  Christopher Faylor <cgf@cygnus.com>
> 
> 	* configure.in: Under cygwin, add checks for newly exported sys_errlist
> 	and sys_nerr.  Collapse two identical if/cases into one.
> 	* configure: Regenerate.

Sorry.  DJ has enlightened me that the "Collapse" part of this patch is pretty
obviously wrong, so I withdraw it.

cgf

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

* Re: [PATCH] Fix libiberty to detect new cygwin exports
  2001-08-15 15:24 ` Richard Henderson
@ 2001-08-15 15:24   ` Christopher Faylor
  2001-08-16 10:49     ` [RFA] Fix libiberty to detect new cygwin export, try 2 Christopher Faylor
  2001-08-16 16:47     ` [PATCH] Fix libiberty to detect new cygwin exports Richard Henderson
  0 siblings, 2 replies; 9+ messages in thread
From: Christopher Faylor @ 2001-08-15 15:24 UTC (permalink / raw)
  To: gcc-patches

On Wed, Aug 15, 2001 at 03:39:58PM -0700, Richard Henderson wrote:
>On Wed, Aug 15, 2001 at 06:06:21PM -0400, Christopher Faylor wrote:
>> Newer cygwins export sys_errlist and sys_nerr.
>
>Why?  strerror provides equivalent functionality, and its
>use requires fewer runtime relocations.

We already export these _variables with a leading underscore.
Apparently a lot of legacy code expects it without the underscore, too.
Linux exports both, so Cygwin should too.

Hopefully no one is writing new software that uses sys_errlist.  I agree
that people should use the "modern" interface for this but it is tiring
having to instruct people on how to rewrite their software that "works
find on linux".

Now that you've mentioned this, though, I think I'll add a cautionary
comment to the appropriate header file, like linux.

cgf

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

* [RFA] Fix libiberty to detect new cygwin export, try 2
  2001-08-15 15:24   ` Christopher Faylor
@ 2001-08-16 10:49     ` Christopher Faylor
  2001-08-16 13:38       ` DJ Delorie
  2001-08-16 16:47     ` [PATCH] Fix libiberty to detect new cygwin exports Richard Henderson
  1 sibling, 1 reply; 9+ messages in thread
From: Christopher Faylor @ 2001-08-16 10:49 UTC (permalink / raw)
  To: gcc-patches; +Cc: DJ Delorie

Here is a much simpler version of the previous patch, worked out
in communication with DJ Delorie.

cgf

2001-08-16  Christopher Faylor <cgf@cygnus.com>

	* configure.in: Always set HAVE_SYS_ERRLIST when targetting cygwin.
	* configure: Regenerate.


Index: configure.in
===================================================================
RCS file: /cvs/uberbaum/libiberty/configure.in,v
retrieving revision 1.33
diff -p -r1.33 configure.in
*** configure.in        2001/07/05 17:24:39     1.33
--- configure.in        2001/08/16 17:45:02
*************** if test -n "${with_target_subdir}"; then
*** 177,182 ****
--- 177,187 ----
      # Of the functions in $checkfuncs, newlib only has strerror.
      AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
  
+     case "${with_target_subdir}" in
+       *-*-cygwin*)
+       AC_DEFINE(HAVE_SYS_ERRLIST)
+       ;;
+     esac
      setobjs=yes
  
    fi

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

* Re: [RFA] Fix libiberty to detect new cygwin export, try 2
  2001-08-16 10:49     ` [RFA] Fix libiberty to detect new cygwin export, try 2 Christopher Faylor
@ 2001-08-16 13:38       ` DJ Delorie
  2001-08-17 13:17         ` Christopher Faylor
  0 siblings, 1 reply; 9+ messages in thread
From: DJ Delorie @ 2001-08-16 13:38 UTC (permalink / raw)
  To: cgf; +Cc: gcc-patches

You want `case "${host}" in' here, like the other cases.  Probably
want a blank line between the esac and setobjs for consistency too.
Otherwise ok.

> +     case "${with_target_subdir}" in

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

* Re: [PATCH] Fix libiberty to detect new cygwin exports
  2001-08-15 15:24   ` Christopher Faylor
  2001-08-16 10:49     ` [RFA] Fix libiberty to detect new cygwin export, try 2 Christopher Faylor
@ 2001-08-16 16:47     ` Richard Henderson
  2001-08-17 13:16       ` Christopher Faylor
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Henderson @ 2001-08-16 16:47 UTC (permalink / raw)
  To: gcc-patches

On Wed, Aug 15, 2001 at 09:48:54PM -0400, Christopher Faylor wrote:
> Apparently a lot of legacy code expects it without the underscore, too.

What has this got to do with gnu software though?

Or does cygwin include then export libiberty?


r~

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

* Re: [PATCH] Fix libiberty to detect new cygwin exports
  2001-08-16 16:47     ` [PATCH] Fix libiberty to detect new cygwin exports Richard Henderson
@ 2001-08-17 13:16       ` Christopher Faylor
  0 siblings, 0 replies; 9+ messages in thread
From: Christopher Faylor @ 2001-08-17 13:16 UTC (permalink / raw)
  To: Richard Henderson, gcc-patches

On Thu, Aug 16, 2001 at 04:47:48PM -0700, Richard Henderson wrote:
>On Wed, Aug 15, 2001 at 09:48:54PM -0400, Christopher Faylor wrote:
>> Apparently a lot of legacy code expects it without the underscore, too.
>
>What has this got to do with gnu software though?
>
>Or does cygwin include then export libiberty?

Cygwin exports a couple of libiberty functions but, ironically, strerror
is not one of them.  It really doesn't even need to build strerror but
there doesn't seem to be a mechanism for excluding it so the patch just
makes it possible to compile it.  Then it ends up, unused, in libiberty.a.

I think that this has proved to me that we have to remove the libiberty
dependence, though.  It really doesn't make any sense to have to go
to this amount of effort for this one target.

cgf

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

* Re: [RFA] Fix libiberty to detect new cygwin export, try 2
  2001-08-16 13:38       ` DJ Delorie
@ 2001-08-17 13:17         ` Christopher Faylor
  0 siblings, 0 replies; 9+ messages in thread
From: Christopher Faylor @ 2001-08-17 13:17 UTC (permalink / raw)
  To: DJ Delorie; +Cc: gcc-patches

On Thu, Aug 16, 2001 at 04:38:39PM -0400, DJ Delorie wrote:
>
>You want `case "${host}" in' here, like the other cases.  Probably
>want a blank line between the esac and setobjs for consistency too.
>Otherwise ok.
>
>> +     case "${with_target_subdir}" in

Thanks, I've made the above two changes and applied this patch.

cgf

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

end of thread, other threads:[~2001-08-17 13:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-15 15:06 [PATCH] Fix libiberty to detect new cygwin exports Christopher Faylor
2001-08-15 15:24 ` Christopher Faylor
2001-08-15 15:24 ` Richard Henderson
2001-08-15 15:24   ` Christopher Faylor
2001-08-16 10:49     ` [RFA] Fix libiberty to detect new cygwin export, try 2 Christopher Faylor
2001-08-16 13:38       ` DJ Delorie
2001-08-17 13:17         ` Christopher Faylor
2001-08-16 16:47     ` [PATCH] Fix libiberty to detect new cygwin exports Richard Henderson
2001-08-17 13:16       ` Christopher Faylor

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).