]> code.delx.au - gnu-emacs/blobdiff - src/s/darwin.h
Merge from emacs--devo--0
[gnu-emacs] / src / s / darwin.h
index 59f63f57189d0c09d6e1d2d66b340d285134aa25..a2a3d862f806dfe9c4fe83ee786f6967e7670122 100644 (file)
@@ -1,11 +1,12 @@
 /* System description header file for Darwin (Mac OS X).
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005,
+                 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -15,8 +16,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 
 /*
@@ -37,10 +38,21 @@ Boston, MA 02111-1307, USA.  */
 #define BSD_SYSTEM
 /* #define VMS */
 
+#if 0 /* Don't define DARWIN on Mac OS X because CoreFoundation.h uses
+        it to distinguish Mac OS X from bare Darwin.  */
+#ifndef        DARWIN
+#define        DARWIN 1
+#endif
+#endif
+
 /* MAC_OS is used to conditionally compile code common to both MAC_OS8
    and MAC_OSX.  */
 #ifdef MAC_OSX
+#ifdef HAVE_CARBON
 #define MAC_OS
+/* We need a little extra space, see ../../lisp/loadup.el. */
+#define SYSTEM_PURESIZE_EXTRA 30000
+#endif
 #endif
 
 /* SYSTEM_TYPE should indicate the kind of system you are using.
@@ -101,10 +113,18 @@ Boston, MA 02111-1307, USA.  */
 
 /*
  *     Define HAVE_PTYS if the system supports pty devices.
+ *      Note: PTYs are broken on darwin <6.  Use at your own risk.
  */
 
 #define HAVE_PTYS
 
+/**
+ * PTYs only work correctly on Darwin 7 or higher.  So make the
+ * default for process-connection-type dependent on the kernel
+ * version.
+ */
+#define MIN_PTY_KERNEL_VERSION '7'
+
 /*
  *     Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
  *      The 4.2 opendir, etc., library functions.
@@ -176,7 +196,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* If the system's imake configuration file defines `NeedWidePrototypes'
    as `NO', we must define NARROWPROTO manually.  Such a define is
-   generated in the Makefile generated by `xmkmf'.  If we don't 
+   generated in the Makefile generated by `xmkmf'.  If we don't
    define NARROWPROTO, we will see the wrong function prototypes
    for X functions taking float or double parameters.  */
 
@@ -198,18 +218,9 @@ Boston, MA 02111-1307, USA.  */
    also the name of a Mach system call.  */
 #define init_process emacs_init_process
 
-/* Fix compilation problem for regex.c.  */
-#define __restrict
-
-/* Fix compilation problem for md5.c.  */
-#define __attribute__(x)
-
 /* Used in dispnew.c.  Copied from freebsd.h. */
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-/* Darwin provides POSIX-style getpgrp.  */
-#define GETPGRP_NO_ARG
-
 /* System uses OXTABS instead of the expected TAB3.  (Copied from
    bsd386.h.)  */
 #define TAB3 OXTABS
@@ -221,8 +232,17 @@ Boston, MA 02111-1307, USA.  */
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
 #define HAVE_SOCKETS
 
+/* In Carbon, asynchronous I/O (using SIGIO) can't be used for window
+   events because they don't come from sockets, even though it works
+   fine on tty's.  */
+#ifdef HAVE_CARBON
+#define NO_SOCK_SIGIO
+#endif
+
 /* Extra initialization calls in main for Mac OS X system type.  */
+#ifdef HAVE_CARBON
 #define SYMS_SYSTEM syms_of_mac()
+#endif
 
 /* Definitions for how to dump.  Copied from nextstep.h.  */
 
@@ -241,15 +261,21 @@ Boston, MA 02111-1307, USA.  */
 
 /* Definitions for how to compile & link.  */
 
-/* Indicate that we are compiling for Mac OS X and where to find Mac
-   specific headers.  */
-#define C_SWITCH_SYSTEM -fpascal-strings -fno-common -DMAC_OSX -I../mac/src
+/* Indicate that we are compiling for Mac OS X.  */
+#define C_SWITCH_SYSTEM -fpascal-strings -DMAC_OSX
 
-/* Link in the Carbon lib.  The -headerpad option tells ld (see man
-   page) to leave room at the end of the header for adding load
-   commands.  Needed for dumping.  0x690 is the total size of 30
-   segment load commands (at 56 each).  */
-#define LD_SWITCH_SYSTEM_TEMACS -prebind -framework Carbon -lstdc++ -Xlinker -headerpad -Xlinker 690
+/* Link in the Carbon lib. */
+#ifdef HAVE_CARBON
+#define LIBS_CARBON -framework Carbon -framework QuickTime
+#else
+#define LIBS_CARBON
+#endif
+
+/* The -headerpad option tells ld (see man page) to leave room at the
+   end of the header for adding load commands.  Needed for dumping.
+   0x690 is the total size of 30 segment load commands (at 56
+   each).  */
+#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_CARBON -Xlinker -headerpad -Xlinker 690
 
 #define C_SWITCH_SYSTEM_TEMACS -Dtemacs
 
@@ -258,6 +284,9 @@ Boston, MA 02111-1307, USA.  */
    option to use it.  */
 #ifdef HAVE_LIBNCURSES
 #define LIBS_TERMCAP -lncurses
+/* This prevents crashes when running Emacs in Terminal.app under
+   10.2.  */
+#define TERMINFO
 #endif
 
 /* Link this program just by running cc.  */
@@ -271,7 +300,9 @@ Boston, MA 02111-1307, USA.  */
 
 /* Tell src/Makefile.in to create files in the Mac OS X application
    bundle mac/Emacs.app.  */
+#ifdef HAVE_CARBON
 #define OTHER_FILES macosx-app
+#endif
 
 
 /* Define the following so emacs symbols will not conflict with those
@@ -284,21 +315,37 @@ Boston, MA 02111-1307, USA.  */
 #define NO_MATHERR
 
 
-/* This prevents a compilation error in xfaces.c: struct kboard * is
-   used in a function protocol the first time this type appears in the
-   file, since MULTI_KBOARD is undefined for the Mac OS X build.  */
-#ifndef NOT_C_CODE
-struct kboard;
-#endif
-
-
-/* This makes create_process in process.c save and restore signal
-   handlers correctly.  Suggested by Nozomu Ando.*/
-#define POSIX_SIGNALS
+/* The following solves the problem that Emacs hangs when evaluating
+   (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile
+   does not exist.  */
+#undef HAVE_WORKING_VFORK
+#define vfork fork
 
+/* Don't close pty in process.c to make it as controlling terminal.
+   It is already a controlling terminal of subprocess, because we did
+   ioctl TIOCSCTTY.  */
+#define DONT_REOPEN_PTY
 
 #ifdef temacs
 #define malloc unexec_malloc
 #define realloc unexec_realloc
 #define free unexec_free
 #endif
+
+/* This makes create_process in process.c save and restore signal
+   handlers correctly.  Suggested by Nozomu Ando.*/
+#define POSIX_SIGNALS
+
+/* Reroute calls to SELECT to the version defined in mac.c to fix the
+   problem of Emacs requiring an extra return to be typed to start
+   working when started from the command line.  */
+#if defined (HAVE_CARBON) && (defined (emacs) || defined (temacs))
+#define select sys_select
+#endif
+
+/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the
+   stack.  */
+#define GC_MARK_STACK   GC_MAKE_GCPROS_NOOPS
+
+/* arch-tag: 481d443d-4f89-43ea-b5fb-49706d95fa41
+   (do not change this comment) */