More 3DNow stuff, 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                 AC_DEFINE(USE_MPG123_INPUT)
68         fi
69 fi
70
71 if test "$enable_ogg123" != "no"; then
72         AC_CHECK_PROG(OGG123_PROG, ogg123, yes)
73         if test "$OGG123_PROG" = "yes"; then
74                 AC_DEFINE(USE_OGG123_INPUT)
75         fi
76 fi
77
78 if test "$enable_xsetpointer" != "no"; then
79         AC_CHECK_PROG(XSETPOINTER_PROG, xsetpointer, yes)
80         if test "$XSETPOINTER_PROG" = "yes"; then
81                 AC_DEFINE(USE_XSETPOINTER)
82         else
83                 if test "$enable_xsetpointer" = "yes"; then
84                         AC_MSG_ERROR([** xsetpointer not found. **])
85                 fi
86         fi
87 fi
88
89 if test "$enable_movqfix" == "no"; then
90         AC_DEFINE(OVERRIDE_MOVQ_AUTODETECT)
91 fi
92
93 using_alsa=no
94 using_oss=no
95
96 dnl if test "$enable_alsa" != "no"; then
97 dnl     AC_CHECK_LIB(asound, snd_ctl_open,alsalib=yes,alsalib=no)
98 dnl     AC_CHECK_HEADERS(sys/asoundlib.h,alsaheader=yes,alsaheader=no)
99 dnl
100 dnl     if test "$alsalib" = "yes"; then
101 dnl             if test "$alsaheader" = "yes"; then
102 dnl                     AC_DEFINE(USE_ALSA)
103 dnl                     using_alsa=yes;
104 dnl             else 
105 dnl                     if test "$enable_alsa" = "yes"; then
106 dnl                             AC_MSG_ERROR([** Coulnd't find ALSA header file sys/asoundlib.h **])
107 dnl                     fi
108 dnl             fi
109 dnl     else
110 dnl             if test "$enable_alsa" = "yes"; then
111 dnl                     AC_MSG_ERROR([** Coulnd'f find ALSA library libasound. **])
112 dnl             fi
113 dnl     fi
114 dnl fi
115
116 if test "$enable_oss" != "no"; then
117         AC_CHECK_HEADERS(sys/ioctl.h sys/soundcard.h,oss=yes,oss=no)
118         
119         if test "$oss" = "yes"; then
120                 AC_DEFINE(USE_OSS)
121                 using_oss=yes;
122         else
123                 if test "$enable_oss" = "yes"; then
124                         AC_MSG_ERROR([** Couldn't find OSS header files. ***])
125                 fi
126         fi
127 fi
128
129 dnl if test "$using_alsa" = "yes"; then
130 dnl     AC_MSG_RESULT([termnatorX audiodevice: using ALSA.])
131 dnl fi
132
133 if test "$using_oss" = "yes"; then
134         AC_MSG_RESULT([termnatorX audiodevice: using OSS.])
135 fi
136
137 if test "$using_alsa" != "yes"; then
138         if test "$using_oss" != "yes"; then
139                 AC_MSG_ERROR([** Found neither OSS nor ALSA! **])
140         fi
141 fi      
142         
143 if test "$enable_wav" != "no";
144 then
145         AC_DEFINE(USE_BUILTIN_WAV)
146 fi
147
148 if test "$enable_flash" = "no"; then
149         AC_DEFINE(DONT_USE_FLASH)
150 fi 
151
152 if test "$enable_3dnow" = "yes"; then
153         AC_DEFINE(USE_3DNOW)
154 fi 
155
156 if test "$enable_scheduler" != "no"; then
157         AC_DEFINE(USE_SCHEDULER)
158 fi
159
160 if test "$enable_debug" = yes; then
161         AC_DEFINE(ENABLE_DEBUG_OUTPUT)
162 fi
163
164 if test "$enable_benchmark" = yes; then
165         AC_DEFINE(CREATE_BENCHMARK)
166 fi
167
168 dnl AC_MSG_CHECKING(whether to use dials)
169 dnl if test "$enable_dial" = no; then
170 dnl     AC_MSG_RESULT(no)
171 dnl else
172 dnl     AC_MSG_RESULT(yes)
173         AC_DEFINE(USE_DIAL)
174 dnl fi
175
176 AC_MSG_CHECKING(for necessary scratching skillz)
177 AC_MSG_RESULT(yes)
178
179 if test "$enable_bigdial" = yes; then
180         AC_DEFINE(USE_DIAL)
181         AC_DEFINE(USE_BIG_BUTTONS)
182 fi
183
184 if test "$enable_dga2" = yes; then
185         AC_DEFINE(USE_DGA2)
186 fi
187
188 dnl Now Check for Xlibs - I do this here as other tests fail if these run earlier
189 AC_PATH_XTRA
190
191 AC_SUBST(X_CFLAGS)
192 AC_SUBST(X_PRE_LIBS)
193 AC_SUBST(X_EXTRA_LIBS)
194 AC_SUBST(X_LIBS)
195 AC_SUBST(x_libraries)
196
197 AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([** X11-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
198 AC_CHECK_LIB(Xext, XShmQueryExtension,, AC_MSG_ERROR([** Xext-libs not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
199 AC_CHECK_LIB(Xi, XOpenDevice,, AC_MSG_ERROR([** XInput not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
200 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,, AC_MSG_ERROR([** DGA not installed or broken **]), $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
201 if test "$enable_dga2" = yes; then
202         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)
203 fi
204 AC_OUTPUT(Makefile src/Makefile gnome-support/Makefile src/gui_icons/Makefile src/smallknob/Makefile doc/Makefile doc/img/Makefile terminatorX.spec)