diff --git a/configure.ac b/configure.ac index a7a10bf6..68a52b8a 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,10 @@ AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes]) AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes]) AM_CONDITIONAL(MACOS, [test "x$macos" = xyes]) +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([void *]) + AC_ARG_WITH([socketdir], [AS_HELP_STRING([--with-socketdir=DIR], [Use directory for UNIX sockets (default: /tmp/.xrdp)])], diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c index e91672fb..1037dccf 100644 --- a/xrdp/xrdp.c +++ b/xrdp/xrdp.c @@ -405,23 +405,17 @@ xrdp_sanity_check(void) #endif /* check long, int and void* sizes */ - if (sizeof(int) != 4) - { - g_writeln("unusable int size, must be 4"); - return 1; - } +#if SIZEOF_INT != 4 +# error unusable int size, must be 4 +#endif - if (sizeof(long) != sizeof(void *)) - { - g_writeln("long size must match void* size"); - return 1; - } +#if SIZEOF_LONG != SIZEOF_VOID_P +# error sizeof(long) must match sizeof(void*) +#endif - if (sizeof(long) != 4 && sizeof(long) != 8) - { - g_writeln("unusable long size, must be 4 or 8"); - return 1; - } +#if SIZEOF_LONG != 4 && SIZEOF_LONG != 8 +# error sizeof(long), must be 4 or 8 +#endif if (sizeof(tui64) != 8) { diff --git a/xrdp/xrdpwin.c b/xrdp/xrdpwin.c index 1544e7c3..6a7836b4 100644 --- a/xrdp/xrdpwin.c +++ b/xrdp/xrdpwin.c @@ -315,23 +315,17 @@ main(int argc, char **argv) } /* check long, int and void* sizes */ - if (sizeof(int) != 4) - { - g_writeln("unusable int size, must be 4"); - return 0; - } +#if SIZEOF_INT != 4 +# error unusable int size, must be 4 +#endif - if (sizeof(long) != sizeof(void *)) - { - g_writeln("long size must match void* size"); - return 0; - } +#if SIZEOF_LONG != SIZEOF_VOID_P +# error sizeof(long) must match sizeof(void*) +#endif - if (sizeof(long) != 4 && sizeof(long) != 8) - { - g_writeln("unusable long size, must be 4 or 8"); - return 0; - } +#if SIZEOF_LONG != 4 && SIZEOF_LONG != 8 +# error sizeof(long), must be 4 or 8 +#endif if (sizeof(tui64) != 8) {