r10071: Configure checks for IRIX build environment. Test whether we can
authorJames Peach <jpeach@samba.org>
Thu, 8 Sep 2005 08:18:08 +0000 (08:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:36:34 +0000 (13:36 -0500)
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.

source/aclocal.m4
source/build/m4/ax_cflags_irix_option.m4 [new file with mode: 0644]
source/build/m4/check_cc.m4
source/build/m4/check_perl.m4
source/build/m4/env.m4
source/build/m4/rewrite.m4
source/build/m4/smb_cc_features.m4 [new file with mode: 0644]
source/pidl/idl.yp
source/pidl/lib/Parse/Pidl/IDL.pm

index 0d4f9b5ce5654b6f2cdc61677cc0a396f5c382e3..4264ddf633d893c99e9c4000d95eb534230dc70c 100644 (file)
@@ -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/source/build/m4/ax_cflags_irix_option.m4 b/source/build/m4/ax_cflags_irix_option.m4
new file mode 100644 (file)
index 0000000..bcfd35c
--- /dev/null
@@ -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($@)])])
index eaf40f1b5304064d1217f333a88cc6a2f9598e07..ab934f328beec76b01378a0ae62dc69021c8dce4 100644 (file)
@@ -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/])
index 2e090ef7cef9b87e10eaf748a97b4959119dabcd..26abff631742244f23673e19cc1ee1fe4d4c759e 100644 (file)
@@ -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/])
index 7ab6dc61b07c1e79d7889486d06b23bbbe911552..cba2780efae0827df8175bef785f5745f22725ab 100644 (file)
@@ -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}"
 
index ecde4ae32968399f6f7d6e3de554136f2ffb66b8..d8ba0104ab174bb94b081491f9e94832d83fb5d8 100644 (file)
@@ -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/source/build/m4/smb_cc_features.m4 b/source/build/m4/smb_cc_features.m4
new file mode 100644 (file)
index 0000000..4044e96
--- /dev/null
@@ -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])
+])
+
index 1e101106ec3c295a19cfa83b9c250c61f0c00369..0f5b17e0fa0a6cae2186280512a694bfa1523c9b 100644 (file)
@@ -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;
index 203e05202283a66e2720d5df7a2c9b52a25582b4..2e73bd8410d252e59a44f477e8506fd5ad3e66ce 100644 (file)
@@ -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;