summaryrefslogtreecommitdiff
path: root/configure.ac
blob: c4b78f8f25d9c184ac4e06719d9c6aa83bea1fb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
dnl
dnl Twin - A Tiny Window System
dnl Copyright © 2003 Keith Packard, Noah Levitt
dnl All rights reserved.
dnl
dnl This Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public License as
dnl published by the Free Software Foundation; either version 2 of the
dnl License, or (at your option) any later version.
dnl
dnl This Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with the Gnome Library; see the file COPYING.LIB.  If not,
dnl write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl Boston, MA 02111-1307, USA.
dnl
dnl
dnl Process this file with autoconf to create configure.

AC_PREREQ([2.57])

AC_INIT(libtwin, 0.0.3, [keithp@keithp.com], libtwin)
AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE()
AM_MAINTAINER_MODE

# Library versioning info
LIB_VERSION_CURRENT=0
LIB_VERSION_REVISION=1
LIB_VERSION_AGE=0
LIB_VERSION="$LIB_VERSION_CURRENT:$LIB_VERSION_REVISION:$LIB_VERSION_AGE"
AC_SUBST(LIB_VERSION)

AM_CONFIG_HEADER(twin_def.h)

# Check for progs
AC_PROG_CC
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG

WARN_CFLAGS=""

if test "x$GCC" = "xyes"; then
	WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
	-Wmissing-prototypes -Wmissing-declarations \
	-Wnested-externs"
fi
AC_SUBST(WARN_CFLAGS)

# Check for X
AC_ARG_ENABLE(x11,
	AC_HELP_STRING([--disable-x11],
		[Disable x11 support (default=enabled)]),
	twin_x11="$enableval", twin_x11="yes")

if test "x$twin_x11" = "xyes"
then
	PKG_CHECK_MODULES(X, x11, twin_x11="yes", twin_x11="no")
fi
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)

# Check for linux framebuffer includes
AC_ARG_ENABLE(fbdev,
	AC_HELP_STRING([--disable-fbdev],
		[Disable framebuffer support (default=enabled)]),
	twin_fb="$enableval", twin_fb="yes")

if test "x$twin_fb" = "xyes"
then
	AC_CHECK_HEADER(linux/fb.h, twin_fb="yes", twin_fb="no")
fi

# linux mouse
AC_ARG_ENABLE(linux-mouse,
	AC_HELP_STRING([--disable-linux-mouse],
		[Disable linux mouse support (default=enabled)]),
	twin_mouse="$enableval", twin_mouse="yes")

# linux joystick
AC_ARG_ENABLE(linux-joystick,
	AC_HELP_STRING([--disable-linux-joystick],
		[Disable linux joystick support (default=enabled)]),
	twin_joystick="$enableval", twin_joystick="yes")

# zlib
AC_ARG_ENABLE(zlib,
	AC_HELP_STRING([--disable-zlib],
		[Disable zlib support (default=enabled)]),
	twin_zlib="$enableval", twin_zlib="yes")
AH_TEMPLATE(HAVE_ZLIB, [Define if the zlib compression library is available])

if test "x$twin_zlib" = "zlib"
then
        AC_CHECK_HEADER(zlib.h, twin_zlib="yes", twin_zlib="no")
fi

if test "x$twin_zlib" = "xyes"
then
	Z_LIBS=-lz
	AC_DEFINE([HAVE_ZLIB])
fi

# png support
AC_ARG_ENABLE(png,
	AC_HELP_STRING([--disable-png],
		[Disable png support (default=enabled)]),
	twin_png="$enableval", twin_png="yes")

if test "x$twin_png" = "xyes"
then
	PKG_CHECK_MODULES(PNG, libpng12, twin_png="yes", twin_png="no")
fi

AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)

# jpeg support
AC_ARG_ENABLE(jpeg,
	AC_HELP_STRING([--disable-jpeg],
		[Disable jpeg support (default=enabled)]),
	twin_jpeg="$enableval", twin_jpeg="yes")

if test "x$twin_jpeg" = "xyes"
then
        AC_CHECK_HEADER(jpeglib.h, twin_jpeg="yes", twin_jpeg="no")
fi

if test "x$twin_jpeg" = "xyes"
then
	JPEG_LIBS=-ljpeg
fi

# Check for freetype
AC_ARG_ENABLE(twin-ttf,
	AC_HELP_STRING([--disable-twin-ttf],
		[Don't build twin ttf font converter (default=enabled)]),
	twin_ttf="$enableval", twin_ttf="yes")

if test "x$twin_ttf" = "xyes"
then
	PKG_CHECK_MODULES(FREETYPE, freetype2, twin_ttf="yes", twin_ttf="no")
fi
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)

# Altivec support
AC_ARG_ENABLE(altivec,
	AC_HELP_STRING([--enable-altivec],
		[Enable altivec support (default=detect)]),
	twin_altivec="$enableval")

if test x$twin_altivec = x
then
	AC_MSG_CHECKING([for altivec support])
	CFLAGS_save="$CFLAGS"
	CFLAGS="$CFLAGS -maltivec"
	AC_TRY_COMPILE([#include <altivec.h>],
		[vector unsigned int v = vec_splat_u32(0)],
		twin_altivec=yes,
		twin_altivec=no)
	CFLAGS="$CFLAGS_save"
	AC_MSG_RESULT($twin_altivec)
fi

ALTIVEC_CFLAGS=""
AH_TEMPLATE(HAVE_ALTIVEC,
	[Define if the C compiler supports altivec extensions])

if test x$twin_altivec = xyes
then
	AC_DEFINE([HAVE_ALTIVEC])
	ALTIVEC_CFLAGS="-maltivec"
fi
AC_SUBST(ALTIVEC_CFLAGS)


# TWIN_DEP_*FLAGS define all flags required by dependencies of libtwin
TWIN_DEP_LDFLAGS="$X_LIBS $PNG_LIBS $JPEG_LIBS $Z_LIBS"
TWIN_DEPCFLAGS="$X_CFLAGS $PNG_CFLAGS"
AC_SUBST(TWIN_DEP_CFLAGS)
AC_SUBST(TWIN_DEP_LDFLAGS)

AM_CONDITIONAL(TWIN_X11, test x$twin_x11 = xyes)
AM_CONDITIONAL(TWIN_FB, test x$twin_fb = xyes)
AM_CONDITIONAL(TWIN_ZLIB, test x$twin_zlib = xyes)
AM_CONDITIONAL(TWIN_PNG, test x$twin_png = xyes)
AM_CONDITIONAL(TWIN_JPEG, test x$twin_jpeg = xyes)
AM_CONDITIONAL(TWIN_TTF, test x$twin_ttf = xyes)
AM_CONDITIONAL(TWIN_MOUSE, test x$twin_mouse = xyes)
AM_CONDITIONAL(TWIN_JOYSTICK, test x$twin_joystick = xyes)

AC_MSG_NOTICE([x11 support:    $twin_x11])
AC_MSG_NOTICE([fbdev support:  $twin_fb])
AC_MSG_NOTICE([zlib support:   $twin_zlib])
AC_MSG_NOTICE([png support:    $twin_png])
AC_MSG_NOTICE([jpeg support:   $twin_jpeg])
AC_MSG_NOTICE([twin_ttf tool:  $twin_ttf])
AC_MSG_NOTICE([linux mouse:    $twin_mouse])
AC_MSG_NOTICE([linux joystick: $twin_joystick])
AC_MSG_NOTICE([altivec:        $twin_altivec])

AC_OUTPUT([Makefile
           libtwin.pc])