~macslow/nux/nux.fix-839476

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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
#
# Based on Clutter's autofoo. Here's how this goes down:
#
# api_version = The soname version "libnux-1.0.so"
# version = The package version "1.2.2"
# 
# Making a point release:
#   - Increase micro_version to the next even number
#   - Increase interface_age to the next even number UNLESS there was an API
#     addition/deprecation, at which point you should set it to 0
#
# After the release:
#   - Increase micro_version to the next odd number
#   - Increase interface_version to the next odd number
# 
m4_define([nux_major_version], [2])
m4_define([nux_minor_version], [4])
m4_define([nux_micro_version], [0])

m4_define([nux_api_version], [2.0])
# Increase the number (to the current date) everytime you propose a branch that breaks the API or ABI
# The number format is : year/month/day
# e.g.: december 5th, 2011 is: 20111205
# To make more than one API change in a day, add a number to the date. Like 20111205.xx
m4_define([nux_abi_version], [20120221.01])

m4_define([nux_version],
          [nux_major_version.nux_minor_version.nux_micro_version])

# increase the interface age by 1 for each release; if the API changes,
# set to 0. interface_age and binary_age are used to create the soname
# of the shared object:
#
#  (<minor> * 100 + <micro>) - <interface_age>
#
# this allows using the same soname for different micro-releases in case
# no API was added or deprecated. for instance:
#
#   nux 1.2.0  -> 100 * 2 + 0  = 200, interface age = 0 -> 200
#   nux 1.2.2  -> 100 * 2 + 2  = 202, interface age = 2 -> 200
#   nux 1.2.4  -> 100 * 2 + 4  = 204, interface age = 4 -> 200
#   [ API addition, deprecation ]
#   nux 1.2.6  -> 100 * 2 + 6  = 206, interface age = 0 -> 206
#   nux 1.2.8  -> 100 * 2 + 8  = 208, interface age = 2 -> 206
#   nux 1.2.10 -> 100 * 2 + 10 = 210, interface age = 4 -> 206
#   ...
#
m4_define([nux_interface_age], [0])
m4_define([nux_binary_age],
          [m4_eval(100 * nux_minor_version + nux_micro_version)])

AC_PREREQ(2.59)

AC_INIT([nux],
        [nux_version],
        [https://bugs.launchpad.net/nux])
AC_COPYRIGHT([Copyright 2010 Inalogic Inc.])

m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

AC_CONFIG_SRCDIR([Makefile.am])
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.10])

NUX_MAJOR_VERSION=nux_major_version
NUX_MINOR_VERSION=nux_minor_version
NUX_MICRO_VERSION=nux_micro_version
NUX_VERSION=nux_version
NUX_API_VERSION=nux_api_version
NUX_ABI_VERSION=nux_abi_version
AC_SUBST(NUX_MAJOR_VERSION)
AC_SUBST(NUX_MINOR_VERSION)
AC_SUBST(NUX_MICRO_VERSION)
AC_SUBST(NUX_VERSION)
AC_SUBST(NUX_API_VERSION)
AC_SUBST(NUX_ABI_VERSION)

m4_define([lt_current],
          [m4_eval(100 * nux_minor_version + nux_micro_version - nux_interface_age)])
m4_define([lt_revision], [nux_interface_age])
m4_define([lt_age], [m4_eval(nux_binary_age - nux_interface_age)])
NUX_LT_CURRENT=lt_current
NUX_LT_REV=lt_revision
NUX_LT_AGE=lt_age
NUX_LT_VERSION="$NUX_LT_CURRENT:$NUX_LT_REV:$NUX_LT_AGE"
NUX_LT_LDFLAGS="-version-info $NUX_LT_VERSION"

AC_SUBST(NUX_LT_VERSION)
AC_SUBST(NUX_LT_LDFLAGS)

AC_CONFIG_MACRO_DIR([m4])

dnl ===========================================================================

# Checks for programs
AC_PROG_CC_C99
AC_PROG_CXX
AM_PROG_CC_C_O

# require libtool >= 2.2
LT_PREREQ([2.2.6])
LT_INIT([disable-static])

# Checks for header files
AC_HEADER_STDC

# Checks for typedefs, structures and compiler charecteristics
AC_C_CONST

# Checks for library functions
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_CHECK_FUNCS([memset munmap strcasecmp strdup])

PKG_PROG_PKG_CONFIG

dnl ===========================================================================
GL_PKGS="gl glu glew glewmx"
MAINTAINER_CFLAGS=""

# Enable opengl es 20 code path
AC_ARG_ENABLE([opengles_20],
              [AC_HELP_STRING([--enable-opengles-20=@<:@no/yes@:>@],
              [Enable OpenGL ES 20 code path @<:@default=no@:>@])],
              [],
              [enable_opengles_20=no])
AS_IF([test "x$enable_opengles_20" = "xyes"],
      [
         MAINTAINER_CFLAGS+=" -DNUX_OPENGLES_20"
         GL_PKGS="egl glesv2"
      ]
)
AM_CONDITIONAL(NUX_OPENGLES_20, [test "x$enable_opengles_20" = "xyes"])

AC_SUBST(GL_PKGS)
AC_SUBST(MAINTAINER_CFLAGS)

dnl ===========================================================================

PKG_CHECK_MODULES(NUX_CORE, glib-2.0 >= 2.25.14 gthread-2.0 sigc++-2.0 gio-2.0)
AC_SUBST(NUX_CORE_CFLAGS)
AC_SUBST(NUX_CORE_LIBS)

PKG_CHECK_MODULES(NUX_IMAGE,
                  glib-2.0 >= 2.25.14
                  gdk-pixbuf-2.0
                  cairo >= 1.9.14
                  libpng >= 1.2.44
                  sigc++-2.0
                  )
AC_SUBST(NUX_IMAGE_CFLAGS)
AC_SUBST(NUX_IMAGE_LIBS)

PKG_CHECK_MODULES(NUX_GRAPHICS,
                  glib-2.0 >= 2.25.14
                  gdk-pixbuf-2.0
                  $GL_PKGS
                  xxf86vm
                  sigc++-2.0
		              xinerama
                  libutouch-geis
                  )
AC_SUBST(NUX_GRAPHICS_CFLAGS)
AC_SUBST(NUX_GRAPHICS_LIBS)

PKG_CHECK_MODULES(NUX,
                  glib-2.0 >= 2.25.14
                  gdk-pixbuf-2.0
                  gthread-2.0
                  $GL_PKGS
                  sigc++-2.0
                  pango
                  pangocairo
                  libpcre
                  )
AC_SUBST(NUX_CFLAGS)
AC_SUBST(NUX_LIBS)

PKG_CHECK_MODULES(UNITY_SUPPORT_TEST,
                  x11
                  $GL_PKGS
                  xcomposite
                  xdamage
                  libpci
                  )
AC_SUBST(UNITY_SUPPORT_TEST_CFLAGS)
AC_SUBST(UNITY_SUPPORT_TEST_LIBS)

dnl ************************************
dnl Enable/disable tests
dnl ************************************

AC_ARG_ENABLE([tests],
              [AC_HELP_STRING([--enable-tests=@<:@no/yes@:>@],
              [Enable Nux Testing @<:@default=yes@:>@])],
              [],
              [enable_tests=yes])
AS_IF([test "x$enable_tests" = "xyes"],
      [
       # Check for googletest and googlemock
       AC_LANG_PUSH([C++])
       AC_CHECK_HEADER([gtest/gtest.h],
                       [],
                       [AC_MSG_ERROR([you are missing google-test, apt-get install libgtest-dev])])
       AC_CHECK_HEADER([gmock/gmock.h],
                       [],
                       [AC_MSG_ERROR([you are missing google-mock, apt-get install google-mock])])
       AC_LANG_POP([C++])

       #Check for libxtst
       AC_CHECK_HEADER([X11/extensions/XTest.h],
                       [],
                       [AC_MSG_ERROR([you are missing libxtst-dev, apt-get install libxtst-dev])])
      ]
)
AM_CONDITIONAL(BUILD_TESTS, [test "x$enable_tests" = "xyes"])


dnl ===========================================================================

# sets up doxygen
DX_DOXYGEN_FEATURE(ON)
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN(nux, doxygen.cfg, doc)

AC_ARG_ENABLE([documentation],
              [AC_HELP_STRING([--enable-documentation=@<:@no/yes@:>@],
              [Enable building of documentation @<:@default=no@:>@])],
              [],
              [enable_documentation=no])

AM_CONDITIONAL(BUILD_DOCUMENTATION, [test "x$enable_documentation" = "xyes"])

dnl ==========================================================================

if test "x$GCC" = "xyes"; then
  GCC_FLAGS="-g -Wall -std=c++0x"
fi
AC_SUBST(GCC_FLAGS)

# use strict compiler flags only on development releases
m4_define([maintainer_mode_default], [m4_if(m4_eval(nux_micro_version % 2), [1], [yes], [no])])
AC_ARG_ENABLE([maintainer-mode],
              [AC_HELP_STRING([--enable-maintainer-mode=@<:@no/yes@:>@],
                              [Use strict compiler flags @<:@default=no@:>@])],
              [],
              [enable_maintainer_mode=maintainer_mode_default])

AS_IF([test "x$enable_maintainer_mode" = "xyes" && test "x$GCC" = "xyes"],
      [
         MAINTAINER_CFLAGS+="-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self"
      ]
)

# this enables lots of useful debugging output in Nux
AC_ARG_ENABLE([debug],
              [AC_HELP_STRING([--enable-debug=@<:@no/yes@:>@],
              [Enable Nux debugging @<:@default=no@:>@])],
              [],
              [enable_debug=no])
AS_IF([test "x$enable_debug" = "xyes"],
      [
         MAINTAINER_CFLAGS+=" -DNUX_DEBUG"
      ]
)

AC_SUBST(MAINTAINER_CFLAGS)

# this enables lots of useful debugging output in Nux
AC_ARG_ENABLE([examples],
              [AC_HELP_STRING([--enable-examples=@<:@no/yes@:>@],
              [Enable building of examples @<:@default=yes@:>@])],
              [],
              [enable_examples=yes])

AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = "xyes"])
AM_COND_IF([BUILD_EXAMPLES],
      [
          PKG_CHECK_MODULES(NUX_EXAMPLES, x11)
          AC_SUBST(NUX_EXAMPLES_CFLAGS)
          AC_SUBST(NUX_EXAMPLES_LIBS)
      ],
)

# this enables gpu tests
AC_ARG_ENABLE([gputests],
              [AC_HELP_STRING([--enable-gputests=@<:@no/yes@:>@],
              [Enable building of gpu tests @<:@default=yes@:>@])],
              [],
              [enable_gputests=yes])

AM_CONDITIONAL(BUILD_GPUTESTS, [test "x$enable_gputests" = "xyes"])
AM_COND_IF([BUILD_GPUTESTS],
      [
          PKG_CHECK_MODULES(NUX_GPUTESTS, x11)
          AC_SUBST(NUX_GPUTESTS_CFLAGS)
          AC_SUBST(NUX_GPUTESTS_LIBS)
      ],
)

dnl ===========================================================================

AC_CONFIG_FILES([
  Makefile
  data/Makefile
  NuxCore/Makefile
  NuxCore/nux-core.pc
  NuxImage/Makefile
  NuxImage/nux-image.pc
  NuxGraphics/Makefile
  NuxGraphics/nux-graphics.pc
  Nux/Makefile
  Nux/nux.pc
  Nux/ABI.h
  examples/Makefile
  tests/Makefile
  tools/Makefile
  gputests/Makefile
])

AC_OUTPUT

BOLD_GREEN="\033@<:@1;32m"
GREEN="\033@<:@0;32m"
BOLD_WHITE="\033@<:@1;37m"
RESET="\033@<:@0m"

echo ""
echo -e "${BOLD_GREEN} Nux - $VERSION"
echo -e "${RESET}"

echo -e "${GREEN} • Global:${RESET}"
echo -e "        Prefix             : ${BOLD_WHITE}${prefix}"

echo -e "${RESET}"
echo -e "${GREEN} • Compiler Options:${RESET}"
echo -e "        CFLAGS             : ${BOLD_WHITE}${CFLAGS} ${GCC_FLAGS}${RESET}" 
echo -e "        Maintainer CFlags  : ${BOLD_WHITE}${MAINTAINER_CFLAGS}${RESET}"
echo -e "        Debug Mode         : ${BOLD_WHITE}${enable_debug}${RESET}"

echo -e "${RESET}"
echo -e "${GREEN} • Documentation:${RESET}"
echo -e "        Build Documentation: ${BOLD_WHITE}${enable_documentation}${RESET}"

echo -e "${RESET}"
echo -e "${GREEN} • Misc Options:${RESET}"
echo -e "        Build Examples     : ${BOLD_WHITE}${enable_examples}${RESET}"
echo -e "        Build Gpu Tests    : ${BOLD_WHITE}${enable_gputests}${RESET}"
echo -e "        Build Nux Tests    : ${BOLD_WHITE}${enable_tests}${RESET}"
echo ""

echo -e "${RESET}"