about summary refs log tree commit diff
path: root/sysdeps/unix/configure.in
blob: 85bc3d1c2c1be711193d759cbec0c87d4eb34f2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
sinclude(./aclocal.m4)dnl Autoconf lossage.
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB.  If
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.

dnl configure fragment for Unix-based systems.  This is processed by Autoconf,
dnl but we just use the AC_MSG_* macros.  This file is sourced by the
dnl top-level configure script.  Note that we use the prefix `unix_' on all
dnl shell variables here, to avoid conflicting with any variables the
dnl top-level script might be using.

sysincludedir=/usr/include # XXX

# Find the <syscall.h> file we will be using, or something like it.
unix_found=
for unix_dir in $sysnames; do
  if test -r $sysdep_dir/$unix_dir/syscall.h; then
    unix_found=$unix_dir
    break
  fi
done
if test $unix_found = stub; then
  # XXX This list of possibilities duplicates the list in Makefile.
  for try in sys.s sys/sys.s sys.S sys/sys.S syscall.h sys/syscall.h; do
    if test -r $sysincludedir/$try; then
      unix_syscall_h=$sysincludedir/$try
      break
    fi
  done
else
  unix_syscall_h=$sysdep_dir/$unix_dir/syscall.h
fi

test -n "$unix_syscall_h" && {

# Where to put the .S files we write.
if test "`pwd`" = "`(cd $srcdir; pwd)`"; then
  unix_generated_dirpfx=sysdeps/unix/
else
  # We are running in a separate build directory.
  unix_generated_dirpfx=
fi

# This variable will collect the names of the files we create.
unix_generated=
unix_srcs=
unix_dests=

# These several functions are system calls on Unix systems which have them.
# The details of these calls are universal enough that if a system's
# <syscall.h> defines the system call number, we know that the simple
# system call implementations in unix/common will be sufficient.

for unix_function in \
  dup2 lstat mkdir rmdir readlink symlink rename swapon \
  access select getgroups setgroups \
  getitimer setitimer \
  getdomainname/getdomain=bsd/bsd4.4 \
  setdomainname/setdomain=bsd/bsd4.4
do

  # $unix_function  =>	$unix_syscall		$unix_srcname
  #	CALL			CALL			CALL
  #	CALL/NAME		CALL			NAME
  unix_srcname=
  unix_srcdir=common
  eval "unix_syscall=`echo $unix_function | \
		       sed -e 's@=\(.*\)$@ unix_srcdir=\1@' \
			   -e 's@/\(.*\)$@ unix_srcname=\1@'`"
  test -z "$unix_srcname" && unix_srcname=$unix_function

  unix_implementor=none
  for unix_dir in $sysnames; do
    if test -r $sysdep_dir/$unix_dir/${unix_srcname}.c ||
       test -r $sysdep_dir/$unix_dir/${unix_srcname}.S ||
       test -r $sysdep_dir/$unix_dir/${unix_srcname}.s; then
      unix_implementor=$unix_dir
      break
    fi
  done

  # mkdir and rmdir have implementations in unix/sysv, but
  # the simple syscall versions are preferable if available.
  test $unix_syscall = mkdir -o $unix_syscall = rmdir && \
  test $unix_implementor = unix/sysv && \
    unix_implementor=generic

  case $unix_implementor in
  none|stub|generic|posix)
    # The chosen implementation of ${unix_syscall} is a boring one.
    # We want to use the unix/common implementation instead iff
    # ${unix_syscall} appears in <syscall.h>.
    AC_MSG_CHECKING(for ${unix_syscall} system call)
changequote(,)dnl We need to use [ and ] for real now.
    if grep -i "[ 	_]${unix_syscall}[ 	]" $unix_syscall_h >/dev/null
changequote([,])dnl Back to Autoconf land.
    then
      # It does seem to be present in <syscall.h>.
      AC_MSG_RESULT(yes)
      unix_dests="$unix_dests ${unix_generated_dirpfx}${unix_srcname}.S"
      unix_srcs="$unix_srcs sysdeps/unix/${unix_srcdir}/${unix_srcname}.S"
      unix_generated="$unix_generated $unix_generated_dirpfx${unix_srcname}.S"
    else
      AC_MSG_RESULT(no)
    fi
  ;;
  *) ;;
  esac

done

# Autoconf magic in the top-level configure.in causes config.status to
# actually make the links.
libc_link_dests="$libc_link_dests $unix_dests"
libc_link_sources="$libc_link_sources $unix_srcs"

# Store the list of files we created in config.make; Makefile uses it.
test -n "$unix_generated" && config_vars="$config_vars
unix-generated := \$(addprefix \$(objpfx),${unix_generated})"

}