Sync new GStreamer element to parent state
[projects/chimara/chimara.git] / configure.ac
1 # configure.ac with sensible comments
2
3 ### INITIALIZATION ############################################################
4
5 AC_PREREQ([2.64]) # Newest feature: m4_map_args_w
6 # Initialize Autoconf
7 # Args: (human-readable package name, package version, bug report address, 
8 # tarballname)
9 AC_INIT([chimara], [0.9])
10 # Sanity check to make sure we are running Autoconf from the right directory
11 AC_CONFIG_SRCDIR(libchimara/chimara-glk.c)
12 # Put m4 macros in their own directory
13 AC_CONFIG_MACRO_DIR([m4])
14 # Initialize Automake
15 AM_INIT_AUTOMAKE([-Wall -Wno-portability])
16 # Configure with --enable-silent-rules to cut down on clutter
17 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
18
19 ### LIBRARY VERSIONING ########################################################
20 # Only update immediately before a public release
21
22 CHIMARA_CURRENT=0  # Increment if interface changes
23 CHIMARA_REVISION=0 # Increment if source changes; set 0 if interface changes
24 CHIMARA_AGE=0 # Increment if interfaces added; set 0 if removed
25 LT_VERSION_INFO="$CHIMARA_CURRENT:$CHIMARA_REVISION:$CHIMARA_AGE"
26 AC_SUBST(LT_VERSION_INFO)
27
28 ### REQUIREMENTS ##############################################################
29 GTK_REQUIRED_VERSION=2.18
30 GLIB_REQUIRED_VERSION=2.32
31 GTK_DOC_REQUIRED_VERSION=1.12
32 AC_SUBST(GTK_REQUIRED_VERSION)
33 AC_SUBST(GLIB_REQUIRED_VERSION)
34 AC_SUBST(GTK_DOC_REQUIRED_VERSION)
35
36 ### DECLARE COMPILERS #########################################################
37
38 AC_USE_SYSTEM_EXTENSIONS     # Define _GNU_SOURCE if using GCC
39 AC_PROG_CC                   # C compiler
40 AM_PROG_CC_C_O               # Automake requires this for per-target CFLAGS
41 AC_C_INLINE                  # Define inline keyword 
42 AC_PROG_YACC                 # Building nitfol requires yacc
43
44 ### DECLARE PROGRAMS ##########################################################
45
46 AC_PROG_INSTALL              # Install
47 LT_INIT([dlopen])            # Libtool 2.2.6 and up
48 LT_PREREQ([2.2.6])
49 AM_GNU_GETTEXT([external])   # Gettext, link to system libintl
50 IT_PROG_INTLTOOL([0.40.0])   # Intltool
51 PKG_PROG_PKG_CONFIG          # pkg_config
52 GTK_DOC_CHECK($GTK_DOC_REQUIRED_VERSION) 
53 GLIB_GSETTINGS               # GSettings
54 # Other utilities used in this package's various make scripts
55 AC_PROG_AWK
56 AC_PATH_PROG([PERL], [perl]) # Perl
57 AC_PATH_PROG([TEST], [test]) # Test
58 AC_PATH_PROG([ECHO], [echo]) # Echo
59
60 ### TYPES #####################################################################
61
62 AC_TYPE_UINT8_T
63 AC_TYPE_UINT16_T
64 AC_TYPE_INT32_T
65 AC_TYPE_UINT32_T
66
67 ### INTERNATIONALIZATION ######################################################
68
69 AM_GNU_GETTEXT_VERSION([0.17])
70 GETTEXT_PACKAGE=chimara
71 AC_SUBST(GETTEXT_PACKAGE)
72 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
73
74 ### INTROSPECTION ##############################################################
75
76 GOBJECT_INTROSPECTION_CHECK([0.6.7])
77
78 ### RPM CONFIGURATION ##########################################################
79 # --enable-rpm requires rpm and rpmbuild
80 AC_PATH_PROG([RPMBUILD], [rpmbuild], [notfound])
81 AC_ARG_ENABLE([rpm],
82         [AS_HELP_STRING([--enable-rpm=@<:@yes/no@:>@],
83                 [Configure for building RPM package @<:@default=no@:>@ (requires rpm and rpmbuild)])],
84         [AS_IF([$TEST "x$enable_rpm" = xyes],
85                 [AS_IF([$TEST "x$RPMBUILD" = xnotfound],
86                         [AC_MSG_ERROR([rpmbuild is required for --enable-rpm])])])],
87         [enable_rpm=no])
88 AM_CONDITIONAL(BUILDING_RPM, $TEST "x$enable_rpm" = xyes)
89
90 ### SOUND LIBRARY TO USE ######################################################
91
92 AC_ARG_WITH([sound],
93         [AS_HELP_STRING([--with-sound=@<:@no/auto/gstreamer0.10/gstreamer1.0@:>@],
94                 [Choose library with which to implement Glk sound])],
95         [],
96         [with_sound=auto])
97
98 have_gstreamer0_10=no
99 have_gstreamer1_0=no
100 AS_IF([test "x$with_sound" != "xno"], [
101         PKG_CHECK_EXISTS([gstreamer-1.0], [have_gstreamer1_0=yes])
102         PKG_CHECK_EXISTS([gstreamer-0.10], [have_gstreamer0_10=yes])])
103 SOUND_MODULE=
104 # Autodetect sound library
105 AS_IF([test "x$with_sound" = "xauto"], [
106         AC_MSG_CHECKING([which sound library to use])
107         AS_IF([test "x$have_gstreamer1_0" = "xyes"], [with_sound=gstreamer1.0], [
108                 AS_IF([test "x$have_gstreamer0_10" = "xyes"],
109                         [with_sound=gstreamer0.10],
110                         [with_sound=no])])
111         AC_MSG_RESULT([$with_sound])])
112 # Sound library to use in the end
113 AS_CASE([$with_sound],
114         [gstreamer0.10], [
115                 AC_DEFINE([GSTREAMER_0_10_SOUND], [1],
116                         [Define to enable sound support with GStreamer 0.10])
117                 SOUND_MODULE="gstreamer-0.10 >= 0.10.12"],
118         [gstreamer1.0], [
119                 AC_DEFINE([GSTREAMER_1_0_SOUND], [1],
120                         [Define to enable sound support with GStreamer 1.0])
121                 SOUND_MODULE="gstreamer-1.0"],
122         [])
123 AS_IF([test "x$with_sound" != "xno"],
124         [AC_DEFINE([HAVE_SOUND], [1], [Define if any sound support is enabled])])
125
126 ### WHETHER TO GENERATE A .VAPI FILE ##########################################
127 # Requires vapigen
128 AC_PATH_PROG([VAPIGEN], [vapigen], [notfound])
129 AM_CONDITIONAL(BUILDING_VAPI, $TEST "x$VAPIGEN" != xnotfound)
130
131 ### CHECK FOR LIBRARIES #######################################################
132
133 # Libraries needed to build Chimara library
134 PKG_CHECK_MODULES([CHIMARA], [
135         glib-2.0 >= $GLIB_REQUIRED_VERSION
136         gtk+-2.0 >= $GTK_REQUIRED_VERSION
137         gthread-2.0 
138         gmodule-2.0
139         pango
140         $SOUND_MODULE
141 ])
142 CHIMARA_LIBS="$CHIMARA_LIBS -lm"
143 AC_SUBST(CHIMARA_LIBS)
144 # Libraries needed to build Chimara player
145 PKG_CHECK_MODULES([PLAYER], [
146         glib-2.0 >= $GLIB_REQUIRED_VERSION
147         gtk+-2.0 >= $GTK_REQUIRED_VERSION
148         gmodule-2.0
149 ])
150 # Libraries needed to build test programs
151 PKG_CHECK_MODULES([TEST], [
152         gtk+-2.0 >= $GTK_REQUIRED_VERSION
153         gmodule-2.0 >= $GLIB_REQUIRED_VERSION
154 ])
155
156 # GStreamer plugins needed to run library
157 AS_CASE([$with_sound],
158         [gstreamer0.10], [
159                 have_all_elements=yes
160                 m4_ifdef([AM_GST_ELEMENT_CHECK], [
161                         m4_map_args_w([
162                                 giostreamsrc
163                                 typefind
164                                 audioconvert
165                                 volume
166                                 oggdemux
167                                 vorbisdec
168                                 autoaudiosink
169                                 aiffparse
170                                 modplug],
171                                 [AM_GST_ELEMENT_CHECK(], [, [], [have_all_elements=no])])
172                         AS_IF([test "x$have_all_elements" = "xno"],
173                                 [AC_MSG_ERROR([One or more required GStreamer elements were not found.
174 You will have to install your system's "base", "good", and "bad" plugins
175 pacakges. Try looking for names such as: gstreamer-plugins-base,
176 gstreamer-plugins-good, gstreamer-plugins-bad-free,
177 gstreamer-plugins-bad-free-extras, gstreamer0.10-plugins-base,
178 gstreamer0.10-plugins-good, gstreamer0.10-plugins-bad])])],
179                 [AC_MSG_ERROR([AM_GST_ELEMENT_CHECK not found. Install the development package
180 for GStreamer 0.10 and rerun autogen.sh.])])
181         ],
182         [gstreamer1.0], [dnl aiffparse is currently broken in Fedora 19
183                 have_all_elements=yes
184                 m4_ifdef([GST_ELEMENT_CHECK], [
185                         m4_map_args_w([
186                                 giostreamsrc
187                                 typefind
188                                 audioconvert
189                                 volume
190                                 oggdemux
191                                 vorbisdec
192                                 autoaudiosink
193                                 modplug],
194                                 [GST_ELEMENT_CHECK(], [, [1.0], [], [have_all_elements=no])])
195                         AS_IF([test "x$have_all_elements" = "xno"],
196                                 [AC_MSG_ERROR([One or more required GStreamer elements were not found.
197 You will have to install your system's "base", "good", and "bad" plugins
198 packages. Try looking for names such as: gstreamer1-plugins-base,
199 gstreamer1-plugins-good, gstreamer1-plugins-bad-free,
200 gstreamer1-plugins-bad-free-extras, gstreamer1.0-plugins-base,
201 gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad])])],
202                         [AC_MSG_ERROR([GST_ELEMENT_CHECK not found. Install the development package
203 for GStreamer 1.0 and rerun autogen.sh.])])
204         ],
205         [])
206
207 # Plugin flags; include '-module' in each Makefile.am, because AC_SUBSTed
208 # variables are black boxes to Automake, so it has to know about it being a
209 # module in the makefile itself.
210 PLUGIN_LIBTOOL_FLAGS='-avoid-version -shared -export-symbols-regex "^glk"'
211 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
212
213 ### OUTPUT ####################################################################
214
215 # Output platform-specific definitions to config.h
216 AC_CONFIG_HEADERS([config.h])
217 # List of other files for Autoconf to output
218 AC_CONFIG_FILES([
219 Makefile
220 chimara.pc
221 chimara-plugin.pc
222 chimara.spec
223 libchimara/Makefile
224 interpreters/Makefile
225 interpreters/frotz/Makefile
226 interpreters/nitfol/Makefile
227 interpreters/glulxe/Makefile
228 interpreters/git/Makefile
229 interpreters/bocfel/Makefile
230 tests/Makefile
231 tests/unit/Makefile
232 player/Makefile
233 player/config.py
234 docs/Makefile
235 docs/reference/Makefile
236 docs/reference/version.xml
237 docs/reference/build-selector-table.pl
238 po/Makefile.in
239 ])
240
241 # Do it
242 AC_OUTPUT
243