1 # Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License
6 # as published by the Free Software Foundation; either version 2 of
7 # the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
20 sysincludedir=/usr/include # XXX
22 # Find the <syscall.h> file we will be using, or something like it.
24 for unix_dir in $sysnames; do
25 if test -r $sysdep_dir/$unix_dir/syscall.h; then
30 if test $unix_found = stub; then
31 # XXX This list of possibilities duplicates the list in Makefile.
32 for try in sys.s sys/sys.s sys.S sys/sys.S syscall.h sys/syscall.h; do
33 if test -r $sysincludedir/$try; then
34 unix_syscall_h=$sysincludedir/$try
39 unix_syscall_h=$sysdep_dir/$unix_dir/syscall.h
42 test -n "$unix_syscall_h" && {
44 # Where to put the .S files we write.
45 if test "`pwd`" = "`(cd $srcdir; pwd)`"; then
46 unix_generated_dirpfx=sysdeps/unix/
48 # We are running in a separate build directory.
49 unix_generated_dirpfx=
52 # This variable will collect the names of the files we create.
57 # These several functions are system calls on Unix systems which have them.
58 # The details of these calls are universal enough that if a system's
59 # <syscall.h> defines the system call number, we know that the simple
60 # system call implementations in unix/common will be sufficient.
62 for unix_function in \
63 dup2 lstat mkdir rmdir readlink symlink rename swapon \
64 access select getgroups setgroups \
66 getdomainname:getdomain=bsd/bsd4.4 \
67 setdomainname:setdomain=bsd/bsd4.4 \
69 profil=bsd readv=bsd writev=bsd \
70 getpriority setpriority \
74 # $unix_function => $unix_syscall $unix_srcname
79 eval "unix_syscall=`echo $unix_function | \
80 sed -e 's@=\(.*\)$@ unix_srcdir=\1@' \
81 -e 's@:\(.*\)@ unix_srcname=\1@'`"
82 test -z "$unix_srcname" && unix_srcname=$unix_syscall
85 for unix_dir in $sysnames; do
86 if test -r $sysdep_dir/$unix_dir/${unix_srcname}.c ||
87 test -r $sysdep_dir/$unix_dir/${unix_srcname}.S ||
88 test -r $sysdep_dir/$unix_dir/${unix_srcname}.s; then
89 unix_implementor=$unix_dir
96 # mkdir and rmdir have implementations in unix/sysv, but
97 # the simple syscall versions are preferable if available.
98 test $unix_implementor = unix/sysv && unix_implementor=generic
102 case $unix_implementor in
103 none|stub|generic|posix)
104 # The chosen implementation of ${unix_syscall} is a boring one.
105 # We want to use the unix/common implementation instead iff
106 # ${unix_syscall} appears in <syscall.h>.
107 echo $ac_n "checking for ${unix_syscall} system call""... $ac_c" 1>&4
108 if grep -i "[ _]${unix_syscall}[ ]" $unix_syscall_h >/dev/null
110 # It does seem to be present in <syscall.h>.
111 echo "$ac_t""yes" 1>&4
112 unix_dests="$unix_dests ${unix_generated_dirpfx}${unix_srcname}.S"
113 unix_srcs="$unix_srcs sysdeps/unix/${unix_srcdir}/${unix_srcname}.S"
114 unix_generated="$unix_generated $unix_generated_dirpfx${unix_srcname}.S"
116 echo "$ac_t""no" 1>&4
124 # Autoconf magic in the top-level configure.in causes config.status to
125 # actually make the links.
126 libc_link_dests="$libc_link_dests $unix_dests"
127 libc_link_sources="$libc_link_sources $unix_srcs"
129 # Store the list of files we created in config.make; Makefile uses it.
130 test -n "$unix_generated" && config_vars="$config_vars
131 unix-generated := \$(addprefix \$(objpfx),${unix_generated})"