Thu Jan 18 00:32:43 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / sysdeps / unix / configure
blob1e659d3451a716c6b6a1e98c7edee3833f954813
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.
23 unix_found=
24 for unix_dir in $sysnames; do
25   if test -r $sysdep_dir/$unix_dir/syscall.h; then
26     unix_found=$unix_dir
27     break
28   fi
29 done
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
35       break
36     fi
37   done
38 else
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/
47 else
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.
53 unix_generated=
54 unix_srcs=
55 unix_dests=
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 \
65   getitimer setitimer \
66   getdomainname:getdomain=bsd/bsd4.4 \
67   setdomainname:setdomain=bsd/bsd4.4 \
68   fchdir=bsd/bsd4.4 \
69   profil=bsd readv=bsd writev=bsd \
70   getpriority setpriority \
71   getrlimit setrlimit
74   # $unix_function  =>  $unix_syscall           $unix_srcname
75   #     CALL                    CALL                    CALL
76   #     CALL/NAME               CALL                    NAME
77   unix_srcname=
78   unix_srcdir=common
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
84   unix_implementor=none
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
90       break
91     fi
92   done
94   case $unix_syscall in
95   mkdir|rmdir) 
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
99     ;;
100   esac
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
109     then
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"
115     else
116       echo "$ac_t""no" 1>&4
117     fi
118   ;;
119   *) ;;
120   esac
122 done
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})"