libk  def.h.m at [cfbfa7fcca]

File mod/kcore/def.h.m artifact 2981fff8c9 part of check-in cfbfa7fcca


dnl kcore/def.h.m → <k/def.h>
dnl ~ lexi hale <lexi@hale.su>
dnl this file gathers information on the environment it's
dnl being compiled in, setting macros that other headers
dnl need. it will be emitted as <k/def.h>.
dnl vim: ft=m4
#ifndef KIdef
#define KIdef
define(`_atom',0)dnl
define(`def',`#define $1 $2')dnl
define(`defatom',`def($1,$2$3)')dnl
define(`newatom',`def($1,_atom)
	define(`_atom',incr(_atom))')dnl

ifdef(`atom_target_bits',`
	define(`target',`atom_target_arch.atom_target_os.atom_target_bits')
	def(KVbits,atom_target_bits)',`
	define(`target',atom_target_arch.atom_target_os)')

newatom(KA_os_lin)dnl
newatom(KA_os_fbsd)dnl
newatom(KA_os_obsd)dnl
newatom(KA_os_nbsd)dnl
newatom(KA_os_dar)dnl
newatom(KA_os_osx)dnl
newatom(KA_os_and)dnl
newatom(KA_os_hai)dnl
newatom(KA_os_win)dnl

newatom(KA_arch_x86)dnl
newatom(KA_arch_arm)dnl
newatom(KA_arch_ppc)dnl
newatom(KA_arch_mips)dnl
newatom(KA_arch_itan)dnl

defatom(KVos,KA_os_,atom_target_os)
defatom(KVarch,KA_arch_,atom_target_arch)

ifelse(target_unix,`yes',
		`def(`KFenv_unix',)
		def(`KFenv_posix',)',`
		ifelse(target_posix,`yes',
			`def(KFenv_posix)')')

#define Kpragma(p) _Pragma(#p)
#if defined(__GNUC__) || defined(__clang__)
#   define Kerror(msg) Kpragma(GCC error #msg) 
#else
#   define Kerror(msg) Kpragma(message #msg)
#endif
def(`Knoimpl(fn)', Kerror(no implementation of fn for platform target))

#endif