1############################################################################
2#    Copyright (C) 2006 by Matteo Franchin                                 #
3#    fnch@libero.it                                                        #
4#                                                                          #
5#    This program is free software; you can redistribute it and/or modify  #
6#    it under the terms of the GNU General Public License as published by  #
7#    the Free Software Foundation; either version 2 of the License, or     #
8#    (at your option) any later version.                                   #
9#                                                                          #
10#    This program is distributed in the hope that it will be useful,       #
11#    but WITHOUT ANY WARRANTY; without even the implied warranty of        #
12#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
13#    GNU General Public License for more details.                          #
14#                                                                          #
15#    You should have received a copy of the GNU General Public License     #
16#    along with this program; if not, write to the                         #
17#    Free Software Foundation, Inc.,                                       #
18#    59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             #
19############################################################################
20
21AC_INIT([box],[0.4.0],[fnch@libero.it])
22
23# Date corresponding to the release of the current version
24BOX_RELEASE_DATE="Sep 07 2013, 09:47:45"
25
26# Major part of the version number
27BOX_VER_MAJOR="0"
28
29# Minor part of the version number
30BOX_VER_MINOR="4"
31
32# Maint part of the version number
33BOX_VER_MAINT="0"
34
35AC_PREREQ(2.61)
36
37# Libtool ltdl library directory
38AC_CONFIG_AUX_DIR([libltdl/config])
39AC_CONFIG_MACRO_DIR([libltdl/m4])
40
41AM_INIT_AUTOMAKE
42
43AC_CONFIG_SRCDIR([box/main.c])
44AC_CONFIG_HEADERS([config.h])
45
46# Libtool support
47LT_CONFIG_LTDL_DIR([libltdl])
48LT_INIT([dlopen],[win32-dll])
49LTDL_INIT([convenience])
50LT_PREREQ([2.2])
51
52# Directories where to store specific box library files
53boxbasename="box$BOX_VER_MAJOR.$BOX_VER_MINOR"
54boxdir="$libdir/$boxbasename"
55boxlibdir="$boxdir/lib"
56boxpkgdir="$boxdir/pkg"
57boxincdir="$includedir/$boxbasename"
58
59# Checks for programs.
60AC_PROG_LN_S
61AC_PROG_CC
62AC_PROG_LEX
63AC_PROG_YACC
64
65# Checks for header files.
66AC_HEADER_STDC
67AC_CHECK_HEADERS([stdlib.h string.h unistd.h stdint.h])
68#AC_CHECK_HEADERS([cairo.h])
69
70# Checks for libraries.
71AC_CHECK_LIB([m], [floor])
72
73# Checks for typedefs, structures, and compiler characteristics.
74AC_C_CONST
75
76# Checks for types
77AC_CHECK_TYPE([ssize_t])
78
79# Checks for library functions.
80AC_FUNC_MALLOC
81AC_FUNC_REALLOC
82AC_CHECK_FUNCS([floor memmove memset pow rint sqrt strdup strncasecmp strndup])
83AC_CHECK_FUNCS([getenv stat])
84
85AC_ARG_WITH([cairo],
86            AS_HELP_STRING([--with-cairo],[use the cairo 2D graphic library [[default=yes]]]),
87            [ac_cv_with_cairo=$withval], [ac_cv_with_cairo=yes])
88
89if test "$ac_cv_with_cairo" = yes; then
90  use_libcairo=yes
91  PKG_CHECK_MODULES([CAIRO],
92                    [cairo >= 0.9.0],
93                    [HAVE_CAIRO=1],
94                    [if test $pkg_failed = yes; then
95    AC_MSG_WARN([Package requirement (cairo >= 0.9.0) was not met])
96                     elif test $pkg_failed = untried; then
97    AC_MSG_WARN([The pkg-config script could not be found or is too old.])
98                     fi
99                     use_libcairo=no])
100
101fi
102
103if test "${use_libcairo}" = yes ; then
104  AC_DEFINE(HAVE_LIBCAIRO, 1, [ Define to 1 if you have the `cairo' library. ])
105fi
106
107AC_DEFINE_UNQUOTED(BOX_RELEASE_DATE, ["$BOX_RELEASE_DATE"],
108  [ Date when the current version of Box was released. ])
109
110AM_CONDITIONAL(BUILD_WINCAIRO, test "${use_libcairo}" = yes)
111
112AC_SUBST(CAIRO_LIBS)
113AC_SUBST(CAIRO_CFLAGS)
114
115AC_SUBST([boxlibdir])
116AC_SUBST([boxincdir])
117AC_SUBST([boxpkgdir])
118AC_SUBST([BOX_VER_MAJOR])
119AC_SUBST([BOX_VER_MINOR])
120AC_SUBST([BOX_VER_MAINT])
121
122AC_CONFIG_FILES([Makefile
123                 box/Makefile
124                 box/version.h
125                 libs/Makefile
126                 libs/g/Makefile
127                 tests/Makefile
128                 tests/dylib/Makefile
129                 man/Makefile
130                 examples/Makefile
131                 examples/smileys/Makefile])
132AC_OUTPUT
133
134AC_MSG_RESULT([])
135AC_MSG_RESULT([Configuration summary:])
136AC_MSG_RESULT([----------------------])
137
138if test "${use_libcairo}" = yes; then
139  AC_MSG_RESULT([Support for the Cairo 2D graphic library: yes])
140else
141  AC_MSG_RESULT([Support for the Cairo 2D graphic library: no])
142fi
143