Salome HOME
New version of hack_libtool utility to workaround problems on some Linux configurations
[modules/kernel.git] / salome_adm / unix / config_files / production.m4
1 dnl  Copyright (C) 2007-2010  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.
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 AC_ENABLE_PRODUCTION
29 dnl This macro enables production build : optimized + no debugging information (-g)
30 dnl default = not enabled
31 dnl
32 AC_DEFUN([AC_ENABLE_PRODUCTION],
33 [define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl
34 AC_ARG_ENABLE([production],
35     [AC_HELP_STRING([--enable-production],
36      [compile in optimized mode @<:@default=]AC_ENABLE_PRODUCTION_DEFAULT[@:>@])],
37     [
38     enable_production=$enableval
39     ],
40     [enable_production=]AC_ENABLE_PRODUCTION_DEFAULT)
41
42 AC_CXX_OPTION(-Wparentheses,CXXFLAGS)
43 AC_CXX_OPTION(-Wreturn-type,CXXFLAGS)
44 AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS)
45 AC_CXX_OPTION(-fmessage-length=0,CXXFLAGS)
46 AC_CXX_OPTION(-Wunused,CXXFLAGS)
47 AC_CXX_OPTION(-pipe,CXXFLAGS)
48
49 if test "X$enable_production" = "Xyes"; then
50   CFLAGS="$CFLAGS -O"
51   AC_CXX_OPTION(-Wuninitialized,CXXFLAGS)
52   CXXFLAGS="$CXXFLAGS -O "
53 else
54   CFLAGS="$CFLAGS -g"
55   CXXFLAGS="$CXXFLAGS -g"
56 fi
57 ])
58
59 # AC_DISABLE_PRODUCTION - set the default flag to --disable-production
60 AC_DEFUN([AC_DISABLE_PRODUCTION], [AC_ENABLE_PRODUCTION(no)])
61
62 dnl AC_ENABLE_DEBUG
63 dnl
64 dnl This macro enables debugging build : debug + trace
65 dnl default = not enabled
66 dnl
67 AC_DEFUN([AC_ENABLE_DEBUG],
68     [define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl
69     AC_ARG_ENABLE([debug],
70        [AC_HELP_STRING([--enable-debug],
71              [build with debug and trace information @<:@default=]AC_ENABLE_DEBUG_DEFAULT[@:>@])],
72     [
73     enable_debug=$enableval
74     ],
75     [enable_debug=]AC_ENABLE_DEBUG_DEFAULT)
76
77 if test "X$enable_debug" = "Xyes"; then
78   CFLAGS="$CFLAGS -g -D_DEBUG_ "
79   CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ "
80 fi
81 ])
82
83 # AC_DISABLE_DEBUG - set the default flag to --disable-debug
84 AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)])
85
86 dnl AC_ENABLE_MPI_SEQ_CONTAINER
87 dnl
88 dnl This macro enables mpi into the sequential container
89 dnl default = not enabled
90 dnl
91 AC_DEFUN([AC_ENABLE_MPI_SEQ_CONTAINER],
92     [define([AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT], ifelse($1, no, no, yes))dnl
93     AC_ARG_ENABLE([mpi-seq-container],
94        [AC_HELP_STRING([--enable-mpi-seq-container],
95              [enable mpi into seq container @<:@default=]AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT[@:>@])],
96     [
97     enable_mpi_seq_container=$enableval
98     ],
99     [enable_mpi_seq_container=]AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT)
100
101 if test "X$enable_mpi_seq_container" = "Xyes"; then
102   CFLAGS="$CFLAGS -D_MPI_SEQ_CONTAINER_ "
103   CXXFLAGS="$CXXFLAGS -D_MPI_SEQ_CONTAINER_ "
104 fi
105 AM_CONDITIONAL([WITH_MPI_SEQ_CONTAINER], [test "x$enable_mpi_seq_container" = "xyes"])
106 ])