1#! /bin/sh 2 3# edit this to taste; note that you can also override via the environment: 4case "$CC" in 5 "") CC=cc 6esac 7 8if test -f config.h; then :; else 9 echo "Creating basic config.h..." 10 cat >config.h <<'END_OF_CONFIG_H' 11/* A bootstrap version of config.h, for systems which can't 12 auto-configure due to a lack of a working sed. If you are on 13 a sufficiently odd machine you may need to hand-tweak this file. 14 15 Regardless, once you get a working version of sed you really should 16 re-build starting with a run of "configure", as the bootstrap 17 version is almost certainly more crippled than it needs to be on 18 your machine. 19*/ 20 21#define PACKAGE "sed" 22#define PACKAGE_BUGREPORT "bug-gnu-utils@gnu.org" 23#define VERSION "4.2.1-boot" 24#define SED_FEATURE_VERSION "4.2" 25#define BOOTSTRAP 1 26 27#ifndef _GNU_SOURCE 28#define _GNU_SOURCE 1 29#endif 30 31/* Define if your compiler/headers don't support const. */ 32#undef const 33#define __getopt_argv_const const 34 35/* Define if headers have no definition. */ 36/* #define mbstate_t int */ 37#define HAVE_WCHAR_H 1 38#define HAVE_MBRTOWC 1 39 40/* Toggle if you encounter errors in lib/mkstemp.c. */ 41#define HAVE_UNISTD_H 1 42#define HAVE_FCNTL_H 1 43#undef HAVE_SYS_FILE_H 44#undef HAVE_IO_H 45 46/* Emulate stdbool.h. */ 47#define bool int 48#define true 1 49#define false 0 50 51/* Avoid uselessly complicated gnulib stuff. */ 52#define _LOCALCHARSET_H 53#define locale_charset() "C" 54 55/* All other config.h.in options intentionally omitted. Report as a 56 bug if you need extra "#define"s in here. */ 57 58END_OF_CONFIG_H 59 60 cat > conftest.c << \EOF 61#define size_t unsigned 62#include <sys/types.h> 63#include <stdio.h> 64 65size_t s; 66EOF 67 if $CC -c conftest.c -o conftest.o > /dev/null 2>&1 ; then 68 echo '#define size_t unsigned' >> config.h 69 echo checking for size_t... no 70 else 71 echo checking for size_t... yes 72 fi 73 74 cat > conftest.c << \EOF 75#define ssize_t int 76#include <sys/types.h> 77#include <stdio.h> 78 79ssize_t s; 80EOF 81 if $CC -c conftest.c -o conftest.o > /dev/null 2>&1 ; then 82 echo '#define ssize_t int' >> config.h 83 echo checking for ssize_t... no 84 else 85 echo checking for ssize_t... yes 86 fi 87 88 cat > conftest.c << \EOF 89void *foo; 90 91EOF 92 if $CC -c conftest.c -o conftest.o > /dev/null 2>&1 ; then 93 echo checking for void *... yes 94 else 95 echo '#define VOID char' >> config.h 96 echo checking for void *... no 97 fi 98 99 rm -f conftest.* 100 101 cat >> config.h << \EOF 102#include <sys/types.h> 103#include <stdio.h> 104EOF 105 106fi 107 108# tell the user what we're doing from here on... 109set -x -e 110 111# the ``|| exit 1''s are for fail-stop; set -e doesn't work on some systems 112 113rm -f lib/*.o sed/*.o sed/sed 114cd lib || exit 1 115cp alloca.in.h alloca.h || exit 1 116${CC} -DHAVE_CONFIG_H -I.. -I. -c alloca.c || exit 1 117${CC} -DHAVE_CONFIG_H -I.. -I. -c copy-acl.c || exit 1 118${CC} -DHAVE_CONFIG_H -I.. -I. -c error.c || exit 1 119${CC} -DHAVE_CONFIG_H -I.. -I. -c exitfail.c || exit 1 120${CC} -DHAVE_CONFIG_H -I.. -I. -c file-has-acl.c || exit 1 121${CC} -DHAVE_CONFIG_H -I.. -I. -c getdelim.c || exit 1 122${CC} -DHAVE_CONFIG_H -I.. -I. -c getline.c || exit 1 123${CC} -DHAVE_CONFIG_H -I.. -I. -c getopt.c || exit 1 124${CC} -DHAVE_CONFIG_H -I.. -I. -c getopt1.c || exit 1 125${CC} -DHAVE_CONFIG_H -I.. -I. -c malloc.c || exit 1 126${CC} -DHAVE_CONFIG_H -I.. -I. -c mkstemp.c || exit 1 127${CC} -DHAVE_CONFIG_H -I.. -I. -c obstack.c || exit 1 128${CC} -DHAVE_CONFIG_H -I.. -I. -c quote.c || exit 1 129${CC} -DHAVE_CONFIG_H -I.. -I. -c quotearg.c || exit 1 130${CC} -DHAVE_CONFIG_H -I.. -I. -c regex.c || exit 1 131${CC} -DHAVE_CONFIG_H -I.. -I. -c set-mode-acl.c || exit 1 132${CC} -DHAVE_CONFIG_H -I.. -I. -c strerror.c || exit 1 133${CC} -DHAVE_CONFIG_H -I.. -I. -c strverscmp.c || exit 1 134${CC} -DHAVE_CONFIG_H -I.. -I. -c tempname.c || exit 1 135${CC} -DHAVE_CONFIG_H -I.. -I. -c xalloc-die.c || exit 1 136${CC} -DHAVE_CONFIG_H -I.. -I. -c xmalloc.c || exit 1 137 138cd ../sed || exit 1 139${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c sed.c || exit 1 140${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c fmt.c || exit 1 141${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c compile.c || exit 1 142${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c execute.c || exit 1 143${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c mbcs.c || exit 1 144${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c regexp.c || exit 1 145${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c utils.c || exit 1 146 147${CC} -o sed *.o ../lib/*.o || exit 1 148