put /tmpasm/IFS {\n}
put /tmpasm/OFS {\n}

put /local/includes ?sys/types/size_t/includes
gsub /local/includes {\\\\n *} {\n}
uniq /local/includes

put /tmpasm/OFS {}
put /tmpasm/IFS {}

print [@
/* Autogenerated by ./configure from conf.h.in - DO NOT EDIT */
#ifndef LIBMAWK_CONF_H
#define LIBMAWK_CONF_H

#define LMAWK_VER "@/local/version/1@.@/local/version/2@.@/local/version/3@"

#define _XOPEN_SOURCE 600

@/local/includes@

@]

switch /local/numeric
case {int} print [@
/* numeric is int, do not use floating point */
#define MAWK_NO_FLOAT
@]
end

case {double} print [@
/* numeric is double, use floating point */
#undef MAWK_NO_FLOAT
@]
end
end

print {\n\n/* Whether realpath is available */\n}
print_ternary ?libs/fs/realpath/presents     {#define mawk_realpath realpath} {#undef mawk_realpath}

print {\n\n/* Whether pipe(2) is available */\n}
print_ternary ?libs/io/pipe/presents         {#undef MAWK_NO_PIPE} {#define MAWK_NO_PIPE 1}

print [@
/* === math_wrap */
@]

print {/* log() */\n}
switch ?libs/math/cc/log/m_0/errno
	case {0} print {#define P_MBROKEN_LOG_M_0\n}; end
	default print {/* #define P_MBROKEN_LOG_M_0 */\n}; end
end

switch ?libs/math/cc/log/p_0/errno
	case {0} print {#define P_MBROKEN_LOG_P_0\n}; end
	default print {/* #define P_MBROKEN_LOG_P_0 */\n}; end
end

switch ?libs/math/cc/log/p_1/errno
	case {0} print {#define P_MBROKEN_LOG_P_1\n}; end
	default print {/* #define P_MBROKEN_LOG_P_1 */\n}; end
end

print {\n\n/* Defined if NaN works as expected in all operations */\n}
print_ternary ?libs/math/nanop/allok  {#define MAWK_HAVE_SAFE_NAN} {/* #define MAWK_HAVE_SAFE_NAN */}

print [@
/* defined if all static global allocations such as builtin variables
   should be freed. Pros: easier memory leak testing (no builtin leaks);
   cons: zmalloc's uninit will throw them out in less cpu cycles.
*/
/* #define MAWK_MEM_PEDANTIC */
@]

print {\n/* Code warnings for TODO, portable (unlike #warning) */}
if ?cc/pragma_message
then
print [@
#define DO_PRAGMA(arg) _Pragma(#arg)
#define TODO(x) DO_PRAGMA(message("TODO: " #x))
@]
else
print {\n/* Not available */\n#define TODO(x)\n}
end

print [@
#endif

@]
