Copyright fixes and mpg321 support - Alex
[terminatorX.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/tX_global.h)
3 AM_INIT_AUTOMAKE(terminatorX,3.72)
4 AM_CONFIG_HEADER(config.h)
5
6 dnl AC_ARG_ENABLE(closedev, [  --enable-closedev       close audio device if not in use. [default=yes] ])
7 AC_ARG_ENABLE(sox, [  --enable-sox            use sox as input converter. [default=yes] ])
8 AC_ARG_ENABLE(mpg123, [  --enable-mpg123         use mpg123 as input converter. [default=yes] ])
9 AC_ARG_ENABLE(ogg123, [  --enable-ogg123         use ogg123 as input converter. [default=yes] ])
10 dnl AC_ARG_ENABLE(wavonly,  [  --enable-wavonly        enable the builtin wav routines. (no sox/mpg123) ])
11 AC_ARG_ENABLE(scheduler,[  --enable-scheduler      enable rt-scheduling (req. root-priv). [default=yes] ])
12 AC_ARG_ENABLE(debug,    [  --enable-debug          enable debug output. [default=no] ])
13 dnl AC_ARG_ENABLE(flash,    [  --enable-flash          enable flashes. [default=yes] ])
14 AC_ARG_ENABLE(3dnow,    [  --enable-3dnow          enables 3DNow! support. [default=no] ])
15 dnl AC_ARG_ENABLE(benchmark,[  --enable-benchmark      creates a non-functional test version [default=no] ])
16 AC_ARG_ENABLE(wav,          [  --enable-wav            enables the builtin wav-loader [default=yes] ])
17 AC_ARG_ENABLE(xsetpointer,  [  --enable-xsetpointer    enables executing of xsetpointer [default=auto] ])
18 dnl AC_ARG_ENABLE(alsa,         [  --enable-alsa           use ALSA for sound output [default=auto] ])
19 AC_ARG_ENABLE(oss,          [  --enable-oss            use OSS for sound output [default=auto] ])
20 AC_ARG_ENABLE(movqfix,      [  --disable-movqfix       don't use movq fix for gcc >= 2.96 [default=on] ])
21 dnl AC_ARG_ENABLE(dial,         [  --enable-dial           use dials instead of scales for effects [default=yes] ])
22 dnl AC_ARG_ENABLE(bigdial,      [  --enable-bigdial        use BIG dials [default=yes] ])
23 dnl AC_ARG_ENABLE(dga2,     [  --enable-dga2           use DGA2 instead of DGA1. (experimental) [default=no] ])
24
25 dnl Checks for programs.
26 AC_PROG_AWK
27 AC_PROG_CC
28 AC_PROG_CXX
29 AC_PROG_INSTALL
30 AC_PROG_LN_S
31 AC_PROG_RANLIB
32
33 dnl Checks for libraries.
34 AC_CHECK_LIB(m, floor,, AC_MSG_ERROR([** math-lib not installed or broken **]))
35 AC_CHECK_LIB(pthread, pthread_mutex_lock,, AC_MSG_ERROR([** POSIX threads not installed or broken **]))
36 AM_PATH_GTK(1.2.5, , AC_MSG_ERROR([** GTK 1.2.5 not installed or broken **]))
37 dnl AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR([** GLIB 1.2.0 not installed or broken **]))
38
39 dnl Checks for header files.
40 AC_HEADER_STDC
41 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h)
42 AC_CHECK_HEADERS(ladspa.h,, AC_MSG_ERROR([** couldn't find ladspa.h - install the ladspa SDK - get it from http://www.ladspa.org **]))
43
44 dnl Checks for typedefs, structures, and compiler characteristics.
45 AC_C_BIGENDIAN
46 AC_TYPE_SIZE_T
47
48 dnl Checks for library functions.
49 AC_PROG_GCC_TRADITIONAL
50
51 dnl Eval args
52 if test "$enable_closedev" = "no"; then
53         AC_DEFINE(KEEP_DEV_OPEN)
54 fi
55
56
57 if test "$enable_sox" != "no"; then
58         AC_CHECK_PROG(SOX_PROG, sox, yes)
59         if test "$SOX_PROG" = "yes"; then
60                 AC_DEFINE(USE_SOX_INPUT)
61         fi
62 fi
63
64 if test "$enable_mpg123" != "no"; then
65         AC_CHECK_PROG(MPG123_PROG, mpg123, yes)
66         if test "$MPG123_PROG" = "yes"; then
67                 if test "$SOX_PROG" = "yes"; then       
68                         AC_DEFINE(USE_MPG123_INPUT)
69                 else
70                         AC_CHECK_PROG(SOX_PROG, sox, yes)
71                         if test "$SOX_PROG" = "yes"; then       
72                                 AC_DEFINE(USE_MPG123_INPUT)
73                         else
74                                 AC_MSG_RESULT([** mpg123 support disabled: couldn't find sox! **])
75                         fi
76                 fi
77         fi
78 fi
79
80 if test "$enable_ogg123" != "no"; then
81         AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
82         if test "$OGG123_PROG" = "yes"; then
83                 AC_DEFINE(USE_OGG123_INPUT)
84         fi
85 fi
86
87 if test "$enable_xsetpointer" != "no"; then
88         AC_CHECK_PROG(XSETPOINTER_PROG, xsetpointer, yes)
89         if test "$XSETPOINTER_PROG" = "yes"; then
90                 AC_DEFINE(USE_XSETPOINTER)
91         else
92                 if test "$enable_xsetpointer" = "yes"; then
93                         AC_MSG_ERROR([** xsetpointer not found. **])
94                 fi
95         fi
96 fi
97
98 if test "$enable_movqfix" == "no"; then
99         AC_DEFINE(OVERRIDE_MOVQ_AUTODETECT)
100 fi
101
102 using_alsa=no
103 using_oss=no
104
105 dnl if test "$enable_alsa" != "no"; then
106 dnl     AC_CHECK_LIB(asound, snd_ctl_open,alsalib=yes,alsalib=no)
107 dnl     AC_CHECK_HEADERS(sys/asoundlib.h,alsaheader=yes,alsaheader=no)
108 dnl
109 dnl     if test "$alsalib" = "yes"; then
110 dnl             if test "$alsaheader" = "yes"; then
111 dnl                     AC_DEFINE(USE_ALSA)
112 dnl                     using_alsa=yes;
113 dnl             else 
114 dnl                     if test "$enable_alsa" = "yes"; then
115 dnl                             AC_MSG_ERROR([** Coulnd't find ALSA header file sys/asoundlib.h **])
116 dnl                     fi
117 dnl             fi
118 dnl     else
119 dnl             if test "$enable_alsa" = "yes"; then
120 dnl                     AC_MSG_ERROR([** Coulnd'f find ALSA library libasound. **])
121 dnl             fi
122 dnl     fi
123 dnl fi
124
125 if test "$enable_oss" != "no"; then
126         AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
127         
128         if test "$oss" = "yes"; then
129                 AC_DEFINE(USE_OSS)
130                 using_oss=yes;
131         else
132                 if test "$enable_oss" = "yes"; then
133                         AC_MSG_ERROR([** Couldn't find OSS header files. ***])
134                 fi
135         fi
136 fi
137
138 dnl if test "$using_alsa" = "yes"; then
139 dnl     AC_MSG_RESULT([termnatorX audiodevice: using ALSA.])
140 dnl fi
141
142 if test "$using_oss" = "yes"; then
143         AC_MSG_RESULT([termnatorX audiodevice: using OSS.])
144 fi
145
146 if test "$using_alsa" != "yes"; then
147         if test "$using_oss" != "yes"; then
148                 AC_MSG_ERROR([** Found neither OSS nor ALSA! **])
149         fi
150 fi      
151         
152 if test "$enable_wav" != "no";
153 then
154         AC_DEFINE(USE_BUILTIN_WAV)
155 fi
156
157 if test "$enable_flash" = "no"; then
158         AC_DEFINE(DONT_USE_FLASH)
159 fi 
160
161 if test "$enable_3dnow" = "yes"; then
162         AC_DEFINE(USE_3DNOW)
163 fi 
164
165 if test "$enable_scheduler" != "no"; then
166         AC_DEFINE(USE_SCHEDULER)
167 fi
168
169 if test "$enable_debug" = yes; then
170         AC_DEFINE(ENABLE_DEBUG_OUTPUT)
171 fi
172
173 if test "$enable_benchmark" = yes; then
174         AC_DEFINE(CREATE_BENCHMARK)
175 fi
176
177 dnl AC_MSG_CHECKING(whether to use dials)
178 dnl if test "$enable_dial" = no; then
179 dnl     AC_MSG_RESULT(no)
180 dnl else
181 dnl     AC_MSG_RESULT(yes)
182         AC_DEFINE(USE_DIAL)
183 dnl fi
184
185 AC_MSG_CHECKING(for necessary scratching skillz)
186 AC_MSG_RESULT(yes)
187
188 if test "$enable_bigdial" = yes; then
189         AC_DEFINE(USE_DIAL)
190         AC_DEFINE(USE_BIG_BUTTONS)
191 fi
192
193 if test "$enable_dga2" = yes; then
194         AC_DEFINE(USE_DGA2)
195 fi
196
197 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
198 AC_PATH_XTRA
199
200 AC_SUBST(X_CFLAGS)
201 AC_SUBST(X_PRE_LIBS)
202 AC_SUBST(X_EXTRA_LIBS)
203 AC_SUBST(X_LIBS)
204 AC_SUBST(x_libraries)
205
206 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
207 AC_CHECK_LIB(Xext, XShmQueryExtension,, AC_MSG_ERROR([** Xext-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
208 AC_CHECK_LIB(Xi, XOpenDevice,, AC_MSG_ERROR([** XInput not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
209 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,, AC_MSG_ERROR([** DGA not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
210 if test "$enable_dga2" = yes; then
211         AC_CHECK_LIB(Xxf86dga, XDGASelectInput,, AC_MSG_ERROR([** DGA2 not installed. Try using dga1 instead. **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
212 fi
213 AC_OUTPUT(Makefile src/Makefile gnome-support/Makefile src/gui_icons/Makefile src/smallknob/Makefile doc/Makefile doc/img/Makefile terminatorX.spec)