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