1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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 commit is contained in:
James Peach 2005-09-08 08:18:08 +00:00 committed by Gerald (Jerry) Carter
parent a3aba57c00
commit 82fab8b747
9 changed files with 249 additions and 18 deletions

2
source/aclocal.m4 vendored
View 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)

View File

@ -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($@)])])

View File

@ -71,10 +71,12 @@ 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],
[
AC_MSG_CHECKING(for c99 struct initialization)
AC_TRY_COMPILE([
#include <stdio.h>],
[
struct foo {
int x;
char y;
@ -83,8 +85,20 @@ AC_CACHE_CHECK([for c99 struct initialization],samba_cv_c99_struct_initializatio
.y = 'X',
.x = 1
};
],
samba_cv_c99_struct_initialization=yes,samba_cv_c99_struct_initialization=no)])
],
[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/])

View 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/])

View 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}"

View 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.

View File

@ -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])
])

View 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;

View 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;