* Added comments from the old config/ directory to configure.ac, and started
changing all the AC_DEFINEs into proper autoconf checks. git-svn-id: svn://svn.zoy.org/elk/trunk@36 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "scheme.h"
|
||||
|
||||
#ifdef REGCOMP
|
||||
#ifdef HAVE_REGCOMP
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
@@ -199,10 +199,10 @@ static Object P_Match_End(m, n) Object m, n; {
|
||||
|
||||
#define Def_Prim Define_Primitive
|
||||
|
||||
#endif /* REGCOMP */
|
||||
#endif /* HAVE_REGCOMP */
|
||||
|
||||
elk_init_lib_regexp() {
|
||||
#ifdef REGCOMP
|
||||
#ifdef HAVE_REGCOMP
|
||||
T_Regexp = Define_Type(0, "regexp", 0, sizeof(struct S_Regexp),
|
||||
Regexp_Eqv, Regexp_Equal, Regexp_Print, Regexp_Visit);
|
||||
T_Match = Define_Type(0, "regexp-match", Match_Size, 0,
|
||||
|
||||
+4
-10
@@ -148,27 +148,21 @@ static Object P_Lseek(fd, off, whence) Object fd, off, whence; {
|
||||
|
||||
int Num_Filedescriptors() {
|
||||
int ret;
|
||||
#ifdef OPEN_MAX
|
||||
#if defined(OPEN_MAX)
|
||||
ret = OPEN_MAX;
|
||||
#else
|
||||
#ifdef GETDTABLESIZE
|
||||
#elif defined(HAVE_GETDTABLESIZE)
|
||||
ret = getdtablesize();
|
||||
#else
|
||||
#ifdef SYSCONF_OPEN_MAX
|
||||
#elif defined(SC_OPEN_MAX_IN_UNISTD_H)
|
||||
static r;
|
||||
if (r == 0) {
|
||||
if ((r = sysconf(_SC_OPEN_MAX)) == -1)
|
||||
r = 256;
|
||||
}
|
||||
ret = r;
|
||||
#else
|
||||
#ifdef NOFILE
|
||||
#elif defined(NOFILE)
|
||||
ret = NOFILE;
|
||||
#else
|
||||
ret = 256;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
#include "unix.h"
|
||||
|
||||
#ifdef UTIME_H
|
||||
#ifdef HAVE_UTIME_H
|
||||
# include <utime.h>
|
||||
#else
|
||||
struct utimbuf {
|
||||
@@ -8,7 +8,7 @@ struct utimbuf {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef DIRENT
|
||||
#ifdef HAVE_DIRENT
|
||||
# include <dirent.h>
|
||||
#else
|
||||
# include <sys/dir.h>
|
||||
@@ -65,7 +65,7 @@ static Object P_Mkdir(fn, mode) Object fn, mode; {
|
||||
|
||||
static Object P_Read_Directory(fn) Object fn; {
|
||||
DIR *d;
|
||||
#ifdef DIRENT
|
||||
#ifdef HAVE_DIRENT
|
||||
struct dirent *dp;
|
||||
#else
|
||||
struct direct *dp;
|
||||
@@ -96,7 +96,7 @@ static Object P_Read_Directory(fn) Object fn; {
|
||||
}
|
||||
|
||||
static Object P_Rename(fromfn, tofn) Object fromfn, tofn; {
|
||||
#ifdef RENAME
|
||||
#ifdef HAVE_RENAME
|
||||
if (rename(Get_Strsym(fromfn), Get_Strsym(tofn)) == -1)
|
||||
Raise_System_Error2("(~s ~s): ~E", fromfn, tofn);
|
||||
#else
|
||||
|
||||
+4
-4
@@ -245,7 +245,7 @@ static Object P_System(cmd) Object cmd; {
|
||||
int n, pid, status;
|
||||
char *s = Get_String(cmd);
|
||||
|
||||
#ifdef VFORK
|
||||
#ifdef HAVE_VFORK
|
||||
switch (pid = vfork()) {
|
||||
#else
|
||||
switch (pid = fork()) {
|
||||
@@ -280,7 +280,7 @@ static Object P_Working_Directory() {
|
||||
char *buf;
|
||||
int max = Path_Max()+2; /* getcwd() needs two extra bytes */
|
||||
Object ret;
|
||||
#if !defined(GETCWD) && !defined(GETWD)
|
||||
#if !defined(HAVE_GETCWD) && !defined(HAVE_GETWD)
|
||||
FILE *fp;
|
||||
char *p;
|
||||
#endif
|
||||
@@ -288,7 +288,7 @@ static Object P_Working_Directory() {
|
||||
|
||||
Alloca(buf, char*, max);
|
||||
Disable_Interrupts;
|
||||
#ifdef GETCWD
|
||||
#ifdef HAVE_GETCWD
|
||||
if (getcwd(buf, max) == 0) {
|
||||
Saved_Errno = errno;
|
||||
Alloca_End;
|
||||
@@ -296,7 +296,7 @@ static Object P_Working_Directory() {
|
||||
Raise_System_Error("~E");
|
||||
}
|
||||
#else
|
||||
#ifdef GETWD
|
||||
#ifdef HAVE_GETWD
|
||||
if (getwd(buf) == 0) {
|
||||
Alloca_End;
|
||||
Enable_Interrupts;
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
#include "unix.h"
|
||||
|
||||
#if defined(UNAME) && !defined(GETHOSTNAME)
|
||||
#if defined(HAVE_UNAME) && !defined(HAVE_GETHOSTNAME)
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
@@ -134,11 +134,11 @@ static Object P_Job_Controlp() {
|
||||
}
|
||||
|
||||
static Object P_System_Info(ret) Object ret; {
|
||||
#ifdef GETHOSTNAME
|
||||
#ifdef HAVE_GETHOSTNAME
|
||||
char hostname[MAXHOSTNAMELEN];
|
||||
char *p = hostname;
|
||||
#else
|
||||
#ifdef UNAME
|
||||
#ifdef HAVE_UNAME
|
||||
struct utsname uts;
|
||||
char *p = uts.nodename;
|
||||
#else
|
||||
@@ -150,10 +150,10 @@ static Object P_System_Info(ret) Object ret; {
|
||||
GC_Node;
|
||||
|
||||
Check_Result_Vector(ret, 3);
|
||||
#ifdef GETHOSTNAME
|
||||
#ifdef HAVE_GETHOSTNAME
|
||||
(void)gethostname(hostname, sizeof(hostname));
|
||||
#else
|
||||
#ifdef UNAME
|
||||
#ifdef HAVE_UNAME
|
||||
(void)uname(&uts);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+16
-16
@@ -1,29 +1,29 @@
|
||||
#include "unix.h"
|
||||
|
||||
#ifdef TEMPNAM /* Make sure only one of these is defined (if any) */
|
||||
# undef TMPNAM /* Order of preference: tempnam, mktemp, tmpnam */
|
||||
# undef MKTEMP
|
||||
#ifdef HAVE_TEMPNAM /* Make sure only one of these is defined (if any) */
|
||||
# undef HAVE_TMPNAM /* Order of preference: tempnam, mktemp, tmpnam */
|
||||
# undef HAVE_MKTEMP
|
||||
#endif
|
||||
#ifdef MKTEMP
|
||||
# undef TMPNAM
|
||||
# undef TEMPNAM
|
||||
#ifdef HAVE_MKTEMP
|
||||
# undef HAVE_TMPNAM
|
||||
# undef HAVE_TEMPNAM
|
||||
#endif
|
||||
#ifdef TMPNAM
|
||||
# undef TEMPNAM
|
||||
# undef MKTEMP
|
||||
#ifdef HAVE_TMPNAM
|
||||
# undef HAVE_TEMPNAM
|
||||
# undef HAVE_MKTEMP
|
||||
#endif
|
||||
|
||||
static Object P_Tempname(argc, argv) int argc; Object *argv; {
|
||||
char *name, *dir = 0, *pref = 0;
|
||||
Object ret;
|
||||
#ifdef TMPNAM
|
||||
#ifdef HAVE_TMPNAM
|
||||
extern char *tmpnam();
|
||||
#else
|
||||
#ifdef TEMPNAM
|
||||
#ifdef HAVE_TEMPNAM
|
||||
extern char *tempnam();
|
||||
#else
|
||||
char buf[1024];
|
||||
#ifdef MKTEMP
|
||||
#ifdef HAVE_MKTEMP
|
||||
extern char *mktemp();
|
||||
#else
|
||||
char *p, *q;
|
||||
@@ -36,10 +36,10 @@ static Object P_Tempname(argc, argv) int argc; Object *argv; {
|
||||
dir = Get_Strsym(argv[0]);
|
||||
if (argc > 1)
|
||||
pref = Get_Strsym(argv[1]);
|
||||
#ifdef TMPNAM
|
||||
#ifdef HAVE_TMPNAM
|
||||
name = tmpnam((char *)0);
|
||||
#else
|
||||
#ifdef TEMPNAM
|
||||
#ifdef HAVE_TEMPNAM
|
||||
Disable_Interrupts; /* Make sure result gets freed */
|
||||
name = tempnam(dir, pref);
|
||||
#else
|
||||
@@ -47,7 +47,7 @@ static Object P_Tempname(argc, argv) int argc; Object *argv; {
|
||||
if (!pref) pref = "elk";
|
||||
if (strlen(dir) + strlen(pref) > 1000)
|
||||
Primitive_Error("directory/prefix argument too long");
|
||||
#ifdef MKTEMP
|
||||
#ifdef HAVE_MKTEMP
|
||||
sprintf(buf, "%s/%sXXXXXX", dir, pref);
|
||||
name = mktemp(buf);
|
||||
#else
|
||||
@@ -80,7 +80,7 @@ fail: ;
|
||||
Raise_Error("cannot create temp file name");
|
||||
}
|
||||
ret = Make_String(name, strlen(name));
|
||||
#ifdef TEMPNAM
|
||||
#ifdef HAVE_TEMPNAM
|
||||
free(name);
|
||||
Enable_Interrupts;
|
||||
#endif
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
#include "unix.h"
|
||||
|
||||
#if !defined(GETTIMEOFDAY) && defined(FTIME)
|
||||
#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME)
|
||||
# include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#ifdef GETTIMEOFDAY
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
@@ -34,11 +34,11 @@ static Object P_Decode_Time(t, ret, utc) Object t, ret, utc; {
|
||||
|
||||
static Object P_Nanotime(ret) Object ret; {
|
||||
Object x, y;
|
||||
#ifdef GETTIMEOFDAY
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
#else
|
||||
#ifdef FTIME
|
||||
#ifdef HAVE_FTIME
|
||||
struct timeb tb;
|
||||
#else
|
||||
time_t now;
|
||||
@@ -50,7 +50,7 @@ static Object P_Nanotime(ret) Object ret; {
|
||||
x = Null;
|
||||
Check_Result_Vector(ret, 3);
|
||||
GC_Link2(ret, x);
|
||||
#ifdef GETTIMEOFDAY
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
(void)gettimeofday(&tv, &tz);
|
||||
x = Cons(Null, Make_Unsigned_Long((unsigned long)tv.tv_usec * 1000));
|
||||
y = Make_Unsigned_Long((unsigned long)tv.tv_sec);
|
||||
@@ -59,7 +59,7 @@ static Object P_Nanotime(ret) Object ret; {
|
||||
VECTOR(ret)->data[1] = Make_Integer(tz.tz_minuteswest);
|
||||
VECTOR(ret)->data[2] = Make_Integer(tz.tz_dsttime);
|
||||
#else
|
||||
#ifdef FTIME
|
||||
#ifdef HAVE_FTIME
|
||||
(void)ftime(&tb);
|
||||
x = Cons(Null, Make_Unsigned_Long((unsigned long)tb.millitm * 1000000));
|
||||
y = Make_Unsigned_Long((unsigned long)tb.time);
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef INCLUDE_UNISTD_H
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
+6
-6
@@ -4,15 +4,15 @@
|
||||
|
||||
#include "unix.h"
|
||||
|
||||
#if defined(WAITPID) || defined(WAIT4)
|
||||
#if defined(HAVE_WAITPID) || defined(HAVE_WAIT4)
|
||||
# define WAIT_PROCESS
|
||||
#endif
|
||||
|
||||
#if defined(WAITPID) || defined(WAIT3) || defined(WAIT4)
|
||||
#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
|
||||
# define WAIT_OPTIONS
|
||||
#endif
|
||||
|
||||
#if defined(WAIT3) || defined(WAIT4)
|
||||
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
|
||||
# define WAIT_RUSAGE
|
||||
# include <sys/time.h>
|
||||
# include <sys/resource.h>
|
||||
@@ -58,15 +58,15 @@ static Object General_Wait(ret, ruret, haspid, pid, options)
|
||||
Check_Result_Vector(ret, 5);
|
||||
Check_Result_Vector(ruret, 2);
|
||||
if (haspid) {
|
||||
#ifdef WAIT4
|
||||
#ifdef HAVE_WAIT4
|
||||
retpid = wait4(pid, &st, options, &ru);
|
||||
#else
|
||||
#ifdef WAITPID
|
||||
#ifdef HAVE_WAITPID
|
||||
retpid = waitpid(pid, &st, options);
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
#ifdef WAIT3
|
||||
#ifdef HAVE_WAIT3
|
||||
retpid = wait3(&st, options, &ru);
|
||||
#else
|
||||
retpid = wait(&st);
|
||||
|
||||
Reference in New Issue
Block a user