#!/bin/sh
#
# $Id: preconfig,v 1.12 1999/09/29 15:17:02 ssb Exp $

disclaimer="Do NOT edit - this file is generated by preconfig"

# security check - simply overwriting existing files could be harmful
if test -w acconfig.h.new ; then
	echo "Please remove acconfig.h.new and rerun this command"
	exit 1
fi

echo "/* $disclaimer */" > acconfig.h.new
cat acconfig.h.in >> acconfig.h.new
confighfiles=`echo ext/*/config.h.stub`
if test "$confighfiles" != "ext/*/config.h.stub"; then
    for file in $confighfiles; do
	cat $file >> acconfig.h.new
    done
fi
confighfiles=`echo sapi/*/config.h.stub`
if test "$confighfiles" != "sapi/*/config.h.stub"; then
    for file in $confighfiles; do
	cat $file >> acconfig.h.new
    done
fi
cmp acconfig.h acconfig.h.new > /dev/null 2>&1
if test $? -ne 0 ; then
    mv acconfig.h.new acconfig.h
else
    rm -f acconfig.h.new
fi
