summaryrefslogtreecommitdiff
path: root/configure.in
blob: 1ad001a6377b6d10cb4d78fe16772d2dafd8758d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
AC_INIT(cairomm/cairomm.h)

#release versioning
GENERIC_MAJOR_VERSION=1
GENERIC_MINOR_VERSION=7
GENERIC_MICRO_VERSION=0
GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
AC_SUBST(GENERIC_MAJOR_VERSION)
AC_SUBST(GENERIC_MINOR_VERSION)
AC_SUBST(GENERIC_MICRO_VERSION)
AC_SUBST(GENERIC_VERSION)

#shared library versioning
GENERIC_LIBRARY_VERSION=4:0:3
#                       | | |
#                +------+ | +---+
#                |        |     |
#             current:revision:age
#                |        |     |
#                |        |     +- increment if interfaces have been added
#                |        |        set to zero if interfaces have been removed
#                                  or changed
#                |        +- increment if source code has changed
#                |           set to zero if current is incremented
#                +- increment if interfaces have been added, removed or changed
AC_SUBST(GENERIC_LIBRARY_VERSION)

VERSION=$GENERIC_VERSION

AM_INIT_AUTOMAKE(cairomm, $GENERIC_VERSION)

# define values for config header
AC_DEFINE_UNQUOTED([CAIROMM_MAJOR_VERSION], $GENERIC_MAJOR_VERSION, [cairomm major version])
AC_DEFINE_UNQUOTED([CAIROMM_MINOR_VERSION], $GENERIC_MINOR_VERSION, [cairomm minor version])
AC_DEFINE_UNQUOTED([CAIROMM_MICRO_VERSION], $GENERIC_MICRO_VERSION, [cairomm micro version])
AC_CONFIG_HEADER(cairomm/cairommconfig.h)

AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG_CPLUSPLUS
AC_PROG_INSTALL
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

dnl Used for enabling the "-no-undefined" and "-export-all-symbols" flags
dnl while generating DLLs. Borrowed from the official gtk+-2 configure.in
AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
  *-*-mingw*|*-*-cygwin*)
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
if test x"$os_win32" = xyes; then
  if test x"$GCC" = xyes; then
    msnative_struct=''
    AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
    if test -z "$ac_cv_prog_CC"; then
      our_gcc="$CC"
    else
      our_gcc="$ac_cv_prog_CC"
    fi
    case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
      2.)
        if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
          msnative_struct='-fnative-struct'
        fi
        ;;
      *)
        if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
          msnative_struct='-mms-bitfields'
        fi
        ;;
    esac
    if test x"$msnative_struct" = x ; then
      AC_MSG_RESULT([no way])
      AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
    else
      CXXFLAGS="$CXXFLAGS $msnative_struct"
      AC_MSG_RESULT([${msnative_struct}])
    fi
  fi
fi

AC_CHECK_HEADERS(string list map, , exit)
dnl some platforms (e.g. Solaris) need additional C headers included so
dnl that there are always prototypes and defines available.
AC_CHECK_HEADERS(math.h)

########################
# Determine Dependencies
########################
dnl base dependencies
DEPS_PC="cairo >= 1.8.0
         sigc++-2.0"

dnl always install the 'base' pkg-config file
INSTALLED_PC="cairomm-1.0.pc"

dnl then check and add additional dependencies
PKG_CHECK_MODULES(CAIROFT, cairo-ft, [HAS_FT=yes], [HAS_FT=no])
if test x$HAS_FT = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-ft-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-ft"
fi

PKG_CHECK_MODULES(CAIROPDF, cairo-pdf, [HAS_PDF=yes], [HAS_PDF=no])
if test x$HAS_PDF = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-pdf-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-pdf"
fi

PKG_CHECK_MODULES(CAIROPNG, cairo-png, [HAS_PNG=yes], [HAS_PNG=no])
if test x$HAS_PNG = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-png-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-png"
fi

PKG_CHECK_MODULES(CAIROPS, cairo-ps, [HAS_PS=yes], [HAS_PS=no])
if test x$HAS_PS = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-ps-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-ps"
fi

PKG_CHECK_MODULES(CAIROSVG, cairo-svg, [HAS_SVG=yes], [HAS_SVG=no])
if test x$HAS_SVG = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-svg-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-svg"
fi

PKG_CHECK_MODULES(CAIROXLIB, cairo-xlib, [HAS_XLIB=yes], [HAS_XLIB=no])
if test x$HAS_XLIB = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-xlib-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-xlib"
fi

PKG_CHECK_MODULES(CAIROXLIBXRENDER, cairo-xlib-xrender, [HAS_XLIBXRENDER=yes], [HAS_XLIBXRENDER=no])
if test x$HAS_XLIBXRENDER = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-xlib-xrender-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-xlib-xrender"
fi

PKG_CHECK_MODULES(CAIROWIN32, cairo-win32, [HAS_WIN32=yes], [HAS_WIN32=no])
if test x$HAS_WIN32 = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-win32-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-win32"
fi

PKG_CHECK_MODULES(CAIROWIN32FONT, cairo-win32-font, [HAS_WIN32FONT=yes], [HAS_WIN32FONT=no])
if test x$HAS_WIN32FONT = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-win32-font-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-win32-font"
fi

PKG_CHECK_MODULES(CAIROQUARTZ, cairo-quartz, [HAS_QUARTZ=yes], [HAS_QUARTZ=no])
if test x$HAS_QUARTZ = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-quartz-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-quartz"
fi

PKG_CHECK_MODULES(CAIROQUARTZFONT, cairo-quartz-font, [HAS_QUARTZFONT=yes], [HAS_QUARTZFONT=no])
if test x$HAS_QUARTZFONT = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-quartz-font-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-quartz-font"
fi

PKG_CHECK_MODULES(CAIROQUARTZIMAGE, cairo-quartz-image, [HAS_QUARTZIMAGE=yes], [HAS_QUARTZIMAGE=no])
if test x$HAS_QUARTZIMAGE = xyes; then
  INSTALLED_PC="$INSTALLED_PC cairomm-quartz-image-1.0.pc"
  DEPS_PC="$DEPS_PC cairo-quartz-image"
fi

PKG_CHECK_MODULES(CAIROMM, [$DEPS_PC])

AC_SUBST(INSTALLED_PC)

CONFIG_PC=""
for pc in $INSTALLED_PC; do
  CONFIG_PC="$CONFIG_PC data/$pc"
done


AC_ARG_ENABLE(tests,
              AC_HELP_STRING([--enable-tests=yes|no],
                             [enable automated tests (default is no)]),
              ENABLE_TESTS=$enableval,
              ENABLE_TESTS=auto)

if test x$ENABLE_TESTS = xauto ; then
    dnl unless explicitly disabled, attempt to enable tests for developers and
    dnl disable it for others
    if test x$CAIROMM_DEVEL = xon ; then
        ENABLE_TESTS=yes
    else
        ENABLE_TESTS=no
    fi
fi

if test x$ENABLE_TESTS = xyes ; then
#######################################################
#boost build system sucks no end.
#it is damn hard to detect the version of boost
#that is installed. All that because our friends of
#the boost project don't want to integrate to autofoo.
#So we resort to hugly hacks to detect the version of
#boost that is installed.
#######################################################
    AX_BOOST_BASE([1.33.1])
    AX_BOOST_UNIT_TEST_FRAMEWORK
    AX_BOOST_TEST_EXEC_MONITOR

    unit_framework_lib_candidates="/usr/lib/libboost_unit_test_framework-st.a /usr/lib/libboost_unit_test_framework.a"
    unit_framework_lib_candidates=$unit_framework_lib_candidates" /usr/lib64/libboost_unit_test_framework-st.a /usr/lib64/libboost_unit_test_framework.a"
    for i in $unit_framework_lib_candidates ; do
        if test -f $i ; then
            BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB=$i
            break
        fi
    done
    AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB)
    AC_MSG_NOTICE(support of automated tests enabled)
else
    AC_MSG_NOTICE(disabled support of automated tests)
fi
AM_CONDITIONAL(AUTOTESTS, test x$ENABLE_TESTS = xyes)

dnl enable compiler warnings when the CAIROMM_DEVEL environment variable is set to 'on'
if test  "x$CAIROMM_DEVEL" = "xon" ; then
    CXXFLAGS="$CXXFLAGS -Wall -g -Werror -Wextra"
fi

CAIROMM_ARG_ENABLE_API_EXCEPTIONS()

dnl Check whether to build the documentation directory
DOCS_SUBDIR="" dnl set DOCS_SUBDIR initially blank
AC_ARG_ENABLE(docs, [AC_HELP_STRING([--enable-docs],
              [build the included docs [default=yes]])],,
              [enable_docs=yes])
if test "x$enable_docs" = "xyes"; then
  dnl check if doxygen is installed
  AC_CHECK_PROGS(DOXYGEN, [doxygen], no)
  if test x$DOXYGEN = xno; then
    AC_MSG_WARN([Doxygen not found, documentation will not be rebuilt])
  else
    dnl check if graphviz / dot is installed (used by doxygen)
    AC_CHECK_PROGS(DOT, [dot], no)
    if test x$DOT = xno; then
      AC_MSG_WARN([graphviz / dot not found, documentation graphs will not be rebuilt])
    fi
  fi

  DOCS_SUBDIR="docs"
  AC_CONFIG_FILES(
    docs/Makefile
    docs/reference/Makefile
    docs/reference/Doxyfile
  )
fi
AC_SUBST(DOCS_SUBDIR)


AC_CONFIG_FILES(
  Makefile
  cairomm/Makefile

  data/Makefile

  examples/Makefile
  examples/png_file/Makefile
  examples/pdf-surface/Makefile
  examples/ps-surface/Makefile
  examples/svg-surface/Makefile
  examples/text/Makefile

  tests/Makefile

  $CONFIG_PC
)

AC_CONFIG_FILES([
  MSVC_Net2005/Makefile
    MSVC_Net2005/gendef/Makefile
    MSVC_Net2005/cairomm/Makefile
    MSVC_Net2005/cairomm/cairomm.rc
    MSVC_Net2005/examples/Makefile
      MSVC_Net2005/examples/pdf-surface/Makefile
      MSVC_Net2005/examples/png_file/Makefile
      MSVC_Net2005/examples/ps-surface/Makefile
      MSVC_Net2005/examples/svg-surface/Makefile
      MSVC_Net2005/examples/text-rotate/Makefile
  MSVC_Net2008/Makefile
    MSVC_Net2008/gendef/Makefile
    MSVC_Net2008/cairomm/Makefile
    MSVC_Net2008/cairomm/cairomm.rc
    MSVC_Net2008/examples/Makefile
      MSVC_Net2008/examples/pdf-surface/Makefile
      MSVC_Net2008/examples/png_file/Makefile
      MSVC_Net2008/examples/ps-surface/Makefile
      MSVC_Net2008/examples/svg-surface/Makefile
      MSVC_Net2008/examples/text-rotate/Makefile
])

AC_OUTPUT()