Don't use g_thread_init() anymore
[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 # Recommended GTK version: at least 2.12
30 GTK_REQUIRED_VERSION=2.6
31 GLIB_REQUIRED_VERSION=2.32
32 GTK_DOC_REQUIRED_VERSION=1.12
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 LT_INIT([dlopen])            # Libtool 2.2.6 and up
49 LT_PREREQ([2.2.6])
50 AM_GNU_GETTEXT([external])   # Gettext, link to system libintl
51 IT_PROG_INTLTOOL([0.40.0])   # Intltool
52 PKG_PROG_PKG_CONFIG          # pkg_config
53 GTK_DOC_CHECK($GTK_DOC_REQUIRED_VERSION) 
54 GLIB_GSETTINGS               # GSettings
55 # Other utilities used in this package's various make scripts
56 AC_PROG_AWK
57 AC_PATH_PROG([PERL], [perl]) # Perl
58 AC_PATH_PROG([TEST], [test]) # Test
59 AC_PATH_PROG([ECHO], [echo]) # Echo
60
61 ### TYPES #####################################################################
62
63 AC_TYPE_UINT8_T
64 AC_TYPE_UINT16_T
65 AC_TYPE_INT32_T
66 AC_TYPE_UINT32_T
67
68 ### INTERNATIONALIZATION ######################################################
69
70 AM_GNU_GETTEXT_VERSION([0.17])
71 GETTEXT_PACKAGE=chimara
72 AC_SUBST(GETTEXT_PACKAGE)
73 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
74
75 ### INTROSPECTION ##############################################################
76
77 GOBJECT_INTROSPECTION_CHECK([0.6.7])
78
79 ### RPM CONFIGURATION ##########################################################
80 # --enable-rpm requires rpm and rpmbuild
81 AC_PATH_PROG([RPMBUILD], [rpmbuild], [notfound])
82 AC_ARG_ENABLE([rpm],
83         [AS_HELP_STRING([--enable-rpm=@<:@yes/no@:>@],
84                 [Configure for building RPM package @<:@default=no@:>@ (requires rpm and rpmbuild)])],
85         [AS_IF([$TEST "x$enable_rpm" = xyes],
86                 [AS_IF([$TEST "x$RPMBUILD" = xnotfound],
87                         [AC_MSG_ERROR([rpmbuild is required for --enable-rpm])])])],
88         [enable_rpm=no])
89 AM_CONDITIONAL(BUILDING_RPM, $TEST "x$enable_rpm" = xyes)
90
91 ### SOUND LIBRARY TO USE ######################################################
92
93 AC_ARG_WITH([gstreamer],
94         [AS_HELP_STRING([--without-gstreamer], [Disable GStreamer sound])],
95         [],
96         [with_gstreamer=yes])
97 SOUND_MODULE=
98 AS_IF([$TEST "x$with_gstreamer" != xno], 
99         [AC_DEFINE([GSTREAMER_SOUND], [1], [Define to enable sound support with GStreamer])
100         SOUND_MODULE="gstreamer-0.10 >= 0.10.12"])
101
102 ### WHETHER TO GENERATE A .VAPI FILE ##########################################
103 # Requires vapigen
104 AC_PATH_PROG([VAPIGEN], [vapigen], [notfound])
105 AM_CONDITIONAL(BUILDING_VAPI, $TEST "x$VAPIGEN" != xnotfound)
106
107 ### CHECK FOR LIBRARIES #######################################################
108
109 # Libraries needed to build Chimara library
110 PKG_CHECK_MODULES([CHIMARA], [
111         glib-2.0 >= $GLIB_REQUIRED_VERSION
112         gtk+-2.0 >= $GTK_REQUIRED_VERSION
113         gthread-2.0 
114         gmodule-2.0
115         pango
116         $SOUND_MODULE
117 ])
118 CHIMARA_LIBS="$CHIMARA_LIBS -lm"
119 AC_SUBST(CHIMARA_LIBS)
120 # Libraries needed to build Chimara player
121 PKG_CHECK_MODULES([PLAYER], [
122         glib-2.0 >= $GLIB_REQUIRED_VERSION
123         gtk+-2.0 >= $GTK_REQUIRED_VERSION
124         gmodule-2.0
125 ])
126 # Libraries needed to build test programs
127 PKG_CHECK_MODULES([TEST], [
128         gtk+-2.0 >= $GTK_REQUIRED_VERSION
129         gmodule-2.0 >= $GLIB_REQUIRED_VERSION
130 ])
131
132 # GStreamer plugins needed to run library
133 AS_IF([$TEST "x$with_gstreamer" != xno], [
134         m4_defun([AX_GST_REQUIRE_ELEMENT],
135                 [AM_GST_ELEMENT_CHECK([$1],
136                         [],
137                         [AC_MSG_ERROR([GStreamer element $1 not found. You need to install gstreamer-plugins-m4_default([$2], [base]).])]
138                 )]
139         )
140         AX_GST_REQUIRE_ELEMENT([giostreamsrc])
141         AX_GST_REQUIRE_ELEMENT([typefind])
142         AX_GST_REQUIRE_ELEMENT([audioconvert])
143         AX_GST_REQUIRE_ELEMENT([volume])
144         AX_GST_REQUIRE_ELEMENT([oggdemux])
145         AX_GST_REQUIRE_ELEMENT([vorbisdec])
146         AX_GST_REQUIRE_ELEMENT([autoaudiosink], [good])
147         AX_GST_REQUIRE_ELEMENT([aiffparse], [bad])
148         AX_GST_REQUIRE_ELEMENT([modplug], [bad])
149 ])
150
151 # Plugin flags; include '-module' in each Makefile.am, because AC_SUBSTed
152 # variables are black boxes to Automake, so it has to know about it being a
153 # module in the makefile itself.
154 PLUGIN_LIBTOOL_FLAGS='-avoid-version -shared -export-symbols-regex "^glk"'
155 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
156
157 ### OUTPUT ####################################################################
158
159 # Output platform-specific definitions to config.h
160 AC_CONFIG_HEADERS([config.h])
161 # List of other files for Autoconf to output
162 AC_CONFIG_FILES([
163 Makefile
164 chimara.pc
165 chimara-plugin.pc
166 chimara.spec
167 libchimara/Makefile
168 interpreters/Makefile
169 interpreters/frotz/Makefile
170 interpreters/nitfol/Makefile
171 interpreters/glulxe/Makefile
172 interpreters/git/Makefile
173 interpreters/bocfel/Makefile
174 tests/Makefile
175 player/Makefile
176 player/config.py
177 docs/Makefile
178 docs/reference/Makefile
179 docs/reference/version.xml
180 docs/reference/build-selector-table.pl
181 po/Makefile.in
182 ])
183
184 # Do it
185 AC_OUTPUT
186