annotate src/osdef.sh @ 2984:aa40bddeea9a v7.3.264

updated for version 7.3.264 Problem: When the current directory name contains wildcard characters, such as "foo[with]bar", the tags file can't be found. (Jeremy Erickson) Solution: When searching for matching files also match without expanding wildcards. This is a bit of a hack.
author Bram Moolenaar <bram@vim.org>
date Wed, 27 Jul 2011 17:31:47 +0200
parents 3fc0f57ecb91
children efa40be729c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 #! /bin/sh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 # osdef.sh -- copy osdef.h.in to osdef.h while removing declarations
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 # found in the system header files. Caution: weird sed magic going on here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 # Warnings are printed if sed did not survive.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 # (C) Michael Schroeder, Juergen Weigert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 # osdef.h.in has been split into osdef1.h.in and osdef2.h.in, because some
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 # sed's could not handle the amount of commands (is 50 commands the limit?).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 #
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 # 31.10.95 jw.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 if test -z "$CC"; then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 CC=cc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 if test -z "$srcdir"; then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 srcdir=.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 rm -f core* *.core
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 cat << EOF > osdef0.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 #ifndef __APPLE__
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 # define select select_declared_wrong
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 #define tgetstr tgetstr_declared_wrong
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 #include "auto/config.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 #include "os_unix.h" /* bring in most header files, more follow below */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 #include "os_unixx.h" /* bring in header files for os_unix.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 #ifdef HAVE_TERMCAP_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 # include <termcap.h> /* only for term.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #ifdef HAVE_FCNTL_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 # include <fcntl.h> /* only used in a few files */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 #ifdef HAVE_SYS_STATFS_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 # include <sys/types.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 # include <sys/statfs.h> /* only for memfile.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 #ifdef HAVE_X11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 # include <X11/Intrinsic.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 EOF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 # Mac uses precompiled headers, but we need real headers here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 case `uname` in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 Darwin) $CC -I. -I$srcdir -E -no-cpp-precomp osdef0.c >osdef0.cc;;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 *) $CC -I. -I$srcdir -E osdef0.c >osdef0.cc;;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 esac
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 # insert a space in front of each line, so that a function name at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 # start of the line is matched with "[)*, ]\1[ (]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 sed < osdef0.cc -e '/\(..*\)/s// \1/' > osdef0.ccc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 sed < $srcdir/osdef1.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\) __ARGS.*@/[)*, ][(]*\1[)]*[ (]/i\\\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 \\/\\[^a-zA-Z_\\]\1 __ARGS\\/d@p' > osdef11.sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 sed < $srcdir/osdef2.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([a-zA-Z_][a-zA-Z0-9_]*\) __ARGS.*@/[)*, ][(]*\1[)]*[ (]/i\\\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 \\/\\[^a-zA-Z_\\]\1 __ARGS\\/d@p' > osdef21.sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 cat << EOF > osdef2.sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 1i\\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 1i\\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 * osdef.h is automagically created from osdef?.h.in by osdef.sh -- DO NOT EDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 1i\\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 EOF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 cat osdef0.ccc | sed -n -f osdef11.sed >> osdef2.sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 sed -f osdef2.sed < $srcdir/osdef1.h.in > auto/osdef.h
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 cat osdef0.ccc | sed -n -f osdef21.sed > osdef2.sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 sed -f osdef2.sed < $srcdir/osdef2.h.in >> auto/osdef.h
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 rm osdef0.c osdef0.cc osdef0.ccc osdef11.sed osdef21.sed osdef2.sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 if test -f core*; then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 file core*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 echo " Sorry, your sed is broken. Call the system administrator."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 echo " Meanwhile, you may try to compile Vim with an empty osdef.h file."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 echo " If you compiler complains about missing prototypes, move the needed"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 echo " ones from osdef1.h.in and osdef2.h.in to osdef.h."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 exit 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 cat $srcdir/osdef1.h.in $srcdir/osdef2.h.in >osdefX.h.in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 if eval test "`diff auto/osdef.h osdefX.h.in | wc -l`" -eq 4; then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 echo " Hmm, sed is very pessimistic about your system header files."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 echo " But it did not dump core -- strange! Let's continue carefully..."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 echo " If this fails, you may want to remove offending lines from osdef.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 echo " or try with an empty osdef.h file, if your compiler can do without"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 echo " function declarations."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 fi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 rm osdefX.h.in