Salome HOME
Salome tutorial
[tools/tutorial.git] / check_gd.m4
1 #  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21
22 AC_DEFUN([CHECK_GDLIB],[
23 AC_REQUIRE([AC_PROG_CC])
24 AC_REQUIRE([AC_PROG_CPP])
25 AC_REQUIRE([AC_LINKER_OPTIONS])
26
27 AC_LANG_SAVE
28 AC_LANG_CPLUSPLUS
29
30 AC_CHECKING(for gd library)
31
32 gd_ok=no
33
34 # check gd.h header
35 AC_CHECK_HEADER(gd.h, gd_ok=yes, gd_ok=no)
36
37 if test "x$gd_ok" = "xyes"; then
38   # check gd library
39   AC_MSG_CHECKING(linking with libgd.so)
40   LIBS_old=$LIBS
41   LIBS="$LIBS -lgd"
42   AC_TRY_LINK([#include <gd.h>],
43               [gdImagePtr image = gdImageCreate(10,10);],
44               gd_ok=yes,
45               gd_ok=no)
46   LIBS=$LIBS_old
47   AC_MSG_RESULT(done)
48 fi
49
50 if test "x$gd_ok" = "xno"; then
51   AC_MSG_WARN(gd library is not installed!)
52 else
53   GD_LIBS="-lgd"
54 fi
55
56 AC_SUBST(GD_LIBS)
57
58 AC_MSG_RESULT(for gd: $gd_ok)
59
60 AC_LANG_RESTORE
61 ])