Salome HOME
copy tag mergefrom_BR_V0_1_CC_Salome_04oct07
[modules/yacs.git] / src / wrappergen / src / HXX2SALOME_GENERIC_CLASS_NAME_SRC / adm_local / unix / config_files / ac_cc_warnings.m4
diff --git a/src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/config_files/ac_cc_warnings.m4 b/src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/adm_local/unix/config_files/ac_cc_warnings.m4
new file mode 100644 (file)
index 0000000..9f3aa1a
--- /dev/null
@@ -0,0 +1,119 @@
+dnl  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+dnl 
+dnl  This library is free software; you can redistribute it and/or 
+dnl  modify it under the terms of the GNU Lesser General Public 
+dnl  License as published by the Free Software Foundation; either 
+dnl  version 2.1 of the License. 
+dnl 
+dnl  This library is distributed in the hope that it will be useful, 
+dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+dnl  Lesser General Public License for more details. 
+dnl 
+dnl  You should have received a copy of the GNU Lesser General Public 
+dnl  License along with this library; if not, write to the Free Software 
+dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+dnl 
+dnl  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+dnl
+dnl
+dnl
+dnl Synopsis :    AC_CC_WARNINGS([ANSI]) 
+dnl 
+dnl Version  :    1.1 (2000/12/31) 
+dnl 
+dnl Author   :    Ville Laurikari <vl@iki.fi> 
+dnl 
+dnl Description :
+dnl 
+dnl         Enables a reasonable set of warnings for the C compiler. 
+dnl         Optionally, if the first argument is nonempty, turns on 
+dnl         flags which enforce and/or enable proper ANSI C if such 
+dnl         flags are known to the compiler used. 
+dnl 
+dnl         Currently this macro knows about GCC, Solaris C compiler, 
+dnl         Digital Unix C compiler, C for AIX Compiler, HP-UX C
+dnl         compiler, and IRIX C compiler.
+
+AC_DEFUN([AC_CC_WARNINGS], [
+  ansi=$1
+  if test -z "$ansi"; then
+    msg="for C compiler warning flags"
+  else
+    msg="for C compiler warning and ANSI conformance flags"
+  fi
+  AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [
+    if test -n "$CC"; then
+      cat > conftest.c <<EOF
+int main(int argc, char **argv) { return 0; }
+EOF
+
+      dnl GCC
+      if test "$GCC" = "yes"; then
+        if test -z "$ansi"; then
+          ac_cv_prog_cc_warnings="-Wall"
+        else
+          ac_cv_prog_cc_warnings="-Wall -ansi -pedantic"
+        fi
+
+      dnl Solaris C compiler
+      elif $CC -flags 2>&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 &&
+           $CC -c -v -Xc conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          ac_cv_prog_cc_warnings="-v"
+        else
+          ac_cv_prog_cc_warnings="-v -Xc"
+        fi
+
+      dnl HP-UX C compiler
+      elif $CC > /dev/null 2>&1 &&
+           $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          ac_cv_prog_cc_warnings="+w1"
+        else
+          ac_cv_prog_cc_warnings="+w1 -Aa"
+        fi
+
+      dnl Digital Unix C compiler
+      elif ! $CC > /dev/null 2>&1 &&
+           $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos"
+        else
+          ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1"
+        fi
+
+      dnl C for AIX Compiler
+      elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 &&
+           $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"
+        else
+          ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi"
+        fi
+
+      dnl IRIX C compiler
+      elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 &&
+           test -f conftest.o; then
+        if test -z "$ansi"; then
+          ac_cv_prog_cc_warnings="-fullwarn"
+        else
+          ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE"
+        fi
+
+      fi
+      rm -f conftest.*
+    fi
+    if test -n "$ac_cv_prog_cc_warnings"; then
+      CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings"
+      CXXFLAGS="$CXXFLAGS $ac_cv_prog_cc_warnings"
+    else
+      ac_cv_prog_cc_warnings="unknown"
+    fi
+  ])
+])