Thu Jan 18 00:32:43 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / sysdeps / unix / configure.in
blob6841a4f8697d49523128a26c91ad074622f7add4
1 sinclude(./aclocal.m4)dnl Autoconf lossage.
2 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
3 # Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public License
8 # as published by the Free Software Foundation; either version 2 of
9 # the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Library General Public License for more details.
16 # You should have received a copy of the GNU Library General Public
17 # License along with the GNU C Library; see the file COPYING.LIB.  If
18 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 # Cambridge, MA 02139, USA.
21 dnl configure fragment for Unix-based systems.  This is processed by Autoconf,
22 dnl but we just use the AC_MSG_* macros.  This file is sourced by the
23 dnl top-level configure script.  Note that we use the prefix `unix_' on all
24 dnl shell variables here, to avoid conflicting with any variables the
25 dnl top-level script might be using.
27 sysincludedir=/usr/include # XXX
29 # Find the <syscall.h> file we will be using, or something like it.
30 unix_found=
31 for unix_dir in $sysnames; do
32   if test -r $sysdep_dir/$unix_dir/syscall.h; then
33     unix_found=$unix_dir
34     break
35   fi
36 done
37 if test $unix_found = stub; then
38   # XXX This list of possibilities duplicates the list in Makefile.
39   for try in sys.s sys/sys.s sys.S sys/sys.S syscall.h sys/syscall.h; do
40     if test -r $sysincludedir/$try; then
41       unix_syscall_h=$sysincludedir/$try
42       break
43     fi
44   done
45 else
46   unix_syscall_h=$sysdep_dir/$unix_dir/syscall.h
49 test -n "$unix_syscall_h" && {
51 # Where to put the .S files we write.
52 if test "`pwd`" = "`(cd $srcdir; pwd)`"; then
53   unix_generated_dirpfx=sysdeps/unix/
54 else
55   # We are running in a separate build directory.
56   unix_generated_dirpfx=
59 # This variable will collect the names of the files we create.
60 unix_generated=
61 unix_srcs=
62 unix_dests=
64 # These several functions are system calls on Unix systems which have them.
65 # The details of these calls are universal enough that if a system's
66 # <syscall.h> defines the system call number, we know that the simple
67 # system call implementations in unix/common will be sufficient.
69 for unix_function in \
70   dup2 lstat mkdir rmdir readlink symlink rename swapon \
71   access select getgroups setgroups \
72   getitimer setitimer \
73   getdomainname:getdomain=bsd/bsd4.4 \
74   setdomainname:setdomain=bsd/bsd4.4 \
75   fchdir=bsd/bsd4.4 \
76   profil=bsd readv=bsd writev=bsd \
77   getpriority setpriority \
78   getrlimit setrlimit
81   # $unix_function  =>  $unix_syscall           $unix_srcname
82   #     CALL                    CALL                    CALL
83   #     CALL/NAME               CALL                    NAME
84   unix_srcname=
85   unix_srcdir=common
86   eval "unix_syscall=`echo $unix_function | \
87                       sed -e 's@=\(.*\)$@ unix_srcdir=\1@' \
88                           -e 's@:\(.*\)@ unix_srcname=\1@'`"
89   test -z "$unix_srcname" && unix_srcname=$unix_syscall
91   unix_implementor=none
92   for unix_dir in $sysnames; do
93     if test -r $sysdep_dir/$unix_dir/${unix_srcname}.c ||
94        test -r $sysdep_dir/$unix_dir/${unix_srcname}.S ||
95        test -r $sysdep_dir/$unix_dir/${unix_srcname}.s; then
96       unix_implementor=$unix_dir
97       break
98     fi
99   done
101   case $unix_syscall in
102   mkdir|rmdir) 
103     # mkdir and rmdir have implementations in unix/sysv, but
104     # the simple syscall versions are preferable if available.
105     test $unix_implementor = unix/sysv && unix_implementor=generic
106     ;;
107   esac
109   case $unix_implementor in
110   none|stub|generic|posix)
111     # The chosen implementation of ${unix_syscall} is a boring one.
112     # We want to use the unix/common implementation instead iff
113     # ${unix_syscall} appears in <syscall.h>.
114     AC_MSG_CHECKING(for ${unix_syscall} system call)
115 changequote(,)dnl We need to use [ and ] for real now.
116     if grep -i "[       _]${unix_syscall}[      ]" $unix_syscall_h >/dev/null
117 changequote([,])dnl Back to Autoconf land.
118     then
119       # It does seem to be present in <syscall.h>.
120       AC_MSG_RESULT(yes)
121       unix_dests="$unix_dests ${unix_generated_dirpfx}${unix_srcname}.S"
122       unix_srcs="$unix_srcs sysdeps/unix/${unix_srcdir}/${unix_srcname}.S"
123       unix_generated="$unix_generated $unix_generated_dirpfx${unix_srcname}.S"
124     else
125       AC_MSG_RESULT(no)
126     fi
127   ;;
128   *) ;;
129   esac
131 done
133 # Autoconf magic in the top-level configure.in causes config.status to
134 # actually make the links.
135 libc_link_dests="$libc_link_dests $unix_dests"
136 libc_link_sources="$libc_link_sources $unix_srcs"
138 # Store the list of files we created in config.make; Makefile uses it.
139 test -n "$unix_generated" && config_vars="$config_vars
140 unix-generated := \$(addprefix \$(objpfx),${unix_generated})"