Start
[exim.git] / src / scripts / Configure-config.h
CommitLineData
61ec970d
PH
1#! /bin/sh
2# $Cambridge: exim/src/scripts/Configure-config.h,v 1.1 2004/10/06 15:07:40 ph10 Exp $
3
4# Build the config.h file, using the buildconfig program, first ensuring that
5# it exists.
6
7# 22-May-1996: remove the use of the "-a" flag for /bin/sh because it is not
8# implemented in the FreeBSD shell. Sigh.
9
10# 12-Mar-1997: add s/#.*$// to the sed script to allow for comments on the
11# ends of settings - someone got caught.
12
13# 18-Apr-1997: put the tab character into a variable to stop it getting
14# lost by accident (which has happened a couple of times).
15
16# 19-Jan-1998: indented settings in the makefile weren't being handled
17# correctly; added [$st]* before \\([A-Z] in the pattern, to ignore leading
18# space. Oddly, the pattern previously read ^\([A-Z which didn't seem to
19# cause a problem (but did when the new bit was put in).
20
21make buildconfig || exit 1
22
23# BEWARE: tab characters needed in the following sed command. They have had
24# a nasty tendency to get lost in the past, causing a problem if a tab has
25# actually been present in makefile. Use a variable to hold a space and a
26# tab to keep the tab in one place. This makes the sed option horrendous to
27# read, but the whole script is safer.
28
29st=' '
30
31(sed -n \
32 "/\\\$/d;s/#.*\$//;s/^[$st]*\\([A-Z][^:$st]*\\)[$st]*=[$st]*\\([^$st]*\\)[$st]*\$/\\1=\\2 export \\1/p" \
33 < Makefile ; echo "./buildconfig") | /bin/sh
34
35# If buildconfig ends with an error code, it will have output an error
36# message. Ensure that a broken config.h gets deleted.
37
38if [ $? != 0 ] ; then
39 rm -f config.h
40 exit 1
41fi
42
43# Double-check that config.h is complete.
44
45if [ "`tail -1 config.h`" != "/* End of config.h */" ] ; then
46 echo "*** config.h appears to be incomplete"
47 echo "*** unexpected failure in buildconfig program"
48 exit 1
49fi
50
51echo ">>> config.h built"
52echo ""
53
54# End of Configure-config.h