Salome HOME
Copyright update 2020
[tools/configuration.git] / autotools / m4 / production.m4
1 dnl Copyright (C) 2007-2020  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 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(-fmessage-length=0,CXXFLAGS)
45 AC_CXX_OPTION(-Wunused,CXXFLAGS)
46 AC_CXX_OPTION(-pipe,CXXFLAGS)
47
48 if test "X$enable_production" = "Xyes"; then
49   CFLAGS="$CFLAGS -O"
50   AC_CXX_OPTION(-Wuninitialized,CXXFLAGS)
51   CXXFLAGS="$CXXFLAGS -O "
52 else
53   CFLAGS="$CFLAGS -g"
54   CXXFLAGS="$CXXFLAGS -g"
55 fi
56 ])
57
58 # AC_DISABLE_PRODUCTION - set the default flag to --disable-production
59 AC_DEFUN([AC_DISABLE_PRODUCTION], [AC_ENABLE_PRODUCTION(no)])
60
61 dnl AC_ENABLE_DEBUG
62 dnl
63 dnl This macro enables debugging build : debug + trace
64 dnl default = not enabled
65 dnl
66 AC_DEFUN([AC_ENABLE_DEBUG],
67     [define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl
68     AC_ARG_ENABLE([debug],
69        [AC_HELP_STRING([--enable-debug],
70              [build with debug and trace information @<:@default=]AC_ENABLE_DEBUG_DEFAULT[@:>@])],
71     [
72     enable_debug=$enableval
73     ],
74     [enable_debug=]AC_ENABLE_DEBUG_DEFAULT)
75
76 if test "X$enable_debug" = "Xyes"; then
77   CFLAGS="$CFLAGS -g -D_DEBUG_ "
78   CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ "
79 fi
80 ])
81
82 # AC_DISABLE_DEBUG - set the default flag to --disable-debug
83 AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)])
84
85 dnl AC_ENABLE_MPI_SEQ_CONTAINER
86 dnl
87 dnl This macro enables mpi into the sequential container
88 dnl default = not enabled
89 dnl
90 AC_DEFUN([AC_ENABLE_MPI_SEQ_CONTAINER],
91     [define([AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT], ifelse($1, no, no, yes))dnl
92     AC_ARG_ENABLE([mpi-seq-container],
93        [AC_HELP_STRING([--enable-mpi-seq-container],
94              [enable mpi into seq container @<:@default=]AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT[@:>@])],
95     [
96     enable_mpi_seq_container=$enableval
97     ],
98     [enable_mpi_seq_container=]AC_ENABLE_MPI_SEQ_CONTAINER_DEFAULT)
99
100 if test "X$enable_mpi_seq_container" = "Xyes"; then
101   CFLAGS="$CFLAGS -D_MPI_SEQ_CONTAINER_ "
102   CXXFLAGS="$CXXFLAGS -D_MPI_SEQ_CONTAINER_ "
103 fi
104 AM_CONDITIONAL([WITH_MPI_SEQ_CONTAINER], [test "x$enable_mpi_seq_container" = "xyes"])
105 ])