1# required autoconf version
2AC_PREREQ([2.54])
3
4#
5# Making releases:
6#   gtkglextmm_micro_version += 1;
7#   gtkglextmm_interface_age += 1;
8#   gtkglextmm_binary_age += 1;
9# if any functions have been added, set gtkglextmm_interface_age to 0.
10# if backwards compatibility has been broken,
11# set gtkglextmm_binary_age and gtkglextmm_interface_age to 0.
12#
13m4_define([gtkglextmm_major_version], [1])
14m4_define([gtkglextmm_minor_version], [2])
15m4_define([gtkglextmm_micro_version], [0])
16m4_define([gtkglextmm_interface_age], [0])
17m4_define([gtkglextmm_binary_age],    [0])
18m4_define([gtkglextmm_version],
19          [gtkglextmm_major_version.gtkglextmm_minor_version.gtkglextmm_micro_version])
20
21# API version
22m4_define([gtkglextmm_api_major_version], [1])
23m4_define([gtkglextmm_api_minor_version], [2])
24m4_define([gtkglextmm_api_version],
25          [gtkglextmm_api_major_version.gtkglextmm_api_minor_version])
26
27# libtool version related macros
28m4_define([gtkglextmm_lt_release],
29          [gtkglextmm_major_version.gtkglextmm_minor_version])
30m4_define([gtkglextmm_lt_current],
31          [m4_eval(gtkglextmm_micro_version - gtkglextmm_interface_age)])
32m4_define([gtkglextmm_lt_revision],
33          [gtkglextmm_interface_age])
34m4_define([gtkglextmm_lt_age],
35          [m4_eval(gtkglextmm_binary_age - gtkglextmm_interface_age)])
36m4_define([gtkglextmm_lt_current_minus_age],
37          [m4_eval(gtkglextmm_lt_current - gtkglextmm_lt_age)])
38
39# Versions of dependencies
40
41# GdkGLExt
42m4_define([gdkglext_pkg], [gdkglext-1.0])
43m4_define([gdkglext_required_version], [1.0.0])
44
45# GtkGLExt
46m4_define([gtkglext_pkg], [gtkglext-1.0])
47m4_define([gtkglext_required_version], [1.0.0])
48
49# libsigc++
50m4_define([sigcxx_pkg], [sigc++-2.0])
51m4_define([sigcxx_required_version], [2.0.0])
52
53# glibmm
54m4_define([glibmm_pkg], [glibmm-2.4])
55m4_define([glibmm_required_version], [2.4.0])
56
57# pangomm
58m4_define([pangomm_pkg], [pangomm-1.4])
59m4_define([pangomm_required_version], [2.4.0])
60
61# gdkmm
62m4_define([gdkmm_pkg], [gdkmm-2.4])
63m4_define([gdkmm_required_version], [2.4.0])
64
65# gtkmm
66m4_define([gtkmm_pkg], [gtkmm-2.4])
67m4_define([gtkmm_required_version], [2.4.0])
68
69
70# Process this file with autoconf to produce a configure script.
71AC_INIT([gtkglextmm], [gtkglextmm_version],
72        [gtkglext-develop@lists.sourceforge.net])
73
74AC_CONFIG_SRCDIR([gdkglext/gdkglmm.h])
75
76# Save this value here, since automake will set cflags later
77cflags_set=${CFLAGS+set}
78
79# Initialize automake stuff
80AM_INIT_AUTOMAKE([1.7 no-define dist-bzip2 dist-zip])
81
82# Specify a configuration file
83AM_CONFIG_HEADER([config.h])
84
85dnl Initialize maintainer mode
86AM_MAINTAINER_MODE
87
88AC_CANONICAL_HOST
89
90# Required GtkGLExt version
91GTKGLEXT_REQUIRED_VERSION=gtkglext_required_version
92AC_SUBST([GTKGLEXT_REQUIRED_VERSION])
93
94# gtkglextmm version
95GTKGLEXTMM_MAJOR_VERSION=gtkglextmm_major_version
96GTKGLEXTMM_MINOR_VERSION=gtkglextmm_minor_version
97GTKGLEXTMM_MICRO_VERSION=gtkglextmm_micro_version
98GTKGLEXTMM_INTERFACE_AGE=gtkglextmm_interface_age
99GTKGLEXTMM_BINARY_AGE=gtkglextmm_binary_age
100GTKGLEXTMM_VERSION=gtkglextmm_version
101GTKGLEXTMM_API_MAJOR_VERSION=gtkglextmm_api_major_version
102GTKGLEXTMM_API_MINOR_VERSION=gtkglextmm_api_minor_version
103GTKGLEXTMM_API_VERSION=gtkglextmm_api_version
104AC_SUBST([GTKGLEXTMM_MAJOR_VERSION])
105AC_SUBST([GTKGLEXTMM_MINOR_VERSION])
106AC_SUBST([GTKGLEXTMM_MICRO_VERSION])
107AC_SUBST([GTKGLEXTMM_INTERFACE_AGE])
108AC_SUBST([GTKGLEXTMM_BINARY_AGE])
109AC_SUBST([GTKGLEXTMM_VERSION])
110AC_SUBST([GTKGLEXTMM_API_MAJOR_VERSION])
111AC_SUBST([GTKGLEXTMM_API_MINOR_VERSION])
112AC_SUBST([GTKGLEXTMM_API_VERSION])
113
114# This is the X.Y used in -lgtkglextmm-FOO-X.Y
115#LIB_MJR=$GTKGLEXTMM_API_MAJOR_VERSION
116#LIB_MNR=$GTKGLEXTMM_API_MINOR_VERSION
117LIB_MJR=$GTKGLEXTMM_MAJOR_VERSION
118LIB_MNR=$GTKGLEXTMM_MINOR_VERSION
119AC_SUBST([LIB_MJR])
120AC_SUBST([LIB_MNR])
121
122# libtool versioning
123LT_RELEASE=gtkglextmm_lt_release
124LT_CURRENT=gtkglextmm_lt_current
125LT_REVISION=gtkglextmm_lt_revision
126LT_AGE=gtkglextmm_lt_age
127LT_CURRENT_MINUS_AGE=gtkglextmm_lt_current_minus_age
128AC_SUBST([LT_RELEASE])
129AC_SUBST([LT_CURRENT])
130AC_SUBST([LT_REVISION])
131AC_SUBST([LT_AGE])
132AC_SUBST([LT_CURRENT_MINUS_AGE])
133
134dnl Initialize libtool
135AC_PROG_CC
136AC_PROG_CPP
137AC_PROG_CXX
138AC_PROG_CXXCPP
139AC_ISC_POSIX
140#AM_DISABLE_STATIC
141AC_LIBTOOL_WIN32_DLL
142AC_PROG_LIBTOOL
143
144platform_win32=no
145AC_MSG_CHECKING([for some Win32 platform])
146case "$host_os" in
147  *mingw*|*cygwin*)
148    platform_win32=yes
149    ;;
150  *)
151    ;;
152esac
153AC_MSG_RESULT([$platform_win32])
154AM_CONDITIONAL([PLATFORM_WIN32], [test "x$platform_win32" = "xyes"])
155
156os_win32=no
157LIBSTDCXX_LIBS=
158AC_MSG_CHECKING([for native Win32])
159case "$host_os" in
160  *mingw*)
161    os_win32=yes
162    LIBSTDCXX_LIBS=-lstdc++
163    ;;
164  *)
165    ;;
166esac
167AC_MSG_RESULT([$os_win32])
168AM_CONDITIONAL([OS_WIN32], [test "x$os_win32" = "xyes"])
169
170if test "x$platform_win32" = "xyes"; then
171  gdktarget=win32
172else
173  gdktarget=x11
174fi
175
176AC_ARG_WITH(gdktarget,
177            [AC_HELP_STRING([--with-gdktarget=@<:@x11/win32@:>@],
178                            [select GDK target])],
179            [gdktarget=$with_gdktarget])
180
181AC_SUBST([gdktarget])
182case $gdktarget in
183  x11|win32) ;;
184  *) AC_MSG_ERROR([Invalid target for GDK: use x11 or win32.]);;
185esac
186
187gdkglextmm_targetlib=libgdkglextmm-$gdktarget-$LIB_MJR.$LIB_MNR.la
188gtkglextmm_targetlib=libgtkglextmm-$gdktarget-$LIB_MJR.$LIB_MNR.la
189
190AC_SUBST([gdkglextmm_targetlib])
191AC_SUBST([gtkglextmm_targetlib])
192
193
194# Build time sanity check...
195AM_SANITY_CHECK
196
197# Checks for programs.
198AM_PROG_CC_STDC
199AC_PROG_INSTALL
200AC_PROG_MAKE_SET
201AC_PROG_LN_S
202AC_PROG_AWK
203
204AL_PROG_GNU_M4(AC_MSG_ERROR([dnl
205SUN m4 does not work for building gtkmm.
206Please install GNU m4.]))
207
208AL_PROG_GNU_MAKE(AC_MSG_ERROR([dnl
209SUN make does not work for building gtkmm.
210Please install GNU make.]))
211
212# Evaluate the --enable-warnings=level option.
213GTKMM_ARG_ENABLE_WARNINGS()
214
215# Ensure MSVC-compatible struct packing convention is used when
216# compiling for Win32 with gcc.
217# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
218# gcc2 uses "-fnative-struct".
219if test "x$os_win32" = "xyes"; then
220  if test "x$GCC" = "xyes"; then
221    msnative_struct=''
222    AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
223    if test -z "$ac_cv_prog_CC"; then
224      our_gcc="$CC"
225    else
226      our_gcc="$ac_cv_prog_CC"
227    fi
228    case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
229      2.)
230	if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
231	  msnative_struct='-fnative-struct'
232	fi
233	;;
234      *)
235	if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
236	  msnative_struct='-mms-bitfields'
237	fi
238	;;
239    esac
240    if test x"$msnative_struct" = x ; then
241      AC_MSG_RESULT([no way])
242      AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
243    else
244      CXXFLAGS="$CXXFLAGS $msnative_struct"
245      AC_MSG_RESULT([${msnative_struct}])
246    fi
247  fi
248fi
249
250# --export-all-symbols option to build Win32 DLL using MinGW ld.
251WIN32_LD_EXPORT_ALL_SYMBOLS=''
252if test "x$os_win32" = "xyes"; then
253  AC_MSG_CHECKING([whether ld accepts --export-all-symbols])
254  if $LD --help 2>&1 | egrep 'export-all-symbols' > /dev/null; then
255    WIN32_LD_EXPORT_ALL_SYMBOLS='-Wl,--export-all-symbols'
256    AC_MSG_RESULT([yes])
257  else
258    AC_MSG_RESULT([no])
259  fi
260fi
261AC_SUBST([WIN32_LD_EXPORT_ALL_SYMBOLS])
262
263# Honor aclocal flags
264ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS -I $srcdir/m4macros"
265
266## Initial sanity check, done here so that users get told they
267## have the wrong dependencies as early in the process as possible.
268## Later on we actually use the cflags/libs from separate pkg-config
269## calls. Oh, also the later pkg-config calls don't include
270## the version requirements since those make the module lists
271## annoying to construct
272PKG_CHECK_MODULES([BASE_DEPENDENCIES], [dnl
273gtkglext_pkg >= gtkglext_required_version dnl
274gdkglext_pkg >= gdkglext_required_version dnl
275gtkmm_pkg >= gtkmm_required_version dnl
276gdkmm_pkg >= gdkmm_required_version dnl
277pangomm_pkg >= pangomm_required_version dnl
278])
279
280# Checks for GtkGLExt
281AM_PATH_GTKGLEXT_1_0([gtkglext_required_version], ,
282                     [AC_MSG_ERROR([GtkGLExt not found])])
283save_CPPFLAGS="$CPPFLAGS"
284CPPFLAGS="$CPPFLAGS $GTKGLEXT_CFLAGS"
285save_LIBS="$LIBS"
286LIBS="$LIBS $GTKGLEXT_LIBS"
287AC_GTKGLEXT_SUPPORTS_MULTIHEAD([GTKGLEXT_SUPPORTS_MULTIHEAD=yes],
288	                       [GTKGLEXT_SUPPORTS_MULTIHEAD=no])
289CPPFLAGS="$save_CPPFLAGS"
290LIBS="$save_LIBS"
291
292# gmmproc
293GLIBMM_CHECK_PERL([5.6.0])
294GLIBMM_PREFIX=`$PKG_CONFIG --variable=prefix glibmm_pkg`
295GMMPROC_DIR=$GLIBMM_PREFIX/lib/glibmm_pkg/proc
296AC_SUBST(GMMPROC_DIR)
297GMMPROC=$GMMPROC_DIR/gmmproc
298AC_SUBST(GMMPROC)
299
300# Checks for libraries.
301
302# Checks for header files.
303AC_HEADER_STDC
304
305# Checks for typedefs, structures, and compiler characteristics.
306AC_C_CONST
307
308# Checks for library functions.
309
310
311##################################################
312# Checks for gdkmm multihead support
313##################################################
314
315GDKGLEXTMM_MULTIHEAD_SUPPORT=no
316
317save_CPPFLAGS="$CPPFLAGS"
318CPPFLAGS="$CPPFLAGS $BASE_DEPENDENCIES_CFLAGS"
319save_LIBS="$LIBS"
320LIBS="$LIBS $BASE_DEPENDENCIES_LIBS"
321
322if test "x$GTKGLEXT_SUPPORTS_MULTIHEAD" = "xyes"; then
323
324  AC_LANG_SAVE
325  AC_LANG_CPLUSPLUS
326
327  AC_CHECK_HEADERS([gdkmm/display.h gdkmm/screen.h],
328                   [GDKGLEXTMM_MULTIHEAD_SUPPORT=yes],
329                   [GDKGLEXTMM_MULTIHEAD_SUPPORT=no])
330
331  if test "x$GDKGLEXTMM_MULTIHEAD_SUPPORT" = "xyes"; then
332    AC_MSG_CHECKING([for Gdk::Display::get_default in gdkmm library])
333    AC_TRY_LINK([#include <gdkmm/display.h>],
334                [Gdk::Display::get_default();],
335                [GDKGLEXTMM_MULTIHEAD_SUPPORT=yes],
336                [GDKGLEXTMM_MULTIHEAD_SUPPORT=no])
337    AC_MSG_RESULT([$GDKGLEXTMM_MULTIHEAD_SUPPORT])
338  fi
339
340  AC_LANG_RESTORE
341
342  if test "x$GDKGLEXTMM_MULTIHEAD_SUPPORT" = "xyes"; then
343    AC_MSG_NOTICE([gdkmm supports multihead])
344  else
345    AC_MSG_NOTICE([gdkmm doesn't support multihead])
346  fi
347
348fi
349
350CPPFLAGS="$save_CPPFLAGS"
351LIBS="$save_LIBS"
352
353AC_SUBST([GDKGLEXTMM_MULTIHEAD_SUPPORT])
354AM_CONDITIONAL([MULTIHEAD_SUPPORT],
355               [test "x$GDKGLEXTMM_MULTIHEAD_SUPPORT" = "xyes"])
356
357
358##################################################
359# CFLAGS and LIBS
360##################################################
361
362GDKGLEXTMM_PACKAGES="gdkglext_pkg gdkmm_pkg pangomm_pkg"
363GDKGLEXTMM_EXTRA_LIBS=""
364GDKGLEXTMM_EXTRA_CFLAGS=""
365GDKGLEXTMM_DEP_LIBS="`$PKG_CONFIG --libs $GDKGLEXTMM_PACKAGES` $GDKGLEXTMM_EXTRA_LIBS $LIBSTDCXX_LIBS"
366GDKGLEXTMM_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDKGLEXTMM_PACKAGES` $GDKGLEXTMM_EXTRA_CFLAGS $MULTIHEAD_SAFE"
367AC_SUBST([GDKGLEXTMM_PACKAGES])
368AC_SUBST([GDKGLEXTMM_EXTRA_LIBS])
369AC_SUBST([GDKGLEXTMM_EXTRA_CFLAGS])
370AC_SUBST([GDKGLEXTMM_DEP_LIBS])
371AC_SUBST([GDKGLEXTMM_DEP_CFLAGS])
372
373GTKGLEXTMM_PACKAGES="gtkglext_pkg gtkmm_pkg"
374GTKGLEXTMM_EXTRA_LIBS=""
375GTKGLEXTMM_EXTRA_CFLAGS=""
376GTKGLEXTMM_DEP_LIBS="`$PKG_CONFIG --libs $GDKGLEXTMM_PACKAGES $GTKGLEXTMM_PACKAGES` $GTKGLEXTMM_EXTRA_LIBS $GDKGLEXTMM_EXTRA_LIBS $LIBSTDCXX_LIBS"
377GTKGLEXTMM_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDKGLEXTMM_PACKAGES $GTKGLEXTMM_PACKAGES` $GDKGLEXTMM_EXTRA_CFLAGS $GTKGLEXTMM_EXTRA_CFLAGS $MULTIHEAD_SAFE"
378AC_SUBST([GTKGLEXTMM_PACKAGES])
379AC_SUBST([GTKGLEXTMM_EXTRA_LIBS])
380AC_SUBST([GTKGLEXTMM_EXTRA_CFLAGS])
381AC_SUBST([GTKGLEXTMM_DEP_LIBS])
382AC_SUBST([GTKGLEXTMM_DEP_CFLAGS])
383
384
385##################################################
386# Checks for doxygen
387##################################################
388
389AC_ARG_WITH(html-dir,
390            [AC_HELP_STRING([--with-html-dir=PATH],
391                            [path to installed docs [DATADIR/doc]])])
392
393if test "x$with_html_dir" = "x" ; then
394  # doxygen's default docdir
395  HTML_DIR='${datadir}/doc'
396else
397  HTML_DIR=$with_html_dir
398fi
399
400AC_SUBST([HTML_DIR])
401
402DOXYGEN_DOC=false
403
404PERL_PATH=""
405AC_PATH_PROGS([PERL_PATH], [perl perl5])
406AC_SUBST([PERL_PATH])
407
408DOT_PATH=""
409HAVE_DOT=NO
410AC_PATH_PROGS([DOT_PATH], [dot])
411if test "x$DOT_PATH" != "x"; then
412  HAVE_DOT=YES
413fi
414AC_SUBST([HAVE_DOT])
415AC_SUBST([DOT_PATH])
416
417DOXYGEN_PATH=""
418AC_PATH_PROGS([DOXYGEN_PATH], [doxygen])
419AC_SUBST([DOXYGEN_PATH])
420
421GLIBMM_INCLUDE_PATH=`$PKG_CONFIG --variable=includedir glibmm_pkg`/glibmm_pkg
422PANGOMM_INCLUDE_PATH=`$PKG_CONFIG --variable=includedir pangomm_pkg`/pangomm_pkg
423GDKMM_INCLUDE_PATH=`$PKG_CONFIG --variable=includedir gdkmm_pkg`/gdkmm_pkg
424GTKMM_INCLUDE_PATH=`$PKG_CONFIG --variable=includedir gtkmm_pkg`/gtkmm_pkg
425AC_SUBST([GLIBMM_INCLUDE_PATH])
426AC_SUBST([PANGOMM_INCLUDE_PATH])
427AC_SUBST([GDKMM_INCLUDE_PATH])
428AC_SUBST([GTKMM_INCLUDE_PATH])
429
430if test "x$PERL_PATH" != "x" -a "x$DOXYGEN_PATH" != "x"; then
431  DOXYGEN_DOC=true
432fi
433
434AC_ARG_ENABLE(doxygen-doc,
435              [AC_HELP_STRING([--enable-doxygen-doc],
436                              [use doxygen to build documentation [default=no]])], ,
437              [enable_doxygen_doc=no])
438
439if test "x$enable_doxygen_doc" = "xyes"; then
440  if test "x$DOXYGEN_DOC" != "xtrue"; then
441    enable_doxygen_doc=no
442  fi
443fi
444
445AM_CONDITIONAL([ENABLE_DOXYGEN_DOC],
446               [test "x$enable_doxygen_doc" = "xyes"])
447
448
449##################################################
450# Output configuration header
451##################################################
452
453dnl this section will only be run if config.status is invoked with no
454dnl arguments, or with "gdkglext/gdkglextmm-config.h" as an argument.
455AC_CONFIG_COMMANDS([gdkglext/gdkglextmm-config.h],
456[
457  outfile=gdkglextmm-config.h-tmp
458  cat > $outfile <<\_______EOF
459/* gdkglextmm-config.h
460 *
461 * This is a generated file.  Please modify `configure.in'
462 */
463
464#ifndef GDKGLEXTMM_CONFIG_H
465#define GDKGLEXTMM_CONFIG_H
466
467#include <gdkglext-config.h>
468
469_______EOF
470
471	cat >>$outfile <<_______EOF
472$gdkglextmm_windowing
473$gdkglextmm_multihead_support
474_______EOF
475
476	cat >>$outfile <<_______EOF
477
478#if !defined(GDKGLEXT_MULTIHEAD_SUPPORT) && defined(GDKGLEXTMM_MULTIHEAD_SUPPORT)
479#error "Installed GdkGLExt library doesn't have multihead support."
480#endif
481_______EOF
482
483	cat >>$outfile <<_______EOF
484
485#endif /* GDKGLEXTMM_CONFIG_H */
486_______EOF
487
488
489  if cmp -s $outfile gdkglext/gdkglextmm-config.h; then
490    AC_MSG_NOTICE([gdkglext/gdkglextmm-config.h is unchanged])
491    rm -f $outfile
492  else
493    mv $outfile gdkglext/gdkglextmm-config.h
494  fi
495
496],[
497
498if test "x$gdktarget" = "xx11" ; then
499  gdkglextmm_windowing='
500#define GDKGLEXTMM_WINDOWING_X11'
501elif test "x$gdktarget" = "xwin32" ; then
502  gdkglextmm_windowing='
503#define GDKGLEXTMM_WINDOWING_WIN32'
504fi
505
506if test "x$GDKGLEXTMM_MULTIHEAD_SUPPORT" = "xyes"; then
507  gdkglextmm_multihead_support='
508#define GDKGLEXTMM_MULTIHEAD_SUPPORT'
509fi
510
511])
512
513
514##################################################
515# Config files
516##################################################
517
518AC_CONFIG_FILES([
519gdkglextmm.pc
520gtkglextmm.pc
521gdkglextmm-uninstalled.pc
522gtkglextmm-uninstalled.pc
523gtkglextmm.spec
524gtkglextmm.nsi
525Makefile
526tools/Makefile
527tools/extra_defs_gen/Makefile
528tools/m4/Makefile
529gdkglext/Makefile
530gdkglext/src/Makefile
531gdkglext/gdkmm/Makefile
532gdkglext/gdkmm/gl/Makefile
533gdkglext/gdkmm/gl/version.h
534gdkglext/gdkmm/gl/private/Makefile
535gtkglext/Makefile
536gtkglext/src/Makefile
537gtkglext/gtkmm/Makefile
538gtkglext/gtkmm/gl/Makefile
539gtkglext/gtkmm/gl/version.h
540gtkglext/gtkmm/gl/private/Makefile
541examples/Makefile
542docs/Makefile
543docs/reference/Makefile
544docs/reference/Doxyfile
545m4macros/Makefile
546])
547
548AC_OUTPUT
549
550
551##################################################
552# Print configuration
553##################################################
554
555echo "
556configuration:
557	multihead support:	$GDKGLEXTMM_MULTIHEAD_SUPPORT
558"
559