Fix the MS-Windows build broken by 2011-01-17T19:01:01Z!eggert@cs.ucla.edu and emacs...
authorEli Zaretskii <eliz@gnu.org>
Sat, 29 Jan 2011 12:36:11 +0000 (14:36 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 29 Jan 2011 12:36:11 +0000 (14:36 +0200)
 lib/makefile.w32-in:
 lib/getopt_.h: New files.
 src/s/ms-w32.h (HAVE_MKTIME): Remove.
 src/makefile.w32-in (LOCAL_FLAGS): Add -I../lib.
 (GNULIB): New variable.
 (LIBS): Add $(GNULIB).
 $(TEMACS): Depend on $(GNULIB).
 <top-level>: Fix font-lock disrupted by a lone `"'.
 src/makefile.w32-in (LOCAL_FLAGS): Add -I../lib.
 (GETOPTOBJS, GETOPTDEPS): Remove targets.
 (MOVEMAILOBJS): Replace $(GETOPTOBJS) with ../lib/$(BLD)/libgnu.$(A).
 ($(BLD)/movemail.exe): Depend on ../lib/getopt.h.
 (ECLIENTOBJS, ETAGSOBJ, CTAGSOBJ, EBROWSEOBJ): Replace getopt.o
 and getopt1.o with ../lib/$(BLD)/libgnu.$(A).
 (clean): Don't remove getopt.h.
 (getopt.h, $(BLD)/getopt.$(O), $(BLD)/getopt1.$(O)): Remove targets.
 ($(BLD)/ctags.$(O), $(BLD)/etags.$(O)): Replace getopt.h with
 $(EMACS_ROOT)/lib/getopt.h.
 nt/makefile.w32-in (all-other-dirs-nmake, all-other-dirs-gmake)
 (bootstrap-nmake, bootstrap-gmake, bootstrap-clean-nmake)
 (bootstrap-clean-gmake, clean-other-dirs-nmake)
 (clean-other-dirs-gmake, cleanall-other-dirs-nmake)
 (cleanall-other-dirs-gmake, distclean-other-dirs-nmake)
 (distclean-other-dirs-gmake, maintainer-clean-other-dirs-nmake)
 (maintainer-clean-other-dirs-gmake): Recurse into ../lib as well.
 nt/configure.bat: Create lib/makefile.
 nt/config.nt (HAVE_MKTIME, BROKEN_MKTIME): Remove.
 (HAVE_ATTRIBUTE_ALIGNED, HAVE_C99_STRTOLD, HAVE_DECL_GETENV)
 (HAVE_DECL_LOCALTIME_R, HAVE_WCHAR_T, PACKAGE, VERSION, inline)
 (_GL_UNUSED, _UNUSED_PARAMETER_): Add definitions, for gnulib.

14 files changed:
ChangeLog
lib-src/ChangeLog
lib-src/makefile.w32-in
lib-src/ntlib.c
lib-src/ntlib.h
lib/getopt_.h [new file with mode: 0644]
lib/makefile.w32-in [new file with mode: 0644]
nt/ChangeLog
nt/config.nt
nt/configure.bat
nt/makefile.w32-in
src/ChangeLog
src/makefile.w32-in
src/s/ms-w32.h

index 27c010f..6bf329b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * lib/makefile.w32-in:
+       * lib/getopt_.h: New files.
+
 2011-01-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        improve fix for MS-DOS file name clash
index 2abfd6c..bc76c25 100644 (file)
@@ -1,3 +1,22 @@
+2011-01-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (LOCAL_FLAGS): Add -I../lib.
+       (GETOPTOBJS, GETOPTDEPS): Remove targets.
+       (MOVEMAILOBJS): Replace $(GETOPTOBJS) with ../lib/$(BLD)/libgnu.$(A).
+       ($(BLD)/movemail.exe): Depend on ../lib/getopt.h.
+       (ECLIENTOBJS, ETAGSOBJ, CTAGSOBJ, EBROWSEOBJ): Replace getopt.o
+       and getopt1.o with ../lib/$(BLD)/libgnu.$(A).
+       (clean): Don't remove getopt.h.
+       (getopt.h, $(BLD)/getopt.$(O), $(BLD)/getopt1.$(O)): Remove targets.
+       ($(BLD)/ctags.$(O), $(BLD)/etags.$(O)): Replace getopt.h with
+       $(EMACS_ROOT)/lib/getopt.h.
+
+2011-01-28  Chong Yidong  <cyd@stupidchicken.com>
+
+       * ntlib.c (setregid): New stub, renamed from setegid.
+
+       * ntlib.h: Update prototype.
+
 2011-01-25  Chong Yidong  <cyd@stupidchicken.com>
 
        * movemail.c (main): Use setregid instead of setegid, which is
index 80931fc..3685d0e 100644 (file)
@@ -24,8 +24,8 @@ ALL = make-docfile hexl ctags etags movemail ebrowse emacsclient
 VERSION                = 24.0.50
 
 LOCAL_FLAGS    = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \
-                 -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../nt/inc \
-                 -I../src
+                 -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \
+                 -I../nt/inc -I../src
 
 LIBS           = $(BASE_LIBS) $(ADVAPI32)
 
@@ -50,22 +50,19 @@ emacsclient:        stamp_BLD $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe
 test-distrib:  stamp_BLD $(BLD)/test-distrib.exe
        "$(BLD)/test-distrib.exe" "$(SRC)/testfile"
 
-GETOPTOBJS = $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O)
-GETOPTDEPS = $(GETOPTOBJS) getopt.h
 MOVEMAILOBJS =  $(BLD)/movemail.$(O) \
                $(BLD)/pop.$(O) \
-               $(BLD)/ntlib.$(O) \
-               $(GETOPTOBJS)
+               ../lib/$(BLD)/libgnu.$(A) \
+               $(BLD)/ntlib.$(O)
 
-$(BLD)/movemail.exe:   $(MOVEMAILOBJS) getopt.h
+$(BLD)/movemail.exe:   $(MOVEMAILOBJS) ../lib/getopt.h
 # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
                $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(MOVEMAILOBJS) $(WSOCK32) $(LIBS)
 
 ECLIENT_CFLAGS = -DHAVE_GETCWD -DHAVE_STRERROR -DVERSION="\"$(VERSION)\""
 ECLIENTOBJS =  $(BLD)/emacsclient.$(O) \
-               $(BLD)/getopt.$(O) \
-               $(BLD)/getopt1.$(O) \
-               $(BLD)/ntlib.$(O)
+               $(BLD)/ntlib.$(O) \
+               ../lib/$(BLD)/libgnu.$(A)
 CLIENTRES =    ../nt/$(BLD)/emacsclient.res
 
 $(CLIENTRES):  ../nt/emacsclient.rc
@@ -86,8 +83,7 @@ $(BLD)/emacsclient.$(O):      emacsclient.c makefile.w32-in
                $(CC) $(CFLAGS) $(ECLIENT_CFLAGS) $(CC_OUT)$@ emacsclient.c
 
 ETAGSOBJ      = $(BLD)/etags.$(O) \
-               $(BLD)/getopt.$(O) \
-               $(BLD)/getopt1.$(O) \
+               ../lib/$(BLD)/libgnu.$(A) \
                $(BLD)/ntlib.$(O) \
                $(BLD)/regex.$(O)
 
@@ -96,8 +92,7 @@ $(BLD)/etags.exe:     $(ETAGSOBJ)
 
 
 EBROWSEOBJ    = $(BLD)/ebrowse.$(O) \
-               $(BLD)/getopt.$(O) \
-               $(BLD)/getopt1.$(O) \
+               ../lib/$(BLD)/libgnu.$(A) \
                $(BLD)/ntlib.$(O)
 
 $(BLD)/ebrowse.exe:     $(EBROWSEOBJ)
@@ -112,8 +107,7 @@ $(BLD)/etags.$(O): etags.c
                $(CC) $(CFLAGS) $(ETAGS_CFLAGS) $(CC_OUT)$@ etags.c
 
 CTAGSOBJ      = $(BLD)/ctags.$(O) \
-               $(BLD)/getopt.$(O) \
-               $(BLD)/getopt1.$(O) \
+               ../lib/$(BLD)/libgnu.$(A) \
                $(BLD)/ntlib.$(O) \
                $(BLD)/regex.$(O)
 
@@ -340,7 +334,6 @@ install:    $(INSTALL_FILES)
 clean:
                - $(DEL) DOC* $(COMPILER_TEMP_FILES)
                - $(DEL) ctags.c
-               - $(DEL) getopt.h
                - $(DEL_TREE) $(OBJDIR)
                - $(DEL) stamp_BLD
                - $(DEL) echolisp.tmp
@@ -365,9 +358,6 @@ cleanall:   clean
                        echo $(CONFIG_H) has changed.  Re-run configure.bat.
                        exit -1
 
-getopt.h:              getopt_.h
-                       $(CP) $(ALL_DEPS) $@
-
 ### TAGS ###
 
 TAGS: $(BLD)/etags.exe *.c *.h
@@ -392,7 +382,7 @@ $(BLD)/ctags.$(O) : \
        $(EMACS_ROOT)/src/m/intel386.h \
        $(EMACS_ROOT)/lib-src/../src/config.h \
        $(SRC)/ntlib.h \
-       $(SRC)/getopt.h
+       $(EMACS_ROOT)/lib/getopt.h
 
 $(BLD)/emacsclient.$(O) : \
        $(SRC)/emacsclient.c \
@@ -407,7 +397,7 @@ $(BLD)/etags.$(O) : \
        $(EMACS_ROOT)/src/m/intel386.h \
        $(EMACS_ROOT)/lib-src/../src/config.h \
        $(SRC)/ntlib.h \
-       $(SRC)/getopt.h
+       $(EMACS_ROOT)/lib/getopt.h
 
 $(BLD)/fakemail.$(O) : \
        $(SRC)/fakemail.c \
@@ -424,21 +414,6 @@ $(BLD)/getdate.$(O) : \
        $(EMACS_ROOT)/src/config.h \
        $(MSTOOLS_SYS)/types.h
 
-$(BLD)/getopt.$(O) : \
-       $(SRC)/getopt.c \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h \
-       $(SRC)/ntlib.h \
-       $(SRC)/getopt.h
-
-$(BLD)/getopt1.$(O) : \
-       $(SRC)/getopt1.c \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h \
-       $(SRC)/getopt.h
-
 $(BLD)/hexl.$(O) : \
        $(SRC)/hexl.c
 
@@ -500,7 +475,7 @@ $(BLD)/timer.$(O) : \
 #
 $(BLD)/make-docfile.$(O) $(BLD)/hexl.$(O) $(BLD)/fakemail.$(O): stamp_BLD
 
-$(BLD)/test-distrib.$(O) $(GETOPTOBJS) $(MOVEMAILOBJS): stamp_BLD
+$(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD
 
 $(BLD)/emacsclient.$(O) $(BLD)/etags.$(O) $(BLD)/regex.$(O): stamp_BLD
 
index 02db2af..0ecd417 100644 (file)
@@ -143,7 +143,7 @@ setuid (unsigned uid)
 }
 
 int
-setegid (unsigned gid)
+setregid (unsigned rgid, unsigned gid)
 {
   return 0;
 }
index d328913..be8d2a5 100644 (file)
@@ -38,7 +38,7 @@ unsigned getuid (void);
 unsigned getegid (void);
 unsigned getgid (void);
 int setuid (unsigned uid);
-int setegid (unsigned gid);
+int setregid (unsigned rgid, unsigned gid);
 char * getpass (const char * prompt);
 int fchown (int fd, unsigned uid, unsigned gid);
 
diff --git a/lib/getopt_.h b/lib/getopt_.h
new file mode 100644 (file)
index 0000000..0b7ea2c
--- /dev/null
@@ -0,0 +1,280 @@
+/* Declarations for getopt.\r
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2011 Free Software\r
+   Foundation, Inc.\r
+   This file is part of the GNU C Library.\r
+\r
+   This program is free software: you can redistribute it and/or modify\r
+   it under the terms of the GNU General Public License as published by\r
+   the Free Software Foundation; either version 3 of the License, or\r
+   (at your option) any later version.\r
+\r
+   This program is distributed in the hope that it will be useful,\r
+   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+   GNU General Public License for more details.\r
+\r
+   You should have received a copy of the GNU General Public License\r
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\r
+\r
+#ifndef _GL_GETOPT_H\r
+\r
+#if __GNUC__ >= 3\r
+#pragma GCC system_header\r
+#endif\r
+\r
+\r
+/* The include_next requires a split double-inclusion guard.  We must\r
+   also inform the replacement unistd.h to not recursively use\r
+   <getopt.h>; our definitions will be present soon enough.  */\r
+#if HAVE_GETOPT_H\r
+# define _GL_SYSTEM_GETOPT\r
+# ifndef __GNUC__\r
+# include <next_getopt.h>\r
+# else\r
+# include_next <getopt.h>\r
+# endif\r
+# undef _GL_SYSTEM_GETOPT\r
+#endif\r
+\r
+#ifndef _GL_GETOPT_H\r
+\r
+#ifndef __need_getopt\r
+# define _GL_GETOPT_H 1\r
+#endif\r
+\r
+/* Standalone applications should #define __GETOPT_PREFIX to an\r
+   identifier that prefixes the external functions and variables\r
+   defined in this header.  When this happens, include the\r
+   headers that might declare getopt so that they will not cause\r
+   confusion if included after this file (if the system had <getopt.h>,\r
+   we have already included it).  Then systematically rename\r
+   identifiers so that they do not collide with the system functions\r
+   and variables.  Renaming avoids problems with some compilers and\r
+   linkers.  */\r
+#if defined __GETOPT_PREFIX && !defined __need_getopt\r
+# if !HAVE_GETOPT_H\r
+#  include <stdlib.h>\r
+#  include <stdio.h>\r
+#  include <unistd.h>\r
+# endif\r
+# undef __need_getopt\r
+# undef getopt\r
+# undef getopt_long\r
+# undef getopt_long_only\r
+# undef optarg\r
+# undef opterr\r
+# undef optind\r
+# undef optopt\r
+# undef option\r
+# define __GETOPT_CONCAT(x, y) x ## y\r
+# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)\r
+# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)\r
+# define getopt __GETOPT_ID (getopt)\r
+# define getopt_long __GETOPT_ID (getopt_long)\r
+# define getopt_long_only __GETOPT_ID (getopt_long_only)\r
+# define optarg __GETOPT_ID (optarg)\r
+# define opterr __GETOPT_ID (opterr)\r
+# define optind __GETOPT_ID (optind)\r
+# define optopt __GETOPT_ID (optopt)\r
+# define option __GETOPT_ID (option)\r
+# define _getopt_internal __GETOPT_ID (getopt_internal)\r
+#endif\r
+\r
+/* Standalone applications get correct prototypes for getopt_long and\r
+   getopt_long_only; they declare "char **argv".  libc uses prototypes\r
+   with "char *const *argv" that are incorrect because getopt_long and\r
+   getopt_long_only can permute argv; this is required for backward\r
+   compatibility (e.g., for LSB 2.0.1).\r
+\r
+   This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',\r
+   but it caused redefinition warnings if both unistd.h and getopt.h were\r
+   included, since unistd.h includes getopt.h having previously defined\r
+   __need_getopt.\r
+\r
+   The only place where __getopt_argv_const is used is in definitions\r
+   of getopt_long and getopt_long_only below, but these are visible\r
+   only if __need_getopt is not defined, so it is quite safe to rewrite\r
+   the conditional as follows:\r
+*/\r
+#if !defined __need_getopt\r
+# if defined __GETOPT_PREFIX\r
+#  define __getopt_argv_const /* empty */\r
+# else\r
+#  define __getopt_argv_const const\r
+# endif\r
+#endif\r
+\r
+/* If __GNU_LIBRARY__ is not already defined, either we are being used\r
+   standalone, or this is the first header included in the source file.\r
+   If we are being used with glibc, we need to include <features.h>, but\r
+   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is\r
+   not defined, include <ctype.h>, which will pull in <features.h> for us\r
+   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it\r
+   doesn't flood the namespace with stuff the way some other headers do.)  */\r
+#if !defined __GNU_LIBRARY__\r
+# include <ctype.h>\r
+#endif\r
+\r
+#ifndef __THROW\r
+# ifndef __GNUC_PREREQ\r
+#  define __GNUC_PREREQ(maj, min) (0)\r
+# endif\r
+# if defined __cplusplus && __GNUC_PREREQ (2,8)\r
+#  define __THROW       throw ()\r
+# else\r
+#  define __THROW\r
+# endif\r
+#endif\r
+\r
+/* The definition of _GL_ARG_NONNULL is copied here.  */\r
+/* A C macro for declaring that specific arguments must not be NULL.\r
+   Copyright (C) 2009-2011 Free Software Foundation, Inc.\r
+\r
+   This program is free software: you can redistribute it and/or modify it\r
+   under the terms of the GNU General Public License as published\r
+   by the Free Software Foundation; either version 3 of the License, or\r
+   (at your option) any later version.\r
+\r
+   This program is distributed in the hope that it will be useful,\r
+   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+   Lesser General Public License for more details.\r
+\r
+   You should have received a copy of the GNU General Public License\r
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\r
+\r
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools\r
+   that the values passed as arguments n, ..., m must be non-NULL pointers.\r
+   n = 1 stands for the first argument, n = 2 for the second argument etc.  */\r
+#ifndef _GL_ARG_NONNULL\r
+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3\r
+#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))\r
+# else\r
+#  define _GL_ARG_NONNULL(params)\r
+# endif\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* For communication from `getopt' to the caller.\r
+   When `getopt' finds an option that takes an argument,\r
+   the argument value is returned here.\r
+   Also, when `ordering' is RETURN_IN_ORDER,\r
+   each non-option ARGV-element is returned here.  */\r
+\r
+extern char *optarg;\r
+\r
+/* Index in ARGV of the next element to be scanned.\r
+   This is used for communication to and from the caller\r
+   and for communication between successive calls to `getopt'.\r
+\r
+   On entry to `getopt', zero means this is the first call; initialize.\r
+\r
+   When `getopt' returns -1, this is the index of the first of the\r
+   non-option elements that the caller should itself scan.\r
+\r
+   Otherwise, `optind' communicates from one call to the next\r
+   how much of ARGV has been scanned so far.  */\r
+\r
+extern int optind;\r
+\r
+/* Callers store zero here to inhibit the error message `getopt' prints\r
+   for unrecognized options.  */\r
+\r
+extern int opterr;\r
+\r
+/* Set to an option character which was unrecognized.  */\r
+\r
+extern int optopt;\r
+\r
+#ifndef __need_getopt\r
+/* Describe the long-named options requested by the application.\r
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector\r
+   of `struct option' terminated by an element containing a name which is\r
+   zero.\r
+\r
+   The field `has_arg' is:\r
+   no_argument          (or 0) if the option does not take an argument,\r
+   required_argument    (or 1) if the option requires an argument,\r
+   optional_argument    (or 2) if the option takes an optional argument.\r
+\r
+   If the field `flag' is not NULL, it points to a variable that is set\r
+   to the value given in the field `val' when the option is found, but\r
+   left unchanged if the option is not found.\r
+\r
+   To have a long-named option do something other than set an `int' to\r
+   a compiled-in constant, such as set a value from `optarg', set the\r
+   option's `flag' field to zero and its `val' field to a nonzero\r
+   value (the equivalent single-letter option character, if there is\r
+   one).  For long options that have a zero `flag' field, `getopt'\r
+   returns the contents of the `val' field.  */\r
+\r
+struct option\r
+{\r
+  const char *name;\r
+  /* has_arg can't be an enum because some compilers complain about\r
+     type mismatches in all the code that assumes it is an int.  */\r
+  int has_arg;\r
+  int *flag;\r
+  int val;\r
+};\r
+\r
+/* Names for the values of the `has_arg' field of `struct option'.  */\r
+\r
+# define no_argument            0\r
+# define required_argument      1\r
+# define optional_argument      2\r
+#endif  /* need getopt */\r
+\r
+\r
+/* Get definitions and prototypes for functions to process the\r
+   arguments in ARGV (ARGC of them, minus the program name) for\r
+   options given in OPTS.\r
+\r
+   Return the option character from OPTS just read.  Return -1 when\r
+   there are no more options.  For unrecognized options, or options\r
+   missing arguments, `optopt' is set to the option letter, and '?' is\r
+   returned.\r
+\r
+   The OPTS string is a list of characters which are recognized option\r
+   letters, optionally followed by colons, specifying that that letter\r
+   takes an argument, to be placed in `optarg'.\r
+\r
+   If a letter in OPTS is followed by two colons, its argument is\r
+   optional.  This behavior is specific to the GNU `getopt'.\r
+\r
+   The argument `--' causes premature termination of argument\r
+   scanning, explicitly telling `getopt' that there are no more\r
+   options.\r
+\r
+   If OPTS begins with `-', then non-option arguments are treated as\r
+   arguments to the option '\1'.  This behavior is specific to the GNU\r
+   `getopt'.  If OPTS begins with `+', or POSIXLY_CORRECT is set in\r
+   the environment, then do not permute arguments.  */\r
+\r
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)\r
+       __THROW _GL_ARG_NONNULL ((2, 3));\r
+\r
+#ifndef __need_getopt\r
+extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,\r
+                        const char *__shortopts,\r
+                        const struct option *__longopts, int *__longind)\r
+       __THROW _GL_ARG_NONNULL ((2, 3));\r
+extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,\r
+                             const char *__shortopts,\r
+                             const struct option *__longopts, int *__longind)\r
+       __THROW _GL_ARG_NONNULL ((2, 3));\r
+\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+/* Make sure we later can get all the definitions and declarations.  */\r
+#undef __need_getopt\r
+\r
+#endif /* getopt.h */\r
+#endif /* getopt.h */\r
diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in
new file mode 100644 (file)
index 0000000..cf74288
--- /dev/null
@@ -0,0 +1,154 @@
+# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
+# Copyright (C) 2011 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 3 of the License, or
+# (at your option) any later version.
+
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+ALL = gnulib
+
+.PHONY: $(ALL)
+
+LOCAL_FLAGS    = -DHAVE_CONFIG_H=1 -I. -I../nt/inc -I../src
+LIBS           =
+
+GNULIBOBJS     = $(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O)
+
+#
+# Build the library
+#
+$(BLD)/libgnu.$(A):    $(GNULIBOBJS)
+       - $(DEL) $@
+       $(AR) $(AR_OUT)$@ $(ALL_DEPS)
+
+gnulib:        stamp_BLD $(BLD)/libgnu.$(A)
+
+#
+# Build everything
+#
+all:           stamp_BLD $(ALL)
+
+### TAGS ###
+
+TAGS:
+        ../lib-src/$(BLD)/etags.exe *.c *.h
+
+### DEPENDENCIES ###
+
+EMACS_ROOT     = ..
+SRC            = .
+
+$(BLD)/dtoastr.$(O) : \
+       $(SRC)/dtoastr.c \
+       $(SRC)/ftoastr.c \
+       $(SRC)/ftoastr.h \
+       $(SRC)/intprops.h \
+       $(EMACS_ROOT)/src/config.h
+
+$(BLD)/getopt.$(O) : \
+       $(SRC)/getopt.c \
+       $(SRC)/getopt.h \
+       $(SRC)/getopt_int.h \
+       $(EMACS_ROOT)/src/s/ms-w32.h \
+       $(EMACS_ROOT)/src/m/intel386.h \
+       $(EMACS_ROOT)/src/config.h
+
+$(BLD)/getopt1.$(O) : \
+       $(SRC)/getopt1.c \
+       $(SRC)/getopt.h \
+       $(SRC)/getopt_int.h \
+       $(EMACS_ROOT)/src/s/ms-w32.h \
+       $(EMACS_ROOT)/src/m/intel386.h \
+       $(EMACS_ROOT)/src/config.h
+
+# The following dependencies are for supporting parallel builds, where
+# we must make sure $(BLD) exists before any compilation starts.
+#
+$(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O): stamp_BLD
+
+#
+# Headers we would preprocess if we could.
+#
+getopt.h:      getopt_.h
+       $(CP) $(ALL_DEPS) $@
+
+#
+# Maintenance
+#
+clean:
+       - $(DEL) $(COMPILER_TEMP_FILES)
+       - $(DEL) getopt.h
+       - $(DEL_TREE) $(OBJDIR)
+       - $(DEL) stamp_BLD
+
+distclean:     cleanall
+       - $(DEL) TAGS
+       - $(DEL) Makefile
+
+maintainer-clean: distclean
+       - $(DEL) getopt_.h
+
+cleanall:      clean
+       - $(DEL_TREE) obj
+       - $(DEL_TREE) obj-spd
+       - $(DEL_TREE) oo
+       - $(DEL_TREE) oo-spd
+
+# A dummy target to force other targets to be evaluated.
+doit:
+
+getopt_.h: getopt.in.h $(ARG_NONNULL_H)
+       $(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
+
+getopt_.h-CMD: doit
+       @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
+       @echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
+       @echo You will need GNU Sed to be installed.
+       exit -1
+
+getopt_.h-SH: doit
+       @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
+       @echo Run '"$(MAKETYPE) getopt_h"' in the lib/ subdirectory.
+       @echo You will need GNU Sed to be installed.
+       exit -1
+
+# Generating getopt_.h from getopt.in.h.
+#
+# To avoid requiring all end users to install Sed, we have below
+# a maintainer-only target that produces getopt_.h from getopt.in.h.
+# For easier maintenance, all the strings that replace the @FOO@
+# placeholder are defined as Make macros below.
+
+HAVE_GETOPT_H = HAVE_GETOPT_H
+INCLUDE_NEXT = include_next
+PRAGMA_SYSTEM_HEADER = \#pragma GCC system_header
+PRAGMA_COLUMNS =
+NEXT_GETOPT_H = <getopt.h>
+ARG_NONNULL_H = ../arg-nonnull.h
+
+getopt_h:
+       - $(DEL) getopt_.h-t getopt_.h
+       sed -e "s!@HAVE_GETOPT_H@!$(HAVE_GETOPT_H)!g" \
+           -e "s!@INCLUDE_NEXT@!$(INCLUDE_NEXT)!g" \
+           -e "s!@PRAGMA_SYSTEM_HEADER@!$(PRAGMA_SYSTEM_HEADER)!g" \
+           -e "s!@PRAGMA_COLUMNS@!$(PRAGMA_COLUMNS)!g" \
+           -e "s!@NEXT_GETOPT_H@!$(NEXT_GETOPT_H)!g" \
+           -e "/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)" \
+           -e "/^\# include_next/i # ifndef __GNUC__" \
+           -e "/^\# include_next/i # include <next_getopt.h>" \
+           -e "/^\# include_next/i # else" \
+           -e "/^\# include_next/a # endif" \
+             < getopt.in.h > getopt_.h-t
+       $(CP) getopt_.h-t getopt_.h
+       - $(DEL) getopt_.h-t
index e0c5aa2..d7301e8 100644 (file)
@@ -1,3 +1,20 @@
+2011-01-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (all-other-dirs-nmake, all-other-dirs-gmake)
+       (bootstrap-nmake, bootstrap-gmake, bootstrap-clean-nmake)
+       (bootstrap-clean-gmake, clean-other-dirs-nmake)
+       (clean-other-dirs-gmake, cleanall-other-dirs-nmake)
+       (cleanall-other-dirs-gmake, distclean-other-dirs-nmake)
+       (distclean-other-dirs-gmake, maintainer-clean-other-dirs-nmake)
+       (maintainer-clean-other-dirs-gmake): Recurse into ../lib as well.
+
+       * configure.bat: Create lib/makefile.
+
+       * config.nt (HAVE_MKTIME, BROKEN_MKTIME): Remove.
+       (HAVE_ATTRIBUTE_ALIGNED, HAVE_C99_STRTOLD, HAVE_DECL_GETENV)
+       (HAVE_DECL_LOCALTIME_R, HAVE_WCHAR_T, PACKAGE, VERSION, inline)
+       (_GL_UNUSED, _UNUSED_PARAMETER_): Add definitions, for gnulib.
+
 2011-01-07  Eli Zaretskii  <eliz@gnu.org>
 
        * config.nt (HAVE___BUILTIN_UNWIND_INIT) [GCC >= 2.8]: Define.
index 6e10c75..53d8970 100644 (file)
@@ -224,7 +224,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef HAVE_SETSID
 #undef HAVE_FPATHCONF
 #undef HAVE_SELECT
-#undef HAVE_MKTIME
 #undef HAVE_EUIDACCESS
 #undef HAVE_GETPAGESIZE
 #undef HAVE_GET_CURRENT_DIR_NAME
@@ -273,6 +272,67 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `getopt_long_only' function. */
 #undef HAVE_GETOPT_LONG_ONLY
 
+/* Preprocessor macros needed for gnulib imports.  */
+
+/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */
+#ifdef __GNUC__
+#define HAVE_ATTRIBUTE_ALIGNED 1
+#else
+#undef HAVE_ATTRIBUTE_ALIGNED
+#endif
+
+/* Define to 1 if strtold conforms to C99. */
+#ifdef __GNUC__
+#define HAVE_C99_STRTOLD 1
+#else
+#undef HAVE_C99_STRTOLD
+#endif
+
+/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
+   */
+#define HAVE_DECL_GETENV 1
+
+/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you
+   don't. */
+#undef HAVE_DECL_LOCALTIME_R
+
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
+/* Define if you have the 'wchar_t' type. */
+#define HAVE_WCHAR_T 1
+
+/* Name of package */
+#define PACKAGE "emacs"
+
+/* FIXME: This is defined by the various makefile.w32-in files for
+   now.  Revisit if/when VERSION from config.h is used by any
+   Makefile.in files.  */
+#if 0
+/* Version number of package */
+#define VERSION "24.0.50"
+#endif
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
+#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_UNUSED __attribute__ ((__unused__))
+#else
+# define _GL_UNUSED
+#endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
+
+/* End of gnulib-related stuff.  */
+
 /* If using GNU, then support inline function declarations. */
 #ifdef __GNUC__
 #define INLINE __inline__
@@ -344,11 +404,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define RE_TRANSLATE_P(TBL) (XFASTINT (TBL) != 0)
 #endif
 
-/* Avoid link-time collision with system mktime if we will use our own.  */
-#if ! HAVE_MKTIME || BROKEN_MKTIME
-#define mktime emacs_mktime
-#endif
-
 #define my_strftime nstrftime   /* for strftime.c */
 
 #ifndef WINDOWSNT
index a2ec2ca..1450650 100755 (executable)
@@ -679,6 +679,7 @@ if exist config.tmp del config.tmp
 copy /b config.settings+%MAKECMD%.defs+..\nt\makefile.w32-in ..\nt\makefile\r
 if exist ..\admin\unidata copy /b config.settings+%MAKECMD%.defs+..\admin\unidata\makefile.w32-in ..\admin\unidata\makefile\r
 copy /b config.settings+%MAKECMD%.defs+..\lib-src\makefile.w32-in ..\lib-src\makefile\r
+copy /b config.settings+%MAKECMD%.defs+..\lib\makefile.w32-in ..\lib\makefile\r
 copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile\r
 copy /b config.settings+%MAKECMD%.defs+..\doc\emacs\makefile.w32-in ..\doc\emacs\makefile\r
 copy /b config.settings+%MAKECMD%.defs+..\doc\misc\makefile.w32-in ..\doc\misc\makefile\r
index 5ad398f..0ce8a5a 100644 (file)
@@ -92,6 +92,8 @@ $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O
 all:   which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)\r
 \r
 all-other-dirs-nmake: addsection\r
+       cd ..\lib\r
+       $(MAKE) $(MFLAGS) all\r
        cd ..\lib-src\r
        $(MAKE) $(MFLAGS) all\r
        cd ..\src\r
@@ -103,6 +105,7 @@ all-other-dirs-nmake: addsection
        cd ..\nt\r
 \r
 all-other-dirs-gmake: addsection\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all\r
@@ -158,6 +161,8 @@ bootstrap-nmake: addsection cmdproxy
        $(MAKE) $(MFLAGS) clean\r
        cd ..\lib-src\r
        $(MAKE) $(MFLAGS) clean\r
+       cd ..\lib\r
+       $(MAKE) $(MFLAGS) clean\r
        cd ..\src\r
        $(MAKE) $(MFLAGS) bootstrap\r
        $(MAKE) $(MFLAGS) bootstrap-clean\r
@@ -173,6 +178,7 @@ bootstrap-gmake: addsection cmdproxy
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
        $(CP) $(BLD)/cmdproxy.exe ../bin\r
@@ -184,11 +190,14 @@ bootstrap-clean: bootstrap-clean-$(MAKETYPE)
 bootstrap-clean-nmake:\r
        cd ..\src\r
        $(MAKE) $(MFLAGS) bootstrap-clean\r
+       cd ..\lib\r
+       $(MAKE) $(MFLAGS) clean\r
        cd ..\lisp\r
        $(MAKE) $(MFLAGS) bootstrap-clean\r
 \r
 bootstrap-clean-gmake:\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
 \r
 $(INSTALL_DIR):\r
@@ -297,6 +306,8 @@ clean:      clean-other-dirs-$(MAKETYPE)
        - $(DEL) ../etc/DOC ../etc/DOC-X\r
 \r
 clean-other-dirs-nmake:\r
+       cd ..\lib\r
+       $(MAKE) $(MFLAGS) clean\r
        cd ..\lib-src\r
        $(MAKE) $(MFLAGS) clean\r
        cd ..\src\r
@@ -314,6 +325,7 @@ clean-other-dirs-nmake:
        cd ..\nt\r
 \r
 clean-other-dirs-gmake:\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean\r
@@ -323,6 +335,8 @@ clean-other-dirs-gmake:
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean\r
 \r
 cleanall-other-dirs-nmake:\r
+       cd ..\lib\r
+       $(MAKE) $(MFLAGS) cleanall\r
        cd ..\lib-src\r
        $(MAKE) $(MFLAGS) cleanall\r
        cd ..\src\r
@@ -330,6 +344,7 @@ cleanall-other-dirs-nmake:
        cd ..\nt\r
 \r
 cleanall-other-dirs-gmake:\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib cleanall\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall\r
 \r
@@ -355,6 +370,8 @@ top-distclean:
 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean\r
 \r
 distclean-other-dirs-nmake:\r
+       cd ..\lib\r
+       $(MAKE) $(MFLAGS) distclean\r
        cd ..\lib-src\r
        $(MAKE) $(MFLAGS) distclean\r
        cd ..\src\r
@@ -374,6 +391,7 @@ distclean-other-dirs-nmake:
        cd ..\nt\r
 \r
 distclean-other-dirs-gmake:\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean\r
@@ -386,6 +404,8 @@ distclean-other-dirs-gmake:
 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean\r
 \r
 maintainer-clean-other-dirs-nmake:\r
+       cd ..\lib\r
+       $(MAKE) $(MFLAGS) maintainer-clean\r
        cd ..\lib-src\r
        $(MAKE) $(MFLAGS) maintainer-clean\r
        cd ..\src\r
@@ -405,6 +425,7 @@ maintainer-clean-other-dirs-nmake:
        cd ..\nt\r
 \r
 maintainer-clean-other-dirs-gmake:\r
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean\r
        $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean\r
@@ -424,6 +445,7 @@ TAGS-gmake: frc
        ../lib-src/$(BLD)/etags $(CURDIR)/*.c\r
        $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP\r
        $(MAKE) $(MFLAGS) -C ../lib-src TAGS\r
+       $(MAKE) $(MFLAGS) -C ../lib TAGS\r
 \r
 TAGS-nmake:\r
        echo This target is not supported with NMake\r
index 340ca37..7f19b02 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * s/ms-w32.h (HAVE_MKTIME): Remove.
+
+       * makefile.w32-in (LOCAL_FLAGS): Add -I../lib.
+       (GNULIB): New variable.
+       (LIBS): Add $(GNULIB).
+       $(TEMACS): Depend on $(GNULIB).
+       <top-level>: Fix font-lock disrupted by a lone `"'.
+
 2011-01-29  Jan Djärv  <jan.h.d@swipnet.se>
 
        * nsselect.m (ns_string_from_pasteboard): Get length of string
index 549acf8..ad21419 100644 (file)
@@ -28,7 +28,7 @@ EMACSLOADPATH=$(CURDIR)/../lisp
 # HAVE_CONFIG_H is required by some generic gnu sources stuck into
 # the emacs source tree.
 #
-LOCAL_FLAGS     = -Demacs=1 -DHAVE_CONFIG_H -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
+LOCAL_FLAGS     = -Demacs=1 -DHAVE_CONFIG_H -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
 
 SRC             = .
 EMACS           = $(BLD)/emacs.exe
@@ -40,6 +40,7 @@ TLIB2           = $(BLD)/temacs2.$(A)
 TOBJ            = $(BLD)/firstfile.$(O)
 TRES           = $(BLD)/emacs.res
 TLASTLIB       = $(BLD)/lastfile.$(A)
+GNULIB         = ../lib/$(BLD)/libgnu.$(A)
 
 DOC            = $(OBJDIR)/etc/DOC-X
 
@@ -140,6 +141,7 @@ LIBS =  $(TLIB0)    \
        $(TLIB1)        \
        $(TLIB2)        \
        $(TLASTLIB)     \
+       $(GNULIB)       \
        $(WINMM)        \
        $(ADVAPI32)     \
        $(GDI32)        \
@@ -174,7 +176,7 @@ $(EMACS):       $(DOC) $(TEMACS)
 #
 temacs:         stamp_BLD $(TEMACS)
 $(TEMACS):      $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
-                 ../nt/$(BLD)/addsection.exe
+                 ../nt/$(BLD)/addsection.exe $(GNULIB)
        $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
        "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
 
@@ -192,6 +194,9 @@ make-buildobj-CMD:
        echo $(OBJ2)            \>> buildobj.h
        echo ^">> buildobj.h
 
+# "
+# The above line is here to countermand the single quote
+# on the last "echo" command above, wrt font-lock.
 make-buildobj-SH:
        echo '#define BUILDOBJ $(DQUOTE)\'  > buildobj.h
        echo $(OBJ0)                   '\' >> buildobj.h
index e9a5806..d247cf8 100644 (file)
@@ -150,7 +150,6 @@ struct sigaction {
 #undef  HAVE_SETSID
 #undef  HAVE_FPATHCONF
 #define HAVE_SELECT 1
-#define HAVE_MKTIME 1
 #undef  HAVE_EUIDACCESS
 #define HAVE_GETPAGESIZE 1
 #define HAVE_TZSET 1