1#! /bin/sh
2
3## Generate include/spu_system.h from src/config.h
4## Includes only those defines needed for the Spread Util Library API
5##
6##  This script takes the path to src/config.h as its only argument and
7##  generates a file suitable for being included as <spu_system.h>.
8
9cat <<EOF
10/* Automatically generated by gen_system_include.sh from config.h; do not edit. */
11
12/* This system header contains those constants that change upon compilation and are
13 * required for the Spread Util Library API. These should not conflict with any
14 * other definitions in other software and should be safe to include in other software.
15 */
16
17#ifndef SYSTEM_H
18#define SYSTEM_H
19
20EOF
21
22awk -f - $1 <<'---END-OF-AWK-SCRIPT---'
23
24/^#define ARCH_PC_WIN95/      { print save $1 " SPU_" $2 " " $3 "\n" }
25/^#define HAVE_UINTXX_T/  { print save $1 " SPU_" $2 " " $3 "\n" }
26/^#define HAVE_U_INT/       { print save $1 " SPU_" $2 " " $3 "\n" }
27/^#define HAVE_U_INT64_T/  { print save $1 " SPU_" $2 " " $3 "\n" }
28/^#define HAVE_U_INTXX_T/  { print save $1 " SPU_" $2 " " $3 "\n" }
29/^#define HAVE_INT64_T/  { print save $1 " SPU_" $2 " " $3 "\n" }
30/^#define HAVE_INTXX_T/  { print save $1 " SPU_" $2 " " $3 "\n" }
31/^#define HAVE_INTTYPES_H/  { print save $1 " SPU_" $2 " " $3 "\n" }
32/^#define SIZEOF_CHAR/  { print save $1 " SPU_" $2 " " $3 "\n" }
33/^#define SIZEOF_INT/  { print save $1 " SPU_" $2 " " $3 "\n" }
34/^#define SIZEOF_LONG_INT/  { print save $1 " SPU_" $2 " " $3 "\n" }
35/^#define SIZEOF_LONG_LONG_INT/  { print save $1 " SPU_" $2 " " $3 "\n" }
36/^#define SIZEOF_SHORT_INT/  { print save $1 " SPU_" $2 " " $3 "\n" }
37/^#define HAVE_STDLIB_H/  { print save $1 " SPU_" $2 " " $3 "\n" }
38/^#define HAVE_SYS_BITYPES_H/  { print save $1 " SPU_" $2 " " $3 "\n" }
39/^#define HAVE_LIMITS_H/  { print save $1 " SPU_" $2 " " $3 "\n" }
40
41
42{ save = $0 "\n" }
43
44---END-OF-AWK-SCRIPT---
45
46cat <<EOF
47
48#include "spu_system_defs.h"
49
50#endif /* SYSTEM_H */
51EOF
52