Salome HOME
Improve make procedure (add aclocal flags)
[plugins/netgenplugin.git] / build_configure
1 #!/bin/bash
2 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 #  This library is free software; you can redistribute it and/or
8 #  modify it under the terms of the GNU Lesser General Public
9 #  License as published by the Free Software Foundation; either
10 #  version 2.1 of the License.
11 #
12 #  This library is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 #  Lesser General Public License for more details.
16 #
17 #  You should have received a copy of the GNU Lesser General Public
18 #  License along with this library; if not, write to the Free Software
19 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 # Tool for updating list of .in file for the SALOME project 
24 # and regenerating configure script
25 # Author : Marc Tajchman - CEA
26 # Date : 10/10/2002
27 # 13/03/2007: Alexander BORODIN - OCN
28 # Reorganization for usage of autotools
29 # $Header$
30 #
31 ORIG_DIR=`pwd`
32 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
33 NETGENPLUGIN_WITH_GUI="yes"
34
35 ########################################################################
36 # Test if the KERNEL_ROOT_DIR is set correctly
37
38 if test ! -d "${KERNEL_ROOT_DIR}"; then
39     echo "failed : KERNEL_ROOT_DIR variable is not correct !"
40     exit
41 fi
42
43 # Test if the KERNEL_SRC is set correctly
44
45 #if test ! -d "${KERNEL_SRC}"; then
46 #    echo "failed : KERNEL_SRC variable is not correct !"
47 #    exit
48 #fi
49 for option
50 do
51   case $option in
52       -with-gui | --with-gui)
53           NETGENPLUGIN_WITH_GUI="yes"
54           break;;
55       -without-gui | --without-gui | -with-gui=no | --with-gui=no)
56           NETGENPLUGIN_WITH_GUI="no"
57           break;;
58   esac
59 done
60
61 ########################################################################
62 # Test if the GUI_ROOT_DIR is set correctly
63
64 if test ${NETGENPLUGIN_WITH_GUI} = yes; then
65     if test ! -d "${GUI_ROOT_DIR}"; then
66         echo "failed : GUI_ROOT_DIR variable is not correct !"
67         exit
68     fi
69 fi
70
71 ########################################################################
72 # Test if the MED_ROOT_DIR is set correctly
73
74 if test ! -d "${MED_ROOT_DIR}"; then
75     echo "failed : MED_ROOT_DIR variable is not correct !"
76     exit
77 fi
78
79 ########################################################################
80 # Test if the GEOM_ROOT_DIR is set correctly
81
82 if test ! -d "${GEOM_ROOT_DIR}"; then
83     echo "failed : GEOM_ROOT_DIR variable is not correct !"
84     exit
85 fi
86
87 ########################################################################
88 # Test if the SMESH_ROOT_DIR is set correctly
89
90 if test ! -d "${SMESH_ROOT_DIR}"; then
91     echo "failed : SMESH_ROOT_DIR variable is not correct !"
92     exit
93 fi
94
95 cd ${CONF_DIR}
96 ABS_CONF_DIR=`pwd`
97
98 #######################################################################
99 # Update configure.ac script: to set NETGENPLUGIN_WITH_GUI variable
100 sed -e s/NETGENPLUGIN_WITH_GUI=[a-z]*/NETGENPLUGIN_WITH_GUI=${NETGENPLUGIN_WITH_GUI}/g configure.ac > configure.tmp
101 mv -f configure.tmp configure.ac
102
103 mkdir -p salome_adm/unix/config_files
104 #cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/* salome_adm/unix/config_files
105 #cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/pythonbe.py salome_adm/unix
106
107 cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix
108
109 #cp -f ${GUI_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
110 #cp -f ${MED_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
111 #cp -f ${GEOM_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
112 #cp -f ${SMESH_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
113
114 # remove KERNEL deprecated configure files
115 #for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \
116 #    check_mico.m4 config.guess ltmain.sh ac_cxx_bool.m4 ltconfig ac_cxx_typename.m4 \
117 #    check_pthreads.m4 config.sub libtool.m4 ac_cxx_mutable.m4 missing
118 #    do
119 #       rm -f salome_adm/unix/config_files/${deprecated}
120 #    done
121                       
122
123 # ____________________________________________________________________
124 # aclocal creates the aclocal.m4 file from the standard macro and the
125 # custom macro embedded in the directory salome_adm/unix/config_files
126 # and KERNEL config_files directory.
127 # output:
128 #   aclocal.m4
129 #   autom4te.cache (directory)
130 echo "====================================================== aclocal"
131
132 if test ${NETGENPLUGIN_WITH_GUI} = yes; then
133   aclocal -I adm_local/unix/config_files \
134           -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \
135           -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
136           -I ${MED_ROOT_DIR}/adm_local/unix/config_files \
137           -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \
138           -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files || exit 1
139 else
140   aclocal -I adm_local/unix/config_files \
141           -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
142           -I ${MED_ROOT_DIR}/adm_local/unix/config_files \
143           -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \
144           -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files || exit 1
145 fi
146
147 # ____________________________________________________________________
148 # libtoolize creates some configuration files (ltmain.sh,
149 # config.guess and config.sub). It only depends on the libtool
150 # version. The files are created in the directory specified with the
151 # AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac).
152 # output:
153 #   salome_adm/unix/config_files/config.guess
154 #   salome_adm/unix/config_files/config.sub
155 #   salome_adm/unix/config_files/ltmain.sh
156 #echo "====================================================== libtoolize"
157
158 libtoolize --force --copy --automake || exit 1
159
160 # ____________________________________________________________________
161 # autoconf creates the configure script from the file configure.ac (or
162 # configure.in if configure.ac doesn't exist)
163 # output:
164 #   configure
165 echo "====================================================== autoconf"
166
167 autoconf
168
169 # ____________________________________________________________________
170 # automake creates some scripts used in building process
171 # (install-sh, missing, ...). It only depends on the automake
172 # version. The files are created in the directory specified with the
173 # AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac). This step also
174 # creates the Makefile.in files from the Makefile.am files.
175 # output:
176 #   salome_adm/unix/config_files/compile
177 #   salome_adm/unix/config_files/depcomp
178 #   salome_adm/unix/config_files/install-sh
179 #   salome_adm/unix/config_files/missing
180 #   salome_adm/unix/config_files/py-compile
181 #   Makefile.in (from Makefile.am)
182 echo "====================================================== automake"
183
184 automake --copy --gnu --add-missing