Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Nov 2001 12:23:28 -0800 (PST)
From:      Sean Jensen-Grey <seanj@xyke.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/31955: ULONG_MAX defined as hex on freebsd, ULONG_MAX defined as int on GNU, breaks autoconf
Message-ID:  <200111132023.fADKNSb92636@freefall.freebsd.org>

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

>Number:         31955
>Category:       misc
>Synopsis:       ULONG_MAX defined as hex on freebsd, ULONG_MAX defined as int on GNU, breaks autoconf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 13 12:30:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Sean Jensen-Grey
>Release:        
>Organization:
>Environment:
bash-2.05$ uname -a
FreeBSD node2 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Fri Jun 29 01:36:59 GMT 2001     xxx@:/usr/src/sys/compile/node2  i386
      
>Description:
I hit this when trying to compile the non-ports version of boa 0.94.11  on freebsd 4.3.

In the configure script is has a little piece of bc(1) code that determines how many bit to shift a ulong.

#include "confdefs.h"
#include <limits.h>

a = ULONG_MAX;
for (i=0;a;i++)
  a=a/2
for(j=0;i;j++)
  i=i/2
print j-1

on FreeBSD ULONG_MAX is defined as 0xfffffffful;

on GNU/Linux it is defined as 

[seanj@scale src]$ grep "ULONG_MAX" `locate limits.h`
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h:#undef ULONG_MAX
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h:#define ULONG_MAX (LONG_MAX * 2UL + 1)
/usr/lib/bcc/include/asm/limits.h:#define ULONG_MAX     0xffffffff      /* maximum unsigned long value */
/usr/include/limits.h:#   define ULONG_MAX      18446744073709551615UL
/usr/include/limits.h:#    define ULONG_MAX     4294967295UL
/usr/include/limits.h:#    define ULONG_MAX     4294967295L

on freebsd 4.3 it is

bash-2.05$ grep "ULONG_MAX" `locate limits.h`
/usr/include/machine/limits.h:#define   ULONG_MAX       0xffffffffffffffffUL
/usr/include/machine/limits.h:#define   ULONG_MAX       0xffffffffUL    /* max value for an unsigned long */
/usr/src/contrib/gcc/glimits.h:#undef ULONG_MAX
/usr/src/contrib/gcc/glimits.h:#define ULONG_MAX (LONG_MAX * 2UL + 1)
/usr/src/sys/alpha/include/limits.h:#define     ULONG_MAX       0xffffffffffffffffUL    /* max for an unsigned long */
/usr/src/sys/alpha/include/limits.h:#define     SIZE_T_MAX      ULONG_MAX       /* max value for a size_t */
/usr/src/sys/alpha/include/limits.h:#define     UQUAD_MAX       (ULONG_MAX)     /* max value for a uquad_t */
/usr/src/sys/i386/include/limits.h:#define      ULONG_MAX       0xffffffffffffffffUL
/usr/src/sys/i386/include/limits.h:#define      ULONG_MAX       0xffffffffUL    /* max value for an unsigned long */

this code gets piped through the cpp, then tr to remove the UL and then passed to bc. But on freebsd bc barfs on the 0xffff; it actually barfs on any hex format. 

I kludged the configure script by replacing the ulong_max line with

a = 2^32;

and skipping the whole cpp, tr step

Now my question is. Is this actually a bug? Or is it something we can change to be more inline with everything else and make configure scripts run more reliably? Or is this just one of the differences between GNU and FreeBSD? I haven't tried changing the definition of ULONG_MAX and recompiling world. Do we just patch the configure script in the ports and call it a day?      
>How-To-Repeat:
      
>Fix:
patch the boa configure script and let differences be differences?
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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