Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / build_configure
1 #!/bin/sh
2
3 #
4 # Tool for updating list of .in file for the SALOME project 
5 # and regenerating configure script
6 #
7 # It may be called with --with-kernel[=yes,no] or --without-kernel
8 # option, default is --with-kernel=yes
9 #
10 # Author : Marc Tajchman - CEA
11 # Date : 10/10/2002
12 # $Header$
13 #
14 # 14/03/2007: Mikhail PONIKAROV - OCN
15 # Reorganization for uage of autotools
16
17 ORIG_DIR=`pwd`
18 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
19
20 ########################################################################
21 # Check --with-kernel option
22
23 MED_WITH_KERNEL="yes"
24 MED_WITH_GUI="yes"
25
26 for option
27 do
28   case $option in
29       -with-kernel | --with-kernel)
30           MED_WITH_KERNEL="yes"
31           MED_WITH_GUI="yes"
32           break;;
33       -without-kernel | --without-kernel | -with-kernel=no | --with-kernel=no)
34           MED_WITH_KERNEL="no"
35           MED_WITH_GUI="no"
36           break;;
37   esac
38 done
39
40 for option
41 do
42   case $option in
43       -with-ihm | --with-ihm)
44           MED_WITH_GUI="yes"
45           break;;
46       -without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no)
47           MED_WITH_GUI="no"
48           break;;
49   esac
50 done
51
52 ########################################################################
53 # Test if the KERNEL_ROOT_DIR is set correctly if KERNEL required
54
55 if test ${MED_WITH_KERNEL} = yes; then
56     if test ! -d "${KERNEL_ROOT_DIR}"; then
57         echo "failed : KERNEL_ROOT_DIR variable is not correct !"
58         exit
59     fi
60 fi
61 ########################################################################
62 # Test if the GUI_ROOT_DIR is set correctly if GUI required
63
64 if test ${MED_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 cd ${CONF_DIR}
72 ABS_CONF_DIR=`pwd`
73
74 #######################################################################
75 # Update configure.ac script: to set MED_WITH_KERNEL and MED_WITH_GUI variables
76 sed -e s/MED_WITH_KERNEL=[a-z]*/MED_WITH_KERNEL=${MED_WITH_KERNEL}/g configure.ac > configure.tmp
77 sed -e s/MED_WITH_GUI=[a-z]*/MED_WITH_GUI=${MED_WITH_GUI}/g configure.tmp > configure.ac
78 rm configure.tmp
79
80 # copy configure files
81 CONFIGURE_SOURCE_DIR=${KERNEL_ROOT_DIR}/salome_adm
82 if test ${MED_WITH_KERNEL} = no; then
83   CONFIGURE_SOURCE_DIR=${ABS_CONF_DIR}/adm_local_without_kernel
84 fi
85
86 rm -rf salome_adm
87 mkdir -p salome_adm/unix/config_files
88 #cp -f ${CONFIGURE_SOURCE_DIR}/unix/config_files/* salome_adm/unix/config_files
89 cp -f ${CONFIGURE_SOURCE_DIR}/unix/SALOMEconfig.h.in salome_adm/unix
90 #if test ${MED_WITH_KERNEL} = yes; then
91 #  cp -f ${CONFIGURE_SOURCE_DIR}/unix/pythonbe.py salome_adm/unix
92 #fi
93
94 # if with GUI, cofy configure files from it
95 #if test ${MED_WITH_GUI} = yes; then
96 #  cp -f ${GUI_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
97 #fi
98
99 # remove KERNEL deprecated configure files
100 #for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \
101 #  check_mico.m4 config.guess ltmain.sh ac_cxx_bool.m4 ltconfig ac_cxx_typename.m4 \
102 #  check_pthreads.m4 config.sub libtool.m4 ac_cxx_mutable.m4 missing
103 #do
104 #  rm -f salome_adm/unix/config_files/${deprecated}
105 #done
106
107 # ____________________________________________________________________
108 # aclocal creates the aclocal.m4 file from the standard macro and the
109 # custom macro embedded in the directory salome_adm/unix/config_files
110 # and KERNEL config_files directory.
111 # output:
112 #   aclocal.m4
113 #   autom4te.cache (directory)
114 echo "====================================================== aclocal"
115
116 if test ${MED_WITH_GUI} = yes; then
117   aclocal -I adm_local/unix/config_files \
118           -I ${CONFIGURE_SOURCE_DIR}/unix/config_files \
119           -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1
120 else
121   aclocal -I adm_local/unix/config_files \
122           -I ${CONFIGURE_SOURCE_DIR}/unix/config_files || exit 1
123 fi
124
125 # ____________________________________________________________________
126 # libtoolize creates some configuration files (ltmain.sh,
127 # config.guess and config.sub). It only depends on the libtool
128 # version. The files are created in the directory specified with the
129 # AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac).
130 # output:
131 #   salome_adm/unix/config_files/config.guess
132 #   salome_adm/unix/config_files/config.sub
133 #   salome_adm/unix/config_files/ltmain.sh
134 #echo "====================================================== libtoolize"
135
136 libtoolize --force --copy --automake || exit 1
137
138 # ____________________________________________________________________
139 # make link to KERNEL configuration files to
140 #ln -sf ${KERNEL_ROOT_DIR}/salome_adm .
141
142 # ____________________________________________________________________
143 # autoconf creates the configure script from the file configure.ac (or
144 # configure.in if configure.ac doesn't exist)
145 # output:
146 #   configure
147 echo "====================================================== autoconf"
148
149 autoconf
150
151 # ____________________________________________________________________
152 # automake creates some scripts used in building process
153 # (install-sh, missing, ...). It only depends on the automake
154 # version. The files are created in the directory specified with the
155 # AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac). This step also
156 # creates the Makefile.in files from the Makefile.am files.
157 # output:
158 #   salome_adm/unix/config_files/compile
159 #   salome_adm/unix/config_files/depcomp
160 #   salome_adm/unix/config_files/install-sh
161 #   salome_adm/unix/config_files/missing
162 #   salome_adm/unix/config_files/py-compile
163 #   Makefile.in (from Makefile.am)
164 echo "====================================================== automake"
165
166 automake --copy --gnu --add-missing