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