home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / sysdeps / unix / configure < prev    next >
Encoding:
Text File  |  1993-05-21  |  3.5 KB  |  103 lines

  1. # Copyright (C) 1993 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. # configure fragment for Unix-based systems.
  20. # This file is sourced by the top-level configure script.  Note that we use
  21. # the prefix `unix_' on all shell variables here, to avoid conflicting with
  22. # any variables the top-level script might be using.
  23.  
  24. sysincludedir=/usr/include # XXX
  25.  
  26. # Find the <syscall.h> file we will be using, or something like it.
  27. unix_found=
  28. for unix_dir in $sysnames; do
  29.   if [ -r $sysdep_dir/$unix_dir/syscall.h ]; then
  30.     unix_found=$unix_dir
  31.     break
  32.   fi
  33. done
  34. if [ $unix_found = stub ]; then
  35.   # XXX This list of possibilities duplicates the list in Makefile.
  36.   for try in syscall.h sys/syscall.h sys.s sys/sys.s sys.S sys/sys.S; do
  37.     if [ -r $sysincludedir/$try ]; then
  38.       unix_syscall_h=$sysincludedir/$try
  39.       break
  40.     fi
  41.   done
  42. else
  43.   unix_syscall_h=$sysdep_dir/$unix_dir/syscall.h
  44. fi
  45.  
  46. test -n "$unix_syscall_h" && {
  47.  
  48. # These several functions are system calls on Unix systems which have them.
  49. # The details of these calls are universal enough that if a system's
  50. # <syscall.h> defines the system call number, we know that the simple
  51. # system call implementations in unix/common will be sufficient.
  52.  
  53. for unix_function in \
  54.   __dup2 __lstat __mkdir __rmdir __readlink __symlink rename swapon \
  55.   __getpgrp __access __select __getgroups/__getgrps setgroups
  56. do
  57.  
  58.   # $unix_function  =>    $unix_syscall        $unix_srcname
  59.   #    CALL            CALL            CALL
  60.   #    __CALL            CALL            __CALL
  61.   #    __CALL/NAME        CALL            NAME
  62.   unix_srcname=
  63.   eval "unix_syscall=`echo $unix_function | \
  64.                sed -e '/^__/s/^__//' \
  65.                -e 's@/\(.*\)$@ unix_srcname=\1@'`"
  66.   test -z "$unix_srcname" && unix_srcname=$unix_function
  67.  
  68.   unix_implementor=none
  69.   for unix_dir in $sysnames; do
  70.     if [ -r $sysdep_dir/$unix_dir/${unix_srcname}.c -o \
  71.      -r $sysdep_dir/$unix_dir/${unix_srcname}.S ]; then
  72.       unix_implementor=$unix_dir
  73.       break
  74.     fi
  75.   done
  76.  
  77.   # mkdir and rmdir have implementations in unix/sysv, but
  78.   # the simple syscall versions are preferable if available.
  79.   test $unix_syscall = mkdir -o $unix_syscall = rmdir && \
  80.   test $unix_implementor = unix/sysv && \
  81.     unix_implementor=generic
  82.  
  83.   case $unix_implementor in
  84.   none|stub|generic|posix)
  85.     # The chosen implementation of ${unix_syscall} is a boring one.
  86.     # We want to use the unix/common implementation instead iff
  87.     # ${unix_syscall} appears in <syscall.h>.
  88.     echo checking for ${unix_syscall} system call
  89.     if grep -i "[     _]${unix_syscall}[     ]" $unix_syscall_h >/dev/null
  90.     then
  91.       # It does seem to be present in <syscall.h>.
  92.       echo "#include <sysdeps/unix/common/${unix_srcname}.S>" \
  93.       > ${unix_srcname}.S
  94.       test -n "$verbose" && echo "    wrote ${unix_srcname}.S"
  95.     fi
  96.   ;;
  97.   *) ;;
  98.   esac
  99.  
  100. done
  101.  
  102. }
  103.