[BACK]Return to assert.m4 CVS log [TXT][DIR] Up to [local] / acopm / m4

File: [local] / acopm / m4 / assert.m4 (download)

Revision 1.1, Sat May 8 15:42:18 2021 UTC (3 years ago) by bountyht
Branch point for: MAIN

Initial revision

AC_DEFUN([ACOPM_TEST_ASSERT],
	[
		AC_MSG_CHECKING([if assert(3) is a no-op])

		AC_RUN_IFELSE(
			[
				AC_LANG_PROGRAM(
					[[
						#include <assert.h>
					]], [[
						int a = 1;
						assert(--a == 0);
						return a;
					]]
				)
			],
			[AC_MSG_RESULT([no])],
			[AC_MSG_ERROR([yes])],
			[AC_MSG_RESULT([cannot; cross-compiling])]
		)

		AC_MSG_CHECKING([if assert(3) aborts on failure])

		AC_RUN_IFELSE(
			[
				AC_LANG_PROGRAM(
					[[
						#include <assert.h>
					]], [[
						int a = 0;
						assert(a == 8); // why not
						return a;
					]]
				)
			],
			[AC_MSG_ERROR([no])],
			[AC_MSG_RESULT([yes])],
			[AC_MSG_RESULT([cannot; cross-compiling])]
		)
	]
)