Mon Oct 9 02:54:14 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / sysdeps / unix / configure
blobdfc1c2296034dd624c24e26e59456232aaaa5f9a
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   profil=bsd readv=bsd writev=bsd \
69   getpriority setpriority \
70   getrlimit setrlimit
73   # $unix_function  =>  $unix_syscall           $unix_srcname
74   #     CALL                    CALL                    CALL
75   #     CALL/NAME               CALL                    NAME
76   unix_srcname=
77   unix_srcdir=common
78   eval "unix_syscall=`echo $unix_function | \
79                        sed -e 's@=\(.*\)$@ unix_srcdir=\1@' \
80                            -e 's@/\(.*\)$@ unix_srcname=\1@'`"
81   test -z "$unix_srcname" && unix_srcname=$unix_syscall
83   unix_implementor=none
84   for unix_dir in $sysnames; do
85     if test -r $sysdep_dir/$unix_dir/${unix_srcname}.c ||
86        test -r $sysdep_dir/$unix_dir/${unix_srcname}.S ||
87        test -r $sysdep_dir/$unix_dir/${unix_srcname}.s; then
88       unix_implementor=$unix_dir
89       break
90     fi
91   done
93   case $unix_syscall in
94   mkdir|rmdir) 
95     # mkdir and rmdir have implementations in unix/sysv, but
96     # the simple syscall versions are preferable if available.
97     test $unix_implementor = unix/sysv && unix_implementor=generic
98     ;;
99   esac
101   case $unix_implementor in
102   none|stub|generic|posix)
103     # The chosen implementation of ${unix_syscall} is a boring one.
104     # We want to use the unix/common implementation instead iff
105     # ${unix_syscall} appears in <syscall.h>.
106     echo $ac_n "checking for ${unix_syscall} system call""... $ac_c" 1>&4
107     if grep -i "[       _]${unix_syscall}[      ]" $unix_syscall_h >/dev/null
108     then
109       # It does seem to be present in <syscall.h>.
110       echo "$ac_t""yes" 1>&4
111       unix_dests="$unix_dests ${unix_generated_dirpfx}${unix_srcname}.S"
112       unix_srcs="$unix_srcs sysdeps/unix/${unix_srcdir}/${unix_srcname}.S"
113       unix_generated="$unix_generated $unix_generated_dirpfx${unix_srcname}.S"
114     else
115       echo "$ac_t""no" 1>&4
116     fi
117   ;;
118   *) ;;
119   esac
121 done
123 # Autoconf magic in the top-level configure.in causes config.status to
124 # actually make the links.
125 libc_link_dests="$libc_link_dests $unix_dests"
126 libc_link_sources="$libc_link_sources $unix_srcs"
128 # Store the list of files we created in config.make; Makefile uses it.
129 test -n "$unix_generated" && config_vars="$config_vars
130 unix-generated := \$(addprefix \$(objpfx),${unix_generated})"