Added guards for compiling without GStreamer
[projects/chimara/chimara.git] / configure.ac
1 # configure.ac with sensible comments
2
3 ### INITIALIZATION ############################################################
4
5 # Initialize Autoconf 
6 # Args: (human-readable package name, package version, bug report address, 
7 # tarballname)
8 AC_INIT([chimara], [0.9])
9 # Sanity check to make sure we are running Autoconf from the right directory
10 AC_CONFIG_SRCDIR(libchimara/chimara-glk.c)
11 # Put m4 macros in their own directory
12 AC_CONFIG_MACRO_DIR(m4)
13 # Initialize Automake
14 AM_INIT_AUTOMAKE([-Wall])
15 # Configure with --enable-silent-rules to cut down on clutter
16 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
17
18 ### LIBRARY VERSIONING ########################################################
19 # Only update immediately before a public release
20
21 CHIMARA_CURRENT=0  # Increment if interface changes
22 CHIMARA_REVISION=0 # Increment if source changes; set 0 if interface changes
23 CHIMARA_AGE=0 # Increment if interfaces added; set 0 if removed
24 LT_VERSION_INFO="$CHIMARA_CURRENT:$CHIMARA_REVISION:$CHIMARA_AGE"
25 AC_SUBST(LT_VERSION_INFO)
26
27 ### REQUIREMENTS ##############################################################
28 # Recommended GTK version: at least 2.12
29 # Recommended Glib version: at least 2.16
30 GTK_REQUIRED_VERSION=2.6
31 GLIB_REQUIRED_VERSION=2.6
32 GTK_DOC_REQUIRED_VERSION=1.9
33 AC_SUBST(GTK_REQUIRED_VERSION)
34 AC_SUBST(GLIB_REQUIRED_VERSION)
35 AC_SUBST(GTK_DOC_REQUIRED_VERSION)
36
37 ### DECLARE COMPILERS #########################################################
38
39 AC_USE_SYSTEM_EXTENSIONS     # Define _GNU_SOURCE if using GCC
40 AC_PROG_CC                   # C compiler
41 AM_PROG_CC_C_O               # Automake requires this for per-target CFLAGS
42 AC_C_INLINE                  # Define inline keyword 
43 AC_PROG_YACC                 # Building nitfol requires yacc
44
45 ### DECLARE PROGRAMS ##########################################################
46
47 AC_PROG_INSTALL              # Install
48 m4_defun([_LT_AC_LANG_CXX_CONFIG], [:]) # Disable unnecessary Libtool checks
49 m4_defun([_LT_AC_LANG_F77_CONFIG], [:]) # to save time (1.5 only)
50 LT_INIT                      # Libtool 2.2.6 and up
51 #LT_INIT([dlopen])           # Should call it this way, but
52 #LT_PREREQ([2.2.6])          # ...goddamn Debian still has 1.5
53 AC_PROG_LIBTOOL              # Old way of declaring Libtool
54 AM_GNU_GETTEXT([external])   # Gettext, link to system libintl
55 IT_PROG_INTLTOOL([0.40.0])   # Intltool
56 PKG_PROG_PKG_CONFIG          # pkg_config
57 GTK_DOC_CHECK($GTK_DOC_REQUIRED_VERSION) 
58 # Other utilities used in this package's various make scripts
59 AC_PROG_AWK
60 AC_PATH_PROG([PERL], [perl]) # Perl
61 AC_PATH_PROG([TEST], [test]) # Test
62 AC_PATH_PROG([ECHO], [echo]) # Echo
63
64 ### TYPES #####################################################################
65
66 AC_TYPE_UINT8_T
67 AC_TYPE_UINT16_T
68 AC_TYPE_INT32_T
69 AC_TYPE_UINT32_T
70
71 ### INTERNATIONALIZATION ######################################################
72
73 AM_GNU_GETTEXT_VERSION([0.17])
74 GETTEXT_PACKAGE=chimara
75 AC_SUBST(GETTEXT_PACKAGE)
76 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
77
78 ### ILIAD #####################################################################
79 AC_ARG_ENABLE([iliad],
80   [AS_HELP_STRING([--enable-iliad],[Compiles Chimara for the iLiad])],
81   [AS_CASE([${enableval}],
82            [yes], [iliad=true],
83            [no], [iliad=false],
84            [AC_MSG_ERROR([bad value ${enableval} for --enable-iliad])]
85    )],
86    [iliad=false]
87 )
88
89 AM_CONDITIONAL([TARGET_ILIAD], [$TEST "x$iliad" = xtrue])
90
91 ### RPM CONFIGURATION ##########################################################
92 # --enable-rpm requires rpm and rpmbuild
93 AC_PATH_PROG([RPMBUILD], [rpmbuild], [notfound])
94 AC_ARG_ENABLE([rpm],
95         [AS_HELP_STRING([--enable-rpm],[Configure for building RPM package [no] (requires rpm and rpmbuild)])],
96         [AS_CASE([${enableval}],
97                 [yes], [AS_IF(
98                         [$TEST "x$RPMBUILD" = xnotfound],
99                                 [AC_MSG_ERROR([rpmbuild is required for --enable-rpm])],
100                         [rpm=true])],
101                 [no],  [rpm=false],
102                 [AC_MSG_ERROR([bad value ${enableval} for --enable-rpm])]
103         )],
104         [rpm=false]
105 )
106 AM_CONDITIONAL([BUILDING_RPM], [$TEST "x$rpm" = xtrue])
107
108 ### SOUND LIBRARY TO USE ######################################################
109
110 AC_ARG_WITH([gstreamer],
111         [AS_HELP_STRING([--without-gstreamer], [Disable GStreamer sound])],
112         [],
113         [with_gstreamer=yes])
114 SOUND_MODULE=
115 AS_IF([$TEST "x$with_gstreamer" != xno], 
116         [AC_DEFINE([GSTREAMER_SOUND], [1], [Define to enable sound support with GStreamer])
117         SOUND_MODULE=gstreamer-0.10])
118
119 ### CHECK FOR LIBRARIES #######################################################
120
121 # Libraries needed to build Chimara library
122 PKG_CHECK_MODULES([CHIMARA], [
123         glib-2.0 >= $GLIB_REQUIRED_VERSION
124         gtk+-2.0 >= $GTK_REQUIRED_VERSION
125         gthread-2.0 
126         gmodule-2.0
127         pango
128         $SOUND_MODULE
129 ])
130 CHIMARA_LIBS="$CHIMARA_LIBS -lm"
131 AC_SUBST(CHIMARA_LIBS)
132 # Libraries needed to build test programs
133 PKG_CHECK_MODULES([TEST], [
134         gtk+-2.0 >= $GTK_REQUIRED_VERSION
135         gmodule-2.0 >= $GLIB_REQUIRED_VERSION
136 ])
137
138 # Plugin flags; include '-module' in each Makefile.am, because AC_SUBSTed
139 # variables are black boxes to Automake, so it has to know about it being a
140 # module in the makefile itself.
141 PLUGIN_LIBTOOL_FLAGS='-avoid-version -shared -export-symbols-regex "^glk"'
142 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
143
144 ### OUTPUT ####################################################################
145
146 # Output platform-specific definitions to config.h
147 AC_CONFIG_HEADERS([config.h])
148 # List of other files for Autoconf to output
149 AC_CONFIG_FILES([
150 Makefile
151 chimara.pc
152 chimara-plugin.pc
153 chimara.spec
154 libchimara/Makefile
155 interpreters/Makefile
156 interpreters/frotz/Makefile
157 interpreters/nitfol/Makefile
158 interpreters/glulxe/Makefile
159 interpreters/git/Makefile
160 tests/Makefile
161 player/Makefile
162 docs/Makefile
163 docs/reference/Makefile
164 docs/reference/version.xml
165 docs/reference/build-selector-table.pl
166 po/Makefile.in
167 ])
168
169 # Do it
170 AC_OUTPUT
171