view src/ @ 18478:94223687df0e

Added tag v8.1.2233 for changeset e93cab5d0f0f27fad7882f1f412927df055b090d
author Bram Moolenaar <>
date Tue, 29 Oct 2019 04:30:05 +0100
parents c4f8b1d48f20
children befdf44737d1
line wrap: on
line source

#! /bin/sh
# -- copy to osdef.h while removing declarations
# found in the system header files. Caution: weird sed magic going on here.
# Warnings are printed if sed did not survive.
# (C) Michael Schroeder, Juergen Weigert
# has been split into and, because some
# sed's could not handle the amount of commands (is 50 commands the limit?).
# 31.10.95 jw.

if test -z "$CC"; then
if test -z "$srcdir"; then

rm -f core* *.core

cat << EOF > osdef0.c
#ifndef __APPLE__
# define select select_declared_wrong
#define tgetstr tgetstr_declared_wrong
#include "auto/config.h"
#include "os_unix.h"	/* bring in most header files, more follow below */
#include "os_unixx.h"	/* bring in header files for os_unix.c */

# include <termcap.h>	/* only for term.c */

# include <fcntl.h>		/* only used in a few files */

# include <sys/types.h>
# include <sys/statfs.h>	/* only for memfile.c */

#ifdef HAVE_X11
# include <X11/Intrinsic.h>

$CC -I. -I$srcdir -E osdef0.c >

# insert a space in front of each line, so that a function name at the
# start of the line is matched with "[)*, 	]\1[ 	(]"
sed < -e '/\(..*\)/s// \1/' > osdef0.ccc

sed < $srcdir/ -n -e '/^extern/s@.*[)* 	][)* 	]*\([a-zA-Z_][a-zA-Z0-9_]*\)(.*@/[)*, 	][(]*\1[)]*[ 	(]/i\\\
\\/\\[^a-zA-Z_\\]\1(\\/d@p' > osdef11.sed

sed < $srcdir/ -n -e '/^extern/s@.*[)* 	][)* 	]*\([a-zA-Z_][a-zA-Z0-9_]*\)(.*@/[)*, 	][(]*\1[)]*[ 	(]/i\\\
\\/\\[^a-zA-Z_\\]\1(\\/d@p' > osdef21.sed

cat << EOF > osdef2.sed
 * osdef.h is automagically created from osdef? by -- DO NOT EDIT

cat osdef0.ccc | sed -n -f osdef11.sed >> osdef2.sed
sed -f osdef2.sed < $srcdir/ > auto/osdef.h

cat osdef0.ccc | sed -n -f osdef21.sed > osdef2.sed
sed -f osdef2.sed < $srcdir/ >> auto/osdef.h

rm osdef0.c osdef0.ccc osdef11.sed osdef21.sed osdef2.sed

if test -f core*; then
  file core*
  echo "  Sorry, your sed is broken. Call the system administrator."
  echo "  Meanwhile, you may try to compile Vim with an empty osdef.h file."
  echo "  If you compiler complains about missing prototypes, move the needed"
  echo "  ones from and to osdef.h."
  exit 1
cat $srcdir/ $srcdir/ >
if eval test "`diff auto/osdef.h | wc -l`" -eq 4; then
  echo "  Hmm, sed is very pessimistic about your system header files."
  echo "  But it did not dump core -- strange! Let's continue carefully..."
  echo "  If this fails, you may want to remove offending lines from osdef.h"
  echo "  or try with an empty osdef.h file, if your compiler can do without"
  echo "  function declarations."