From 7c4026b6ad03974a55a175af17c8e76c61931b69 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 30 Mar 2013 20:00:51 +0300 Subject: [PATCH] Finished with lib-src compilation, except emacsclientw and emacsclient.res. Next -- compilation in nt/, and then problems in src/. --- configure.ac | 15 ++++++++++++--- lib-src/Makefile.in | 38 +++++++++++++++++++++++-------------- lib-src/ntlib.c | 26 ++++++++++++++++++++++--- lib-src/ntlib.h | 4 ++-- lib-src/update-game-score.c | 4 ++++ nt/inc/ms-w32.h | 4 +++- 6 files changed, 68 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 5ed6aed23d..c41a091460 100644 --- a/configure.ac +++ b/configure.ac @@ -1026,6 +1026,8 @@ AC_SUBST(C_SWITCH_SYSTEM) LIBS_SYSTEM= +LIB_WSOCK32= +NTLIB_O= case "$opsys" in ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2. aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;; @@ -1038,9 +1040,16 @@ case "$opsys" in ## Motif needs -lgen. unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;; + + mingw32) LIBS_SYSTEM="-lcomctl32" + LIB_WSOCK32="$LIB_WSOCK32 -lwsock32" + NTLIB_O="ntlib.$ac_objext" + ;; esac -AC_SUBST(LIBS_SYSTEM) +AC_SUBST(LIBS_SYSTEM) +AC_SUBST(LIB_WSOCK32) +AC_SUBST(NTLIB_O) ### Make sure subsequent tests use flags consistent with the build flags. @@ -1574,8 +1583,8 @@ if test "${HAVE_W32}" = "yes"; then W32_RES_LINK="-Wl,-bpe-i386 -Wl,emacs.res" else W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o" - W32_LIBS="$W32_LIBS -lwinmm -ladvapi32 -lgdi32 -lcomdlg32 -luser32" - W32_LIBS="$W32_LIBS -lmpr -lshell32 -lwinspool -lole32 -lcomctl32 -lusp10" + W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32" + W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lusp10" fi fi AC_SUBST(W32_OBJ) diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 7069af9767..903dbfcf7b 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -163,11 +163,16 @@ LIBS_MAIL=@LIBS_MAIL@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ ## empty or -lrt or -lposix4 if HAVE_FDATASYNC LIB_FDATASYNC = @LIB_FDATASYNC@ +## empty of -lwsock32 for MinGW +LIB_WSOCK32 = @LIB_WSOCK32@ ## Extra libraries to use when linking movemail. LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) +## Extra object files for linking emacsclient +NTLIB_O = @NTLIB_O@ + ## Some systems define this to request special libraries. LIBS_SYSTEM = @LIBS_SYSTEM@ @@ -292,7 +297,7 @@ TAGS: etags${EXEEXT} ## distribute Emacs. If they were clobbered, all the .elc files were ## clobbered too. test-distrib${EXEEXT}: ${srcdir}/test-distrib.c - $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c + $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c ./test-distrib ${srcdir}/testfile ../lib/libgnu.a: $(config_h) @@ -305,44 +310,49 @@ regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h) $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ -DVERSION="\"${version}\"" ${srcdir}/etags.c \ - regex.o $(LOADLIBES) -o etags + regex.o $(LOADLIBES) -o etags${EXEEXT} ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h) $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ - ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse + ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse${EXEEXT} ## We depend on etags to assure that parallel makes do not write two ## etags.o files on top of each other. ctags${EXEEXT}: etags${EXEEXT} $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \ -DVERSION="\"${version}\"" ${srcdir}/etags.c \ - regex.o $(LOADLIBES) -o ctags + regex.o $(LOADLIBES) -o ctags${EXEEXT} profile${EXEEXT}: ${srcdir}/profile.c $(config_h) $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \ - $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile + $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT} make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h) $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ - -o make-docfile + -o make-docfile${EXEEXT} -movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(config_h) +movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB_O) $(config_h) $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \ - $(LOADLIBES) $(LIBS_MOVE) -o movemail + $(NTLIB_O) $(LIB_WSOCK32) $(LOADLIBES) $(LIBS_MOVE) \ + -o movemail${EXEEXT} pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h) $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c -emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h) +emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB_O) $(config_h) $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ - -DVERSION="\"${version}\"" \ - $(LOADLIBES) $(LIB_FDATASYNC) -o emacsclient + -DVERSION="\"${version}\"" $(LIB_WSOCK32) \ + $(LOADLIBES) $(LIB_FDATASYNC) -o emacsclient${EXEEXT} + +ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h + $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h) - $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl + $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT} -update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(config_h) +update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB_O) $(config_h) $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ - ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score + ${srcdir}/update-game-score.c $(NTLIB_O) $(LOADLIBES) \ + -o update-game-score${EXEEXT} ## Makefile ends here. diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index 849abc2ede..9dbfda90e0 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c @@ -20,6 +20,20 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +#ifdef __MINGW32__ +/* A kludge to avoid including header files in lib/. They cannot be + configured-out, and their stuff interferes with what we have + defined in this header and in other headers in nt/inc. Yuck! */ +#define __need_system_fcntl_h +#define _GL_FCNTL_H +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H +#define _GL_ALREADY_INCLUDING_SIGNAL_H +#define _GL_ALREADY_INCLUDING_STDIO_H +#define __need_system_stdlib_h +#define _GL_TIME_H +#define __need_system_sys_stat_h +#endif + #include #include #include @@ -49,10 +63,11 @@ struct timezone /* Emulate sleep...we could have done this with a define, but that would necessitate including windows.h in the files that used it. This is much easier. */ -void -sleep (unsigned long seconds) +unsigned +sleep (unsigned seconds) { Sleep (seconds * 1000); + return 0; } /* Get the current working directory. */ @@ -137,6 +152,12 @@ getuid (void) return 0; } +unsigned +geteuid (void) +{ + return getuid (); +} + unsigned getgid (void) { @@ -415,4 +436,3 @@ lstat (const char * path, struct stat * buf) { return stat (path, buf); } - diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h index 1b2f57f35e..3e48d2997e 100644 --- a/lib-src/ntlib.h +++ b/lib-src/ntlib.h @@ -16,7 +16,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ - #include #include @@ -29,12 +28,13 @@ along with GNU Emacs. If not, see . */ #ifdef sleep #undef sleep #endif -void sleep (unsigned long seconds); +unsigned sleep (unsigned seconds); char *getwd (char *dir); int getppid (void); char * getlogin (void); char * cuserid (char * s); unsigned getuid (void); +unsigned geteuid (void); unsigned getegid (void); unsigned getgid (void); int setuid (unsigned uid); diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 29c81a8936..ec8b431777 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c @@ -46,6 +46,10 @@ along with GNU Emacs. If not, see . */ #include #include +#ifdef WINDOWSNT +#include "ntlib.h" +#endif + #define MAX_ATTEMPTS 5 #define MAX_SCORES 200 #define MAX_DATA_LEN 1024 diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 9817cd78ca..ce2b566277 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -368,9 +368,11 @@ typedef int sigset_t; typedef int ssize_t; #endif -#ifndef _POSIX /* MinGW64 */ +#ifdef _W64 /* MinGW64 */ +#ifndef _POSIX typedef _sigset_t sigset_t; #endif +#endif typedef void (_CALLBACK_ *signal_handler) (int); extern signal_handler sys_signal (int, signal_handler); -- 2.20.1