]> SALOME platform Git repositories - modules/gui.git/blob - adm_local/unix/config_files/check_sip.m4
Salome HOME
cb50cce222bbc6974bb06595460157e4de72cc57
[modules/gui.git] / adm_local / unix / config_files / check_sip.m4
1 dnl Copyright (C) 2007-2012  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 AC_DEFUN([CHECK_SIP],[
24 AC_REQUIRE([CHECK_PYTHON])dnl
25 AC_REQUIRE([CHECK_QT])dnl
26 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
27
28 sip_ok=yes
29
30 AC_ARG_WITH(sip,
31     [  --with-sip=EXEC sip executable ],
32     [SIP="$withval"
33       AC_MSG_RESULT([Try $withval as sip executable])
34     ], [
35       AC_PATH_PROG(SIP, sip)
36     ])
37
38 if test "x$SIP" = "x" ; then
39     sip_ok=no
40     AC_MSG_RESULT(sip is not in the PATH variable)
41 else
42     AC_MSG_CHECKING(whether sip version >= 4.6)
43     SIP_VERSION=`$SIP -V | awk '{print $[1]}'`
44     SIP_VERSION_ID=`echo $SIP_VERSION | awk -F. '{v=$[1]*10000+$[2]*100+$[3];print v}'`
45     if test $SIP_VERSION_ID -ge 40600 ; then 
46         AC_MSG_RESULT(yes)
47         AC_MSG_RESULT(sip version is $SIP_VERSION)
48     else
49         AC_MSG_RESULT(no)
50         AC_MSG_RESULT(WARNING! sip version $SIP_VERSION is not supported (at least 4.6 is required)!)
51         sip_ok=no
52     fi
53 fi
54
55 if test "x$sip_ok" = "xyes" ; then
56     if test "x$SIPDIR" = "x" ; then
57         SIPDIR=`dirname $SIP`
58         SIPDIR=`dirname $SIPDIR`
59     fi
60
61     TEST_INC_DIRS=""
62     TEST_LIB_DIRS=""
63     if test "x${SIPDIR}" != "x" ; then
64         TEST_INC_DIRS="${TEST_INC_DIRS} ${SIPDIR} ${SIPDIR}/include"
65         TEST_INC_DIRS="${TEST_INC_DIRS} ${SIPDIR}/include/python${PYTHON_VERSION}"
66         TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR} ${SIPDIR}/lib"
67         TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
68     fi
69     if test "x${PYTHONHOME}" != "x" ; then
70         TEST_INC_DIRS="${TEST_INC_DIRS} ${PYTHONHOME}/include/python${PYTHON_VERSION}"
71         TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
72     fi
73     TEST_INC_DIRS="${TEST_INC_DIRS} /usr/include /usr/include/python${PYTHON_VERSION}"
74     TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
75     TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/dist-packages"
76     TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/dist-packages/PyQt4"
77     TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX}/pymodules/python${PYTHON_VERSION}"
78     if test "${build_cpu::6}" = "x86_64" ; then
79       TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib64/python${PYTHON_VERSION}/site-packages"
80     fi
81     dnl Search sip.h file
82     sip_ok=no
83     for d in ${TEST_INC_DIRS} ; do
84         if test -d $d ; then
85             AC_CHECK_FILE(${d}/sip.h,sip_ok=yes,sip_ok=no)
86             if test "x$sip_ok" == "xyes" ; then
87                 SIP_INCLUDES="-I${d}"
88                 break
89             fi
90         fi
91     done
92
93     if test "x$sip_ok" == "xyes" ; then
94         dnl Search sip.so file
95         sip_ok=no
96         for d in ${TEST_LIB_DIRS} ; do
97             if test -d $d ; then
98                 AC_CHECK_FILE(${d}/sip.so,sip_ok=yes,sip_ok=no)
99                 if test "x$sip_ok" == "xyes" ; then
100                     if test "x${d}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
101                         SIP_LIBS=""
102                     else
103                         SIP_LIBS="-L${d}"
104                     fi
105                     break
106                 fi
107             fi
108         done
109     fi
110 fi
111
112 AC_SUBST(SIP)
113 AC_SUBST(SIP_INCLUDES)
114 AC_SUBST(SIP_LIBS)
115 AC_SUBST(SIP_VERSION)
116 AC_SUBST(SIP_VERSION_ID)
117
118 AC_MSG_RESULT(for sip: $sip_ok)
119
120 ])dnl
121 dnl