gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] configure and make failed on FreeBSD


From: GOTO Kentaro
Subject: Re: [Gcl-devel] configure and make failed on FreeBSD
Date: Sun, 03 Nov 2002 06:58:37 +0900
User-agent: Wanderlust/2.8.1 (Something) Emacs/21.2 Mule/5.0 (SAKAKI)

Hi Camm and folks, 

Good news, gcl has been successfully compiled on my FreeBSD box! :)

At 31 Oct 2002 23:11:11 -0500,
Camm Maguire wrote:

> Hi Goto!  And thanks for your work on this!

I also thank you very much for your agile responses!

;; BTW, Many of Japanese write their own family names in ALL-UPCASE 
;; to indicate that it is written in the native order, i.e. FAMILY Person. 
;; Yes, GOTO is my family name.  My person name is Kentaro.  :)

> >   * acconfig.h,h/gclincl.h.in: 
> >       added ISNORMAL() macro but it doesn't exclude the case of denormal. 
> >       It is better to write ISNORMAL() as a function.  
> 
> I'd prefer not to add this patch, as denormal numbers will give us
> problems.  Doesn't freebsd have an equivalent?

AFAIK, there doesn't exists here.  I tried another macro which detect
normal numbers exactly.  Although this uses DBL_MIN/DBL_MAX, it works
also on float at least ISNORMAL(f) in o/num_co.c because a coercion by
the substitution "f = d" never generates a denormal float value:

#define ISNORMAL(a) \
        ((DBL_MIN<=(a) && (a)<=DBL_MAX) || (DBL_MIN<=(-a) && (-a)<=DBL_MAX))

> This is a macro defined for example in linux.h.  If Freebsd uses elf,
> it can likely copy the same thing.  In fact, I'd seriously suggest
> starting by trying to configure with --enable-machine=386-linux, or
> copying the 386-linux.{h,defs} onto the Freebsd ones, at least as a
> start.  Much work has already gone in here, and they are bound to be
> close. 

I've realized that your advices and your prediction are pretty
accurate at last.  The diff is larger than the file it self :)
So, I would attach the whole of FreeBSD.h instead of patch this time. 

And some patches:

  * h/FreeBSD.defs:
      comment-outed all compiler options. 
  * h/gclincl.h.in:
      added ISNORMAL() macro for platforms having <float.h>.
  * o/unixfasl.c:
      added `#include <a.out.h>' to define the type `struct exec' for BSD. 
  * o/unixtime.c: 
      changed type of static var `beginning' with `struct timeval' for BSD. 
  * o/unixtime.c:init_unixtime(): 
      use gettimeofday instead of ftime, obsolete at least from 4.4BSD
      which was released 10 years ago. 

Other changes which you rejected weren't needed indeed. 

I'll reports the details and the rest of problems. 


Cheers, 


Gotoken

/*
 * FreeBSD.h for gcl 1.1
 *
 * Ported by Jeffrey Hsu (address@hidden).
 *  Looked at previous versions by Hsu, Werkowsksi, Tobin, and Mogart.
 *
 */
#include "bsd.h"

#ifndef __ELF__
#error Linux systems use ELF
#endif

#undef HAVE_AOUT
#define HAVE_AOUT <elf.h>
#define HAVE_ELF

/* Seeking to the end of ELF data is a little messy... */
#include <link.h>
#define SEEK_TO_END_OFILE(fp)\
  do { \
        long offset = 0, endofelf; int j; \
        Elf_Ehdr eheader; Elf_Shdr shdr; \
        fseek(fp, 0, SEEK_SET); \
        fread(&eheader, sizeof(eheader), 1, fp); \
  /* in case the headers themselves come AFTER the actual sections */ \
        endofelf=offset = eheader.e_shoff+ eheader.e_shentsize 
*eheader.e_shnum;\
        fseek(fp, eheader.e_shoff, SEEK_SET); \
        if ( eheader.e_shentsize != sizeof(Elf_Shdr) ) \
          { FEerror("Bad ELF section header size",0); } \
        for ( j = 0; j < eheader.e_shnum; j++ ) \
          { fread(&shdr,eheader.e_shentsize,1,fp); \
            if ( (shdr.sh_offset > offset) && (shdr.sh_type != SHT_NOBITS) ) \
              { offset = shdr.sh_offset; endofelf = offset+shdr.sh_size; } \
          } \
        if ( fseek(fp, endofelf, SEEK_SET) ) \
            FEerror("Bad ELF file",0); \
      } while(0)


#ifdef IN_GBC
/* Based upon sun4.h */
#define MPROTECT_ACTION_FLAGS SA_RESTART
#define INSTALL_MPROTECT_HANDLER \
do {static struct sigaction action; \
      action.sa_handler = (void *)memprotect_handler; \
      action.sa_flags = MPROTECT_ACTION_FLAGS; \
      /*action.sa_restorer = 0;*/ \
      sigemptyset(&action.sa_mask); \
      sigaddset(&action.sa_mask,SIGINT); \
      sigaddset(&action.sa_mask,SIGALRM); \
      sigaction(SIGSEGV,&action,0); \
      sigaction(SIGBUS,&action,0);} while (0)

/* the following two files have changed back
   and forth in recent versions of linux...
   Include both if they both exist, otherwise
   include whatever one exists...
   basically one wants the
   struct sigcontext_struct { ... } ;
   so as to get the fault address.
   */

#ifdef   SIGNAL_H_HAS_SIGCONTEXT
#include <signal.h>
#else     
#ifdef HAVE_ASM_SIGCONTEXT_H     
#include <asm/sigcontext.h>
#endif
#ifdef HAVE_ASM_SIGNAL_H          
#include <asm/signal.h>
#endif
#ifdef HAVE_SIGCONTEXT
#define sigcontext_struct sigcontext
#endif
#endif     

#endif

#define ELF_TEXT_BASE  DBEGIN

#undef SET_REAL_MAXPAGE
#define SET_REAL_MAXPAGE do { struct rlimit data_rlimit; \
                              extern char etext; \
                               real_maxpage = MAXPAGE ;\
        getrlimit(RLIMIT_DATA, &data_rlimit); \
        real_maxpage = ((unsigned int)&etext/PAGESIZE \
                        + data_rlimit.rlim_cur/PAGESIZE - 
ELF_TEXT_BASE/PAGESIZE); \
        if (real_maxpage > MAXPAGE) \
                real_maxpage = MAXPAGE ; } while(0)

#ifdef USE_DLOPEN
#define SPECIAL_RSYM "rsym_elf.c"
#define SEPARATE_SFASL_FILE "fasldlsym.c"
#else
#ifdef HAVE_LIBBFD
#define SEPARATE_SFASL_FILE "sfaslbfd.c"
#else
#if !defined(__i386__) && !defined(__sparc__)
#error Can only do non-bfd relocs for i386 and sparc
#endif
#define SPECIAL_RSYM "rsym_elf.c"
#define SEPARATE_SFASL_FILE "sfaslelf.c"
#endif
#endif

#define UNEXEC_USE_MAP_PRIVATE
#define UNIXSAVE "unexelf.c"

#undef HAVE_SIGVEC
#define HAVE_SIGACTION
/* make this a noop */
#define SETUP_SIG_STACK
#ifndef HAVE_SV_ONSTACK
#define SV_ONSTACK 0
#endif

/* unblock signals m and n, and set val to signal_mask(m) | signal_mask(n)
   if they were set */
#define SIG_UNBLOCK_SIGNALS(val,m,n) \
    current_mask = sigblock(0);  \
    sigsetmask(~(sigmask(m)) & ~(sigmask(n)) & current_mask); \
    result = (current_mask & sigmask(m) ? signal_mask(m) : 0) \
      | (current_mask & sigmask(n) ? signal_mask(n) : 0);

#undef RUN_PROCESS

#define IEEEFLOAT
       
#undef HAVE_XDR

#define USE_ULONG_

/*   How to check for input */
#undef LISTEN_FOR_INPUT
#define LISTEN_FOR_INPUT(fp) \
do {int c=0;\
  if ((fp)->_r <=0 && (c=0, ioctl((fp)->_file, FIONREAD, &c), c<=0)) \
        return(FALSE);} while(0)

/* we dont need to worry about zeroing fp->_base , to prevent  */
#define FCLOSE_SETBUF_OK 

/* #define DATA_BEGIN((TXTRELOC+header.a_text+(SEGSIZ-1)) & ~(SEGSIZ-1)); */
#define DATA_BEGIN (char *)(char *)N_DATADDR(header);

#define PAGSIZ          (NBPG)
#define SEGSIZ          (NBPG * CLSIZE)
#define TXTRELOC        0

#define USE_DIRENT
#define GETPATHNAME
#define PATHNAME_CACHE  10


#define INSTALL_SEGMENTATION_CATCHER \
         (void) signal(SIGSEGV,segmentation_catcher)


/* get the fileno of a FILE* */
#define FILENO(x) fileno(x)

#define ULONG_DEFINED

#undef LD_COMMAND
#define LD_COMMAND(command,main,start,input,ldarg,output) \
  sprintf(command, "ld -d -S -N -x -A %s -T %x %s %s -o %s", \
            main,start,input,ldarg,output)

#define SET_SESSION_ID() (setpgid(0,0) ? -1 : 0)

#define CLEANUP_CODE \
  setbuf(stdin,0); \
   setbuf(stdout,0);

#define INIT_CORE_END terminal_io->sm.sm_object0->sm.sm_fp = 
stdin;terminal_io->sm.sm_object1->sm.sm_fp = stdout;

Index: h/FreeBSD.defs
===================================================================
RCS file: /cvsroot/gcl/gcl/h/FreeBSD.defs,v
retrieving revision 1.2
diff -u -r1.2 FreeBSD.defs
--- h/FreeBSD.defs      1 Nov 2002 04:09:34 -0000       1.2
+++ h/FreeBSD.defs      2 Nov 2002 00:09:15 -0000
@@ -4,9 +4,9 @@
 
 LBINDIR=/usr/local/bin
 
-OFLAG  = -pipe -O2 
-CFLAGS = -fwritable-strings -fomit-frame-pointer -DVOL=volatile -I$(GCLDIR)/o 
-I/usr/local/lib/gcl-2.0/h -fsigned-char -I/usr/local/lib
-LIBS    = -lm -L/usr/local/lib
+# OFLAG        = -pipe -O2 
+# CFLAGS       = -fwritable-strings -fomit-frame-pointer -DVOL=volatile 
-I$(GCLDIR)/o -fsigned-char -I/usr/local/lib
+# LIBS    = -lm -L/usr/local/lib
 ODIR_DEBUG=
 NULLFILE=../h/twelve_null
 
@@ -14,7 +14,7 @@
 # and also in the compiler::*cc* variable for later compilation of
 # lisp files.
 
-CC = gcc
+# CC = gcc
 
 LDCC = $(CC) -static
 
Index: h/gclincl.h.in
===================================================================
RCS file: /cvsroot/gcl/gcl/h/gclincl.h.in,v
retrieving revision 1.24
diff -u -r1.24 gclincl.h.in
--- h/gclincl.h.in      27 Oct 2002 21:11:31 -0000      1.24
+++ h/gclincl.h.in      2 Nov 2002 00:09:15 -0000
@@ -109,7 +109,14 @@
 #include <ieeefp.h>
 #define ISNORMAL(a) (fpclass(a)>=FP_NZERO)
 #else
+#define HAVE_FLOAT_H 1
+#ifdef HAVE_FLOAT_H
+#include <float.h>
+#define ISNORMAL(a) \
+       ((DBL_MIN<=(a) && (a)<=DBL_MAX) || (DBL_MIN<=(-a) && (-a)<=DBL_MAX))
+#else
 #error "No isnormal found"
+#endif
 #endif
 #endif
 #endif
Index: o/unixfasl.c
===================================================================
RCS file: /cvsroot/gcl/gcl/o/unixfasl.c,v
retrieving revision 1.3
diff -u -r1.3 unixfasl.c
--- o/unixfasl.c        23 Sep 2002 14:02:10 -0000      1.3
+++ o/unixfasl.c        2 Nov 2002 00:09:16 -0000
@@ -31,6 +31,7 @@
 #undef ATT
 #define BSD
 #include HAVE_AOUT
+#include <a.out.h>
 #endif
 
 #ifdef COFF_ENCAPSULATE
Index: o/unixtime.c
===================================================================
RCS file: /cvsroot/gcl/gcl/o/unixtime.c,v
retrieving revision 1.14
diff -u -r1.14 unixtime.c
--- o/unixtime.c        27 Oct 2002 15:35:06 -0000      1.14
+++ o/unixtime.c        2 Nov 2002 00:09:16 -0000
@@ -62,7 +62,7 @@
 #include <sys/times.h>
 #endif
 #include <sys/time.h>
-static struct timeb beginning;
+static struct timeval beginning;
 #endif
 
 #ifdef ATT
@@ -187,7 +187,7 @@
 init_unixtime(void)
 {
 #ifdef BSD
-       ftime(&beginning);
+       gettimeofday(&beginning,NULL);
 #endif
 #ifdef ATT
        beginning = time(0);

# end of patch




reply via email to

[Prev in Thread] Current Thread [Next in Thread]