use strict;
use warnings;
use Config;

open(OUT, ">config.h") or die "Failed to open config.h for output";

print OUT <<"EOH";
/* This file has been autogenerated by config.h.PL. Any changes
 * made to this file will be lost. Edit config.h.PL instead. */
#ifndef __TCPP_CONFIG_H__
#define __TCPP_CONFIG_H__

/* These control system.h */

EOH

print OUT "#define HAVE_FCNTL_H 1\n" if $Config{i_fcntl};
print OUT "#define HAVE_LIMITS_H 1\n" if $Config{i_limits};
print OUT "#define HAVE_MALLOC_H 1\n" if $Config{i_malloc};
print OUT "#define HAVE_STDDEF_H 1\n" if $Config{i_stddef};
print OUT "#define HAVE_STDLIB_H 1\n" if $Config{i_stdlib};
print OUT "#define HAVE_STRING_H 1\n" if $Config{i_string};
print OUT "#define HAVE_SYS_FILE_H 1\n" if $Config{i_sysfile};
print OUT "#define HAVE_SYS_PARAM_H 1\n" if $Config{i_sysparam};
print OUT "#define HAVE_SYS_STAT_H 1\n" if $Config{i_sysstat};
print OUT "#define HAVE_SYS_WAIT_H 1\n" if $Config{i_syswait};
print OUT "#define HAVE_UNISTD_H 1\n" if $Config{i_unistd};

if ($Config{i_systime} && $Config{i_time}) {
	print OUT "#define TIME_WITH_SYS_TIME 1\n";
}
print OUT "#define HAVE_TIME_H 1\n" if $Config{i_time};
print OUT "#define HAVE_SYS_TIME_H 1\n" if $Config{i_systime};
# print OUT "#define HAVE_STRSIGNAL 1\n" if $Config{i_foo} eq 'define';

print OUT <<"EOF"


/* HAVE_DOS_BASED_FILE_SYSTEM */

#$Config{d_volatile} HAVE_VOLATILE


#include "global.h"

#endif
EOF

__END__

#if 0
HAVE__BOOL
HAVE_DECL_ABORT
HAVE_DECL_ATOF
HAVE_DECL_ATOL
HAVE_DECL_CALLOC
HAVE_DECL_ERRNO
HAVE_DECL_FPRINTF_UNLOCKED
HAVE_DECL_FPUTS_UNLOCKED
HAVE_DECL_FREE
HAVE_DECL_FWRITE_UNLOCKED
HAVE_DECL_GETCWD
HAVE_DECL_GETENV
HAVE_DECL_GETOPT
HAVE_DECL_GETRLIMIT
HAVE_DECL_GETWD
HAVE_DECL_MALLOC
HAVE_DECL_PUTC_UNLOCKED
HAVE_DECL_REALLOC
HAVE_DECL_SBRK
HAVE_DECL_SETRLIMIT
HAVE_DECL_STRSTR
HAVE_DESIGNATED_INITIALIZERS
HAVE_DOS_BASED_FILE_SYSTEM
HAVE_FCNTL_H
HAVE_FPRINTF_UNLOCKED
HAVE_FPUTC_UNLOCKED
HAVE_FPUTS_UNLOCKED
HAVE_FWRITE_UNLOCKED
HAVE_GETRLIMIT
HAVE_LIMITS_H
HAVE_MALLOC_H
HAVE_PRINTF_PTR
HAVE_PUTC_UNLOCKED
HAVE_SETRLIMIT
HAVE_STDBOOL_H
HAVE_STDDEF_H
HAVE_STDLIB_H
HAVE_STRING_H
HAVE_STRINGS_H
HAVE_STRSIGNAL
HAVE_SYS_FILE_H
HAVE_SYS_PARAM_H
HAVE_SYS_STAT_H
HAVE_SYS_TIME_H
HAVE_SYS_WAIT_H
HAVE_TIME_H
HAVE_UNISTD_H
HAVE_VOLATILE
#endif


# These have not been dealt with.

HAVE__BOOL
HAVE_DECL_ABORT
HAVE_DECL_ATOF
HAVE_DECL_ATOL
HAVE_DECL_CALLOC
HAVE_DECL_ERRNO
HAVE_DECL_FREE
HAVE_DECL_GETCWD
HAVE_DECL_GETENV
HAVE_DECL_GETOPT
HAVE_DECL_GETRLIMIT
HAVE_DECL_GETWD
HAVE_DECL_MALLOC
HAVE_DECL_REALLOC
HAVE_DECL_SBRK
HAVE_DECL_SETRLIMIT
HAVE_DECL_STRSTR

# Not provided by Perl

#$Config{i_strings} HAVE_STRINGS_H 1
