Two patches which fix issues on cross compiling/building
[samba.git] / source4 / build / m4 / check_cc.m4
index 324ddb3c030ee4a940addb13934c9999ba1b8d15..32e4b5083ddddce13a03c3658e5955bd7adf721f 100644 (file)
@@ -30,7 +30,7 @@ fi
 # check if the compiler can handle negative enum values
 # and don't truncate the values to INT_MAX
 # a runtime test is needed here
-AC_CACHE_CHECK([that the C compiler understands negative enum values],SMB_BUILD_CC_NEGATIVE_ENUM_VALUES, [
+AC_CACHE_CHECK([that the C compiler understands negative enum values],samba_cv_CC_NEGATIVE_ENUM_VALUES, [
     AC_TRY_RUN(
 [
        #include <stdio.h>
@@ -45,14 +45,15 @@ AC_CACHE_CHECK([that the C compiler understands negative enum values],SMB_BUILD_
                return 0;
        }
 ],
-       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"
+       samba_cv_CC_NEGATIVE_ENUM_VALUES=yes,
+       samba_cv_CC_NEGATIVE_ENUM_VALUES=no,
+       samba_cv_CC_NEGATIVE_ENUM_VALUES=yes)])
+if test x"$samba_cv_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then
+       AC_DEFINE(USE_UINT_ENUMS, 1, [Whether the compiler has uint enum support])
 fi
 
 AC_MSG_CHECKING([for test routines])
-AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
+AC_TRY_RUN([#include "${srcdir-.}/../tests/trivial.c"],
            AC_MSG_RESULT(yes),
            AC_MSG_ERROR([cant find test code. Aborting config]),
            AC_MSG_WARN([cannot run when cross-compiling]))
@@ -72,11 +73,10 @@ if test -n "$VISIBILITY_CFLAGS"; then
        OLD_CFLAGS="$CFLAGS"
 
        CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
-       AC_TRY_LINK([],
-       [
+       AC_TRY_LINK([
                void vis_foo1(void) {}
                __attribute__((visibility("default"))) void vis_foo2(void) {}
-               #include "${srcdir-.}/build/tests/trivial.c"
+       ],[
        ],[
                AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_VISIBILITY_ATTR,1,[Whether the C compiler supports the visibility attribute])
@@ -124,6 +124,13 @@ if test x$developer = xyes; then
            #
            AX_CFLAGS_GCC_OPTION(-Wno-format-y2k, DEVELOPER_CFLAGS)
            AX_CFLAGS_GCC_OPTION(-Wno-unused-parameter, DEVELOPER_CFLAGS)
+           #
+           # warnings we don't want just for some files e.g. swig bindings
+           #
+           AX_CFLAGS_GCC_OPTION(-Wno-cast-qual, CFLAG_NO_CAST_QUAL)
+           AC_SUBST(CFLAG_NO_CAST_QUAL)
+           AX_CFLAGS_GCC_OPTION(-Wno-unused-macros, CFLAG_NO_UNUSED_MACROS)
+           AC_SUBST(CFLAG_NO_UNUSED_MACROS)
        else
            AX_CFLAGS_IRIX_OPTION(-fullwarn, DEVELOPER_CFLAGS)
        fi
@@ -141,7 +148,7 @@ if test -n "$DEVELOPER_CFLAGS"; then
 fi
 
 # allow for --with-hostcc=gcc
-AC_ARG_WITH(hostcc,[  --with-hostcc=compiler    choose host compiler],
+AC_ARG_WITH(hostcc,[  --with-hostcc=compiler  choose host compiler],
 [HOSTCC=$withval],
 [
 if test z"$cross_compiling" = "yes"; then