* Added -no-undefined to all plugins' LDFLAGS.

* Disabled most of the unix plugin code under Windows.
  * Replaced remaining index/rindex calls with strchr/strrchr.
  * Updated the Win32 build.


git-svn-id: svn://svn.zoy.org/elk/trunk@164 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-19 08:54:08 +00:00
parent 7d3267a72c
commit 69724a8ba7
16 changed files with 93 additions and 25 deletions

View File

@ -13,10 +13,11 @@ rm -Rf "${DIRNAME}"
rm -f "${DIRNAME}.zip"
mkdir "${DIRNAME}"
# To build for win32, I use ./configure --host=i586-mingw32msvc
(cd src && make && cp elk.exe "${DESTDIR}")
(cd scm && make install DESTDIR="${DESTDIR}" datadir="/")
mv "${DESTDIR}/elk" "${DESTDIR}/scm"
# To build for win32, I use:
# ./configure --host=i586-mingw32msvc --prefix=/ --bindir=/ --libdir=/
# make pkglibdir=/lib pkgdatadir=/scm
make install DESTDIR="${DESTDIR}" pkglibdir=/lib pkgdatadir=/scm
cp "src/.libs/libelk-0.dll" "${DESTDIR}"
# Pack the directory
zip "${DIRNAME}.zip" `find "${DIRNAME}"`

View File

@ -383,7 +383,7 @@ AC_DEFINE(ANSI_CPP, 1, [FIXME HARD])
# The UNIX extension likes to know which of the following system calls,
# library functions, and include files are supported by the system.
AC_CHECK_HEADERS(utime.h sys/wait.h)
AC_CHECK_HEADERS(utime.h sys/utime.h sys/wait.h dirent.h)
AC_CHECK_FUNCS(waitpid wait3 wait4 vfork uname gethostname gettimeofday ftime)
AC_CHECK_FUNCS(mktemp tmpnam tempnam getcwd getwd rename regcomp)
@ -410,7 +410,7 @@ AC_DEFINE_UNQUOTED(LIB_DIR, "${prefix}/lib/elk", [Plugins directory])
#define FIND_AOUT defined(USE_LD) || defined(CAN_DUMP) || defined(INIT_OBJECTS)
AC_DEFINE(FIND_AOUT, 1, [FIXME HARD])
AC_CHECK_HEADERS(pwd.h sys/resource.h)
AC_CHECK_HEADERS(pwd.h grp.h sys/resource.h)
dnl
dnl Check for available compiler features

View File

@ -19,7 +19,7 @@ unix_la_SOURCES = \
unix.c \
wait.c \
$(NULL)
unix_la_LDFLAGS = -module -avoid-version
unix_la_LDFLAGS = -module -avoid-version -no-undefined
unix_la_LIBADD = $(top_builddir)/src/libelk.la
extensions_HEADERS = unix.h

View File

@ -62,7 +62,9 @@ static SYMDESCR Fcntl_Flags[] = {
#ifdef O_SYNCIO
{ "syncio", O_SYNCIO },
#endif
#ifdef O_NDELAY
{ "ndelay", O_NDELAY },
#endif
#ifdef O_NONBLOCK
{ "nonblock", O_NONBLOCK },
#endif
@ -91,15 +93,19 @@ static Object P_Close(Object fd) {
}
static Object P_Close_On_Exec(int argc, Object *argv) {
int flags, fd;
int flags = 0, fd;
fd = Get_Integer(argv[0]);
#ifndef WIN32
if ((flags = fcntl(fd, F_GETFD, 0)) == -1)
Raise_System_Error("fcntl(F_GETFD): ~E");
#endif
if (argc == 2) {
Check_Type(argv[1], T_Boolean);
#ifndef WIN32
if (fcntl(fd, F_SETFD, Truep(argv[1])) == -1)
Raise_System_Error("fcntl(F_SETFD): ~E");
#endif
}
return flags & 1 ? True : False;
}
@ -113,14 +119,18 @@ static Object P_Dup(int argc, Object *argv) {
}
static Object P_Filedescriptor_Flags(int argc, Object *argv) {
int flags, fd;
int flags = 0, fd;
fd = Get_Integer(argv[0]);
#ifndef WIN32
if ((flags = fcntl(fd, F_GETFL, 0)) == -1)
Raise_System_Error("fcntl(F_GETFL): ~E");
#endif
if (argc == 2) {
#ifndef WIN32
if (fcntl(fd, F_SETFL, Symbols_To_Bits(argv[1], 1, Fcntl_Flags)) == -1)
Raise_System_Error("fcntl(F_SETFL): ~E");
#endif
}
return Bits_To_Symbols((unsigned long)flags, 1, Fcntl_Flags);
}
@ -223,7 +233,11 @@ static Object P_Open(int argc, Object *argv) {
static Object P_Pipe() {
int fd[2];
#ifdef WIN32
if (_pipe(fd, 256, O_BINARY) == -1)
#else
if (pipe(fd) == -1)
#endif
Raise_System_Error("~E");
return Integer_Pair(fd[0], fd[1]);
}
@ -267,12 +281,14 @@ static Object P_Writex(int argc, Object *argv) {
}
static Object P_Ttyname(Object fd) {
char *ret;
char *ret = NULL;
#ifndef WIN32
extern char *ttyname();
Disable_Interrupts;
ret = ttyname(Get_Integer(fd));
Enable_Interrupts;
#endif
return ret ? Make_String(ret, strlen(ret)) : False;
}

View File

@ -34,13 +34,15 @@
#ifdef HAVE_UTIME_H
# include <utime.h>
#elif HAVE_SYS_UTIME_H
# include <sys/utime.h>
#else
struct utimbuf {
time_t actime, modtime;
};
#endif
#ifdef HAVE_DIRENT
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#else
# include <sys/dir.h>
@ -78,26 +80,32 @@ static Object P_Chmod(Object fn, Object mode) {
}
static Object P_Chown(Object fn, Object uid, Object gid) {
#ifndef WIN32
if (chown(Get_Strsym(fn), Get_Integer(uid), Get_Integer(gid)) == -1)
Raise_System_Error1("~s: ~E", fn);
#endif
return Void;
}
static Object P_Link(Object fn1, Object fn2) {
#ifndef WIN32
if (link(Get_Strsym(fn1), Get_Strsym(fn2)) == -1)
Raise_System_Error2("(~s ~s): ~E", fn1, fn2);
#endif
return Void;
}
static Object P_Mkdir(Object fn, Object mode) {
#ifndef WIN32
if (mkdir(Get_Strsym(fn), Get_Integer(mode)) == -1)
Raise_System_Error1("~s: ~E", fn);
#endif
return Void;
}
static Object P_Read_Directory(Object fn) {
DIR *d;
#ifdef HAVE_DIRENT
#ifdef HAVE_DIRENT_H
struct dirent *dp;
#else
struct direct *dp;
@ -155,7 +163,7 @@ static Object General_Stat(Object obj, Object ret, int l) {
Object x;
struct stat st;
char *s, *fn = NULL;
int fd = -1, result;
int fd = -1, result = 0;
GC_Node;
Check_Result_Vector(ret, 11);
@ -268,9 +276,11 @@ static Object P_Utime(int argc, Object *argv) {
ut.actime = (time_t)Get_Unsigned_Long(argv[1]);
ut.modtime = (time_t)Get_Unsigned_Long(argv[2]);
}
#ifndef WIN32
if (utime(Get_Strsym(argv[0]), argc == 1 ? (struct utimbuf *)0 : &ut)
== -1)
Raise_System_Error1("~s: ~E", argv[0]);
#endif
return Void;
}

View File

@ -32,6 +32,7 @@
#include <string.h>
#ifndef WIN32
static Object P_Getpass(Object prompt) {
char *ret;
extern char *getpass();
@ -47,3 +48,4 @@ static Object P_Getpass(Object prompt) {
void elk_init_unix_misc() {
Def_Prim(P_Getpass, "unix-getpass", 1, 1, EVAL);
}
#endif

View File

@ -31,10 +31,15 @@
#include "unix.h"
#include <string.h>
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef HAVE_GRP_H
# include <grp.h>
#endif
static Object P_Get_Passwd(int argc, Object *argv) {
#ifndef WIN32
struct passwd *p;
Object arg, x;
@ -77,24 +82,30 @@ static Object P_Get_Passwd(int argc, Object *argv) {
VECTOR(argv[0])->data[5] = x;
x = Make_String(p->pw_shell, strlen(p->pw_shell));
VECTOR(argv[0])->data[6] = x;
#endif
return Void;
}
static Object P_Rewind_Passwd() {
#ifndef WIN32
Disable_Interrupts;
setpwent();
Enable_Interrupts;
#endif
return Void;
}
static Object P_End_Passwd() {
#ifndef WIN32
Disable_Interrupts;
endpwent();
Enable_Interrupts;
#endif
return Void;
}
static Object P_Get_Group(int argc, Object *argv) {
#ifndef WIN32
char **pp;
struct group *p;
Object arg, member, x;
@ -140,20 +151,25 @@ static Object P_Get_Group(int argc, Object *argv) {
x = P_Reverse(x);
GC_Unlink;
VECTOR(argv[0])->data[3] = x;
#endif
return Void;
}
static Object P_Rewind_Group() {
#ifndef WIN32
Disable_Interrupts;
setgrent();
Enable_Interrupts;
#endif
return Void;
}
static Object P_End_Group() {
#ifndef WIN32
Disable_Interrupts;
endgrent();
Enable_Interrupts;
#endif
return Void;
}

View File

@ -32,8 +32,11 @@
#include <string.h>
#include <stdio.h>
#include <sys/times.h>
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#ifndef WIN32
/* "extern" in front of the next declaration causes the Ultrix 4.2 linker
* to fail when dynamically loading unix.o (but omitting it does no longer
* work with modern C compilers):
@ -50,7 +53,7 @@ static Object P_Environ() {
GC_Link2(ret, cell);
for (ep = environ; *ep; ep++) {
cell = Cons(Null, Null);
p = index(*ep, '=');
p = strchr(*ep, '=');
if (p)
*p++ = 0;
else p = c+1;
@ -343,7 +346,7 @@ err:
}
if (fgets(buf, max, fp) == 0)
goto err;
if (p = index(buf, '\n')) *p = '\0';
if (p = strchr(buf, '\n')) *p = '\0';
(void)pclose(fp);
#endif
#endif
@ -374,3 +377,4 @@ void elk_init_unix_process() {
Def_Prim(P_Umask, "unix-umask", 1, 1, EVAL);
Def_Prim(P_Working_Directory, "unix-working-directory", 0, 0, EVAL);
}
#endif

View File

@ -33,17 +33,27 @@
static Object Sym_Exit, Sym_Default, Sym_Ignore;
static SYMDESCR Signal_Syms[] = {
#ifdef SIGALRM
{ "sigalrm", SIGALRM },
#endif
#ifdef SIGBUS
{ "sigbus", SIGBUS },
#endif
{ "sigfpe", SIGFPE },
#ifdef SIGHUP
{ "sighup", SIGHUP },
#endif
{ "sigill", SIGILL },
{ "sigint", SIGINT },
#ifdef SIGKILL
{ "sigkill", SIGKILL },
#endif
#ifdef SIGPIPE
{ "sigpipe", SIGPIPE },
#endif
#ifdef SIGQUIT
{ "sigquit", SIGQUIT },
#endif
{ "sigsegv", SIGSEGV },
{ "sigterm", SIGTERM },
#ifdef SIGABRT
@ -179,6 +189,7 @@ static SYMDESCR Signal_Syms[] = {
};
static Object P_Kill(Object pid, Object sig) {
#ifndef WIN32
int t, s;
if ((t = TYPE(sig)) == T_Fixnum || t == T_Bignum)
@ -189,6 +200,7 @@ static Object P_Kill(Object pid, Object sig) {
Wrong_Type_Combination(sig, "symbol or integer");
if (kill(Get_Integer(pid), s) == -1)
Raise_System_Error("~E");
#endif
return Void;
}
@ -197,8 +209,11 @@ static Object P_List_Signals() {
}
static Object P_Pause() {
#ifndef WIN32
pause();
Fatal_Error("pause() returned unexpectedly");
#endif
return Void;
}
#if defined(HAVE_SIGPROCMASK) || defined(HAVE_SIGBLOCK)

View File

@ -192,7 +192,7 @@ static Object P_System_Info(Object ret) {
GC_Link(ret);
x = Make_String(p, strlen(p)); VECTOR(ret)->data[0] = x;
strcpy(systype, SYSTEMTYPE);
if ((p = index(systype, '-')) && (q = index(p+1, '-'))) {
if ((p = strchr(systype, '-')) && (q = strchr(p+1, '-'))) {
*p++ = 0; *q = 0;
} else p = "?";
x = Make_String(systype, strlen(systype)); VECTOR(ret)->data[1] = x;

View File

@ -34,7 +34,9 @@
#include <sys/stat.h>
#include <sys/param.h>
#include <time.h>
#include <sys/wait.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#include <fcntl.h>
#include <errno.h>

View File

@ -77,6 +77,7 @@ static SYMDESCR Wait_Flags[] = {
static Object General_Wait(Object ret, Object ruret,
int haspid, int pid, int options) {
#ifndef WIN32
int retpid, st, code;
char *status;
#ifdef WAIT_RUSAGE
@ -137,6 +138,7 @@ static Object General_Wait(Object ret, Object ruret,
VECTOR(ruret)->data[1] = x;
#endif
GC_Unlink;
#endif
return Void;
}

View File

@ -34,7 +34,7 @@ xlib_la_SOURCES = \
xobjects.c \
$(NULL)
xlib_la_CFLAGS = @X_CFLAGS@
xlib_la_LDFLAGS = -module -avoid-version
xlib_la_LDFLAGS = -module -avoid-version -no-undefined
xlib_la_LIBADD = $(top_builddir)/src/libelk.la @X_LIBS@
extensions_HEADERS = xlib.h

View File

@ -18,12 +18,12 @@ endif
xaw_xt_la_SOURCES = $(SOURCES_XT)
xaw_xt_la_CFLAGS = -I$(srcdir)/../xlib @XAW_CFLAGS@
xaw_xt_la_LDFLAGS = -module -avoid-version
xaw_xt_la_LDFLAGS = -module -avoid-version -no-undefined
xaw_xt_la_LIBADD = $(top_builddir)/src/libelk.la @XAW_LIBS@
motif_xt_la_SOURCES = $(SOURCES_XT)
motif_xt_la_CFLAGS = -I$(srcdir)/../xlib @MOTIF_CFLAGS@
motif_xt_la_LDFLAGS = -module -avoid-version
motif_xt_la_LDFLAGS = -module -avoid-version -no-undefined
motif_xt_la_LIBADD = $(top_builddir)/src/libelk.la @MOTIF_LIBS@
extensions_HEADERS = xt.h

View File

@ -12,7 +12,7 @@ endif
nodist_motif_widgets_la_SOURCES = $(SOURCES_C)
motif_widgets_la_SOURCES = init.c
motif_widgets_la_CFLAGS = -I$(srcdir)/../../xlib @MOTIF_CFLAGS@
motif_widgets_la_LDFLAGS = -module -avoid-version -u XmIsMotifWMRunning
motif_widgets_la_LDFLAGS = -module -avoid-version -no-undefined -u XmIsMotifWMRunning
motif_widgets_la_LIBADD = $(top_builddir)/src/libelk.la @MOTIF_LIBS@
.d.c:

View File

@ -12,7 +12,7 @@ endif
nodist_xaw_widgets_la_SOURCES = $(SOURCES_C)
xaw_widgets_la_SOURCES = init.c
xaw_widgets_la_CFLAGS = -I$(srcdir)/../../xlib @XAW_CFLAGS@
xaw_widgets_la_LDFLAGS = -module -avoid-version
xaw_widgets_la_LDFLAGS = -module -avoid-version -no-undefined
xaw_widgets_la_LIBADD = $(top_builddir)/src/libelk.la @XAW_LIBS@
.d.c: