configure.in (getlogin,getgid,getuid, [...]): Check.

* libU77/configure.in (getlogin,getgid,getuid, kill,link,ttyname):
	Check.
	* libU77/config.h.in (HAVE_GETLOGIN, HAVE_GETGID, HAVE_GETUID,
	HAVE_KILL, HAVE_LINK, HAVE_TTYNAME): New defs.
	* libU77/getlog_.c: Conditionalize for target platform. Set errno
	to ENOSYS if target libc doesn't have the function.
	* libU77/getgid_.c: Likewise.
	* libU77/getuid_.c: Likewise.
	* libU77/kill_.c: Likewise.
	* libU77/link_.c: Likewise.
	* libU77/ttynam_.c: Likewise.

From-SVN: r17562
This commit is contained in:
Jeff Law 1998-01-31 17:41:14 -07:00
parent eed90b2cec
commit f65a7138c4
9 changed files with 60 additions and 17 deletions

View File

@ -25,30 +25,19 @@ VPATH = @srcdir@
#### Start of system configuration section. ####
# The _FOR_TARGET things are appropriate for a cross-make, passed by the
# superior makefile
GCC_FOR_TARGET = @CC@
CC = $(GCC_FOR_TARGET)
CFLAGS = @CFLAGS@ $(GCC_FLAGS)
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
CGFLAGS = #-g0
# f2c.h should already be installed in xgcc's include directory but add that
# to -I anyhow in case not using xgcc. fio.h is in libI77. We need config.h
# from `.'.
ALL_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/../libI77 -I../../../include $(CPPFLAGS) $(DEFS) $(CFLAGS)
AR = @AR@
AR_FLAGS = rc
RANLIB = @RANLIB@
RANLIB_TEST = @RANLIB_TEST@
ALL_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/../libI77 -I.. $(CPPFLAGS) $(DEFS) $(CFLAGS)
CROSS = @CROSS@
G77DIR = ../../../
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $(CGFLAGS) $<
$(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $<
OBJS = VersionU.o gerror_.o perror_.o ierrno_.o itime_.o time_.o \
unlink_.o fnum_.o getpid_.o getuid_.o getgid_.o kill_.o rand_.o \
@ -71,7 +60,7 @@ SRCS = Version.c gerror_.c perror_.c ierrno_.c itime_.c time_.c \
umask_.c sys_clock_.c date_.c second_.c flush1_.c mclock_.c \
alarm_.c
F2C_H = ../../../include/f2c.h
F2C_H = ../f2c.h
all: $(OBJS)
@ -93,7 +82,7 @@ distclean realclean maintainer-clean: clean
$(OBJS): $(F2C_H) config.h
check:
-$(G77DIR)g77 --driver=$(G77DIR)/xgcc -B$(G77DIR) -g $(srcdir)/u77-test.f $(lib) && ./a.out
-$(G77DIR)g77 -B$(G77DIR) -g $(srcdir)/u77-test.f $(lib) && ./a.out
rm -f a.out
access_.o: access_.c

View File

@ -84,3 +84,20 @@
/* Define if you have the times function. */
#undef HAVE_TIMES
/* Define if you have the getlogin function. */
#undef HAVE_GETLOGIN
/* Define if you have the getgid function. */
#undef HAVE_GETGID
/* Define if you have the getuid function. */
#undef HAVE_GETUID
/* Define if you have the kill function. */
#undef HAVE_KILL
/* Define if you have the link function. */
#undef HAVE_LINK
/* Define if you have the ttyname function. */
#undef HAVE_TTYNAME

View File

@ -98,7 +98,7 @@ AC_STRUCT_TM
dnl Checks for library functions.
AC_CHECK_FUNCS(symlink getcwd getwd lstat gethostname strerror clock \
getrusage times alarm)
getrusage times alarm getlogin getgid getuid kill link ttyname)
test $ac_cv_func_symlink = yes && MAYBES="$MAYBES symlnk_.o"
test $ac_cv_func_lstat = yes && MAYBES="$MAYBES lstat_.o"
test $ac_cv_func_gethostname = yes && MAYBES="$MAYBES hostnm_.o"

View File

@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */
#include <unistd.h>
#endif
#include <sys/types.h>
#include <errno.h> /* for ENOSYS */
#include "f2c.h"
#ifdef KR_headers
@ -31,5 +32,10 @@ integer G77_getgid_0 ()
integer G77_getgid_0 (void)
#endif
{
#if defined (HAVE_GETGID)
return getgid ();
#else
errno = ENOSYS;
return -1;
#endif
}

View File

@ -34,6 +34,7 @@ Boston, MA 02111-1307, USA. */
#else
# include <strings.h>
#endif
#include <errno.h> /* for ENOSYS */
#include "f2c.h"
/* getlogin not in svr1-3 */
@ -51,7 +52,9 @@ extern void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb);
{
size_t i;
char *p;
int status;
#if defined (HAVE_GETLOGIN)
p = getlogin ();
if (p != NULL) {
i = strlen (p);
@ -59,5 +62,10 @@ extern void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb);
} else {
s_copy (str, " ", Lstr, 1);
}
return 0;
status = 0;
#else
errno = ENOSYS;
status = -1;
#endif
return status;
}

View File

@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */
#include <unistd.h>
#endif
#include <sys/types.h>
#include <errno.h> /* for ENOSYS */
#include "f2c.h"
#ifdef KR_headers
@ -31,5 +32,10 @@ integer G77_getuid_0 ()
integer G77_getuid_0 (void)
#endif
{
#if defined (HAVE_GETUID)
return getuid ();
#else
errno = ENOSYS;
return -1;
#endif
}

View File

@ -33,5 +33,10 @@ integer G77_kill_0 (pid, signum)
integer G77_kill_0 (const integer *pid, const integer *signum)
#endif
{
#if defined (HAVE_KILL)
return kill ((pid_t) *pid, *signum) ? errno : 0;
#else
errno = ENOSYS;
return -1;
#endif
}

View File

@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#include <errno.h> /* for ENOSYS */
#include "f2c.h"
#ifdef KR_headers
@ -44,6 +45,7 @@ void g_char(const char *a, ftnlen alen, char *b);
integer G77_link_0 (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2)
#endif
{
#if defined (HAVE_LINK)
char *buff1, *buff2;
char *bp, *blast;
int i;
@ -57,4 +59,8 @@ integer G77_link_0 (const char *path1, const char *path2, const ftnlen Lpath1, c
i = link (buff1, buff2);
free (buff1); free (buff2);
return i ? errno : 0;
#else /* ! HAVE_LINK */
errno = ENOSYS;
return -1;
#endif
}

View File

@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
#else
# include <strings.h>
#endif
#include <errno.h> /* for ENOSYS */
#include "f2c.h"
#ifdef KR_headers
@ -45,6 +46,7 @@ extern void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb);
/* Character */ void G77_ttynam_0 (char *ret_val, ftnlen ret_val_len, integer *lunit)
#endif
{
#if defined (HAVE_TTYNAME)
size_t i;
char *p;
@ -55,4 +57,8 @@ extern void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb);
} else {
s_copy (ret_val, " ", ret_val_len, 1);
}
#else
errno = ENOSYS;
return -1;
#endif
}