SPDX: Mass-update to GPL-2.0-or-later
[exim.git] / src / scripts / Configure-os.h
1 #! /bin/sh
2 # Copyright (c) The Exim Maintainters 2022
3 # SPDX-License-Identifier: GPL-2.0-or-later
4
5
6 # Shell script to create a link to the appropriate OS-specific header file.
7
8 scripts=../scripts
9
10 # Get the OS type, and check that there is a make file for it.
11
12 os=`$scripts/os-type -generic` || exit 1
13
14 if      test ! -r ../OS/Makefile-$os
15 then    echo ""
16         echo "*** Sorry - operating system $os is not supported"
17         echo "*** See OS/Makefile-* for supported systems" 1>&2
18         echo ""
19         exit 1;
20 fi
21
22 # Ensure there is an OS-specific header file, and link it to os.h. There should
23 # always be one if there is a make file for the OS, so its absence is somewhat
24 # disastrous.
25
26 if      test ! -r ../OS/os.h-$os
27 then    echo ""
28         echo "*** Build error: OS/os.h-$os file is missing"
29         echo ""
30         exit 1;
31 fi
32 rm -f os.h
33
34 # In order to accommodate for the fudge below, copy the file instead of
35 # symlinking it. Otherwise we pollute the clean copy with the fudge.
36 cp -p ../OS/os.h-$os os.h || exit 1
37
38 # Special-purpose fudge for older versions of Linux (pre 2.1.15) that
39 # use the structure name "options" instead of "ip_options".
40
41 if [ "$os" != "Linux" -a "$os" != "Linux-libc5" ] ; then exit 0; fi
42
43 grep ip_options /usr/include/linux/ip.h >/dev/null
44 if [ $? = 0 ] ; then exit 0; fi
45
46 cat >>os.h <<End
47
48 /* Fudge added because this Linux doesn't appear to have a definition
49 for ip_options in /usr/include/linux/ip.h. */
50
51 #define ip_options options
52 End
53
54 # End of Configure-os.h