put /local/librnd/compat_inc [@

@?/host/libs/fs/realpath/includes@
@?libs/ldl/includes@
@?libs/LoadLibrary/includes@
@?libs/fs/getcwd/includes@
@?libs/fs/_getcwd/includes@
@?libs/fs/getwd/includes@
@?/target/libs/proc/wait/includes@
@?/target/libs/proc/fork/includes@
@?/target/libs/proc/_spawnvp/includes@
@?/target/libs/fs/mkdir/includes@
@?/target/libs/fs/_mkdir/includes@
@?/target/libs/fs/mkdtemp/includes@
@?/target/libs/userpass/getpwuid/includes@
@?/target/libs/math/round/includes@
@?/target/libs/env/setenv/includes@
@?/target/libs/fs/readdir/includes@
@?/target/libs/io/fileno/includes@
@?/target/libs/time/Sleep/includes@
@?/target/libs/time/usleep/includes@
@?/target/libs/time/gettimeofday/includes@
@?/target/libs/socket/select/includes@
@]

put /tmpasm/IFS {\n}
put /local/OFS_save /tmpasm/OFS
put /tmpasm/OFS {\n}
gsub /local/librnd/compat_inc {\\\\n *} {\n}
uniq /local/librnd/compat_inc /local/librnd/compat_inc {#define} {#include}

# do not redefine _XOPEN_SOURCE, which is hardwired in this template
gsub /local/librnd/compat_inc {#define *_XOPEN_SOURCE} {}

put /tmpasm/OFS /local/OFS_save


print [@
/*** DO NOT EDIT - automatically generated by scconfig ***/

#ifndef RND_COMPAT_INC
#define RND_COMPAT_INC

#ifndef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#endif

#define _XOPEN_SOURCE 500

/* system-dependent includes, as detected in ./configure */

@/local/librnd/compat_inc@

/* These are required for stat() but are C89. Keeping them here, just in case. */
#include <sys/types.h>
#include <sys/stat.h>


/* Name of fileno() differs on windows */
#define RND_HOST_FILENO(f) @/target/libs/io/fileno/call@(f)

#endif
@]


