From: Andrew C. <ak...@sh...> - 2002-02-09 23:25:15
|
> I wonder if you know of anyone that has been working on your patch to > include X11 support? One of the big reasons to move from emacs20 to > emacs21 is its improved faces support. For those who are interested in running Emacs 21.1 on Mac OS X under X Window, Tsutumo Ikegami has sent in the patch below. Thank you, Tsutumo! Andrew. ----- From: Tsutomu IKEGAMI <ik...@ad...> To: ak...@cs... Subject: Re: Emacs-21.1 on Mac In-reply-to: Your message of "Sat, 29 Dec 2001 11:48:50 AST." <200...@cs...> Date: Thu, 03 Jan 2002 14:24:16 -0400 Sender: ik...@as... Andrew, A Happy New Year! I've played with emacs-21.1. I noticed that 'emacs-21.1.30 -nw' crashes on C-g after M-x manual-entry command (or, after some subprocess calls, maybe). The patch at the end is a fix, which is stolen from emacs-20.7.41 package from darwin project. It works fine for me. The patch should be applied after your emacs-21.1-2-mac.patch. I haven't applied your patch on src/process.c. The patches on src/macmenu.c and src/macterm.c may be applied. It also include some fixes for the compilation with X11. To compile with X11, (1) ./configure --without-carbon (2) Modify src/Makefile manually(!) so that X11R6/lib*.a should be linked instead of lib*.dylib. (Those *.dylibs, prepared by X on X project, are not prebound. unexmacosx.c cannot dump.) Because of (2), the resulting executable is fatty. Despite my expectation, I still cannot launch Carbon Emacs (build with ./configure --without-x). Again, blank window opens, application icon continues popping in the Dock, and that's all. I should look into more detail. truly yours, IKEGAMI, Tsutomu Dep. of Chemistry, UPR ik...@ad... ----- 8< ---------- 8< ----- snip, snip ----- 8< ---------- 8< ----- diff -aur -x info emacs-21.1.org/src/callproc.c emacs-21.1/src/callproc.c --- emacs-21.1.org/src/callproc.c Thu Jan 3 12:57:50 2002 +++ emacs-21.1/src/callproc.c Thu Jan 3 01:48:54 2002 @@ -611,7 +611,11 @@ pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, 0, current_dir); #else /* not WINDOWSNT */ +#ifndef PUMA_VFORK_ISSUES_CLEARED_UP + pid = fork (); +#else pid = vfork (); +#endif if (pid == 0) { diff -aur -x info emacs-21.1.org/src/dispextern.h emacs-21.1/src/dispextern.h --- emacs-21.1.org/src/dispextern.h Thu Jan 3 12:57:36 2002 +++ emacs-21.1/src/dispextern.h Thu Jan 3 02:00:44 2002 @@ -39,7 +39,7 @@ #include "w32gui.h" #endif -#if defined (MAC_OS8) || defined (MAC_OSX) +#ifdef MAC_OS #include "macgui.h" #endif diff -aur -x info emacs-21.1.org/src/getloadavg.c emacs-21.1/src/getloadavg.c --- emacs-21.1.org/src/getloadavg.c Tue Jun 20 09:17:40 2000 +++ emacs-21.1/src/getloadavg.c Thu Jan 3 01:48:54 2002 @@ -401,7 +401,7 @@ # define host_self mach_host_self # endif -# ifdef NeXT +# if defined(NeXT) || defined(MAC_OSX) # ifdef HAVE_MACH_MACH_H # include <mach/mach.h> # else @@ -449,7 +449,7 @@ /* Avoid static vars inside a function since in HPUX they dump as pure. */ -# ifdef NeXT +# if defined(NeXT) || defined(MAC_OSX) static processor_set_t default_set; static int getloadavg_initialized; # endif /* NeXT */ @@ -626,13 +626,15 @@ # endif /* __NetBSD__ */ -# if !defined (LDAV_DONE) && defined (NeXT) +# if !defined (LDAV_DONE) && (defined (NeXT) || defined(MAC_OSX)) # define LDAV_DONE /* The NeXT code was adapted from iscreen 3.2. */ +#ifndef MAC_OSX host_t host; struct processor_set_basic_info info; unsigned info_count; +#endif /* We only know how to get the 1-minute average for this system, so even if the caller asks for more than 1, we only return 1. */ @@ -645,6 +647,7 @@ if (getloadavg_initialized) { +#ifndef MAC_OSX info_count = PROCESSOR_SET_BASIC_INFO_COUNT; if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host, (processor_set_info_t) &info, &info_count) @@ -655,6 +658,21 @@ if (nelem > 0) loadavg[elem++] = (double) info.load_average / LOAD_SCALE; } +#else + struct processor_set_load_info info; + host_t host; + unsigned info_count = PROCESSOR_SET_LOAD_INFO_COUNT; + + if (processor_set_info (default_set, PROCESSOR_SET_LOAD_INFO, &host, + (processor_set_info_t) &info, &info_count) + != KERN_SUCCESS) + getloadavg_initialized = 0; + else + { + if (nelem > 0) + loadavg[elem++] = (double) info.load_average / LOAD_SCALE; + } +#endif } if (!getloadavg_initialized) diff -aur -x info emacs-21.1.org/src/m/powermac.h emacs-21.1/src/m/powermac.h --- emacs-21.1.org/src/m/powermac.h Thu Jan 3 12:57:37 2002 +++ emacs-21.1/src/m/powermac.h Thu Jan 3 01:48:54 2002 @@ -58,11 +58,11 @@ /* Data type of load average, as read out of kmem. */ -#define LOAD_AVE_TYPE long +/* #define LOAD_AVE_TYPE long */ /* Convert that into an integer that is 100 for a load average of 1.0 */ -#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) +/* #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) */ /* Define CANNOT_DUMP on machines where unexec does not work. Then the function dump-emacs will not be defined @@ -119,3 +119,5 @@ If you've just fixed a problem in an existing configuration file, you should also check `etc/MACHINES' to make sure its descriptions of known problems in that configuration should be updated. */ + +#define DATA_SEG_BITS 0 diff -aur -x info emacs-21.1.org/src/md5.h emacs-21.1/src/md5.h --- emacs-21.1.org/src/md5.h Wed Dec 6 17:16:37 2000 +++ emacs-21.1/src/md5.h Thu Jan 3 01:48:54 2002 @@ -71,7 +71,7 @@ #endif -#ifndef __GNUC__ +#if !defined(__GNUC__) || defined(MAC_OSX) #define __attribute__(X) #define __alignof__(X) 1 #endif diff -aur -x info emacs-21.1.org/src/process.c emacs-21.1/src/process.c --- emacs-21.1.org/src/process.c Tue Sep 25 04:21:22 2001 +++ emacs-21.1/src/process.c Thu Jan 3 01:48:54 2002 @@ -1482,7 +1482,11 @@ current_dir = ENCODE_FILE (current_dir); #ifndef WINDOWSNT +#ifndef PUMA_VFORK_ISSUES_CLEARED_UP + pid = fork (); +#else pid = vfork (); +#endif if (pid == 0) #endif /* not WINDOWSNT */ { diff -aur -x info emacs-21.1.org/src/regex.h emacs-21.1/src/regex.h --- emacs-21.1.org/src/regex.h Tue Oct 17 02:55:04 2000 +++ emacs-21.1/src/regex.h Thu Jan 3 01:48:54 2002 @@ -533,6 +533,8 @@ # else # define __restrict # endif +# elif defined(MAC_OSX) +# define __restrict # endif #endif /* For now unconditionally define __restrict_arr to expand to nothing. diff -aur -x info emacs-21.1.org/src/s/darwin.h emacs-21.1/src/s/darwin.h --- emacs-21.1.org/src/s/darwin.h Thu Jan 3 12:57:38 2002 +++ emacs-21.1/src/s/darwin.h Thu Jan 3 02:17:35 2002 @@ -39,7 +39,7 @@ /* MAC_OS is used to conditionally compile code common to both MAC_OS8 and MAC_OSX. */ -#ifdef MAC_OSX +#if defined(MAC_OSX) && !defined(HAVE_X11) #define MAC_OS #endif @@ -48,6 +48,13 @@ #define SYSTEM_TYPE "darwin" +#undef KERNEL_FILE +#define KERNEL_FILE "/mach_kernel" + +#define HAVE_ALLOCA + +#define HAVE_MACH_MACH_H + /* NOMULTIPLEJOBS should be defined if your system's shell does not have "job control" (the ability to stop a program, run some other program, then continue the first one). */ @@ -76,7 +83,7 @@ to read the input and send it to the true Emacs process through a pipe. */ -#define INTERRUPT_INPUT 1 +#define INTERRUPT_INPUT /* Letter to use in finding device name of first pty, if system supports pty's. 'a' means it is /dev/ptya0 */ @@ -202,7 +209,7 @@ #define __restrict /* Fix compilation problem for md5.c. */ -#define __attribute__(x) +/* #define __attribute__(x) */ /* Used in dispnew.c. Copied from freebsd.h. */ #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) @@ -210,6 +217,16 @@ /* Darwin provides POSIX-style getpgrp. */ #define GETPGRP_NO_ARG +#define TERMCAP_FILE "/usr/share/misc/termcap" + +#define A_OUT_H_FILE <sys/exec.h> + +/* Data type of load average, as read out of kmem. */ +#define LOAD_AVE_TYPE long + +/* Convert that into an integer that is 100 for a load average of 1.0 */ +#define LOAD_AVE_CVT(x) (int) (((double)(x)) * 100.0 / FSCALE) + /* System uses OXTABS instead of the expected TAB3. (Copied from bsd386.h.) */ #define TAB3 OXTABS @@ -218,11 +235,17 @@ framework. */ #define SYSTEM_MALLOC +#define WAIT_USE_INT + +#define SOCKLEN_TYPE int + /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ #define HAVE_SOCKETS /* Extra initialization calls in main for Mac OS X system type. */ +#ifndef HAVE_X11 #define SYMS_SYSTEM syms_of_mac() +#endif /* Definitions for how to dump. Copied from nextstep.h. */ diff -aur -x info emacs-21.1.org/src/sysdep.c emacs-21.1/src/sysdep.c --- emacs-21.1.org/src/sysdep.c Thu Jan 3 12:57:38 2002 +++ emacs-21.1/src/sysdep.c Thu Jan 3 01:48:54 2002 @@ -811,7 +811,12 @@ synch_process_alive = 1; #endif /* __DJGPP__ > 1 */ #else +#ifndef PUMA_VFORK_ISSUES_CLEARED_UP + pid = fork (); +#else pid = vfork (); +#endif + if (pid == -1) error ("Can't spawn subshell"); #endif diff -aur -x info emacs-21.1.org/src/term.c emacs-21.1/src/term.c --- emacs-21.1.org/src/term.c Thu Jan 3 12:57:38 2002 +++ emacs-21.1/src/term.c Thu Jan 3 01:48:54 2002 @@ -2191,6 +2191,10 @@ Initialization ***********************************************************************/ +#if defined(__APPLE_CC__) +__private_extern__ char _emacs_PC; +#define PC _emacs_PC +#endif void term_init (terminal_type) char *terminal_type; diff -aur -x info emacs-21.1.org/src/termcap.c emacs-21.1/src/termcap.c --- emacs-21.1.org/src/termcap.c Thu Jan 3 12:57:38 2002 +++ emacs-21.1/src/termcap.c Thu Jan 3 01:48:54 2002 @@ -297,9 +297,12 @@ int tputs_baud_rate; /* Already defined in the System framework in Mac OS X and causes prebinding to fail. */ -#ifndef MAC_OSX -char PC; -#endif /* MAC_OSX */ +#ifdef __APPLE_CC__ +__private_extern__ char _emacs_PC = '\0'; +#define PC _emacs_PC +#else + char PC; +#endif #if 0 /* Doesn't seem to be used anymore. */ diff -aur -x info emacs-21.1.org/src/tparam.c emacs-21.1/src/tparam.c --- emacs-21.1.org/src/tparam.c Thu Jan 3 12:57:38 2002 +++ emacs-21.1/src/tparam.c Thu Jan 3 01:48:54 2002 @@ -107,9 +107,15 @@ /* These are already defined in the System framework in Mac OS X and cause prebinding to fail. */ -#ifndef MAC_OSX -char *BC; -char *UP; +#ifdef __APPLE_CC__ +__private_extern__ char *_emacs_BC = NULL; +__private_extern__ char *_emacs_UP = NULL; +#define BC _emacs_BC +#define UP _emacs_UP +#else + char *BC; + char *UP; +#endif static char tgoto_buf[50]; @@ -125,7 +131,7 @@ args[1] = hpos; return tparam1 (cm, tgoto_buf, 50, UP, BC, args); } -#endif + static char * tparam1 (string, outstring, len, up, left, argp) diff -aur -x info emacs-21.1.org/src/unexmacosx.c emacs-21.1/src/unexmacosx.c --- emacs-21.1.org/src/unexmacosx.c Thu Jan 3 12:57:38 2002 +++ emacs-21.1/src/unexmacosx.c Thu Jan 3 10:06:17 2002 @@ -724,7 +724,8 @@ } else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 - || strncmp (sectp->sectname, "__dyld", 16) == 0) + || strncmp (sectp->sectname, "__dyld", 16) == 0 + || strncmp (sectp->sectname, "__const", 16) == 0 ) { if (!unexec_copy (sectp->offset, old_file_offset, sectp->size)) unexec_error ("cannot copy section %s", sectp->sectname); ----- >8 ---------- >8 ----- snip, snip ----- >8 ---------- >8 ----- |