b26065f2e5ce814b0d3ba1ceb06ca5b7df479bf5
[dana/openbox.git] / configure.ac
1 AC_PREREQ([2.54])
2 AC_INIT([openbox], [3.999.0], [http://bugzilla.icculus.org])
3 AM_INIT_AUTOMAKE
4 AC_CONFIG_SRCDIR([openbox/openbox.c])
5
6 dnl Making releases:
7 dnl   RR_MICRO_VERSION += 1;
8 dnl   RR_INTERFACE_AGE += 1;
9 dnl   R_BINARY_AGE += 1;
10 dnl if any functions have been added, set RR_INTERFACE_AGE to 0.
11 dnl if backwards compatibility has been broken,
12 dnl set RR_BINARY_AGE and RR_INTERFACE_AGE to 0.
13 dnl
14 dnl if MAJOR or MINOR version changes, be sure to change AC_INIT above to match
15 dnl
16 RR_MAJOR_VERSION=4
17 RR_MINOR_VERSION=0
18 RR_MICRO_VERSION=17
19 RR_INTERFACE_AGE=0
20 RR_BINARY_AGE=0
21 RR_VERSION=$RR_MAJOR_VERSION.$RR_MINOR_VERSION
22
23 OBT_MAJOR_VERSION=4
24 OBT_MINOR_VERSION=0
25 OBT_MICRO_VERSION=0
26 OBT_INTERFACE_AGE=0
27 OBT_BINARY_AGE=0
28 OBT_VERSION=$OBT_MAJOR_VERSION.$OBT_MINOR_VERSION
29
30 AC_SUBST(RR_MAJOR_VERSION)
31 AC_SUBST(RR_MINOR_VERSION)
32 AC_SUBST(RR_MICRO_VERSION)
33 AC_SUBST(RR_INTERFACE_AGE)
34 AC_SUBST(RR_BINARY_AGE)
35 AC_SUBST(RR_VERSION)
36 AC_SUBST(OBT_MAJOR_VERSION)
37 AC_SUBST(OBT_MINOR_VERSION)
38 AC_SUBST(OBT_MICRO_VERSION)
39 AC_SUBST(OBT_INTERFACE_AGE)
40 AC_SUBST(OBT_BINARY_AGE)
41 AC_SUBST(OBT_VERSION)
42
43 dnl Libtool versioning
44 RR_RELEASE=$RR_MAJOR_VERSION.$RR_MINOR_VERSION
45 RR_CURRENT=`expr $RR_MICRO_VERSION - $RR_INTERFACE_AGE`
46 RR_REVISION=$RR_INTERFACE_AGE
47 RR_AGE=`expr $RR_BINARY_AGE - $RR_INTERFACE_AGE`
48 RR_CURRENT_MINUS_AGE=`expr $RR_CURRENT - $RR_AGE`
49
50 OBT_RELEASE=$OBT_MAJOR_VERSION.$OBT_MINOR_VERSION
51 OBT_CURRENT=`expr $OBT_MICRO_VERSION - $OBT_INTERFACE_AGE`
52 OBT_REVISION=$OBT_INTERFACE_AGE
53 OBT_AGE=`expr $OBT_BINARY_AGE - $OBT_INTERFACE_AGE`
54 OBT_CURRENT_MINUS_AGE=`expr $OBT_CURRENT - $OBT_AGE`
55
56 AC_SUBST(RR_RELEASE)
57 AC_SUBST(RR_CURRENT)
58 AC_SUBST(RR_REVISION)
59 AC_SUBST(RR_AGE)
60 AC_SUBST(RR_CURRENT_MINUS_AGE)
61 AC_SUBST(OBT_RELEASE)
62 AC_SUBST(OBT_CURRENT)
63 AC_SUBST(OBT_REVISION)
64 AC_SUBST(OBT_AGE)
65 AC_SUBST(OBT_CURRENT_MINUS_AGE)
66
67 AC_PREFIX_DEFAULT([/usr/local])
68 test "$prefix" = "NONE" && prefix=$ac_default_prefix
69
70 dnl Determine build target
71 OB_DEBUG
72 dnl Pick compiler specific/build target flags, and set $CVS
73 AM_PROG_CC_C_O
74 OB_COMPILER_FLAGS
75 AC_C_CONST
76 AC_C_INLINE
77
78 AC_PROG_LIBTOOL
79 AC_SUBST(LIBTOOL_DEPS)
80 LIBTOOL="$LIBTOOL --silent"
81
82 AC_PROG_INSTALL
83
84 AM_GNU_GETTEXT_VERSION(0.15)
85 AM_GNU_GETTEXT([external])
86
87 AC_CHECK_HEADERS(ctype.h fcntl.h locale.h signal.h string.h stdio.h stdlib.h)
88 AC_CHECK_HEADERS(unistd.h sys/stat.h sys/select.h sys/time.h sys/wait.h)
89 # AC_HEADER_TIME
90 # AC_TYPE_SIGNAL
91
92 AC_PATH_PROG([SED], [sed], [no])
93 if test "$SED" = "no"; then
94   AC_MSG_ERROR([The program "sed" is not available. This program is required to build Openbox.])
95 fi
96
97 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.6.0])
98 AC_SUBST(GLIB_CFLAGS)
99 AC_SUBST(GLIB_LIBS)
100
101 PKG_CHECK_MODULES(PANGO, [pango >= 1.8.0 pangoxft >= 1.8.0])
102 AC_SUBST(PANGO_CFLAGS)
103 AC_SUBST(PANGO_LIBS)
104
105 PKG_CHECK_MODULES(XFT, [xft])
106 AC_SUBST(XFT_CFLAGS)
107 AC_SUBST(XFT_LIBS)
108
109 PKG_CHECK_MODULES(XML, [libxml-2.0 >= 2.6.0])
110 AC_SUBST(XML_CFLAGS)
111 AC_SUBST(XML_LIBS)
112
113 AC_ARG_ENABLE(startup-notification,
114   AC_HELP_STRING(
115     [--disable-startup-notification],
116     [disable the startup notification library. [[default=enabled]]]
117   ),
118   [enable_sn=$enableval],
119   [enable_sn=yes]
120 )
121
122 if test "$enable_sn" = yes; then
123 PKG_CHECK_MODULES(LIBSN, [libstartup-notification-1.0 >= 0.8],
124   [
125     AC_DEFINE(USE_LIBSN, [1], [Use startup-notification])
126     AC_SUBST(LIBSN_CFLAGS)
127     AC_SUBST(LIBSN_LIBS)
128     sn_found=yes
129   ],
130   [
131     sn_found=no
132   ]
133 )
134 else
135   sn_found=no
136 fi
137
138 AC_ARG_ENABLE(xcursor,
139   AC_HELP_STRING(
140     [--disable-xcursor],
141     [disable use of the X Cursor library. [[default=enabled]]]
142   ),
143   [enable_xcursor=$enableval],
144   [enable_xcursor=yes]
145 )
146
147 if test "$enable_xcursor" = yes; then
148 PKG_CHECK_MODULES(XCURSOR, [xcursor],
149   [
150     AC_DEFINE(USE_XCURSOR, [1], [Use X Cursor library])
151     AC_SUBST(XCURSOR_CFLAGS)
152     AC_SUBST(XCURSOR_LIBS)
153     xcursor_found=yes
154   ],
155   [
156     xcursor_found=no
157   ]
158 )
159 else
160   xcursor_found=no
161 fi
162
163 AC_ARG_ENABLE(xcomposite,
164   AC_HELP_STRING(
165     [--disable-xcomposite],
166     [disable use of the X Composite library. [[default=enabled]]]
167   ),
168   [enable_xcomposite=$enableval],
169   [enable_xcomposite=yes]
170 )
171
172 if test "$enable_xcomposite" = yes; then
173 PKG_CHECK_MODULES(XRENDER, [xrender],
174   [
175     AC_DEFINE(USE_XRENDER, [1], [Use X Render library])
176     AC_SUBST(XRENDER_CFLAGS)
177     AC_SUBST(XRENDER_LIBS)
178     PKG_CHECK_MODULES(XDAMAGE, [xdamage],
179       [
180         AC_DEFINE(USE_XDAMAGE, [1], [Use X Damage library])
181         AC_SUBST(XDAMAGE_CFLAGS)
182         AC_SUBST(XDAMAGE_LIBS)
183         PKG_CHECK_MODULES(XCOMPOSITE, [xcomposite],
184           [
185             AC_DEFINE(USE_XCOMPOSITE, [1], [Use X Composite library])
186             AC_SUBST(XCOMPOSITE_CFLAGS)
187             AC_SUBST(XCOMPOSITE_LIBS)
188             xcomposite_found=yes
189           ],
190           [
191             xcomposite_found=no
192           ]
193         )
194       ],
195       [
196         xcomposite_found=no
197       ]
198     )
199   ],
200   [
201     xcomposite_found=no
202   ]
203 )
204 else
205   xcomposite_found=no
206 fi
207
208 dnl Check for session management
209 X11_SM
210
211 #EFENCE_LIBS=-lefence
212 EFENCE_LIBS=""
213 AC_SUBST(EFENCE_LIBS)
214
215 dnl Check for X11 extensions
216 X11_EXT_XKB
217 X11_EXT_XRANDR
218 X11_EXT_SHAPE
219 X11_EXT_XINERAMA
220 X11_EXT_SYNC
221
222 AC_CONFIG_FILES([
223   Makefile
224   m4/Makefile
225   po/Makefile.in
226   render/obrender-4.0.pc
227   obt/obt-4.0.pc
228   render/version.h
229   obt/version.h
230 ])
231 AC_CONFIG_COMMANDS([doc],
232                    [test -d doc || mkdir doc])
233 AC_CONFIG_COMMANDS([data],
234                    [test -d data || mkdir data])
235 AC_CONFIG_COMMANDS([data/xsession],
236                    [test -d data/xsession || mkdir data/xsession])
237 AC_OUTPUT
238
239 AC_MSG_RESULT
240 AC_MSG_RESULT([Compiling with these options:
241                Startup Notification... $sn_found
242                X Cursor Library... $xcursor_found
243                X Composite Library... $xcomposite_found
244                Session Management... $SM
245                ])
246 AC_MSG_RESULT([configure complete, now type "make"])