/*
 * test for posix_memalign function
 *
 * This file is automatically generated by Configure
 * from test_c.in.
 */
#include <@malloc_header@>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
	void * p;
	size_t s = 256;
	/*
	 * at least glibc 2.2.4's posix_memalign is broken
	 * (it checks size for being a power of 2 instead of alignment)
	 *
	 * TODO only disable memalign_if_possible (which may have
	 *      arbitrary allocation size)
	 */
	int i = posix_memalign(&p, s, 177);
       puts(((@ptrcast@)p & 0xff) == 0 && i == 0 ? "ok" : "nix");
	return i;
}
