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