| 1 | #! /bin/sh | 
|---|
| 2 |  | 
|---|
| 3 | # edit this to taste; note that you can also override via the environment: | 
|---|
| 4 | case "$CC" in | 
|---|
| 5 | "") CC=cc | 
|---|
| 6 | esac | 
|---|
| 7 |  | 
|---|
| 8 | if 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 VERSION "@VERSION@-boot" | 
|---|
| 23 | #define SED_FEATURE_VERSION "@SED_FEATURE_VERSION@" | 
|---|
| 24 | #define BOOTSTRAP 1 | 
|---|
| 25 |  | 
|---|
| 26 | /* Define if your compiler/headers don't support const. */ | 
|---|
| 27 | #undef const | 
|---|
| 28 |  | 
|---|
| 29 | /* Undefine if headers have conflicting definition.  */ | 
|---|
| 30 | #define mbstate_t int | 
|---|
| 31 |  | 
|---|
| 32 | /* Toggle if you encounter errors in lib/mkstemp.c.  */ | 
|---|
| 33 | #define HAVE_UNISTD_H | 
|---|
| 34 | #define HAVE_FCNTL_H | 
|---|
| 35 | #undef HAVE_SYS_FILE_H | 
|---|
| 36 | #undef HAVE_IO_H | 
|---|
| 37 |  | 
|---|
| 38 | /* Undefine if <stdio.h> or <sys/types.h> has conflicting definition.  */ | 
|---|
| 39 | #define size_t unsigned | 
|---|
| 40 | #define ssize_t int | 
|---|
| 41 |  | 
|---|
| 42 | /* If your antique compiler doesn't grok ``void *'', then #define VOID char */ | 
|---|
| 43 | #undef VOID | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 | /* All other config.h.in options intentionally omitted.  Report as a | 
|---|
| 47 | bug if you need extra "#define"s in here. */ | 
|---|
| 48 | END_OF_CONFIG_H | 
|---|
| 49 | fi | 
|---|
| 50 |  | 
|---|
| 51 | # tell the user what we're doing from here on... | 
|---|
| 52 | set -x -e | 
|---|
| 53 |  | 
|---|
| 54 | # the ``|| exit 1''s are for fail-stop; set -e doesn't work on some systems | 
|---|
| 55 |  | 
|---|
| 56 | rm -f lib/*.o sed/*.o sed/sed | 
|---|
| 57 | cd lib || exit 1 | 
|---|
| 58 | rm -f regex.h | 
|---|
| 59 | cp regex_.h regex.h | 
|---|
| 60 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c alloca.c | 
|---|
| 61 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c getline.c || exit 1 | 
|---|
| 62 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c getopt.c || exit 1 | 
|---|
| 63 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c getopt1.c || exit 1 | 
|---|
| 64 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c memchr.c || exit 1 | 
|---|
| 65 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c memcmp.c || exit 1 | 
|---|
| 66 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c memmove.c || exit 1 | 
|---|
| 67 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c mkstemp.c || exit 1 | 
|---|
| 68 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c strverscmp.c || exit 1 | 
|---|
| 69 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c obstack.c || exit 1 | 
|---|
| 70 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c regex.c || exit 1 | 
|---|
| 71 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c strerror.c || exit 1 | 
|---|
| 72 | ${CC} -DHAVE_CONFIG_H -I.. -I. -c utils.c || exit 1 | 
|---|
| 73 |  | 
|---|
| 74 | cd ../sed || exit 1 | 
|---|
| 75 | ${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c sed.c || exit 1 | 
|---|
| 76 | ${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c fmt.c || exit 1 | 
|---|
| 77 | ${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c compile.c || exit 1 | 
|---|
| 78 | ${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c execute.c || exit 1 | 
|---|
| 79 | ${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c mbcs.c || exit 1 | 
|---|
| 80 | ${CC} -DHAVE_CONFIG_H -I.. -I. -I../lib -c regexp.c || exit 1 | 
|---|
| 81 |  | 
|---|
| 82 | ${CC} -o sed *.o ../lib/*.o || exit 1 | 
|---|