]>
Commit | Line | Data |
---|---|---|
28f540f4 RM |
1 | # Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. |
2 | # This file is part of the GNU C Library. | |
3 | ||
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. | |
8 | ||
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. | |
13 | ||
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. | |
18 | ||
19 | ||
20 | sysincludedir=/usr/include # XXX | |
21 | ||
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 | |
40 | fi | |
41 | ||
42 | test -n "$unix_syscall_h" && { | |
43 | ||
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= | |
50 | fi | |
51 | ||
52 | # This variable will collect the names of the files we create. | |
53 | unix_generated= | |
54 | unix_srcs= | |
55 | unix_dests= | |
56 | ||
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. | |
61 | ||
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 \ | |
3f33a4ce RM |
67 | setdomainname/setdomain=bsd/bsd4.4 \ |
68 | profil=bsd \ | |
69 | getpriority setpriority \ | |
70 | getrlimit setrlimit | |
28f540f4 RM |
71 | do |
72 | ||
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_function | |
82 | ||
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 | |
92 | ||
93 | # mkdir and rmdir have implementations in unix/sysv, but | |
94 | # the simple syscall versions are preferable if available. | |
95 | test $unix_syscall = mkdir -o $unix_syscall = rmdir && \ | |
96 | test $unix_implementor = unix/sysv && \ | |
97 | unix_implementor=generic | |
98 | ||
99 | case $unix_implementor in | |
100 | none|stub|generic|posix) | |
101 | # The chosen implementation of ${unix_syscall} is a boring one. | |
102 | # We want to use the unix/common implementation instead iff | |
103 | # ${unix_syscall} appears in <syscall.h>. | |
104 | echo $ac_n "checking for ${unix_syscall} system call""... $ac_c" 1>&4 | |
105 | if grep -i "[ _]${unix_syscall}[ ]" $unix_syscall_h >/dev/null | |
106 | then | |
107 | # It does seem to be present in <syscall.h>. | |
108 | echo "$ac_t""yes" 1>&4 | |
109 | unix_dests="$unix_dests ${unix_generated_dirpfx}${unix_srcname}.S" | |
110 | unix_srcs="$unix_srcs sysdeps/unix/${unix_srcdir}/${unix_srcname}.S" | |
111 | unix_generated="$unix_generated $unix_generated_dirpfx${unix_srcname}.S" | |
112 | else | |
113 | echo "$ac_t""no" 1>&4 | |
114 | fi | |
115 | ;; | |
116 | *) ;; | |
117 | esac | |
118 | ||
119 | done | |
120 | ||
121 | # Autoconf magic in the top-level configure.in causes config.status to | |
122 | # actually make the links. | |
123 | libc_link_dests="$libc_link_dests $unix_dests" | |
124 | libc_link_sources="$libc_link_sources $unix_srcs" | |
125 | ||
126 | # Store the list of files we created in config.make; Makefile uses it. | |
127 | test -n "$unix_generated" && config_vars="$config_vars | |
128 | unix-generated := \$(addprefix \$(objpfx),${unix_generated})" | |
129 | ||
130 | } |