summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2005-09-08 08:18:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:36:34 -0500
commite6190e6be55c8e6037b0cb2b357e133f5b313a02 (patch)
treead648e7bfbeb5c9ef5a2b0658190a3d8d4e839bf /source4
parent1f2f470889d63a2a81ee3f2d8bdff782ac8d0e28 (diff)
downloadsamba-e6190e6be55c8e6037b0cb2b357e133f5b313a02.tar.gz
samba-e6190e6be55c8e6037b0cb2b357e133f5b313a02.tar.bz2
samba-e6190e6be55c8e6037b0cb2b357e133f5b313a02.zip
r10071: Configure checks for IRIX build environment. Test whether we can
use the MIPSPro 7.4 -c99 option to get C99 support. Try to find a common perl that is more modern than /usr/bin/perl. (This used to be commit 82fab8b747bf68d8548c6f0f2f4bff98bd428d22)
Diffstat (limited to 'source4')
-rw-r--r--source4/aclocal.m42
-rw-r--r--source4/build/m4/ax_cflags_irix_option.m4174
-rw-r--r--source4/build/m4/check_cc.m440
-rw-r--r--source4/build/m4/check_perl.m412
-rw-r--r--source4/build/m4/env.m42
-rw-r--r--source4/build/m4/rewrite.m42
-rw-r--r--source4/build/m4/smb_cc_features.m429
-rw-r--r--source4/pidl/idl.yp3
-rw-r--r--source4/pidl/lib/Parse/Pidl/IDL.pm3
9 files changed, 249 insertions, 18 deletions
diff --git a/source4/aclocal.m4 b/source4/aclocal.m4
index 0d4f9b5ce5..4264ddf633 100644
--- a/source4/aclocal.m4
+++ b/source4/aclocal.m4
@@ -317,3 +317,5 @@ fi
sinclude(build/m4/public.m4)
sinclude(build/m4/core.m4)
sinclude(build/m4/ax_cflags_gcc_option.m4)
+sinclude(build/m4/ax_cflags_irix_option.m4)
+sinclude(build/m4/smb_cc_features.m4)
diff --git a/source4/build/m4/ax_cflags_irix_option.m4 b/source4/build/m4/ax_cflags_irix_option.m4
new file mode 100644
index 0000000000..bcfd35caa6
--- /dev/null
+++ b/source4/build/m4/ax_cflags_irix_option.m4
@@ -0,0 +1,174 @@
+dnl @synopsis AX_CFLAGS_IRIX_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
+dnl
+dnl AX_CFLAGS_IRIX_OPTION(-go_for_it) would show a message as like
+dnl "checking CFLAGS for irix/cc -go_for_it ... yes" and adds the
+dnl optionflag to CFLAGS if it is understood. You can override the
+dnl shellvar-default of CFLAGS of course. The order of arguments stems
+dnl from the explicit macros like AX_CFLAGS_WARN_ALL.
+dnl
+dnl The cousin AX_CXXFLAGS_IRIX_OPTION would check for an option to add
+dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
+dnl (since it is possible to use different compilers for C and C++).
+dnl
+dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
+dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
+dnl However, if you use this macro in a few places, it would be great
+dnl if you would make up a new function-macro and submit it to the
+dnl ac-archive.
+dnl
+dnl - $1 option-to-check-for : required ("-option" as non-value)
+dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
+dnl - $3 action-if-found : add value to shellvariable
+dnl - $4 action-if-not-found : nothing
+dnl
+dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
+dnl situation and accept a $2=~/-/ as being the old
+dnl option-to-check-for.
+dnl
+dnl see also: AX_CFLAGS_GCC_OPTION for the widely used original
+dnl variant.
+dnl
+dnl @category C
+dnl @author Guido Draheim <guidod@gmx.de>
+dnl @version 2005-01-21
+dnl @license GPLWithACException
+
+AC_DEFUN([AX_CFLAGS_IRIX_OPTION_OLD], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_irix_option_$2])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for irix/cc m4_ifval($2,$2,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-fullwarn -use_readonly_const % m4_ifval($2,$2,-option)" dnl IRIX C
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
+ m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+dnl the only difference - the LANG selection... and the default FLAGS
+
+AC_DEFUN([AX_CXXFLAGS_IRIX_OPTION_OLD], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_irix_option_$2])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for irix/cc m4_ifval($2,$2,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_CXX
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-fullwarn -use_readonly_const % m4_ifval($2,$2,-option)" dnl IRIX C
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
+ m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+dnl --------------------------------------------------------------------------
+
+AC_DEFUN([AX_CFLAGS_IRIX_OPTION_NEW], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_irix_option_$1])dnl
+AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for irix/cc m4_ifval($1,$1,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-fullwarn -use_readonly_const % m4_ifval($1,$1,-option)" dnl IRIX C
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
+ m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+dnl the only difference - the LANG selection... and the default FLAGS
+
+AC_DEFUN([AX_CXXFLAGS_IRIX_OPTION_NEW], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_irix_option_$1])dnl
+AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for irix/cc m4_ifval($1,$1,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_CXX
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-fullwarn -use_readonly_const % m4_ifval($1,$1,-option)" dnl IRIX C
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
+ m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+AC_DEFUN([AX_CFLAGS_IRIX_OPTION],[ifelse(m4_regexp([$2],[-]),-1,
+[AX_CFLAGS_IRIX_OPTION_NEW($@)],[AX_CFLAGS_IRIX_OPTION_OLD($@)])])
+
+AC_DEFUN([AX_CXXFLAGS_IRIX_OPTION],[ifelse(m4_regexp([$2],[-]),-1,
+[AX_CXXFLAGS_IRIX_OPTION_NEW($@)],[AX_CXXFLAGS_IRIX_OPTION_OLD($@)])])
diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4
index eaf40f1b53..ab934f328b 100644
--- a/source4/build/m4/check_cc.m4
+++ b/source4/build/m4/check_cc.m4
@@ -71,20 +71,34 @@ fi
############################################
# check if the compiler handles c99 struct initialization
-AC_CACHE_CHECK([for c99 struct initialization],samba_cv_c99_struct_initialization, [
- AC_TRY_COMPILE([
-#include <stdio.h>],
+AC_DEFUN([SMB_CC_SUPPORTS_C99_STRUCT_INIT],
[
- struct foo {
- int x;
- char y;
- } ;
- struct foo bar = {
- .y = 'X',
- .x = 1
- };
-],
- samba_cv_c99_struct_initialization=yes,samba_cv_c99_struct_initialization=no)])
+AC_MSG_CHECKING(for c99 struct initialization)
+AC_TRY_COMPILE([
+ #include <stdio.h>],
+ [
+ struct foo {
+ int x;
+ char y;
+ } ;
+ struct foo bar = {
+ .y = 'X',
+ .x = 1
+ };
+ ],
+[AC_MSG_RESULT(yes); $1],[AC_MSG_RESULT(no); $2])
+])
+
+SMB_CC_SUPPORTS_C99_STRUCT_INIT(samba_cv_c99_struct_initialization=yes,
+ samba_cv_c99_struct_initialization=no)
+
+if test x"$samba_cv_c99_struct_initialization" != x"yes"; then
+ # We might need to add some flags to CC to get c99 behaviour.
+ AX_CFLAGS_IRIX_OPTION(-c99, CFLAGS)
+ SMB_CC_SUPPORTS_C99_STRUCT_INIT(samba_cv_c99_struct_initialization=yes,
+ samba_cv_c99_struct_initialization=no)
+fi
+
if test x"$samba_cv_c99_struct_initialization" != x"yes"; then
AC_MSG_WARN([C compiler does not support c99 struct initialization!])
AC_MSG_ERROR([Please Install gcc from http://gcc.gnu.org/])
diff --git a/source4/build/m4/check_perl.m4 b/source4/build/m4/check_perl.m4
index 2e090ef7ce..26abff6317 100644
--- a/source4/build/m4/check_perl.m4
+++ b/source4/build/m4/check_perl.m4
@@ -5,7 +5,17 @@ dnl Released under the GNU GPL
dnl -------------------------------------------------------
dnl
-AC_PATH_PROG(PERL, perl)
+case "$host_os" in
+ *irix*)
+ # On IRIX, we prefer Freeware or Nekoware Perl, because the
+ # system perl so ancient.
+ AC_PATH_PROG(PERL, perl, "", "/usr/freeware/bin:/usr/nekoware/bin:$PATH")
+ ;;
+ *)
+ AC_PATH_PROG(PERL, perl)
+ ;;
+esac
+
if test x"$PERL" = x""; then
AC_MSG_WARN([No version of perl was not found!])
AC_MSG_ERROR([Please install perl from http://www.perl.com/])
diff --git a/source4/build/m4/env.m4 b/source4/build/m4/env.m4
index 7ab6dc61b0..cba2780efa 100644
--- a/source4/build/m4/env.m4
+++ b/source4/build/m4/env.m4
@@ -5,6 +5,8 @@ dnl Released under the GNU GPL
dnl -------------------------------------------------------
dnl
+AC_CANONICAL_HOST
+
SMB_VERSION_STRING=`cat include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
echo "SAMBA VERSION: ${SMB_VERSION_STRING}"
diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4
index ecde4ae329..d8ba0104ab 100644
--- a/source4/build/m4/rewrite.m4
+++ b/source4/build/m4/rewrite.m4
@@ -11,8 +11,6 @@ AC_SUBST(PICFLAG)
AC_DEFINE([_GNU_SOURCE],[],[Pull in GNU extensions])
AC_SYS_LARGEFILE
-AC_CANONICAL_HOST
-
#
# Config CPPFLAG settings for strange OS's that must be set
# before other tests.
diff --git a/source4/build/m4/smb_cc_features.m4 b/source4/build/m4/smb_cc_features.m4
new file mode 100644
index 0000000000..4044e9615e
--- /dev/null
+++ b/source4/build/m4/smb_cc_features.m4
@@ -0,0 +1,29 @@
+dnl SMB Compiler Capability Checks
+dnl -------------------------------------------------------
+dnl Copyright (C) Stefan (metze) Metzmacher 2004,2005
+dnl Released under the GNU GPL
+dnl -------------------------------------------------------
+dnl
+
+############################################
+# Check if the compiler handles c99 struct initialization.
+# Usage: SMB_CC_SUPPORTS_C99_STRUCT_INIT(success-action,failure-action)
+
+AC_DEFUN([SMB_CC_SUPPORTS_C99_STRUCT_INIT],
+[
+AC_MSG_CHECKING(for C99 designated initializers)
+AC_TRY_COMPILE([
+ #include <stdio.h>],
+ [
+ struct foo {
+ int x;
+ char y;
+ } ;
+ struct foo bar = {
+ .y = 'X',
+ .x = 1
+ };
+ ],
+[AC_MSG_RESULT(yes); $1],[AC_MSG_RESULT(no); $2])
+])
+
diff --git a/source4/pidl/idl.yp b/source4/pidl/idl.yp
index 1e101106ec..0f5b17e0fa 100644
--- a/source4/pidl/idl.yp
+++ b/source4/pidl/idl.yp
@@ -319,6 +319,7 @@ optional_semicolon:
# start code
%%
+use config qw(%config);
use Parse::Pidl::Util;
#####################################################################
@@ -422,7 +423,7 @@ sub parse_idl($$)
undef $/;
my $cpp = $ENV{CPP};
if (! defined $cpp) {
- $cpp = "cpp"
+ $cpp = $config::config{'CPP'};
}
my $data = `$cpp -D__PIDL__ -xc $filename`;
$/ = $saved_delim;
diff --git a/source4/pidl/lib/Parse/Pidl/IDL.pm b/source4/pidl/lib/Parse/Pidl/IDL.pm
index 203e052022..2e73bd8410 100644
--- a/source4/pidl/lib/Parse/Pidl/IDL.pm
+++ b/source4/pidl/lib/Parse/Pidl/IDL.pm
@@ -2672,6 +2672,7 @@ sub
#line 320 "pidl/idl.yp"
+use config qw(%config);
use Parse::Pidl::Util;
#####################################################################
@@ -2775,7 +2776,7 @@ sub parse_idl($$)
undef $/;
my $cpp = $ENV{CPP};
if (! defined $cpp) {
- $cpp = "cpp"
+ $cpp = $config::config{'CPP'};
}
my $data = `$cpp -D__PIDL__ -xc $filename`;
$/ = $saved_delim;