1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-28 17:47:29 +03:00
Stefan Metzmacher 1b3471ed0c r7425: configure check to see if a compiler can handle negative enum values
if the compiler doesn't support it we pass --uint-enums to pidl

metze
(This used to be commit c52703c0a8adb4f64ec52e4bf602e9c17ef2c748)
2007-10-10 13:17:51 -05:00

104 lines
3.3 KiB
Plaintext

dnl SMB Build Environment CC Checks
dnl -------------------------------------------------------
dnl Copyright (C) Stefan (metze) Metzmacher 2004
dnl Released under the GNU GPL
dnl -------------------------------------------------------
dnl
AC_PROG_CC
if test x"$CC" = x""; then
AC_MSG_WARN([No c compiler was not found!])
AC_MSG_ERROR([Please Install gcc from http://gcc.gnu.org/])
fi
dnl needed before AC_TRY_COMPILE
AC_ISC_POSIX
dnl Check if C compiler understands -c and -o at the same time
AC_PROG_CC_C_O
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
BROKEN_CC=
else
BROKEN_CC=#
fi
AC_SUBST(BROKEN_CC)
AC_CACHE_CHECK([that the C compiler can precompile header files],samba_cv_precompiled_headers, [
dnl Check whether the compiler can generate precompiled headers
touch conftest.h
if ${CC-cc} conftest.h 2> /dev/null && test -f conftest.h.gch; then
samba_cv_precompiled_headers=yes
else
samba_cv_precompiled_headers=no
fi])
PCH_AVAILABLE="#"
if test x"$samba_cv_precompiled_headers" = x"yes"; then
PCH_AVAILABLE=""
fi
AC_SUBST(PCH_AVAILABLE)
dnl Check if the C compiler understands volatile (it should, being ANSI).
AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
samba_cv_volatile=yes,samba_cv_volatile=no)])
if test x"$samba_cv_volatile" = x"yes"; then
AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
fi
############################################
# check if the compiler can do immediate structures
AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
AC_TRY_COMPILE([
#include <stdio.h>],
[
typedef struct {unsigned x;} FOOBAR;
#define X_FOOBAR(x) ((FOOBAR) { x })
#define FOO_ONE X_FOOBAR(1)
FOOBAR f = FOO_ONE;
static struct {
FOOBAR y;
} f2[] = {
{FOO_ONE}
};
],
samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
if test x"$samba_cv_immediate_structures" = x"yes"; then
AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
fi
############################################
# check if the compiler can handle negative enum values
AC_CACHE_CHECK([that the C compiler understands negative enum values],SMB_BUILD_CC_NEGATIVE_ENUM_VALUES, [
AC_TRY_COMPILE([
#include <stdio.h>],
[
enum negative_values { NEGATIVE_VALUE = 0xFFFFFFFF };
],
SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes,SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=no)])
if test x"$SMB_BUILD_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then
AC_MSG_WARN([using --unit-enums for pidl])
PIDL_ARGS="$PIDL_ARGS --uint-enums"
fi
AC_MSG_CHECKING([for test routines])
AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
AC_MSG_RESULT(yes),
AC_MSG_ERROR([cant find test code. Aborting config]),
AC_MSG_WARN([cannot run when cross-compiling]))
#
# Check if the compiler can handle the options we selected by
# --enable-*developer
#
if test -n "$DEVELOPER_CFLAGS"; then
OLD_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
AC_MSG_CHECKING([that the C compiler can use the DEVELOPER_CFLAGS])
AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
AC_MSG_RESULT(yes),
DEVELOPER_CFLAGS=""; AC_MSG_RESULT(no),
AC_MSG_WARN([cannot run when cross-compiling]))
CFLAGS="${OLD_CFLAGS}"
fi