aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-02-26 00:03:36 +0100
committerJoakim Verona2013-02-26 00:03:36 +0100
commit6f75e5103f0b1d6395fb5b0fea2a4a9c9f4601f7 (patch)
tree44f49e30237e3a897287c8b05c807c3212e464da
parent1b907e3f10d78d2bc58e2c8fd707d29b44498865 (diff)
parentd9bb0d4811696c94affc751a2de1906d3b54baf9 (diff)
downloademacs-6f75e5103f0b1d6395fb5b0fea2a4a9c9f4601f7.tar.gz
emacs-6f75e5103f0b1d6395fb5b0fea2a4a9c9f4601f7.zip
auto upstream
-rw-r--r--ChangeLog9
-rw-r--r--admin/CPP-DEFINES2
-rw-r--r--admin/ChangeLog5
-rw-r--r--autogen/Makefile.in5
-rw-r--r--autogen/config.in10
-rwxr-xr-xautogen/configure284
-rw-r--r--configure.ac219
-rw-r--r--doc/emacs/ChangeLog5
-rw-r--r--doc/emacs/files.texi24
-rw-r--r--etc/ChangeLog8
-rw-r--r--etc/NEWS10
-rw-r--r--etc/PROBLEMS35
-rw-r--r--lisp/ChangeLog18
-rw-r--r--lisp/emacs-lisp/bytecomp.el2
-rw-r--r--lisp/files.el39
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/mml2015.el2
-rw-r--r--lisp/replace.el59
-rw-r--r--nt/ChangeLog6
-rw-r--r--nt/config.nt2
-rw-r--r--nt/inc/ms-w32.h12
-rw-r--r--src/ChangeLog76
-rw-r--r--src/Makefile.in34
-rw-r--r--src/autodeps.mk1
-rw-r--r--src/callint.c4
-rw-r--r--src/deps.mk2
-rw-r--r--src/emacs.c26
-rw-r--r--src/eval.c2
-rw-r--r--src/filelock.c113
-rw-r--r--src/makefile.w32-in2
-rw-r--r--src/mem-limits.h43
-rw-r--r--src/pre-crt0.c10
-rw-r--r--src/textprop.c125
-rw-r--r--src/unexaix.c2
-rw-r--r--src/unexcoff.c4
-rw-r--r--src/vm-limit.c103
-rw-r--r--src/w32.c11
-rw-r--r--src/w32proc.c32
-rw-r--r--test/automated/python-tests.el4
39 files changed, 553 insertions, 802 deletions
diff --git a/ChangeLog b/ChangeLog
index 711971a61ad..5b289f27ef1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
12013-02-25 Paul Eggert <eggert@cs.ucla.edu>
2
3 Simplify data_start configuration (Bug#13783).
4 * configure.ac (CRT_DIR, LIB_STANDARD, START_FILES, DATA_START)
5 (LD_FIRSTFLAG, ORDINARY_LINK, LIB_GCC): Remove.
6 (AC_CHECK_HEADERS_ONCE): Remove sys/resource.h, as it's
7 not always needed.
8 (HAVE_DATA_START): New macro.
9
12013-02-18 Aidan Gauland <aidalgol@no8wireless.co.nz> 102013-02-18 Aidan Gauland <aidalgol@no8wireless.co.nz>
2 11
3 * lisp/eshell/em-cmpl.el: Corrected "context-related help" 12 * lisp/eshell/em-cmpl.el: Corrected "context-related help"
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 393cf56e993..da8dec5a0f6 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -90,7 +90,6 @@ BROKEN_NON_BLOCKING_CONNECT
90BROKEN_PTY_READ_AFTER_EAGAIN 90BROKEN_PTY_READ_AFTER_EAGAIN
91CLASH_DETECTION 91CLASH_DETECTION
92DATA_SEG_BITS 92DATA_SEG_BITS
93DATA_START
94DEFAULT_SOUND_DEVICE 93DEFAULT_SOUND_DEVICE
95DEVICE_SEP 94DEVICE_SEP
96DIRECTORY_SEP 95DIRECTORY_SEP
@@ -408,7 +407,6 @@ NO_EDITRES
408NSIG 407NSIG
409NSIG_MINIMUM 408NSIG_MINIMUM
410NULL_DEVICE 409NULL_DEVICE
411ORDINARY_LINK
412PAGESIZE 410PAGESIZE
413PREFER_VSUSP 411PREFER_VSUSP
414PTY_ITERATION 412PTY_ITERATION
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 7e72e10cd9f..28e25ad98a3 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,8 @@
12013-02-25 Paul Eggert <eggert@cs.ucla.edu>
2
3 Simplify data_start configuration (Bug#13783).
4 * CPP-DEFINES (DATA_START, ORDINARY_LINK): Remove.
5
12013-02-11 Paul Eggert <eggert@cs.ucla.edu> 62013-02-11 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Tune by using memchr and memrchr. 8 Tune by using memchr and memrchr.
diff --git a/autogen/Makefile.in b/autogen/Makefile.in
index 65d3880c027..eadb1ab8c22 100644
--- a/autogen/Makefile.in
+++ b/autogen/Makefile.in
@@ -174,7 +174,6 @@ CFLAGS_SOUND = @CFLAGS_SOUND@
174COM_ERRLIB = @COM_ERRLIB@ 174COM_ERRLIB = @COM_ERRLIB@
175CPP = @CPP@ 175CPP = @CPP@
176CPPFLAGS = @CPPFLAGS@ 176CPPFLAGS = @CPPFLAGS@
177CRT_DIR = @CRT_DIR@
178CRYPTOLIB = @CRYPTOLIB@ 177CRYPTOLIB = @CRYPTOLIB@
179CYGPATH_W = @CYGPATH_W@ 178CYGPATH_W = @CYGPATH_W@
180CYGWIN_OBJ = @CYGWIN_OBJ@ 179CYGWIN_OBJ = @CYGWIN_OBJ@
@@ -619,7 +618,6 @@ INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@
619KRB4LIB = @KRB4LIB@ 618KRB4LIB = @KRB4LIB@
620KRB5LIB = @KRB5LIB@ 619KRB5LIB = @KRB5LIB@
621LDFLAGS = @LDFLAGS@ 620LDFLAGS = @LDFLAGS@
622LD_FIRSTFLAG = @LD_FIRSTFLAG@
623LD_SWITCH_SYSTEM = @LD_SWITCH_SYSTEM@ 621LD_SWITCH_SYSTEM = @LD_SWITCH_SYSTEM@
624LD_SWITCH_SYSTEM_TEMACS = @LD_SWITCH_SYSTEM_TEMACS@ 622LD_SWITCH_SYSTEM_TEMACS = @LD_SWITCH_SYSTEM_TEMACS@
625LD_SWITCH_X_SITE = @LD_SWITCH_X_SITE@ 623LD_SWITCH_X_SITE = @LD_SWITCH_X_SITE@
@@ -659,11 +657,9 @@ LIBX_OTHER = @LIBX_OTHER@
659LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ 657LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
660LIB_EACCESS = @LIB_EACCESS@ 658LIB_EACCESS = @LIB_EACCESS@
661LIB_EXECINFO = @LIB_EXECINFO@ 659LIB_EXECINFO = @LIB_EXECINFO@
662LIB_GCC = @LIB_GCC@
663LIB_MATH = @LIB_MATH@ 660LIB_MATH = @LIB_MATH@
664LIB_PTHREAD = @LIB_PTHREAD@ 661LIB_PTHREAD = @LIB_PTHREAD@
665LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ 662LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
666LIB_STANDARD = @LIB_STANDARD@
667LIB_TIMER_TIME = @LIB_TIMER_TIME@ 663LIB_TIMER_TIME = @LIB_TIMER_TIME@
668LN_S = @LN_S@ 664LN_S = @LN_S@
669LTLIBINTL = @LTLIBINTL@ 665LTLIBINTL = @LTLIBINTL@
@@ -858,7 +854,6 @@ SET_MAKE = @SET_MAKE@
858SHELL = @SHELL@ 854SHELL = @SHELL@
859SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ 855SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
860SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ 856SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
861START_FILES = @START_FILES@
862STDALIGN_H = @STDALIGN_H@ 857STDALIGN_H = @STDALIGN_H@
863STDARG_H = @STDARG_H@ 858STDARG_H = @STDARG_H@
864STDBOOL_H = @STDBOOL_H@ 859STDBOOL_H = @STDBOOL_H@
diff --git a/autogen/config.in b/autogen/config.in
index 0492fc20110..10cc3c68196 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -93,9 +93,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
93/* Extra bits to be or'd in with any pointers stored in a Lisp_Object. */ 93/* Extra bits to be or'd in with any pointers stored in a Lisp_Object. */
94#undef DATA_SEG_BITS 94#undef DATA_SEG_BITS
95 95
96/* Address of the start of the data segment. */
97#undef DATA_START
98
99/* Name of the default sound device. */ 96/* Name of the default sound device. */
100#undef DEFAULT_SOUND_DEVICE 97#undef DEFAULT_SOUND_DEVICE
101 98
@@ -259,6 +256,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
259/* Define to 1 if you have the `copysign' function. */ 256/* Define to 1 if you have the `copysign' function. */
260#undef HAVE_COPYSIGN 257#undef HAVE_COPYSIGN
261 258
259/* Define to 1 if data_start is the address of the start of the main data
260 segment. */
261#undef HAVE_DATA_START
262
262/* Define to 1 if using D-Bus. */ 263/* Define to 1 if using D-Bus. */
263#undef HAVE_DBUS 264#undef HAVE_DBUS
264 265
@@ -1227,9 +1228,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1227/* Define to 1 if the nlist n_name member is a pointer */ 1228/* Define to 1 if the nlist n_name member is a pointer */
1228#undef N_NAME_POINTER 1229#undef N_NAME_POINTER
1229 1230
1230/* Define if the C compiler is the linker. */
1231#undef ORDINARY_LINK
1232
1233/* Name of package */ 1231/* Name of package */
1234#undef PACKAGE 1232#undef PACKAGE
1235 1233
diff --git a/autogen/configure b/autogen/configure
index 0ba98637fa4..8f5ee260426 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -605,8 +605,6 @@ LTLIBOBJS
605LIBOBJS 605LIBOBJS
606SUBDIR_MAKEFILES_IN 606SUBDIR_MAKEFILES_IN
607WINDOW_SYSTEM_OBJ 607WINDOW_SYSTEM_OBJ
608LIB_GCC
609LD_FIRSTFLAG
610LD_SWITCH_SYSTEM_TEMACS 608LD_SWITCH_SYSTEM_TEMACS
611LIBGNU_LTLIBDEPS 609LIBGNU_LTLIBDEPS
612LIBGNU_LIBDEPS 610LIBGNU_LIBDEPS
@@ -1337,7 +1335,6 @@ W32_RES
1337W32_LIBS 1335W32_LIBS
1338W32_OBJ 1336W32_OBJ
1339WINDRES 1337WINDRES
1340LIB_STANDARD
1341NS_OBJC_OBJ 1338NS_OBJC_OBJ
1342NS_OBJ 1339NS_OBJ
1343ns_self_contained 1340ns_self_contained
@@ -1352,8 +1349,6 @@ ALSA_LIBS
1352ALSA_CFLAGS 1349ALSA_CFLAGS
1353LIBSOUND 1350LIBSOUND
1354PKG_CONFIG 1351PKG_CONFIG
1355CRT_DIR
1356START_FILES
1357LIB_MATH 1352LIB_MATH
1358LIBS_SYSTEM 1353LIBS_SYSTEM
1359C_SWITCH_SYSTEM 1354C_SWITCH_SYSTEM
@@ -1507,7 +1502,6 @@ with_inotify
1507with_makeinfo 1502with_makeinfo
1508with_compress_info 1503with_compress_info
1509with_pkg_config_prog 1504with_pkg_config_prog
1510with_crt_dir
1511with_gameuser 1505with_gameuser
1512with_gnustep_conf 1506with_gnustep_conf
1513enable_ns_self_contained 1507enable_ns_self_contained
@@ -2236,8 +2230,6 @@ Optional Packages:
2236 --without-compress-info don't compress the installed Info pages 2230 --without-compress-info don't compress the installed Info pages
2237 --with-pkg-config-prog=FILENAME 2231 --with-pkg-config-prog=FILENAME
2238 file name of pkg-config for finding GTK and librsvg 2232 file name of pkg-config for finding GTK and librsvg
2239 --with-crt-dir=DIR directory containing crtn.o etc. The default is
2240 /usr/lib, or /usr/lib64 on some platforms.
2241 --with-gameuser=USER user for shared game score files 2233 --with-gameuser=USER user for shared game score files
2242 --with-gnustep-conf=FILENAME 2234 --with-gnustep-conf=FILENAME
2243 name of GNUstep.conf; default $GNUSTEP_CONFIG_FILE, 2235 name of GNUstep.conf; default $GNUSTEP_CONFIG_FILE,
@@ -3326,7 +3318,6 @@ as_fn_append ac_header_list " linux/version.h"
3326as_fn_append ac_header_list " sys/systeminfo.h" 3318as_fn_append ac_header_list " sys/systeminfo.h"
3327as_fn_append ac_header_list " coff.h" 3319as_fn_append ac_header_list " coff.h"
3328as_fn_append ac_header_list " pty.h" 3320as_fn_append ac_header_list " pty.h"
3329as_fn_append ac_header_list " sys/vlimit.h"
3330as_fn_append ac_header_list " sys/resource.h" 3321as_fn_append ac_header_list " sys/resource.h"
3331as_fn_append ac_header_list " sys/utsname.h" 3322as_fn_append ac_header_list " sys/utsname.h"
3332as_fn_append ac_header_list " pwd.h" 3323as_fn_append ac_header_list " pwd.h"
@@ -4368,15 +4359,6 @@ if test "X${with_pkg_config_prog}" != X; then
4368 fi 4359 fi
4369fi 4360fi
4370 4361
4371CRT_DIR=
4372
4373# Check whether --with-crt-dir was given.
4374if test "${with_crt_dir+set}" = set; then :
4375 withval=$with_crt_dir;
4376fi
4377
4378CRT_DIR="${with_crt_dir}"
4379
4380 4362
4381# Check whether --with-gameuser was given. 4363# Check whether --with-gameuser was given.
4382if test "${with_gameuser+set}" = set; then : 4364if test "${with_gameuser+set}" = set; then :
@@ -8571,36 +8553,24 @@ fi
8571 8553
8572 8554
8573LIB_MATH=-lm 8555LIB_MATH=-lm
8574LIB_STANDARD=
8575START_FILES=
8576SYSTEM_TYPE=`echo $opsys | sed -e 's/[0-9].*//' -e 's|-|/|'` 8556SYSTEM_TYPE=`echo $opsys | sed -e 's/[0-9].*//' -e 's|-|/|'`
8577 8557
8578case $opsys in 8558case $opsys in
8579 cygwin ) 8559 cygwin )
8580 LIB_MATH= 8560 LIB_MATH=
8581 START_FILES='pre-crt0.o'
8582 ;; 8561 ;;
8583 darwin ) 8562 darwin )
8584 ## Adding -lm confuses the dynamic linker, so omit it. 8563 ## Adding -lm confuses the dynamic linker, so omit it.
8585 LIB_MATH= 8564 LIB_MATH=
8586 START_FILES='pre-crt0.o'
8587 ;; 8565 ;;
8588 freebsd ) 8566 freebsd )
8589 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
8590 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
8591 SYSTEM_TYPE=berkeley-unix 8567 SYSTEM_TYPE=berkeley-unix
8592 ;; 8568 ;;
8593 gnu-linux | gnu-kfreebsd ) 8569 gnu-linux | gnu-kfreebsd )
8594 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
8595 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
8596 ;; 8570 ;;
8597 hpux10-20 | hpux11 ) 8571 hpux10-20 | hpux11 )
8598 LIB_STANDARD=-lc
8599 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
8600 ;; 8572 ;;
8601 netbsd | openbsd ) 8573 netbsd | openbsd )
8602 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
8603 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
8604 SYSTEM_TYPE=berkeley-unix 8574 SYSTEM_TYPE=berkeley-unix
8605 ;; 8575 ;;
8606 8576
@@ -8612,117 +8582,11 @@ esac
8612 8582
8613 8583
8614 8584
8615
8616cat >>confdefs.h <<_ACEOF 8585cat >>confdefs.h <<_ACEOF
8617#define SYSTEM_TYPE "$SYSTEM_TYPE" 8586#define SYSTEM_TYPE "$SYSTEM_TYPE"
8618_ACEOF 8587_ACEOF
8619 8588
8620 8589
8621crt_files=
8622
8623for file in x $LIB_STANDARD $START_FILES; do
8624 case "$file" in
8625 *CRT_DIR*) crt_files="$crt_files `echo $file | sed -e 's|.*/||'`" ;;
8626 esac
8627done
8628
8629if test "x$crt_files" != x; then
8630
8631 ## If user specified a crt-dir, use that unconditionally.
8632 crt_gcc=no
8633
8634 if test "X$CRT_DIR" = "X"; then
8635
8636 CRT_DIR=/usr/lib # default
8637
8638 case "$canonical" in
8639 x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
8640 ## On x86-64 and s390x GNU/Linux distributions, the standard library
8641 ## can be in a variety of places. We only try /usr/lib64 and /usr/lib.
8642 ## For anything else (eg /usr/lib32), it is up the user to specify
8643 ## the location (bug#5655).
8644 ## Test for crtn.o, not just the directory, because sometimes the
8645 ## directory exists but does not have the relevant files (bug#1287).
8646 ## FIXME better to test for binary compatibility somehow.
8647 test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
8648 ;;
8649
8650 powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
8651 esac
8652
8653 case "$opsys" in
8654 hpux10-20) CRT_DIR=/lib ;;
8655 esac
8656
8657 test "x${GCC}" = xyes && crt_gcc=yes
8658
8659 fi # CRT_DIR = ""
8660
8661 crt_missing=
8662
8663 for file in $crt_files; do
8664
8665 ## If we're using gcc, try to determine it automatically by asking
8666 ## gcc. [If this doesn't work, CRT_DIR will remain at the
8667 ## system-dependent default from above.]
8668 if test $crt_gcc = yes && test ! -e $CRT_DIR/$file; then
8669
8670 crt_file=`$CC --print-file-name=$file 2>/dev/null`
8671 case "$crt_file" in
8672 */*)
8673 CRT_DIR=`$as_dirname -- "$crt_file" ||
8674$as_expr X"$crt_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
8675 X"$crt_file" : 'X\(//\)[^/]' \| \
8676 X"$crt_file" : 'X\(//\)$' \| \
8677 X"$crt_file" : 'X\(/\)' \| . 2>/dev/null ||
8678$as_echo X"$crt_file" |
8679 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
8680 s//\1/
8681 q
8682 }
8683 /^X\(\/\/\)[^/].*/{
8684 s//\1/
8685 q
8686 }
8687 /^X\(\/\/\)$/{
8688 s//\1/
8689 q
8690 }
8691 /^X\(\/\).*/{
8692 s//\1/
8693 q
8694 }
8695 s/.*/./; q'`
8696 ;;
8697 esac
8698 fi
8699
8700 crt_gcc=no
8701
8702 test -e $CRT_DIR/$file || crt_missing="$crt_missing $file"
8703 done # $crt_files
8704
8705 test "x$crt_missing" = x || \
8706 as_fn_error "Required file(s) not found:$crt_missing
8707Try using the --with-crt-dir option." "$LINENO" 5
8708
8709fi # crt_files != ""
8710
8711
8712
8713case $opsys in
8714 netbsd | openbsd )
8715 if test -f $CRT_DIR/crti.o; then
8716
8717 test -f $CRT_DIR/crtn.o || \
8718 as_fn_error "Required file not found: crtn.o" "$LINENO" 5
8719
8720 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
8721 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
8722 fi
8723 ;;
8724esac
8725
8726 8590
8727pre_PKG_CONFIG_CFLAGS=$CFLAGS 8591pre_PKG_CONFIG_CFLAGS=$CFLAGS
8728pre_PKG_CONFIG_LIBS=$LIBS 8592pre_PKG_CONFIG_LIBS=$LIBS
@@ -8992,8 +8856,6 @@ done
8992 8856
8993 8857
8994 8858
8995
8996
8997{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if personality LINUX32 can be set" >&5 8859{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if personality LINUX32 can be set" >&5
8998$as_echo_n "checking if personality LINUX32 can be set... " >&6; } 8860$as_echo_n "checking if personality LINUX32 can be set... " >&6; }
8999cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8861cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -9719,8 +9581,6 @@ if test "${with_ns}" != no; then
9719 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" 9581 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
9720 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}" 9582 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
9721 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread" 9583 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
9722 LIB_STANDARD=
9723 START_FILES=
9724 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS" >&5 9584 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS" >&5
9725$as_echo_n "checking if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS... " >&6; } 9585$as_echo_n "checking if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS... " >&6; }
9726if test "${emacs_cv_objc_exceptions+set}" = set; then : 9586if test "${emacs_cv_objc_exceptions+set}" = set; then :
@@ -9858,7 +9718,6 @@ CPPFLAGS="$tmp_CPPFLAGS"
9858 9718
9859 9719
9860 9720
9861
9862HAVE_W32=no 9721HAVE_W32=no
9863W32_OBJ= 9722W32_OBJ=
9864W32_LIBS= 9723W32_LIBS=
@@ -10149,6 +10008,50 @@ $as_echo "#define SYSTEM_MALLOC 1" >>confdefs.h
10149else 10008else
10150 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o 10009 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
10151 VMLIMIT_OBJ=vm-limit.o 10010 VMLIMIT_OBJ=vm-limit.o
10011
10012 for ac_header in sys/vlimit.h
10013do :
10014 ac_fn_c_check_header_mongrel "$LINENO" "sys/vlimit.h" "ac_cv_header_sys_vlimit_h" "$ac_includes_default"
10015if test "x$ac_cv_header_sys_vlimit_h" = x""yes; then :
10016 cat >>confdefs.h <<_ACEOF
10017#define HAVE_SYS_VLIMIT_H 1
10018_ACEOF
10019
10020fi
10021
10022done
10023
10024 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for data_start" >&5
10025$as_echo_n "checking for data_start... " >&6; }
10026if test "${emacs_cv_data_start+set}" = set; then :
10027 $as_echo_n "(cached) " >&6
10028else
10029 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
10030/* end confdefs.h. */
10031extern char data_start[]; char ch;
10032int
10033main ()
10034{
10035return data_start == &ch;
10036 ;
10037 return 0;
10038}
10039_ACEOF
10040if ac_fn_c_try_link "$LINENO"; then :
10041 emacs_cv_data_start=yes
10042else
10043 emacs_cv_data_start=no
10044fi
10045rm -f core conftest.err conftest.$ac_objext \
10046 conftest$ac_exeext conftest.$ac_ext
10047fi
10048{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_data_start" >&5
10049$as_echo "$emacs_cv_data_start" >&6; }
10050 if test $emacs_cv_data_start = yes; then
10051
10052$as_echo "#define HAVE_DATA_START 1" >>confdefs.h
10053
10054 fi
10152fi 10055fi
10153 10056
10154 10057
@@ -15808,28 +15711,16 @@ esac
15808 15711
15809 15712
15810 15713
15811
15812case $opsys in 15714case $opsys in
15813 gnu)
15814 $as_echo "#define DATA_START ({ extern int data_start; (char *) &data_start; })" >>confdefs.h
15815
15816 ;;
15817
15818 aix*) 15715 aix*)
15819 $as_echo "#define DATA_START 0x20000000" >>confdefs.h 15716 $as_echo "#define DATA_SEG_BITS 0x20000000" >>confdefs.h
15820
15821 $as_echo "#define DATA_SEG_BITS 0x20000000" >>confdefs.h
15822 15717
15823 ;; 15718 ;;
15824 hpux*) 15719 hpux*)
15825 $as_echo "#define DATA_START 0x40000000" >>confdefs.h 15720 $as_echo "#define DATA_SEG_BITS 0x40000000" >>confdefs.h
15826
15827 $as_echo "#define DATA_SEG_BITS 0x40000000" >>confdefs.h
15828 15721
15829 ;; 15722 ;;
15830 irix6-5) 15723 irix6-5)
15831 $as_echo "#define DATA_START 0x10000000" >>confdefs.h
15832
15833 $as_echo "#define DATA_SEG_BITS 0x10000000" >>confdefs.h 15724 $as_echo "#define DATA_SEG_BITS 0x10000000" >>confdefs.h
15834 15725
15835 ;; 15726 ;;
@@ -26644,89 +26535,6 @@ esac
26644 26535
26645 26536
26646 26537
26647
26648LD_FIRSTFLAG=
26649ORDINARY_LINK=
26650case "$opsys" in
26651 ## gnu: GNU needs its own crt0.
26652 aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
26653
26654 ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
26655 ## library search parth, i.e. it won't search /usr/lib for libc and
26656 ## friends. Using -nostartfiles instead avoids this problem, and
26657 ## will also work on earlier NetBSD releases.
26658 netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
26659
26660 ## powerpc*: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
26661 ## MkLinux/LinuxPPC needs this.
26662 ## s390x-* only supports opsys = gnu-linux so it can be added here.
26663 gnu-*)
26664 case "$canonical" in
26665 powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;;
26666 esac
26667 ;;
26668esac
26669
26670
26671if test "x$ORDINARY_LINK" = "xyes"; then
26672
26673 LD_FIRSTFLAG=""
26674
26675$as_echo "#define ORDINARY_LINK 1" >>confdefs.h
26676
26677
26678## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
26679## freebsd, gnu-* not on powerpc*|s390x*.
26680elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
26681
26682 ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
26683 ## places that are difficult to figure out at make time. Fortunately,
26684 ## these same versions allow you to pass arbitrary flags on to the
26685 ## linker, so there is no reason not to use it as a linker.
26686 ##
26687 ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from
26688 ## searching for libraries in its internal directories, so we have to
26689 ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
26690 LD_FIRSTFLAG="-nostdlib"
26691fi
26692
26693## FIXME? What setting of EDIT_LDFLAGS should this have?
26694test "$NS_IMPL_GNUSTEP" = "yes" && LD_FIRSTFLAG="-rdynamic"
26695
26696
26697
26698
26699## FIXME? The logic here is not precisely the same as that above.
26700## There is no check here for a pre-defined LD_FIRSTFLAG.
26701## Should we only be setting LIB_GCC if LD ~ -nostdlib?
26702LIB_GCC=
26703if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
26704
26705 case "$opsys" in
26706 freebsd|netbsd|openbsd) LIB_GCC= ;;
26707
26708 gnu-*)
26709 ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
26710 ## build on ARM EABI under GNU/Linux. (Bug#5518)
26711 case $host_cpu in
26712 arm*)
26713 LIB_GCC="-lgcc_s"
26714 ;;
26715 *)
26716 ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
26717 ## immediately undefine it again and redefine it to empty.
26718 ## Was the C_SWITCH_X_SITE part really necessary?
26719## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
26720 LIB_GCC=
26721 ;;
26722 esac
26723 ;;
26724
26725 ## Ask GCC where to find libgcc.a.
26726 *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
26727 esac
26728fi
26729
26730## Common for all window systems 26538## Common for all window systems
26731if test "$window_system" != "none"; then 26539if test "$window_system" != "none"; then
26732 26540
diff --git a/configure.ac b/configure.ac
index 146166fbe45..26388eeffa4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,12 +232,6 @@ if test "X${with_pkg_config_prog}" != X; then
232 fi 232 fi
233fi 233fi
234 234
235CRT_DIR=
236AC_ARG_WITH([crt-dir],dnl
237[AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
238The default is /usr/lib, or /usr/lib64 on some platforms.])])
239CRT_DIR="${with_crt_dir}"
240
241AC_ARG_WITH(gameuser,dnl 235AC_ARG_WITH(gameuser,dnl
242[AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])]) 236[AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])])
243test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \ 237test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \
@@ -1053,42 +1047,29 @@ AC_DEFUN([AC_TYPE_UID_T])
1053 1047
1054 1048
1055LIB_MATH=-lm 1049LIB_MATH=-lm
1056LIB_STANDARD=
1057START_FILES=
1058dnl Current possibilities handled by sed (aix4-2 -> aix, 1050dnl Current possibilities handled by sed (aix4-2 -> aix,
1059dnl gnu-linux -> gnu/linux, etc.): 1051dnl gnu-linux -> gnu/linux, etc.):
1060dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix. 1052dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix.
1061dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt. 1053dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
1062SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'` 1054SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
1063 1055
1064dnl NB do not use CRT_DIR unquoted here, since it might not be set yet.
1065case $opsys in 1056case $opsys in
1066 cygwin ) 1057 cygwin )
1067 LIB_MATH= 1058 LIB_MATH=
1068 START_FILES='pre-crt0.o'
1069 ;; 1059 ;;
1070 darwin ) 1060 darwin )
1071 ## Adding -lm confuses the dynamic linker, so omit it. 1061 ## Adding -lm confuses the dynamic linker, so omit it.
1072 LIB_MATH= 1062 LIB_MATH=
1073 START_FILES='pre-crt0.o'
1074 ;; 1063 ;;
1075 freebsd ) 1064 freebsd )
1076 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
1077 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
1078 SYSTEM_TYPE=berkeley-unix 1065 SYSTEM_TYPE=berkeley-unix
1079 ;; 1066 ;;
1080 gnu-linux | gnu-kfreebsd ) 1067 gnu-linux | gnu-kfreebsd )
1081 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
1082 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
1083 ;; 1068 ;;
1084 hpux10-20 | hpux11 ) 1069 hpux10-20 | hpux11 )
1085 LIB_STANDARD=-lc
1086 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
1087 ;; 1070 ;;
1088 dnl NB this may be adjusted below. 1071 dnl NB this may be adjusted below.
1089 netbsd | openbsd ) 1072 netbsd | openbsd )
1090 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
1091 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
1092 SYSTEM_TYPE=berkeley-unix 1073 SYSTEM_TYPE=berkeley-unix
1093 ;; 1074 ;;
1094 1075
@@ -1099,96 +1080,9 @@ case $opsys in
1099esac 1080esac
1100 1081
1101AC_SUBST(LIB_MATH) 1082AC_SUBST(LIB_MATH)
1102AC_SUBST(START_FILES)
1103AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE", 1083AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
1104 [The type of system you are compiling for; sets `system-type'.]) 1084 [The type of system you are compiling for; sets `system-type'.])
1105 1085
1106dnl Not all platforms use crtn.o files. Check if the current one does.
1107crt_files=
1108
1109for file in x $LIB_STANDARD $START_FILES; do
1110 case "$file" in
1111 *CRT_DIR*) crt_files="$crt_files `echo $file | sed -e 's|.*/||'`" ;;
1112 esac
1113done
1114
1115if test "x$crt_files" != x; then
1116
1117 ## If user specified a crt-dir, use that unconditionally.
1118 crt_gcc=no
1119
1120 if test "X$CRT_DIR" = "X"; then
1121
1122 CRT_DIR=/usr/lib # default
1123
1124 case "$canonical" in
1125 x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
1126 ## On x86-64 and s390x GNU/Linux distributions, the standard library
1127 ## can be in a variety of places. We only try /usr/lib64 and /usr/lib.
1128 ## For anything else (eg /usr/lib32), it is up the user to specify
1129 ## the location (bug#5655).
1130 ## Test for crtn.o, not just the directory, because sometimes the
1131 ## directory exists but does not have the relevant files (bug#1287).
1132 ## FIXME better to test for binary compatibility somehow.
1133 test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
1134 ;;
1135
1136 powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
1137 esac
1138
1139 case "$opsys" in
1140 hpux10-20) CRT_DIR=/lib ;;
1141 esac
1142
1143 test "x${GCC}" = xyes && crt_gcc=yes
1144
1145 fi # CRT_DIR = ""
1146
1147 crt_missing=
1148
1149 for file in $crt_files; do
1150
1151 ## If we're using gcc, try to determine it automatically by asking
1152 ## gcc. [If this doesn't work, CRT_DIR will remain at the
1153 ## system-dependent default from above.]
1154 if test $crt_gcc = yes && test ! -e $CRT_DIR/$file; then
1155
1156 crt_file=`$CC --print-file-name=$file 2>/dev/null`
1157 case "$crt_file" in
1158 */*)
1159 CRT_DIR=`AS_DIRNAME(["$crt_file"])`
1160 ;;
1161 esac
1162 fi
1163
1164 dnl We expect all the files to be in a single directory, so after the
1165 dnl first there is no point asking gcc.
1166 crt_gcc=no
1167
1168 test -e $CRT_DIR/$file || crt_missing="$crt_missing $file"
1169 done # $crt_files
1170
1171 test "x$crt_missing" = x || \
1172 AC_MSG_ERROR([Required file(s) not found:$crt_missing
1173Try using the --with-crt-dir option.])
1174
1175fi # crt_files != ""
1176
1177AC_SUBST(CRT_DIR)
1178
1179case $opsys in
1180 netbsd | openbsd )
1181 if test -f $CRT_DIR/crti.o; then
1182
1183 test -f $CRT_DIR/crtn.o || \
1184 AC_MSG_ERROR([Required file not found: crtn.o])
1185
1186 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
1187 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
1188 fi
1189 ;;
1190esac
1191
1192 1086
1193pre_PKG_CONFIG_CFLAGS=$CFLAGS 1087pre_PKG_CONFIG_CFLAGS=$CFLAGS
1194pre_PKG_CONFIG_LIBS=$LIBS 1088pre_PKG_CONFIG_LIBS=$LIBS
@@ -1306,7 +1200,7 @@ dnl checks for header files
1306AC_CHECK_HEADERS_ONCE( 1200AC_CHECK_HEADERS_ONCE(
1307 linux/version.h sys/systeminfo.h 1201 linux/version.h sys/systeminfo.h
1308 coff.h pty.h 1202 coff.h pty.h
1309 sys/vlimit.h sys/resource.h 1203 sys/resource.h
1310 sys/utsname.h pwd.h utmp.h util.h) 1204 sys/utsname.h pwd.h utmp.h util.h)
1311 1205
1312AC_MSG_CHECKING(if personality LINUX32 can be set) 1206AC_MSG_CHECKING(if personality LINUX32 can be set)
@@ -1523,8 +1417,6 @@ if test "${with_ns}" != no; then
1523 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}" 1417 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1524 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}" 1418 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
1525 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread" 1419 LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
1526 LIB_STANDARD=
1527 START_FILES=
1528 dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1. 1420 dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
1529 dnl If they had chosen to either define it or not, we could have 1421 dnl If they had chosen to either define it or not, we could have
1530 dnl just used AC_CHECK_DECL here. 1422 dnl just used AC_CHECK_DECL here.
@@ -1613,7 +1505,6 @@ AC_SUBST(INSTALL_ARCH_INDEP_EXTRA)
1613AC_SUBST(ns_self_contained) 1505AC_SUBST(ns_self_contained)
1614AC_SUBST(NS_OBJ) 1506AC_SUBST(NS_OBJ)
1615AC_SUBST(NS_OBJC_OBJ) 1507AC_SUBST(NS_OBJC_OBJ)
1616AC_SUBST(LIB_STANDARD)
1617 1508
1618HAVE_W32=no 1509HAVE_W32=no
1619W32_OBJ= 1510W32_OBJ=
@@ -1753,6 +1644,20 @@ if test "${system_malloc}" = "yes"; then
1753else 1644else
1754 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o 1645 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
1755 VMLIMIT_OBJ=vm-limit.o 1646 VMLIMIT_OBJ=vm-limit.o
1647
1648 AC_CHECK_HEADERS([sys/vlimit.h])
1649 AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
1650 [AC_LINK_IFELSE(
1651 [AC_LANG_PROGRAM(
1652 [[extern char data_start[]; char ch;]],
1653 [[return data_start == &ch;]])],
1654 [emacs_cv_data_start=yes],
1655 [emacs_cv_data_start=no])])
1656 if test $emacs_cv_data_start = yes; then
1657 AC_DEFINE([HAVE_DATA_START], 1,
1658 [Define to 1 if data_start is the address of the start
1659 of the main data segment.])
1660 fi
1756fi 1661fi
1757AC_SUBST(GMALLOC_OBJ) 1662AC_SUBST(GMALLOC_OBJ)
1758AC_SUBST(VMLIMIT_OBJ) 1663AC_SUBST(VMLIMIT_OBJ)
@@ -3796,9 +3701,7 @@ case $opsys in
3796esac 3701esac
3797 3702
3798 3703
3799dnl Used in vm-limit.c 3704dnl Used in lisp.h, emacs.c, vm-limit.c
3800AH_TEMPLATE(DATA_START, [Address of the start of the data segment.])
3801dnl Used in lisp.h, emacs.c, mem-limits.h
3802dnl NEWS.18 describes this as "a number which contains 3705dnl NEWS.18 describes this as "a number which contains
3803dnl the high bits to be inclusive or'ed with pointers that are unpacked." 3706dnl the high bits to be inclusive or'ed with pointers that are unpacked."
3804AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers 3707AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers
@@ -3806,23 +3709,15 @@ stored in a Lisp_Object.])
3806dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT. 3709dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT.
3807 3710
3808case $opsys in 3711case $opsys in
3809 gnu)
3810 dnl libc defines data_start.
3811 AC_DEFINE(DATA_START, [({ extern int data_start; (char *) &data_start; })])
3812 ;;
3813
3814 aix*) 3712 aix*)
3815 dnl This works with 32-bit executables; Emacs doesn't support 64-bit. 3713 dnl This works with 32-bit executables; Emacs doesn't support 64-bit.
3816 AC_DEFINE(DATA_START, [0x20000000])
3817 AC_DEFINE(DATA_SEG_BITS, [0x20000000]) 3714 AC_DEFINE(DATA_SEG_BITS, [0x20000000])
3818 ;; 3715 ;;
3819 hpux*) 3716 hpux*)
3820 dnl The data segment on this machine always starts at address 0x40000000. 3717 dnl The data segment on this machine always starts at address 0x40000000.
3821 AC_DEFINE(DATA_START, [0x40000000])
3822 AC_DEFINE(DATA_SEG_BITS, [0x40000000]) 3718 AC_DEFINE(DATA_SEG_BITS, [0x40000000])
3823 ;; 3719 ;;
3824 irix6-5) 3720 irix6-5)
3825 AC_DEFINE(DATA_START, [0x10000000])
3826 AC_DEFINE(DATA_SEG_BITS, [0x10000000]) 3721 AC_DEFINE(DATA_SEG_BITS, [0x10000000])
3827 ;; 3722 ;;
3828esac 3723esac
@@ -4382,88 +4277,6 @@ esac
4382 4277
4383AC_SUBST(LD_SWITCH_SYSTEM_TEMACS) 4278AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
4384 4279
4385
4386LD_FIRSTFLAG=
4387ORDINARY_LINK=
4388case "$opsys" in
4389 ## gnu: GNU needs its own crt0.
4390 aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
4391
4392 ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
4393 ## library search parth, i.e. it won't search /usr/lib for libc and
4394 ## friends. Using -nostartfiles instead avoids this problem, and
4395 ## will also work on earlier NetBSD releases.
4396 netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
4397
4398 ## powerpc*: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
4399 ## MkLinux/LinuxPPC needs this.
4400 ## s390x-* only supports opsys = gnu-linux so it can be added here.
4401 gnu-*)
4402 case "$canonical" in
4403 powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;;
4404 esac
4405 ;;
4406esac
4407
4408
4409if test "x$ORDINARY_LINK" = "xyes"; then
4410
4411 LD_FIRSTFLAG=""
4412 AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
4413
4414## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
4415## freebsd, gnu-* not on powerpc*|s390x*.
4416elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
4417
4418 ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
4419 ## places that are difficult to figure out at make time. Fortunately,
4420 ## these same versions allow you to pass arbitrary flags on to the
4421 ## linker, so there is no reason not to use it as a linker.
4422 ##
4423 ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from
4424 ## searching for libraries in its internal directories, so we have to
4425 ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
4426 LD_FIRSTFLAG="-nostdlib"
4427fi
4428
4429## FIXME? What setting of EDIT_LDFLAGS should this have?
4430test "$NS_IMPL_GNUSTEP" = "yes" && LD_FIRSTFLAG="-rdynamic"
4431
4432AC_SUBST(LD_FIRSTFLAG)
4433
4434
4435## FIXME? The logic here is not precisely the same as that above.
4436## There is no check here for a pre-defined LD_FIRSTFLAG.
4437## Should we only be setting LIB_GCC if LD ~ -nostdlib?
4438LIB_GCC=
4439if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
4440
4441 case "$opsys" in
4442 freebsd|netbsd|openbsd) LIB_GCC= ;;
4443
4444 gnu-*)
4445 ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
4446 ## build on ARM EABI under GNU/Linux. (Bug#5518)
4447 case $host_cpu in
4448 arm*)
4449 LIB_GCC="-lgcc_s"
4450 ;;
4451 *)
4452 ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
4453 ## immediately undefine it again and redefine it to empty.
4454 ## Was the C_SWITCH_X_SITE part really necessary?
4455## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
4456 LIB_GCC=
4457 ;;
4458 esac
4459 ;;
4460
4461 ## Ask GCC where to find libgcc.a.
4462 *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
4463 esac
4464fi dnl if $GCC
4465AC_SUBST(LIB_GCC)
4466
4467## Common for all window systems 4280## Common for all window systems
4468if test "$window_system" != "none"; then 4281if test "$window_system" != "none"; then
4469 AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.]) 4282 AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 33f530cbadc..44245441791 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
12013-02-25 Eli Zaretskii <eliz@gnu.org>
2
3 * files.texi (Interlocking): Don't refer to symlinks as the
4 exclusive means of locking files.
5
12013-02-22 Glenn Morris <rgm@gnu.org> 62013-02-22 Glenn Morris <rgm@gnu.org>
2 7
3 * ack.texi (Acknowledgments): 8 * ack.texi (Acknowledgments):
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 7f7ae483cd5..1f78747eaa6 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -734,10 +734,10 @@ file.
734@cindex locking files 734@cindex locking files
735 When you make the first modification in an Emacs buffer that is 735 When you make the first modification in an Emacs buffer that is
736visiting a file, Emacs records that the file is @dfn{locked} by you. 736visiting a file, Emacs records that the file is @dfn{locked} by you.
737(It does this by creating a specially-named symbolic link in the same 737(It does this by creating a specially-named symbolic link or regular
738directory.) Emacs removes the lock when you save the changes. The 738file with special contents in the same directory.) Emacs removes the
739idea is that the file is locked whenever an Emacs buffer visiting it 739lock when you save the changes. The idea is that the file is locked
740has unsaved changes. 740whenever an Emacs buffer visiting it has unsaved changes.
741 741
742@vindex create-lockfiles 742@vindex create-lockfiles
743 You can prevent the creation of lock files by setting the variable 743 You can prevent the creation of lock files by setting the variable
@@ -774,14 +774,14 @@ multiple names, Emacs does not prevent two users from editing it
774simultaneously under different names. 774simultaneously under different names.
775 775
776 A lock file cannot be written in some circumstances, e.g., if Emacs 776 A lock file cannot be written in some circumstances, e.g., if Emacs
777lacks the system permissions or the system does not support symbolic 777lacks the system permissions or cannot create lock files for some
778links. In these cases, Emacs can still detect the collision when you 778other reason. In these cases, Emacs can still detect the collision
779try to save a file, by checking the file's last-modification date. If 779when you try to save a file, by checking the file's last-modification
780the file has changed since the last time Emacs visited or saved it, 780date. If the file has changed since the last time Emacs visited or
781that implies that changes have been made in some other way, and will 781saved it, that implies that changes have been made in some other way,
782be lost if Emacs proceeds with saving. Emacs then displays a warning 782and will be lost if Emacs proceeds with saving. Emacs then displays a
783message and asks for confirmation before saving; answer @kbd{yes} to 783warning message and asks for confirmation before saving; answer
784save, and @kbd{no} or @kbd{C-g} cancel the save. 784@kbd{yes} to save, and @kbd{no} or @kbd{C-g} cancel the save.
785 785
786 If you are notified that simultaneous editing has already taken 786 If you are notified that simultaneous editing has already taken
787place, one way to compare the buffer to its file is the @kbd{M-x 787place, one way to compare the buffer to its file is the @kbd{M-x
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 2e0eb2d7056..e50d288da1c 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,11 @@
12013-02-25 Paul Eggert <eggert@cs.ucla.edu>
2
3 Simplify data_start configuration (Bug#13783).
4 * NEWS: Document removal of --with-crt-dir.
5 * PROBLEMS (LIBS_SYSTEM, LIBS_MACHINE, LIBS_STANDARD): Remove.
6 Remove legacy-systems section, as this stuff is no longer
7 applicable with current linking strategies.
8
12013-02-14 Michael Albinus <michael.albinus@gmx.de> 92013-02-14 Michael Albinus <michael.albinus@gmx.de>
2 10
3 * NEWS: Tramp methods "scpc" and "rsyncc" are discontinued. 11 * NEWS: Tramp methods "scpc" and "rsyncc" are discontinued.
diff --git a/etc/NEWS b/etc/NEWS
index d6691ffed8f..7d1110d5dc6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -28,6 +28,9 @@ This happens by default if a suitable support library is found at
28build time, like libacl on GNU/Linux. To prevent this, use the 28build time, like libacl on GNU/Linux. To prevent this, use the
29configure option `--without-acl'. 29configure option `--without-acl'.
30 30
31** The configure option --with-crt-dir has been removed.
32It is no longer needed, as the crt*.o files are no longer linked specially.
33
31 34
32* Startup Changes in Emacs 24.4 35* Startup Changes in Emacs 24.4
33 36
@@ -345,6 +348,13 @@ Setting it has no effect, and %t in the mode-line format is ignored.
345Likewise, `file-name-buffer-file-type-alist' is now obsolete, and 348Likewise, `file-name-buffer-file-type-alist' is now obsolete, and
346modifying it has no effect. 349modifying it has no effect.
347 350
351---
352** Lock files now work on MS-Windows.
353This allows to avoid losing your edits if the same file is being
354edited in another Emacs session or by another user. See the node
355"Interlocking" in the Emacs User Manual for the details. To disable
356file locking, customize `create-lockfiles' to nil.
357
348** Improved fullscreen support on Mac OS X. 358** Improved fullscreen support on Mac OS X.
349Both native (>= OSX 10.7) and "old style" fullscreen are supported. 359Both native (>= OSX 10.7) and "old style" fullscreen are supported.
350Customize `ns-use-native-fullscreen' to change style. For >= 10.7 360Customize `ns-use-native-fullscreen' to change style. For >= 10.7
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 441ad7b4df4..b38a1240540 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -432,21 +432,7 @@ The fix is to install an unshared library that corresponds to what you
432installed in the shared library, and then relink Emacs. 432installed in the shared library, and then relink Emacs.
433 433
434If you have already installed the name resolver in the file libresolv.a, 434If you have already installed the name resolver in the file libresolv.a,
435then you need to compile Emacs to use that library. The easiest way to 435then you need to compile Emacs to use that library.
436do this is to add to config.h a definition of LIBS_SYSTEM, LIBS_MACHINE
437or LIB_STANDARD which uses -lresolv. Watch out! If you redefine a macro
438that is already in use in your configuration to supply some other libraries,
439be careful not to lose the others.
440
441Thus, you could start by adding this to config.h:
442
443#define LIBS_SYSTEM -lresolv
444
445Then if this gives you an error for redefining a macro, and you see that
446config.h already defines LIBS_SYSTEM as -lfoo -lbar at some other point
447(possibly in an included file) you could change it to say this:
448
449#define LIBS_SYSTEM -lresolv -lfoo -lbar
450 436
451*** Emacs does not know your host's fully-qualified domain name. 437*** Emacs does not know your host's fully-qualified domain name.
452 438
@@ -3179,25 +3165,6 @@ as a concentrator.
3179 3165
3180This problem seems to be a matter of configuring the DECserver to use 3166This problem seems to be a matter of configuring the DECserver to use
31817 bit characters rather than 8 bit characters. 31677 bit characters rather than 8 bit characters.
3182
3183* Build problems on legacy systems
3184
3185** SunOS: Emacs gets error message from linker on Sun.
3186
3187If the error message says that a symbol such as `f68881_used' or
3188`ffpa_used' or `start_float' is undefined, this probably indicates
3189that you have compiled some libraries, such as the X libraries,
3190with a floating point option other than the default.
3191
3192It's not terribly hard to make this work with small changes in
3193crt0.c together with linking with Fcrt1.o, Wcrt1.o or Mcrt1.o.
3194However, the easiest approach is to build Xlib with the default
3195floating point option: -fsoft.
3196
3197** HPUX 10.20: Emacs crashes during dumping on the HPPA machine.
3198
3199This seems to be due to a GCC bug; it is fixed in GCC 2.8.1.
3200
3201 3168
3202This file is part of GNU Emacs. 3169This file is part of GNU Emacs.
3203 3170
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d596d4f6fb1..d6de9baa118 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,21 @@
12013-02-25 Juri Linkov <juri@jurta.org>
2
3 * replace.el (read-regexp): Let-bind `default' to the first
4 element of `defaults' if it's a list, otherwise it should be
5 a string or nil. Let-bind `suggestions' to `defaults' if it's
6 a list, otherwise make a list with the string value. Doc fix.
7 (Bug#13805)
8
92013-02-25 Eli Zaretskii <eliz@gnu.org>
10
11 * emacs-lisp/bytecomp.el (byte-recompile-directory): Reject files
12 that match "\`\.#", to avoid compiling lock files, even if they
13 are readable (as they are on MS-Windows).
14
152013-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
16
17 * files.el (basic-save-buffer): Remove redundant directory-creation.
18
12013-02-24 Jay Belanger <jay.p.belanger@gmail.com> 192013-02-24 Jay Belanger <jay.p.belanger@gmail.com>
2 20
3 * calc/calc-ext.el (math-to-radians-2, math-from-radians-2): 21 * calc/calc-ext.el (math-to-radians-2, math-from-radians-2):
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index f5861550c9a..e0837033c74 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1594,7 +1594,9 @@ that already has a `.elc' file."
1594 (setq directories (nconc directories (list source)))) 1594 (setq directories (nconc directories (list source))))
1595 ;; It is an ordinary file. Decide whether to compile it. 1595 ;; It is an ordinary file. Decide whether to compile it.
1596 (if (and (string-match emacs-lisp-file-regexp source) 1596 (if (and (string-match emacs-lisp-file-regexp source)
1597 ;; The next 2 tests avoid compiling lock files
1597 (file-readable-p source) 1598 (file-readable-p source)
1599 (not (string-match "\\`\\.#" file))
1598 (not (auto-save-file-name-p source)) 1600 (not (auto-save-file-name-p source))
1599 (not (string-equal dir-locals-file 1601 (not (string-equal dir-locals-file
1600 (file-name-nondirectory source)))) 1602 (file-name-nondirectory source))))
diff --git a/lisp/files.el b/lisp/files.el
index f9d02511839..cbc6e59c442 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4563,32 +4563,21 @@ Before and after saving the buffer, this function runs
4563 (not (file-exists-p buffer-file-name)))) 4563 (not (file-exists-p buffer-file-name))))
4564 (let ((recent-save (recent-auto-save-p)) 4564 (let ((recent-save (recent-auto-save-p))
4565 setmodes) 4565 setmodes)
4566 ;; If buffer has no file name, ask user for one. 4566 ;; If buffer has no file name, ask user for one.
4567 (or buffer-file-name 4567 (or buffer-file-name
4568 (let ((filename 4568 (let ((filename
4569 (expand-file-name 4569 (expand-file-name
4570 (read-file-name "File to save in: " 4570 (read-file-name "File to save in: "
4571 nil (expand-file-name (buffer-name)))))) 4571 nil (expand-file-name (buffer-name))))))
4572 (if (file-exists-p filename) 4572 (if (file-exists-p filename)
4573 (if (file-directory-p filename) 4573 (if (file-directory-p filename)
4574 ;; Signal an error if the user specified the name of an 4574 ;; Signal an error if the user specified the name of an
4575 ;; existing directory. 4575 ;; existing directory.
4576 (error "%s is a directory" filename) 4576 (error "%s is a directory" filename)
4577 (unless (y-or-n-p (format "File `%s' exists; overwrite? " 4577 (unless (y-or-n-p (format "File `%s' exists; overwrite? "
4578 filename)) 4578 filename))
4579 (error "Canceled"))) 4579 (error "Canceled"))))
4580 ;; Signal an error if the specified name refers to a 4580 (set-visited-file-name filename)))
4581 ;; non-existing directory.
4582 (let ((dir (file-name-directory filename)))
4583 (unless (file-directory-p dir)
4584 (if (file-exists-p dir)
4585 (error "%s is not a directory" dir)
4586 (if (y-or-n-p
4587 (format "Directory `%s' does not exist; create? "
4588 dir))
4589 (make-directory dir t)
4590 (error "Canceled"))))))
4591 (set-visited-file-name filename)))
4592 (or (verify-visited-file-modtime (current-buffer)) 4581 (or (verify-visited-file-modtime (current-buffer))
4593 (not (file-exists-p buffer-file-name)) 4582 (not (file-exists-p buffer-file-name))
4594 (yes-or-no-p 4583 (yes-or-no-p
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 6642a2082c7..0fa870e595f 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12013-02-25 Adam Sjøgren <asjo@koldfront.dk>
2
3 * mml2015-el (mml2015-epg-key-image): Wrap epg-gpg-program in
4 shell-quote-argument.
5
12013-02-22 David Engster <deng@randomsample.de> 62013-02-22 David Engster <deng@randomsample.de>
2 7
3 * gnus-registry.el (gnus-registry-save): Provide class name when 8 * gnus-registry.el (gnus-registry-save): Provide class name when
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index b20c02aa26f..39bce23e76c 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -865,7 +865,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
865 (coding-system-for-read 'binary) 865 (coding-system-for-read 'binary)
866 (data (shell-command-to-string 866 (data (shell-command-to-string
867 (format "%s --list-options no-show-photos --attribute-fd 3 --list-keys %s 3>&1 >/dev/null 2>&1" 867 (format "%s --list-options no-show-photos --attribute-fd 3 --list-keys %s 3>&1 >/dev/null 2>&1"
868 epg-gpg-program key-id)))) 868 (shell-quote-argument epg-gpg-program) key-id))))
869 (when (> (length data) 0) 869 (when (> (length data) 0)
870 (insert (substring data 16)) 870 (insert (substring data 16))
871 (create-image (buffer-string) nil t))))) 871 (create-image (buffer-string) nil t)))))
diff --git a/lisp/replace.el b/lisp/replace.el
index 7f9ea869333..86b1aa27069 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -583,34 +583,39 @@ of `history-length', which see.")
583(defun read-regexp (prompt &optional defaults history) 583(defun read-regexp (prompt &optional defaults history)
584 "Read and return a regular expression as a string. 584 "Read and return a regular expression as a string.
585When PROMPT doesn't end with a colon and space, it adds a final \": \". 585When PROMPT doesn't end with a colon and space, it adds a final \": \".
586If DEFAULTS is non-nil, it displays the first default in the prompt. 586If the first element of DEFAULTS is non-nil, it's added to the prompt.
587 587
588Optional arg DEFAULTS is a string or a list of strings that are 588Optional arg DEFAULTS has the form (DEFAULT . SUGGESTIONS)
589prepended to a list of standard default values, which include the 589or simply DEFAULT where DEFAULT, if non-nil, should be a string that
590tag at point, the last isearch regexp, the last isearch string, 590is returned as the default value when the user enters empty input.
591SUGGESTIONS is a list of strings that can be inserted into
592the minibuffer using \\<minibuffer-local-map>\\[next-history-element]. \
593The values supplied in SUGGESTIONS
594are prepended to the list of standard suggestions that include
595the tag at point, the last isearch regexp, the last isearch string,
591and the last replacement regexp. 596and the last replacement regexp.
592 597
593Non-nil HISTORY is a symbol to use for the history list. 598Optional arg HISTORY is a symbol to use for the history list.
594If HISTORY is nil, `regexp-history' is used." 599If HISTORY is nil, `regexp-history' is used."
595 (let* ((defaults 600 (let* ((default (if (consp defaults) (car defaults) defaults))
596 (append 601 (suggestions (if (listp defaults) defaults (list defaults)))
597 (if (listp defaults) defaults (list defaults)) 602 (suggestions
598 (list 603 (append
599 ;; Regexp for tag at point. 604 suggestions
600 (let* ((tagf (or find-tag-default-function 605 (list
601 (get major-mode 'find-tag-default-function) 606 ;; Regexp for tag at point.
602 'find-tag-default)) 607 (let* ((tagf (or find-tag-default-function
603 (tag (funcall tagf))) 608 (get major-mode 'find-tag-default-function)
604 (cond ((not tag) "") 609 'find-tag-default))
605 ((eq tagf 'find-tag-default) 610 (tag (funcall tagf)))
606 (format "\\_<%s\\_>" (regexp-quote tag))) 611 (cond ((not tag) "")
607 (t (regexp-quote tag)))) 612 ((eq tagf 'find-tag-default)
608 (car regexp-search-ring) 613 (format "\\_<%s\\_>" (regexp-quote tag)))
609 (regexp-quote (or (car search-ring) "")) 614 (t (regexp-quote tag))))
610 (car (symbol-value 615 (car regexp-search-ring)
611 query-replace-from-history-variable))))) 616 (regexp-quote (or (car search-ring) ""))
612 (defaults (delete-dups (delq nil (delete "" defaults)))) 617 (car (symbol-value query-replace-from-history-variable)))))
613 (default (car defaults)) 618 (suggestions (delete-dups (delq nil (delete "" suggestions))))
614 ;; Do not automatically add default to the history for empty input. 619 ;; Do not automatically add default to the history for empty input.
615 (history-add-new-input nil) 620 (history-add-new-input nil)
616 (input (read-from-minibuffer 621 (input (read-from-minibuffer
@@ -621,9 +626,11 @@ If HISTORY is nil, `regexp-history' is used."
621 (query-replace-descr default))) 626 (query-replace-descr default)))
622 (t 627 (t
623 (format "%s: " prompt))) 628 (format "%s: " prompt)))
624 nil nil nil (or history 'regexp-history) defaults t))) 629 nil nil nil (or history 'regexp-history) suggestions t)))
625 (if (equal input "") 630 (if (equal input "")
631 ;; Return the default value when the user enters empty input.
626 (or default input) 632 (or default input)
633 ;; Otherwise, add non-empty input to the history and return input.
627 (prog1 input 634 (prog1 input
628 (add-to-history (or history 'regexp-history) input))))) 635 (add-to-history (or history 'regexp-history) input)))))
629 636
diff --git a/nt/ChangeLog b/nt/ChangeLog
index a8bb8c74c91..fab143fcddc 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,9 @@
12013-02-25 Eli Zaretskii <eliz@gnu.org>
2
3 * inc/ms-w32.h (BOOT_TIME_FILE): Define.
4
5 * config.nt (CLASH_DETECTION): Define to 1.
6
12013-02-16 Eli Zaretskii <eliz@gnu.org> 72013-02-16 Eli Zaretskii <eliz@gnu.org>
2 8
3 * inc/ms-w32.h (__STDC__): Fiddle with value only for MSVC. 9 * inc/ms-w32.h (__STDC__): Fiddle with value only for MSVC.
diff --git a/nt/config.nt b/nt/config.nt
index 61e56174bb4..cc4e91d9af0 100644
--- a/nt/config.nt
+++ b/nt/config.nt
@@ -75,7 +75,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
75/* Define if you want lock files to be written, so that Emacs can tell 75/* Define if you want lock files to be written, so that Emacs can tell
76 instantly when you try to modify a file that someone else has modified in 76 instantly when you try to modify a file that someone else has modified in
77 his/her Emacs. */ 77 his/her Emacs. */
78#undef CLASH_DETECTION 78#define CLASH_DETECTION 1
79 79
80/* Short copyright string for this version of Emacs. */ 80/* Short copyright string for this version of Emacs. */
81#define COPYRIGHT "Copyright (C) 2013 Free Software Foundation, Inc." 81#define COPYRIGHT "Copyright (C) 2013 Free Software Foundation, Inc."
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 66f586a4f76..9473fbe3ca6 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -70,6 +70,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
70#define HAVE___BUILTIN_UNWIND_INIT 1 70#define HAVE___BUILTIN_UNWIND_INIT 1
71#endif 71#endif
72 72
73/* This isn't perfect, as some systems might have the page file in
74 another place. Also, I suspect that the time stamp of that file
75 might also change when Windows enlarges the file due to
76 insufficient VM. Still, this seems to be the most reliable way;
77 the alternative (of using GetSystemTimes) won't work on laptops
78 that hibernate, because the system clock is stopped then. Other
79 possibility would be to run "net statistics workstation" and parse
80 the output, but that's gross. So this should do; if the file is
81 not there, the boot time will be returned as zero, and filelock.c
82 already handles that. */
83#define BOOT_TIME_FILE "C:/pagefile.sys"
84
73/* ============================================================ */ 85/* ============================================================ */
74 86
75/* Here, add any special hacks needed to make Emacs work on this 87/* Here, add any special hacks needed to make Emacs work on this
diff --git a/src/ChangeLog b/src/ChangeLog
index 8d3fc1e56fb..135d4d48b41 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,79 @@
12013-02-25 Eli Zaretskii <eliz@gnu.org>
2
3 Implement CLASH_DETECTION for MS-Windows.
4
5 * filelock.c [WINDOWSNT]: Include w32.h.
6 (MAKE_LOCK_NAME): Don't use 'lock', it clashes with MS runtime
7 function of that name. Up-case the macro arguments.
8 (IS_LOCK_FILE): New macro.
9 (fill_in_lock_file_name): Use IS_LOCK_FILE instead of S_ISLNK.
10 (create_lock_file): New function, with body extracted from
11 lock_file_1.
12 [WINDOWSNT]: Implement lock files by writing a regular file with
13 the lock information as its contents.
14 (read_lock_data): New function, on Posix platforms just calls
15 emacs_readlinkat.
16 [WINDOWSNT]: Read the lock info from the file.
17 (current_lock_owner): Call read_lock_data instead of calling
18 emacs_readlinkat directly.
19 (lock_file) [WINDOWSNT]: Run the file name through
20 dostounix_filename.
21
22 * w32proc.c (sys_kill): Support the case of SIG = 0, in which case
23 just check if the process by that PID exists.
24
25 * w32.c (sys_open): Don't reset the _O_CREAT flag if _O_EXCL is
26 also present, as doing so will fail to error out if the file
27 already exists.
28
29 * makefile.w32-in ($(BLD)/filelock.$(O)): Depend on src/w32.h.
30
31 * textprop.c (Fadd_text_properties, Fremove_text_properties)
32 (Fremove_list_of_text_properties): Skip all of the intervals in
33 the region between START and END that already have resp. don't
34 have the requested properties, not just the first one. Add
35 assertions that the loop afterwards always modifies the
36 properties. (Bug#13743)
37
382013-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
39
40 * callint.c (Fcall_interactively): Use the right lexical environment
41 for `interactive' specs (bug#13811).
42 * eval.c (Feval): Accept a lexical environment.
43
442013-02-25 Paul Eggert <eggert@cs.ucla.edu>
45
46 Simplify data_start configuration (Bug#13783).
47 This is a followon simplification to the fix for Bug#13650.
48 * Makefile.in (LD_FIRSTFLAG, LIB_GCC, CRT_DIR, LIB_STANDARD)
49 (START_FILES): Remove. All uses removed.
50 (otherobj): Remove $(VMLIMIT_OBJ), as it's now first.
51 (ALLOBJS): Move here from autodeps.mk, and with VMLIMITS_OBJ first.
52 (buildobj.h): Use it.
53 ($(ALLOBJS)): Depend on globals.h.
54 (temacs$(EXEEXT)): Use $(ALLOBJS).
55 * autodeps.mk (ALLOBJS): Move to Makefile.in.
56 * deps.mk (vm-limit.o):
57 * makefile.w32-in ($(BLD)/vm-limit.$(O)):
58 Do not depend on mem-limits.h.
59 * emacs.c (__do_global_ctors, __do_global_ctors_aux)
60 (__do_global_dtors, __CTOR_LIST__, __DTOR_LIST__)
61 [__GNUC__ && !ORDINARY_LINK]: Remove.
62 * mem-limits.h, pre-crt0.c: Remove.
63 * unexaix.c, unexcoff.c: Don't include mem-limits.h.
64 * unexcoff.c (etext): New decl.
65 (make_hdr): Use DATA_START instead of start_of_data.
66 * vm-limit.c: Move most of mem-limits.h's contents here.
67 (data_start): New decl. It's OK if this is approximate,
68 so simplify-away some unnecessary exactness.
69 (POINTER): Remove; all uses removed.
70 (data_space_start): Now char *, to avoid casts.
71 (exceeds_lisp_ptr): New function, replacing the old
72 EXCEEDS_LISP_PTR macro. All uses changed.
73 (check_memory_limits): Simplify and remove casts.
74 (start_of_data) [!CANNOT_DUMP || !SYSTEM_MALLOC]: Remove.
75 (memory_warnings): Use data_start instead of start_of_data.
76
12013-02-24 Andreas Schwab <schwab@linux-m68k.org> 772013-02-24 Andreas Schwab <schwab@linux-m68k.org>
2 78
3 * xdisp.c (set_message): Only check for debug-on-message if STRING 79 * xdisp.c (set_message): Only check for debug-on-message if STRING
diff --git a/src/Makefile.in b/src/Makefile.in
index 47803ab59f3..8a9a43ac124 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -36,7 +36,6 @@ WINDRES = @WINDRES@
36CFLAGS = @CFLAGS@ 36CFLAGS = @CFLAGS@
37CPPFLAGS = @CPPFLAGS@ 37CPPFLAGS = @CPPFLAGS@
38LDFLAGS = @LDFLAGS@ 38LDFLAGS = @LDFLAGS@
39LD_FIRSTFLAG=@LD_FIRSTFLAG@
40EXEEXT = @EXEEXT@ 39EXEEXT = @EXEEXT@
41version = @version@ 40version = @version@
42# Substitute an assignment for the MAKE variable, because 41# Substitute an assignment for the MAKE variable, because
@@ -102,10 +101,8 @@ LD_SWITCH_X_SITE_RPATH=@LD_SWITCH_X_SITE_RPATH@
102## System-specific LDFLAGS. 101## System-specific LDFLAGS.
103LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@ 102LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@
104 103
105## This holds any special options for linking temacs only (ie, not 104## This holds any special options for linking temacs only (i.e., not
106## used by configure). Not used elsewhere because it sometimes 105## used by configure).
107## contains options that have to do with using Emacs's crt0,
108## which are only good with temacs.
109LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@ 106LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@
110 107
111## Flags to pass to ld only for temacs. 108## Flags to pass to ld only for temacs.
@@ -120,14 +117,6 @@ PAXCTL = @PAXCTL@
120## Some systems define this to request special libraries. 117## Some systems define this to request special libraries.
121LIBS_SYSTEM=@LIBS_SYSTEM@ 118LIBS_SYSTEM=@LIBS_SYSTEM@
122 119
123## Where to find libgcc.a, if using gcc and necessary.
124LIB_GCC=@LIB_GCC@
125
126CRT_DIR=@CRT_DIR@
127## May use $CRT_DIR.
128LIB_STANDARD=@LIB_STANDARD@
129START_FILES = @START_FILES@
130
131## -lm, or empty. 120## -lm, or empty.
132LIB_MATH=@LIB_MATH@ 121LIB_MATH=@LIB_MATH@
133 122
@@ -401,17 +390,16 @@ POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
401 390
402## List of object files that make-docfile should not be told about. 391## List of object files that make-docfile should not be told about.
403otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \ 392otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
404 $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS) 393 $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
405 394
395## All object files linked into temacs. $(VMLIMIT_OBJ) should be first.
396ALLOBJS = $(VMLIMIT_OBJ) $(obj) $(otherobj)
406 397
407## Configure inserts the file lisp.mk at this point, defining $lisp. 398## Configure inserts the file lisp.mk at this point, defining $lisp.
408@lisp_frag@ 399@lisp_frag@
409 400
410 401
411## Construct full set of libraries to be linked. 402## Construct full set of libraries to be linked.
412## Note that SunOS needs -lm to come before -lc; otherwise, you get
413## duplicated symbols. If the standard libraries were compiled
414## with GCC, we might need LIB_GCC again after them.
415LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ 403LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
416 $(LIBX_OTHER) $(LIBSOUND) \ 404 $(LIBX_OTHER) $(LIBSOUND) \
417 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) \ 405 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) \
@@ -422,7 +410,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
422 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ 410 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
423 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 411 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
424 $(LIBACL_LIBS) $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \ 412 $(LIBACL_LIBS) $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
425 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) 413 $(LIB_MATH)
426 414
427all: emacs$(EXEEXT) $(OTHER_FILES) 415all: emacs$(EXEEXT) $(OTHER_FILES)
428.PHONY: all 416.PHONY: all
@@ -469,7 +457,7 @@ $(libsrc)/make-docfile$(EXEEXT):
469 cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT) 457 cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT)
470 458
471buildobj.h: Makefile 459buildobj.h: Makefile
472 echo "#define BUILDOBJ \"$(obj) $(otherobj) " "\"" > buildobj.h 460 echo "#define BUILDOBJ \"$(ALLOBJS) " "\"" >$@
473 461
474globals.h: gl-stamp; @true 462globals.h: gl-stamp; @true
475 463
@@ -481,15 +469,15 @@ gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES)
481 $(srcdir)/../build-aux/move-if-change gl-tmp globals.h 469 $(srcdir)/../build-aux/move-if-change gl-tmp globals.h
482 echo timestamp > $@ 470 echo timestamp > $@
483 471
484$(obj) $(otherobj): globals.h 472$(ALLOBJS): globals.h
485 473
486$(lib)/libgnu.a: $(config_h) 474$(lib)/libgnu.a: $(config_h)
487 cd $(lib) && $(MAKE) libgnu.a 475 cd $(lib) && $(MAKE) libgnu.a
488 476
489temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) \ 477temacs$(EXEEXT): stamp-oldxmenu $(ALLOBJS) \
490 $(lib)/libgnu.a $(W32_RES) 478 $(lib)/libgnu.a $(W32_RES)
491 $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ 479 $(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
492 -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES) \ 480 -o temacs $(ALLOBJS) $(lib)/libgnu.a $(LIBES) \
493 $(W32_RES_LINK) 481 $(W32_RES_LINK)
494 test "$(CANNOT_DUMP)" = "yes" || \ 482 test "$(CANNOT_DUMP)" = "yes" || \
495 test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT) 483 test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
diff --git a/src/autodeps.mk b/src/autodeps.mk
index fb0e21366c7..8b014a7508c 100644
--- a/src/autodeps.mk
+++ b/src/autodeps.mk
@@ -2,5 +2,4 @@
2 2
3## This is inserted in src/Makefile if AUTO_DEPEND=yes. 3## This is inserted in src/Makefile if AUTO_DEPEND=yes.
4 4
5ALLOBJS=$(START_FILES) ${obj} ${otherobj}
6-include $(ALLOBJS:%.o=${DEPDIR}/%.d) 5-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
diff --git a/src/callint.c b/src/callint.c
index 3e295a3b26b..b0d4bcdd011 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -342,8 +342,8 @@ invoke it. If KEYS is omitted or nil, the return value of
342 /* Compute the arg values using the user's expression. */ 342 /* Compute the arg values using the user's expression. */
343 GCPRO2 (input, filter_specs); 343 GCPRO2 (input, filter_specs);
344 specs = Feval (specs, 344 specs = Feval (specs,
345 CONSP (funval) && EQ (Qclosure, XCAR (funval)) 345 CONSP (funval) && EQ (Qclosure, XCAR (funval))
346 ? Qt : Qnil); 346 ? CAR_SAFE (XCDR (funval)) : Qnil);
347 UNGCPRO; 347 UNGCPRO;
348 if (events != num_input_events || !NILP (record_flag)) 348 if (events != num_input_events || !NILP (record_flag))
349 { 349 {
diff --git a/src/deps.mk b/src/deps.mk
index 47185c9262c..83444474c59 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -144,7 +144,7 @@ macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h msdos.h \
144 dispextern.h lisp.h globals.h $(config_h) systime.h coding.h composite.h 144 dispextern.h lisp.h globals.h $(config_h) systime.h coding.h composite.h
145gmalloc.o: gmalloc.c $(config_h) 145gmalloc.o: gmalloc.c $(config_h)
146ralloc.o: ralloc.c lisp.h $(config_h) 146ralloc.o: ralloc.c lisp.h $(config_h)
147vm-limit.o: vm-limit.c mem-limits.h lisp.h globals.h $(config_h) 147vm-limit.o: vm-limit.c lisp.h globals.h $(config_h)
148marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h) 148marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h)
149minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \ 149minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
150 buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \ 150 buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
diff --git a/src/emacs.c b/src/emacs.c
index 43fcae8e062..2d5a61c62b0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -524,32 +524,6 @@ DEFUN ("invocation-directory", Finvocation_directory, Sinvocation_directory,
524static char const dump_tz[] = "UtC0"; 524static char const dump_tz[] = "UtC0";
525#endif 525#endif
526 526
527#ifndef ORDINARY_LINK
528/* We don't include crtbegin.o and crtend.o in the link,
529 so these functions and variables might be missed.
530 Provide dummy definitions to avoid error.
531 (We don't have any real constructors or destructors.) */
532#ifdef __GNUC__
533
534/* Define a dummy function F. Declare F too, to pacify gcc
535 -Wmissing-prototypes. */
536#define DEFINE_DUMMY_FUNCTION(f) \
537 void f (void) ATTRIBUTE_CONST EXTERNALLY_VISIBLE; void f (void) {}
538
539#ifndef GCC_CTORS_IN_LIBC
540DEFINE_DUMMY_FUNCTION (__do_global_ctors)
541DEFINE_DUMMY_FUNCTION (__do_global_ctors_aux)
542DEFINE_DUMMY_FUNCTION (__do_global_dtors)
543/* GNU/Linux has a bug in its library; avoid an error. */
544#ifndef GNU_LINUX
545char * __CTOR_LIST__[2] EXTERNALLY_VISIBLE = { (char *) (-1), 0 };
546#endif
547char * __DTOR_LIST__[2] EXTERNALLY_VISIBLE = { (char *) (-1), 0 };
548#endif /* GCC_CTORS_IN_LIBC */
549DEFINE_DUMMY_FUNCTION (__main)
550#endif /* __GNUC__ */
551#endif /* ORDINARY_LINK */
552
553/* Test whether the next argument in ARGV matches SSTR or a prefix of 527/* Test whether the next argument in ARGV matches SSTR or a prefix of
554 LSTR (at least MINLEN characters). If so, then if VALPTR is non-null 528 LSTR (at least MINLEN characters). If so, then if VALPTR is non-null
555 (the argument is supposed to have a value) store in *VALPTR either 529 (the argument is supposed to have a value) store in *VALPTR either
diff --git a/src/eval.c b/src/eval.c
index 030bf14bcea..5db6f9d0bf3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1898,7 +1898,7 @@ If LEXICAL is t, evaluate using lexical scoping. */)
1898{ 1898{
1899 ptrdiff_t count = SPECPDL_INDEX (); 1899 ptrdiff_t count = SPECPDL_INDEX ();
1900 specbind (Qinternal_interpreter_environment, 1900 specbind (Qinternal_interpreter_environment,
1901 NILP (lexical) ? Qnil : Fcons (Qt, Qnil)); 1901 CONSP (lexical) || NILP (lexical) ? lexical : Fcons (Qt, Qnil));
1902 return unbind_to (count, eval_sub (form)); 1902 return unbind_to (count, eval_sub (form));
1903} 1903}
1904 1904
diff --git a/src/filelock.c b/src/filelock.c
index cd2cd2e53a2..4d556de2454 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -43,6 +43,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
43#include "buffer.h" 43#include "buffer.h"
44#include "coding.h" 44#include "coding.h"
45#include "systime.h" 45#include "systime.h"
46#ifdef WINDOWSNT
47#include "w32.h" /* for dostounix_filename */
48#endif
46 49
47#ifdef CLASH_DETECTION 50#ifdef CLASH_DETECTION
48 51
@@ -288,13 +291,22 @@ typedef struct
288#define FREE_LOCK_INFO(i) do { xfree ((i).user); xfree ((i).host); } while (0) 291#define FREE_LOCK_INFO(i) do { xfree ((i).user); xfree ((i).host); } while (0)
289 292
290 293
291/* Write the name of the lock file for FN into LFNAME. Length will be 294/* Write the name of the lock file for FNAME into LOCKNAME. Length
292 that of FN plus two more for the leading `.#' plus 1 for the 295 will be that of FN plus two more for the leading `.#' plus 1 for
293 trailing period plus one for the digit after it plus one for the 296 the trailing period plus one for the digit after it plus one for
294 null. */ 297 the null. */
295#define MAKE_LOCK_NAME(lock, file) \ 298#define MAKE_LOCK_NAME(LOCKNAME, FNAME) \
296 (lock = alloca (SBYTES (file) + 2 + 1 + 1 + 1), \ 299 (LOCKNAME = alloca (SBYTES (FNAME) + 2 + 1 + 1 + 1), \
297 fill_in_lock_file_name (lock, (file))) 300 fill_in_lock_file_name (LOCKNAME, (FNAME)))
301
302#ifdef WINDOWSNT
303/* 256 chars for user, 1024 chars for host, 10 digits for each of 2 int's. */
304#define MAX_LFINFO (256 + 1024 + 10 + 10 + 2)
305 /* min size: .@PID */
306#define IS_LOCK_FILE(ST) (MAX_LFINFO >= (ST).st_size && (ST).st_size >= 3)
307#else
308#define IS_LOCK_FILE(ST) S_ISLNK ((ST).st_mode)
309#endif
298 310
299static void 311static void
300fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn) 312fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
@@ -318,7 +330,7 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
318 330
319 p = lockfile + length + 2; 331 p = lockfile + length + 2;
320 332
321 while (lstat (lockfile, &st) == 0 && !S_ISLNK (st.st_mode)) 333 while (lstat (lockfile, &st) == 0 && !IS_LOCK_FILE (st))
322 { 334 {
323 if (count > 9) 335 if (count > 9)
324 { 336 {
@@ -329,6 +341,49 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
329 } 341 }
330} 342}
331 343
344static int
345create_lock_file (char *lfname, char *lock_info_str, bool force)
346{
347 int err;
348
349#ifdef WINDOWSNT
350 /* Symlinks are supported only by latest versions of Windows, and
351 creating them is a privileged operation that often triggers UAC
352 elevation prompts. Therefore, instead of using symlinks, we
353 create a regular file with the lock info written as its
354 contents. */
355 {
356 int fd = emacs_open (lfname, O_WRONLY | O_BINARY | O_CREAT | O_EXCL,
357 S_IREAD | S_IWRITE);
358
359 if (fd < 0 && errno == EEXIST && force)
360 fd = emacs_open (lfname, O_WRONLY | O_BINARY | O_TRUNC,
361 S_IREAD | S_IWRITE);
362 if (fd >= 0)
363 {
364 ssize_t lock_info_len = strlen (lock_info_str);
365
366 err = 0;
367 if (emacs_write (fd, lock_info_str, lock_info_len) != lock_info_len)
368 err = -1;
369 if (emacs_close (fd))
370 err = -1;
371 }
372 else
373 err = -1;
374 }
375#else
376 err = symlink (lock_info_str, lfname);
377 if (errno == EEXIST && force)
378 {
379 unlink (lfname);
380 err = symlink (lock_info_str, lfname);
381 }
382#endif
383
384 return err;
385}
386
332/* Lock the lock file named LFNAME. 387/* Lock the lock file named LFNAME.
333 If FORCE, do so even if it is already locked. 388 If FORCE, do so even if it is already locked.
334 Return true if successful. */ 389 Return true if successful. */
@@ -355,13 +410,7 @@ lock_file_1 (char *lfname, bool force)
355 410
356 esprintf (lock_info_str, boot ? "%s@%s.%"pMd":%"pMd : "%s@%s.%"pMd, 411 esprintf (lock_info_str, boot ? "%s@%s.%"pMd":%"pMd : "%s@%s.%"pMd,
357 user_name, host_name, pid, boot); 412 user_name, host_name, pid, boot);
358 413 err = create_lock_file (lfname, lock_info_str, force);
359 err = symlink (lock_info_str, lfname);
360 if (errno == EEXIST && force)
361 {
362 unlink (lfname);
363 err = symlink (lock_info_str, lfname);
364 }
365 414
366 symlink_errno = errno; 415 symlink_errno = errno;
367 SAFE_FREE (); 416 SAFE_FREE ();
@@ -377,6 +426,32 @@ within_one_second (time_t a, time_t b)
377 return (a - b >= -1 && a - b <= 1); 426 return (a - b >= -1 && a - b <= 1);
378} 427}
379 428
429static Lisp_Object
430read_lock_data (char *lfname)
431{
432#ifndef WINDOWSNT
433 return emacs_readlinkat (AT_FDCWD, lfname);
434#else
435 int fd = emacs_open (lfname, O_RDONLY | O_BINARY, S_IREAD);
436 ssize_t nbytes;
437 char lfinfo[MAX_LFINFO + 1];
438
439 if (fd < 0)
440 return Qnil;
441
442 nbytes = emacs_read (fd, lfinfo, MAX_LFINFO);
443 emacs_close (fd);
444
445 if (nbytes > 0)
446 {
447 lfinfo[nbytes] = '\0';
448 return build_string (lfinfo);
449 }
450 else
451 return Qnil;
452#endif
453}
454
380/* Return 0 if nobody owns the lock file LFNAME or the lock is obsolete, 455/* Return 0 if nobody owns the lock file LFNAME or the lock is obsolete,
381 1 if another process owns it (and set OWNER (if non-null) to info), 456 1 if another process owns it (and set OWNER (if non-null) to info),
382 2 if the current process owns it, 457 2 if the current process owns it,
@@ -390,7 +465,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
390 lock_info_type local_owner; 465 lock_info_type local_owner;
391 intmax_t n; 466 intmax_t n;
392 char *at, *dot, *colon; 467 char *at, *dot, *colon;
393 Lisp_Object lfinfo_object = emacs_readlinkat (AT_FDCWD, lfname); 468 Lisp_Object lfinfo_object = read_lock_data (lfname);
394 char *lfinfo; 469 char *lfinfo;
395 struct gcpro gcpro1; 470 struct gcpro gcpro1;
396 471
@@ -552,6 +627,12 @@ lock_file (Lisp_Object fn)
552 orig_fn = fn; 627 orig_fn = fn;
553 GCPRO1 (fn); 628 GCPRO1 (fn);
554 fn = Fexpand_file_name (fn, Qnil); 629 fn = Fexpand_file_name (fn, Qnil);
630#ifdef WINDOWSNT
631 /* Ensure we have only '/' separators, to avoid problems with
632 looking (inside fill_in_lock_file_name) for backslashes in file
633 names encoded by some DBCS codepage. */
634 dostounix_filename (SSDATA (fn), 1);
635#endif
555 encoded_fn = ENCODE_FILE (fn); 636 encoded_fn = ENCODE_FILE (fn);
556 637
557 /* Create the name of the lock-file for file fn */ 638 /* Create the name of the lock-file for file fn */
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 6e1873f8e49..93f12900dde 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -864,6 +864,7 @@ $(BLD)/fileio.$(O) : \
864 864
865$(BLD)/filelock.$(O) : \ 865$(BLD)/filelock.$(O) : \
866 $(SRC)/filelock.c \ 866 $(SRC)/filelock.c \
867 $(SRC)/w32.h \
867 $(NT_INC)/pwd.h \ 868 $(NT_INC)/pwd.h \
868 $(NT_INC)/sys/file.h \ 869 $(NT_INC)/sys/file.h \
869 $(NT_INC)/sys/stat.h \ 870 $(NT_INC)/sys/stat.h \
@@ -1492,7 +1493,6 @@ $(BLD)/unexw32.$(O) : \
1492 1493
1493$(BLD)/vm-limit.$(O) : \ 1494$(BLD)/vm-limit.$(O) : \
1494 $(SRC)/vm-limit.c \ 1495 $(SRC)/vm-limit.c \
1495 $(SRC)/mem-limits.h \
1496 $(SRC)/w32heap.h \ 1496 $(SRC)/w32heap.h \
1497 $(NT_INC)/unistd.h \ 1497 $(NT_INC)/unistd.h \
1498 $(CONFIG_H) \ 1498 $(CONFIG_H) \
diff --git a/src/mem-limits.h b/src/mem-limits.h
deleted file mode 100644
index 941ccf5f121..00000000000
--- a/src/mem-limits.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/* Includes for memory limit warnings.
2 Copyright (C) 1990, 1993-1996, 2001-2013 Free Software Foundation,
3 Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifdef MSDOS
21#include <dpmi.h>
22extern int etext;
23#endif
24
25/* Some systems need this before <sys/resource.h>. */
26#include <sys/types.h>
27
28#ifdef HAVE_SYS_RESOURCE_H
29# include <sys/time.h>
30# include <sys/resource.h>
31#else
32# if HAVE_SYS_VLIMIT_H
33# include <sys/vlimit.h> /* Obsolete, says glibc */
34# endif
35#endif
36
37extern char *start_of_data (void) ATTRIBUTE_CONST;
38#if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX
39#define EXCEEDS_LISP_PTR(ptr) 0
40#else
41#define EXCEEDS_LISP_PTR(ptr) \
42 (((uintptr_t) (ptr) & ~DATA_SEG_BITS) >> VALBITS)
43#endif
diff --git a/src/pre-crt0.c b/src/pre-crt0.c
deleted file mode 100644
index 6b9618c8dc3..00000000000
--- a/src/pre-crt0.c
+++ /dev/null
@@ -1,10 +0,0 @@
1/* This file is loaded before crt0.o on machines where we do not
2 remap part of the data space into text space in unexec.
3 On these machines, there is no problem with standard crt0.o's
4 that make environ an initialized variable. However, we do
5 need to make sure the label data_start exists anyway. */
6
7/* Create a label to appear at the beginning of data space.
8 Its value is nonzero so that it cannot be put into bss. */
9
10int data_start = 1;
diff --git a/src/textprop.c b/src/textprop.c
index c1f6e59bf2e..49fe427913c 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1133,6 +1133,7 @@ Return t if any property value actually changed, nil otherwise. */)
1133 register ptrdiff_t s, len; 1133 register ptrdiff_t s, len;
1134 register int modified = 0; 1134 register int modified = 0;
1135 struct gcpro gcpro1; 1135 struct gcpro gcpro1;
1136 ptrdiff_t got;
1136 1137
1137 properties = validate_plist (properties); 1138 properties = validate_plist (properties);
1138 if (NILP (properties)) 1139 if (NILP (properties))
@@ -1152,26 +1153,25 @@ Return t if any property value actually changed, nil otherwise. */)
1152 and live buffers are always protected. */ 1153 and live buffers are always protected. */
1153 GCPRO1 (properties); 1154 GCPRO1 (properties);
1154 1155
1155 /* If we're not starting on an interval boundary, we have to 1156 /* If this interval already has the properties, we can skip it. */
1156 split this interval. */ 1157 if (interval_has_all_properties (properties, i))
1157 if (i->position != s)
1158 { 1158 {
1159 /* If this interval already has the properties, we can 1159 got = LENGTH (i) - (s - i->position);
1160 skip it. */ 1160 do {
1161 if (interval_has_all_properties (properties, i)) 1161 if (got >= len)
1162 { 1162 RETURN_UNGCPRO (Qnil);
1163 ptrdiff_t got = (LENGTH (i) - (s - i->position)); 1163 len -= got;
1164 if (got >= len) 1164 i = next_interval (i);
1165 RETURN_UNGCPRO (Qnil); 1165 got = LENGTH (i);
1166 len -= got; 1166 } while (interval_has_all_properties (properties, i));
1167 i = next_interval (i); 1167 }
1168 } 1168 else if (i->position != s)
1169 else 1169 {
1170 { 1170 /* If we're not starting on an interval boundary, we have to
1171 unchanged = i; 1171 split this interval. */
1172 i = split_interval_right (unchanged, s - unchanged->position); 1172 unchanged = i;
1173 copy_properties (unchanged, i); 1173 i = split_interval_right (unchanged, s - unchanged->position);
1174 } 1174 copy_properties (unchanged, i);
1175 } 1175 }
1176 1176
1177 if (BUFFERP (object)) 1177 if (BUFFERP (object))
@@ -1195,7 +1195,8 @@ Return t if any property value actually changed, nil otherwise. */)
1195 signal_after_change (XINT (start), XINT (end) - XINT (start), 1195 signal_after_change (XINT (start), XINT (end) - XINT (start),
1196 XINT (end) - XINT (start)); 1196 XINT (end) - XINT (start));
1197 1197
1198 return modified ? Qt : Qnil; 1198 eassert (modified);
1199 return Qt;
1199 } 1200 }
1200 1201
1201 if (LENGTH (i) == len) 1202 if (LENGTH (i) == len)
@@ -1426,6 +1427,7 @@ Use `set-text-properties' if you want to remove all text properties. */)
1426 register INTERVAL i, unchanged; 1427 register INTERVAL i, unchanged;
1427 register ptrdiff_t s, len; 1428 register ptrdiff_t s, len;
1428 register int modified = 0; 1429 register int modified = 0;
1430 ptrdiff_t got;
1429 1431
1430 if (NILP (object)) 1432 if (NILP (object))
1431 XSETBUFFER (object, current_buffer); 1433 XSETBUFFER (object, current_buffer);
@@ -1437,26 +1439,25 @@ Use `set-text-properties' if you want to remove all text properties. */)
1437 s = XINT (start); 1439 s = XINT (start);
1438 len = XINT (end) - s; 1440 len = XINT (end) - s;
1439 1441
1440 if (i->position != s) 1442 /* If there are no properties on this entire interval, return. */
1443 if (! interval_has_some_properties (properties, i))
1441 { 1444 {
1442 /* No properties on this first interval -- return if 1445 got = (LENGTH (i) - (s - i->position));
1443 it covers the entire region. */ 1446 do {
1444 if (! interval_has_some_properties (properties, i)) 1447 if (got >= len)
1445 { 1448 return Qnil;
1446 ptrdiff_t got = (LENGTH (i) - (s - i->position)); 1449 len -= got;
1447 if (got >= len) 1450 i = next_interval (i);
1448 return Qnil; 1451 got = LENGTH (i);
1449 len -= got; 1452 } while (! interval_has_some_properties (properties, i));
1450 i = next_interval (i); 1453 }
1451 } 1454 /* Split away the beginning of this interval; what we don't
1452 /* Split away the beginning of this interval; what we don't 1455 want to modify. */
1453 want to modify. */ 1456 else if (i->position != s)
1454 else 1457 {
1455 { 1458 unchanged = i;
1456 unchanged = i; 1459 i = split_interval_right (unchanged, s - unchanged->position);
1457 i = split_interval_right (unchanged, s - unchanged->position); 1460 copy_properties (unchanged, i);
1458 copy_properties (unchanged, i);
1459 }
1460 } 1461 }
1461 1462
1462 if (BUFFERP (object)) 1463 if (BUFFERP (object))
@@ -1470,7 +1471,13 @@ Use `set-text-properties' if you want to remove all text properties. */)
1470 if (LENGTH (i) >= len) 1471 if (LENGTH (i) >= len)
1471 { 1472 {
1472 if (! interval_has_some_properties (properties, i)) 1473 if (! interval_has_some_properties (properties, i))
1473 return modified ? Qt : Qnil; 1474 {
1475 eassert (modified);
1476 if (BUFFERP (object))
1477 signal_after_change (XINT (start), XINT (end) - XINT (start),
1478 XINT (end) - XINT (start));
1479 return Qt;
1480 }
1474 1481
1475 if (LENGTH (i) == len) 1482 if (LENGTH (i) == len)
1476 { 1483 {
@@ -1512,6 +1519,7 @@ Return t if any property was actually removed, nil otherwise. */)
1512 register ptrdiff_t s, len; 1519 register ptrdiff_t s, len;
1513 register int modified = 0; 1520 register int modified = 0;
1514 Lisp_Object properties; 1521 Lisp_Object properties;
1522 ptrdiff_t got;
1515 properties = list_of_properties; 1523 properties = list_of_properties;
1516 1524
1517 if (NILP (object)) 1525 if (NILP (object))
@@ -1524,26 +1532,25 @@ Return t if any property was actually removed, nil otherwise. */)
1524 s = XINT (start); 1532 s = XINT (start);
1525 len = XINT (end) - s; 1533 len = XINT (end) - s;
1526 1534
1527 if (i->position != s) 1535 /* If there are no properties on the interval, return. */
1536 if (! interval_has_some_properties_list (properties, i))
1528 { 1537 {
1529 /* No properties on this first interval -- return if 1538 got = (LENGTH (i) - (s - i->position));
1530 it covers the entire region. */ 1539 do {
1531 if (! interval_has_some_properties_list (properties, i)) 1540 if (got >= len)
1532 { 1541 return Qnil;
1533 ptrdiff_t got = (LENGTH (i) - (s - i->position)); 1542 len -= got;
1534 if (got >= len) 1543 i = next_interval (i);
1535 return Qnil; 1544 got = LENGTH (i);
1536 len -= got; 1545 } while (! interval_has_some_properties_list (properties, i));
1537 i = next_interval (i); 1546 }
1538 } 1547 /* Split away the beginning of this interval; what we don't
1539 /* Split away the beginning of this interval; what we don't 1548 want to modify. */
1540 want to modify. */ 1549 else if (i->position != s)
1541 else 1550 {
1542 { 1551 unchanged = i;
1543 unchanged = i; 1552 i = split_interval_right (unchanged, s - unchanged->position);
1544 i = split_interval_right (unchanged, s - unchanged->position); 1553 copy_properties (unchanged, i);
1545 copy_properties (unchanged, i);
1546 }
1547 } 1554 }
1548 1555
1549 /* We are at the beginning of an interval, with len to scan. 1556 /* We are at the beginning of an interval, with len to scan.
diff --git a/src/unexaix.c b/src/unexaix.c
index da44480fdca..44a824b8c12 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -59,8 +59,6 @@ what you give them. Help stamp out software-hoarding! */
59#include <unistd.h> 59#include <unistd.h>
60#include <fcntl.h> 60#include <fcntl.h>
61 61
62#include "mem-limits.h"
63
64extern char _data[]; 62extern char _data[];
65extern char _text[]; 63extern char _text[];
66 64
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 466a5c0e491..2e662a34145 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -99,7 +99,7 @@ struct aouthdr
99 99
100#include <sys/file.h> 100#include <sys/file.h>
101 101
102#include "mem-limits.h" 102extern int etext;
103 103
104static long block_copy_start; /* Old executable start point */ 104static long block_copy_start; /* Old executable start point */
105static struct filehdr f_hdr; /* File header */ 105static struct filehdr f_hdr; /* File header */
@@ -168,7 +168,7 @@ make_hdr (int new, int a_out,
168 pagemask = getpagesize () - 1; 168 pagemask = getpagesize () - 1;
169 169
170 /* Adjust text/data boundary. */ 170 /* Adjust text/data boundary. */
171 data_start = (int) start_of_data (); 171 data_start = (int) DATA_START;
172 data_start = ADDR_CORRECT (data_start); 172 data_start = ADDR_CORRECT (data_start);
173 data_start = data_start & ~pagemask; /* (Down) to page boundary. */ 173 data_start = data_start & ~pagemask; /* (Down) to page boundary. */
174 174
diff --git a/src/vm-limit.c b/src/vm-limit.c
index fc7a253325a..3fca8bd26c1 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -19,7 +19,37 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#include <config.h> 19#include <config.h>
20#include <unistd.h> /* for 'environ', on AIX */ 20#include <unistd.h> /* for 'environ', on AIX */
21#include "lisp.h" 21#include "lisp.h"
22#include "mem-limits.h" 22
23#ifdef MSDOS
24#include <dpmi.h>
25extern int etext;
26#endif
27
28/* Some systems need this before <sys/resource.h>. */
29#include <sys/types.h>
30
31#ifdef HAVE_SYS_RESOURCE_H
32# include <sys/time.h>
33# include <sys/resource.h>
34#else
35# if HAVE_SYS_VLIMIT_H
36# include <sys/vlimit.h> /* Obsolete, says glibc */
37# endif
38#endif
39
40/* Start of data. It is OK if this is approximate; it's used only as
41 a heuristic. */
42#ifdef DATA_START
43# define data_start ((char *) DATA_START)
44#else
45extern char data_start[];
46# ifndef HAVE_DATA_START
47/* Initialize to nonzero, so that it's put into data and not bss.
48 Link this file's object code first, so that this symbol is near the
49 start of data. */
50char data_start[1] = { 1 };
51# endif
52#endif
23 53
24/* 54/*
25 Level number of warnings already issued. 55 Level number of warnings already issued.
@@ -35,12 +65,20 @@ static enum warnlevel warnlevel;
35 0 means don't issue them. */ 65 0 means don't issue them. */
36static void (*warn_function) (const char *); 66static void (*warn_function) (const char *);
37 67
38/* Start of data space; can be changed by calling malloc_init. */ 68/* Start of data space; can be changed by calling memory_warnings. */
39static void *data_space_start; 69static char *data_space_start;
40 70
41/* Number of bytes of writable memory we can expect to be able to get. */ 71/* Number of bytes of writable memory we can expect to be able to get. */
42static size_t lim_data; 72static size_t lim_data;
43 73
74/* Return true if PTR cannot be represented as an Emacs Lisp object. */
75static bool
76exceeds_lisp_ptr (void *ptr)
77{
78 return (! USE_LSB_TAG
79 && VAL_MAX < UINTPTR_MAX
80 && ((uintptr_t) ptr & ~DATA_SEG_BITS) >> VALBITS != 0);
81}
44 82
45#ifdef HAVE_GETRLIMIT 83#ifdef HAVE_GETRLIMIT
46 84
@@ -122,10 +160,12 @@ check_memory_limits (void)
122{ 160{
123#ifdef REL_ALLOC 161#ifdef REL_ALLOC
124 extern void *(*real_morecore) (ptrdiff_t); 162 extern void *(*real_morecore) (ptrdiff_t);
163#else
164 void *(*real_morecore) (ptrdiff_t) = 0;
125#endif 165#endif
126 extern void *(*__morecore) (ptrdiff_t); 166 extern void *(*__morecore) (ptrdiff_t);
127 167
128 void *cp; 168 char *cp;
129 size_t five_percent; 169 size_t five_percent;
130 size_t data_size; 170 size_t data_size;
131 enum warnlevel new_warnlevel; 171 enum warnlevel new_warnlevel;
@@ -135,13 +175,8 @@ check_memory_limits (void)
135 five_percent = lim_data / 20; 175 five_percent = lim_data / 20;
136 176
137 /* Find current end of memory and issue warning if getting near max */ 177 /* Find current end of memory and issue warning if getting near max */
138#ifdef REL_ALLOC 178 cp = (real_morecore ? real_morecore : __morecore) (0);
139 if (real_morecore) 179 data_size = cp - data_space_start;
140 cp = (char *) (*real_morecore) (0);
141 else
142#endif
143 cp = (char *) (*__morecore) (0);
144 data_size = (char *) cp - (char *) data_space_start;
145 180
146 if (!warn_function) 181 if (!warn_function)
147 return; 182 return;
@@ -188,49 +223,10 @@ check_memory_limits (void)
188 warnlevel = warned_85; 223 warnlevel = warned_85;
189 } 224 }
190 225
191 if (EXCEEDS_LISP_PTR (cp)) 226 if (exceeds_lisp_ptr (cp))
192 (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); 227 (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
193} 228}
194 229
195#if !defined (CANNOT_DUMP) || !defined (SYSTEM_MALLOC)
196/* Some systems that cannot dump also cannot implement these. */
197
198/*
199 * Return the address of the start of the data segment prior to
200 * doing an unexec. After unexec the return value is undefined.
201 * See crt0.c for further information and definition of data_start.
202 *
203 * Apparently, on BSD systems this is etext at startup. On
204 * USG systems (swapping) this is highly mmu dependent and
205 * is also dependent on whether or not the program is running
206 * with shared text. Generally there is a (possibly large)
207 * gap between end of text and start of data with shared text.
208 *
209 */
210
211char *
212start_of_data (void)
213{
214#ifdef BSD_SYSTEM
215 extern char etext;
216 return (void *) &etext;
217#elif defined DATA_START
218 return (void *) DATA_START;
219#elif defined ORDINARY_LINK
220 /*
221 * This is a hack. Since we're not linking crt0.c or pre_crt0.c,
222 * data_start isn't defined. We take the address of environ, which
223 * is known to live at or near the start of the system crt0.c, and
224 * we don't sweat the handful of bytes that might lose.
225 */
226 return (void *) &environ;
227#else
228 extern int data_start;
229 return (void *) &data_start;
230#endif
231}
232#endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */
233
234/* Enable memory usage warnings. 230/* Enable memory usage warnings.
235 START says where the end of pure storage is. 231 START says where the end of pure storage is.
236 WARNFUN specifies the function to call to issue a warning. */ 232 WARNFUN specifies the function to call to issue a warning. */
@@ -240,10 +236,7 @@ memory_warnings (void *start, void (*warnfun) (const char *))
240{ 236{
241 extern void (* __after_morecore_hook) (void); /* From gmalloc.c */ 237 extern void (* __after_morecore_hook) (void); /* From gmalloc.c */
242 238
243 if (start) 239 data_space_start = start ? start : data_start;
244 data_space_start = start;
245 else
246 data_space_start = start_of_data ();
247 240
248 warn_function = warnfun; 241 warn_function = warnfun;
249 __after_morecore_hook = check_memory_limits; 242 __after_morecore_hook = check_memory_limits;
diff --git a/src/w32.c b/src/w32.c
index 5011642adf2..aff9771e4bb 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3402,10 +3402,13 @@ int
3402sys_open (const char * path, int oflag, int mode) 3402sys_open (const char * path, int oflag, int mode)
3403{ 3403{
3404 const char* mpath = map_w32_filename (path, NULL); 3404 const char* mpath = map_w32_filename (path, NULL);
3405 /* Try to open file without _O_CREAT, to be able to write to hidden 3405 int res = -1;
3406 and system files. Force all file handles to be 3406
3407 non-inheritable. */ 3407 /* If possible, try to open file without _O_CREAT, to be able to
3408 int res = _open (mpath, (oflag & ~_O_CREAT) | _O_NOINHERIT, mode); 3408 write to existing hidden and system files. Force all file
3409 handles to be non-inheritable. */
3410 if ((oflag & (_O_CREAT | _O_EXCL)) != (_O_CREAT | _O_EXCL))
3411 res = _open (mpath, (oflag & ~_O_CREAT) | _O_NOINHERIT, mode);
3409 if (res < 0) 3412 if (res < 0)
3410 res = _open (mpath, oflag | _O_NOINHERIT, mode); 3413 res = _open (mpath, oflag | _O_NOINHERIT, mode);
3411 if (res >= 0 && res < MAXDESC) 3414 if (res >= 0 && res < MAXDESC)
diff --git a/src/w32proc.c b/src/w32proc.c
index 961791a40ed..84589388cd7 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -2263,12 +2263,42 @@ sys_kill (pid_t pid, int sig)
2263 pid = -pid; 2263 pid = -pid;
2264 2264
2265 /* Only handle signals that will result in the process dying */ 2265 /* Only handle signals that will result in the process dying */
2266 if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) 2266 if (sig != 0
2267 && sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP)
2267 { 2268 {
2268 errno = EINVAL; 2269 errno = EINVAL;
2269 return -1; 2270 return -1;
2270 } 2271 }
2271 2272
2273 if (sig == 0)
2274 {
2275 /* It will take _some_ time before PID 4 or less on Windows will
2276 be Emacs... */
2277 if (pid <= 4)
2278 {
2279 errno = EPERM;
2280 return -1;
2281 }
2282 proc_hand = OpenProcess (PROCESS_QUERY_INFORMATION, 0, pid);
2283 if (proc_hand == NULL)
2284 {
2285 DWORD err = GetLastError ();
2286
2287 switch (err)
2288 {
2289 case ERROR_ACCESS_DENIED: /* existing process, but access denied */
2290 errno = EPERM;
2291 return -1;
2292 case ERROR_INVALID_PARAMETER: /* process PID does not exist */
2293 errno = ESRCH;
2294 return -1;
2295 }
2296 }
2297 else
2298 CloseHandle (proc_hand);
2299 return 0;
2300 }
2301
2272 cp = find_child_pid (pid); 2302 cp = find_child_pid (pid);
2273 if (cp == NULL) 2303 if (cp == NULL)
2274 { 2304 {
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index 8dd15ffbaa7..b38fbdd122f 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -24,7 +24,7 @@
24(require 'python) 24(require 'python)
25 25
26(defmacro python-tests-with-temp-buffer (contents &rest body) 26(defmacro python-tests-with-temp-buffer (contents &rest body)
27 "Create a `python-mode' enabeld temp buffer with CONTENTS. 27 "Create a `python-mode' enabled temp buffer with CONTENTS.
28BODY is code to be executed within the temp buffer. Point is 28BODY is code to be executed within the temp buffer. Point is
29always located at the beginning of buffer." 29always located at the beginning of buffer."
30 (declare (indent 1) (debug t)) 30 (declare (indent 1) (debug t))
@@ -37,7 +37,7 @@ always located at the beginning of buffer."
37(defun python-tests-look-at (string &optional num restore-point) 37(defun python-tests-look-at (string &optional num restore-point)
38 "Move point at beginning of STRING in the current buffer. 38 "Move point at beginning of STRING in the current buffer.
39Optional argument NUM defaults to 1 and is an integer indicating 39Optional argument NUM defaults to 1 and is an integer indicating
40how many ocurrences must be found, when positive the search is 40how many occurrences must be found, when positive the search is
41done forwards, otherwise backwards. When RESTORE-POINT is 41done forwards, otherwise backwards. When RESTORE-POINT is
42non-nil the point is not moved but the position found is still 42non-nil the point is not moved but the position found is still
43returned. When searching forward and point is already looking at 43returned. When searching forward and point is already looking at