Replace deprecated functions
[projects/chimara/chimara.git] / configure.ac
1 # configure.ac with sensible comments
2
3 ### INITIALIZATION ############################################################
4
5 AC_PREREQ([2.62]) # Oldest version of Autoconf that works with introspection
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=3.2
30 GLIB_REQUIRED_VERSION=2.16
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 ### ILIAD #####################################################################
79 AC_ARG_ENABLE([iliad],
80         [AS_HELP_STRING([--enable-iliad=@<:@yes/no@:>@],
81                 [Compiles Chimara for the iLiad @<:@default=no@:>@])],
82         [],
83         [enable_iliad=no])
84 AM_CONDITIONAL(TARGET_ILIAD, $TEST "x$enable_iliad" = xyes)
85
86 ### RPM CONFIGURATION ##########################################################
87 # --enable-rpm requires rpm and rpmbuild
88 AC_PATH_PROG([RPMBUILD], [rpmbuild], [notfound])
89 AC_ARG_ENABLE([rpm],
90         [AS_HELP_STRING([--enable-rpm=@<:@yes/no@:>@],
91                 [Configure for building RPM package @<:@default=no@:>@ (requires rpm and rpmbuild)])],
92         [AS_IF([$TEST "x$enable_rpm" = xyes],
93                 [AS_IF([$TEST "x$RPMBUILD" = xnotfound],
94                         [AC_MSG_ERROR([rpmbuild is required for --enable-rpm])])])],
95         [enable_rpm=no])
96 AM_CONDITIONAL(BUILDING_RPM, $TEST "x$enable_rpm" = xyes)
97
98 ### SOUND LIBRARY TO USE ######################################################
99
100 AC_ARG_WITH([gstreamer],
101         [AS_HELP_STRING([--without-gstreamer], [Disable GStreamer sound])],
102         [],
103         [with_gstreamer=yes])
104 SOUND_MODULE=
105 AS_IF([$TEST "x$with_gstreamer" != xno], 
106         [AC_DEFINE([GSTREAMER_SOUND], [1], [Define to enable sound support with GStreamer])
107         SOUND_MODULE="gstreamer-0.10 >= 0.10.12"])
108
109 ### WHETHER TO GENERATE A .VAPI FILE ##########################################
110 # Requires vapigen
111 AC_PATH_PROG([VAPIGEN], [vapigen], [notfound])
112 AM_CONDITIONAL(BUILDING_VAPI, $TEST "x$VAPIGEN" != xnotfound)
113
114 ### CHECK FOR LIBRARIES #######################################################
115
116 # Libraries needed to build Chimara library
117 PKG_CHECK_MODULES([CHIMARA], [
118         glib-2.0 >= $GLIB_REQUIRED_VERSION
119         gtk+-3.0 >= $GTK_REQUIRED_VERSION
120         gthread-2.0 
121         gmodule-2.0
122         pango
123         $SOUND_MODULE
124 ])
125 CHIMARA_LIBS="$CHIMARA_LIBS -lm"
126 AC_SUBST(CHIMARA_LIBS)
127 # Libraries needed to build Chimara player
128 PKG_CHECK_MODULES([PLAYER], [
129         glib-2.0 >= $GLIB_REQUIRED_VERSION
130         gtk+-3.0 >= $GTK_REQUIRED_VERSION
131         gmodule-2.0
132         dnl libgda-4.0
133         libsoup-2.4
134 ])
135 # Libraries needed to build test programs
136 PKG_CHECK_MODULES([TEST], [
137         gtk+-3.0 >= $GTK_REQUIRED_VERSION
138         gmodule-2.0 >= $GLIB_REQUIRED_VERSION
139 ])
140
141 # GStreamer plugins needed to run library
142 AS_IF([$TEST "x$with_gstreamer" != xno], [
143         m4_defun([AX_GST_REQUIRE_ELEMENT],
144                 [AM_GST_ELEMENT_CHECK([$1],
145                         [],
146                         [AC_MSG_ERROR([GStreamer element $1 not found. You need to install gstreamer-plugins-m4_default([$2], [base]).])]
147                 )]
148         )
149         AX_GST_REQUIRE_ELEMENT([giostreamsrc])
150         AX_GST_REQUIRE_ELEMENT([typefind])
151         AX_GST_REQUIRE_ELEMENT([audioconvert])
152         AX_GST_REQUIRE_ELEMENT([volume])
153         AX_GST_REQUIRE_ELEMENT([oggdemux])
154         AX_GST_REQUIRE_ELEMENT([vorbisdec])
155         AX_GST_REQUIRE_ELEMENT([autoaudiosink], [good])
156         AX_GST_REQUIRE_ELEMENT([aiffparse], [bad])
157         AX_GST_REQUIRE_ELEMENT([modplug], [bad])
158 ])
159
160 # Plugin flags; include '-module' in each Makefile.am, because AC_SUBSTed
161 # variables are black boxes to Automake, so it has to know about it being a
162 # module in the makefile itself.
163 PLUGIN_LIBTOOL_FLAGS='-avoid-version -shared -export-symbols-regex "^glk"'
164 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
165
166 ### OUTPUT ####################################################################
167
168 # Output platform-specific definitions to config.h
169 AC_CONFIG_HEADERS([config.h])
170 # List of other files for Autoconf to output
171 AC_CONFIG_FILES([
172 Makefile
173 chimara.pc
174 chimara-plugin.pc
175 chimara.spec
176 libchimara/Makefile
177 interpreters/Makefile
178 interpreters/frotz/Makefile
179 interpreters/nitfol/Makefile
180 interpreters/glulxe/Makefile
181 interpreters/git/Makefile
182 tests/Makefile
183 player/Makefile
184 player/config.py
185 docs/Makefile
186 docs/reference/Makefile
187 docs/reference/version.xml
188 docs/reference/build-selector-table.pl
189 po/Makefile.in
190 babel/Makefile
191 ])
192
193 # Do it
194 AC_OUTPUT
195