1#!/bin/sh
2
3if [ $# -lt 3 ]
4then
5    echo "Usage: $0 srcdir builddir compiler"
6    exit 1
7fi
8
9uname=`uname -a`
10date=`date`
11srcdir=$1
12builddir=$2
13compiler=$3
14
15if [ ! "x$USER" = "x" ]; then
16    whoami=$USER
17else 
18    if [ ! "x$LOGNAME" = "x" ]; then
19	whoami=$LOGNAME
20    else
21	whoami=`whoami || id -un`
22    fi
23fi
24
25host=`hostname`
26
27cat <<EOF
28/* This file is automatically generated with "make include/build_env.h". DO NOT EDIT */
29
30#ifndef _BUILD_ENV_H
31#define _BUILD_ENV_H
32
33#define BUILD_ENV_UNAME "${uname}"
34#define BUILD_ENV_DATE "${date}"
35#define BUILD_ENV_SRCDIR "${srcdir}"
36#define BUILD_ENV_BUILDDIR "${builddir}"
37#define BUILD_ENV_USER "${whoami}"
38#define BUILD_ENV_HOST "${host}"
39#define BUILD_ENV_COMPILER "${compiler}"
40#endif /* _BUILD_ENV_H */
41EOF
42