Salome HOME
Join modifications from branch BR_PR_V320b1
[modules/kernel.git] / salome_adm / unix / config_files / production.m4
1 dnl  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 dnl  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 dnl 
4 dnl  This library is free software; you can redistribute it and/or 
5 dnl  modify it under the terms of the GNU Lesser General Public 
6 dnl  License as published by the Free Software Foundation; either 
7 dnl  version 2.1 of the License. 
8 dnl 
9 dnl  This library is distributed in the hope that it will be useful, 
10 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 dnl  Lesser General Public License for more details. 
13 dnl 
14 dnl  You should have received a copy of the GNU Lesser General Public 
15 dnl  License along with this library; if not, write to the Free Software 
16 dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 dnl 
18 dnl  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 dnl
20 dnl
21 dnl
22 dnl define macros :
23 dnl AC_ENABLE_PRODUCTION AC_DISABLE_PRODUCTION
24 dnl and 
25 dnl AC_ENABLE_DEBUG AC_DISABLE_DEBUG
26 dnl
27 dnl version $Id$
28 dnl author Patrick GOLDBRONN
29 dnl
30  
31 # AC_ENABLE_PRODUCTION
32 AC_DEFUN([AC_ENABLE_PRODUCTION], [dnl
33 define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl
34 AC_ARG_ENABLE(production,
35 changequote(<<, >>)dnl
36 <<  --enable-production[=PKGS]  build without debug information [default=>>AC_ENABLE_PRODUCTION_DEFAULT],
37 changequote([, ])dnl
38 [p=${PACKAGE-default}
39 case "$enableval" in
40 yes) enable_production=yes ;;
41 no) enable_production=no ;;
42 *)
43   enable_production=no
44   # Look at the argument we got.  We use all the common list separators.
45   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
46   for pkg in $enableval; do
47     if test "X$pkg" = "X$p"; then
48       enable_production=yes
49     fi
50   done
51   IFS="$ac_save_ifs"
52   ;;
53 esac],
54 enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl
55
56 AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS)
57 AC_CXX_OPTION(-Wparentheses,CXXFLAGS)
58 AC_CXX_OPTION(-Wreturn-type,CXXFLAGS)
59 AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS)
60 AC_CXX_OPTION(-fmessage-length=0,CXXFLAGS)
61 AC_CXX_OPTION(-Wunused,CXXFLAGS)
62 AC_CXX_OPTION(-pipe,CXXFLAGS)
63
64 if test "X$enable_production" = "Xyes"; then
65   CFLAGS="$CFLAGS -O"
66   AC_CXX_OPTION(-Wuninitialized,CXXFLAGS)
67   CXXFLAGS="$CXXFLAGS -O "
68 fi
69 ])
70
71 # AC_DISABLE_PRODUCTION - set the default flag to --disable-production
72 AC_DEFUN([AC_DISABLE_PRODUCTION], [AC_ENABLE_PRODUCTION(no)])
73
74 # AC_ENABLE_DEBUG
75 AC_DEFUN([AC_ENABLE_DEBUG], [dnl
76 define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl
77 AC_ARG_ENABLE(debug,
78 changequote(<<, >>)dnl
79 <<  --enable-debug[=PKGS]  build without debug information [default=>>AC_ENABLE_DEBUG_DEFAULT],
80 changequote([, ])dnl
81 [p=${PACKAGE-default}
82 case "$enableval" in
83 yes) enable_debug=yes ;;
84 no) enable_debug=no ;;
85 *)
86   enable_debug=no
87   # Look at the argument we got.  We use all the common list separators.
88   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
89   for pkg in $enableval; do
90     if test "X$pkg" = "X$p"; then
91       enable_debug=yes
92     fi
93   done
94   IFS="$ac_save_ifs"
95   ;;
96 esac],
97 enable_debug=AC_ENABLE_DEBUG_DEFAULT)dnl
98
99 if test "X$enable_debug" = "Xyes"; then
100   CFLAGS="$CFLAGS -g -D_DEBUG_ "
101   CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ "
102 fi
103 ])
104
105 # AC_DISABLE_DEBUG - set the default flag to --disable-debug
106 AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)])