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