33758b7af2ba30d571fc0491d1640bd67f2d375e
[grits] / configure.ac
1 m4_define([grits_release], [0.7])
2 m4_define([grits_version], [4:0:0])
3 m4_define([grits_subdir],  [grits4])
4
5 # Init and options
6 AC_INIT([grits], [grits_release], [andy753421@gmail.com])
7 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign])
8 AC_CONFIG_HEADERS([config.h])
9 AC_CONFIG_MACRO_DIR([m4])
10 #AM_SILENT_RULES([yes])
11
12 # For library versioning
13 LIB_VERSION=grits_version
14 GRITS_SUBDIR=grits_subdir
15 AC_SUBST(LIB_VERSION)
16 AC_SUBST(GRITS_SUBDIR)
17
18 # Fix broken libtool
19 lt_cv_sys_lib_dlsearch_path_spec="/lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64"
20
21 # Check for required programs
22 AC_PROG_CC
23 AC_PROG_LIBTOOL
24 DOLT
25 PKG_PROG_PKG_CONFIG
26 GTK_DOC_CHECK(1.9)
27
28 # Check for required packages
29 PKG_CHECK_MODULES(GLIB,  glib-2.0 >= 2.32 gobject-2.0 gthread-2.0 gmodule-2.0)
30 PKG_CHECK_MODULES(CAIRO, cairo)
31 PKG_CHECK_MODULES(SOUP,  libsoup-2.4 >= 2.26)
32
33 # Check for gtk 3
34 AC_ARG_ENABLE([gtk3],
35         AS_HELP_STRING([--enable-gtk3], [Build with gtk3 support]))
36 AS_IF([test "$enable_gtk3" = "yes"],
37         [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0)],
38         [PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18)])
39 AS_IF([test "$enable_gtk3" = "yes"],
40         [GTK_VERSION=gtk+-3.0],
41         [GTK_VERSION=gtk+-2.0])
42 AC_SUBST(GTK_VERSION)
43
44 # Check for glut for example plugin
45 AC_CHECK_LIB(glut, glutSolidTeapot, GLUT_LIBS="-lglut")
46 AM_CONDITIONAL(HAVE_GLUT, test "$GLUT_LIBS" != "")
47 AC_SUBST(GLUT_LIBS)
48
49 # Test for windowing system
50 case "${host}" in
51         *mingw32*) SYS="WIN" ;;
52         *cygwin*)  SYS="WIN" ;;
53         *apple*)   SYS="MAC" ;;
54         *)         SYS="X11" ;;
55 esac
56 AM_CONDITIONAL([SYS_WIN], test "$SYS" = "WIN")
57 AM_CONDITIONAL([SYS_MAC], test "$SYS" = "MAC")
58 AM_CONDITIONAL([SYS_X11], test "$SYS" = "X11")
59
60 # OpenGL flags
61 GL_CFLAGS="-DSYS_$SYS"
62 case "$SYS" in
63         "WIN") GL_LIBS="-lglu32 -lopengl32" ;;
64         "MAC") GL_LIBS="-framework OpenGL" ;;
65         "X11") GL_LIBS="-lX11 -lGL -lGLU" ;;
66 esac
67 AC_SUBST([GL_CFLAGS])
68 AC_SUBST([GL_LIBS])
69
70 # Check for relative build
71 AC_ARG_ENABLE(relative, [AS_HELP_STRING([--enable-relative],
72         [enable runtime search paths @<:@default=no@:>@])],
73         [DOTS=".."; ac_default_prefix="/"])
74 AC_SUBST([DOTS])
75
76 # Output 
77 AC_CONFIG_FILES([
78         Makefile
79         src/Makefile
80         src/data/Makefile
81         src/objects/Makefile
82         src/plugins/Makefile
83         src/grits.pc
84         docs/Makefile
85         docs/api/Makefile
86 ])
87 AC_OUTPUT