aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 4bbddad25053ad7d3d7d1548831869fafb72832a (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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
dnl ---------------------------------------------------------------------
dnl Process this file with autoconf to produce a configure script.

AC_INIT(xawtv.spec.in)
AC_CONFIG_HEADER(config.h)


dnl ---------------------------------------------------------------------
dnl Options

AC_ARG_ENABLE(xfree-ext,
  [  --enable-xfree-ext      use XFree extentions (DGA,VidMode,DPMS)])
AC_ARG_ENABLE(xvideo,
  [  --enable-xvideo         use the Xvideo extention])
AC_ARG_ENABLE(lirc,
  [  --enable-lirc           lirc support])
AC_ARG_ENABLE(quicktime,
  [  --enable-quicktime      quicktime support])
AC_ARG_ENABLE(motif,
  [  --enable-motif          enable experimental motif support])
AC_ARG_ENABLE(aa,
  [  --enable-aa             enable aalib support])
AC_ARG_ENABLE(alsa,
  [  --enable-alsa           enable alsa support])
AC_ARG_ENABLE(zvbi,
  [  --enable-zvbi           enable vbi support (via libzvbi)])
AC_ARG_ENABLE(gl,
  [  --enable-gl             enable opengl support])
AC_ARG_ENABLE(dv,
  [  --enable-dv             enable dvlib support])
AC_ARG_ENABLE(mmx,
  [  --enable-mmx            enable mmx support])
AC_ARG_ENABLE(xft,
  [  --enable-xft            enable xft support])


dnl ---------------------------------------------------------------------
dnl Checks for programs.

AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP

AC_PROG_INSTALL
AC_CHECK_PROGS(DEPEND,gccmakedep makedepend,true)

dnl ---------------------------------------------------------------------
dnl do some OS specific stuff here

AC_SUBST(FOUND_AALIB)
AC_SUBST(FOUND_ALSA)
AC_SUBST(FOUND_DV)
AC_SUBST(FOUND_LQT)
AC_SUBST(FOUND_MOTIF)
AC_SUBST(FOUND_OS)
AC_SUBST(FOUND_X11)
AC_SUBST(FOUND_GL)
AC_SUBST(FOUND_ZVBI)
FOUND_AALIB="no"
FOUND_ALSA="no"
FOUND_DV="no"
FOUND_LQT="no"
FOUND_MOTIF="no"
FOUND_OS="unknown"
FOUND_X11="no"
FOUND_GL="no"
FOUND_ZVBI="no"

case "`uname -s`" in
	Linux)
		FOUND_OS="linux"
		;;
	OpenBSD | FreeBSD | NetBSD)
		# *BSD has important stuff (from ports)
		# in /usr/local ...
		CFLAGS="$CFLAGS -I/usr/local/include -L/usr/local/lib"
		LDLIBS="$LDLIBS -L/usr/local/lib"
		FOUND_OS="bsd"
		;;
	*)
		AC_MSG_CHECKING(if xawtv will build on `uname -s`)
		AC_MSG_RESULT(maybe)
		FOUND_OS="unknown"
		;;
esac


dnl ---------------------------------------------------------------------
dnl Checks for functions

AC_EGREP_HEADER(sockaddr_storage,sys/socket.h,AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,"have ipv6"))
AC_CHECK_HEADERS(getopt.h soundcard.h unistd.h sys/select.h sys/soundcard.h alsa/asoundlib.h linux/joystick.h dev/ic/bt8xx.h machine/ioctl_bt848.h)
AC_CHECK_FUNCS(ftello fseeko getpt getnameinfo getopt_long strcasestr dlopen)

AC_SUBST(DLFLAGS)
DLFLAGS=""
if test "$ac_cv_func_dlopen" = "no"; then
  AC_CHECK_LIB(dl,dlopen, [ DLFLAGS="-ldl" ] )
fi
AC_MSG_CHECKING(for ELF)
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
  AC_MSG_RESULT(yes)
  DLFLAGS="$DLFLAGS -Wl,-E"
else
  AC_MSG_RESULT(no)
fi

AC_CHECK_LIB(pthread,pthread_create,LIBPTHREAD="-lpthread")
if test "$LIBPTHREAD" = ""; then
  AC_CHECK_LIB(c_r,pthread_create,LIBPTHREAD="-lc_r")
fi
AC_CHECK_LIB(ossaudio,main,LIBOSS="-lossaudio")
AC_CHECK_LIB(ncursesw,initscr,LIBCURSES="-lncursesw")
if test "$LIBCURSES" = ""; then
  AC_CHECK_LIB(ncurses,initscr,LIBCURSES="-lncurses")
fi
if test "$LIBCURSES" = ""; then
  AC_CHECK_LIB(curses,initscr,LIBCURSES="-lcurses")
fi
if test "$LIBCURSES" = ""; then
  echo "Oops: (n)curses library not found.  You need this one, please install."
  echo "Note: to compile stuff just the library packages are not enougth,"
  echo "      you need also the *-devel packages."
  exit 1
fi
if test "$LIBCURSES" = "-lncursesw"; then
  CFLAGS="$CFLAGS -I/usr/include/ncursesw"
fi
AC_SUBST(LIBPTHREAD)
AC_SUBST(LIBOSS)
AC_SUBST(LIBCURSES)


dnl ---------------------------------------------------------------------
dnl X11 checks

AC_PATH_XTRA
if test "$no_x" != "yes"; then
  FOUND_X11="yes"
  ATHENA="-lXaw -lXmu -lXt $X_PRE_LIBS -lXpm -lXext -lX11 $X_EXTRA_LIBS"
  FSLIB="-lFS"
  XFT_FLAGS=""
  XFT_LIBS=""
  if test "$enable_xft" != "no"; then
    AC_MSG_CHECKING(for Xft)
    if test -x "`which pkg-config 2>/dev/null`" && pkg-config xft; then
      XFT_FLAGS="`pkg-config --cflags xft`"
      XFT_LIBS="`pkg-config --libs xft`"
      AC_DEFINE(HAVE_XFT,1,"have xft")
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
else
  ATHENA=""
  FSLIB=""
fi
AC_SUBST(X_CFLAGS)
AC_SUBST(X_PRE_LIBS)
AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(X_LIBS)
AC_SUBST(x_includes)
AC_SUBST(ATHENA)
AC_SUBST(FSLIB)
AC_SUBST(SUBS)
AC_SUBST(TOOLS)
AC_SUBST(LDLIBS)
AC_SUBST(XFT_FLAGS)
AC_SUBST(XFT_LIBS)

AC_CHECK_LIB(jpeg, jpeg_start_compress, JPEG="found",,)
if test "$JPEG" != "found"; then
    echo "Oops:	jpeg library not found.  You need this one, please install."
    echo "Note:	to compile stuff just the library packages are not enougth,"
    echo "	you need also the *-devel packages."
    exit 1
fi

AC_SUBST(LIBALSA)
LIBALSA=""
if test "$enable_alsa" != "no"; then
    AC_CHECK_LIB(asound, snd_seq_open,
	AC_DEFINE(HAVE_ALSA,1,"have alsa") FOUND_ALSA="yes"; LIBALSA="-lasound",,)
else
    echo "*** alsa disabled"
fi

AC_SUBST(LIRC)
LIRC=""
if test "$enable_lirc" != "no"; then
    AC_CHECK_LIB(lirc_client, lirc_init,
	AC_DEFINE(HAVE_LIBLIRC_CLIENT,1,"have lirc") LIRC="-llirc_client",,)
else
    echo "*** lirc disabled"
fi

AC_SUBST(LIBZVBI)
LIBZVBI=""
if test "$enable_zvbi" != "no"; then
    AC_CHECK_LIB(zvbi, vbi_capture_fd,
        AC_DEFINE(HAVE_ZVBI,1,"have zvbi") FOUND_ZVBI="yes"; LIBZVBI="-lzvbi -lpthread -lm -lpng -lz",,$LIBPTHREAD)
else
    echo "*** zvbi disabled"
fi

AC_SUBST(AALIBS)
AALIBS=""
if test "$enable_aa" != "no"; then
    AC_CHECK_LIB(aa,aa_autoinit, [ FOUND_AALIB="yes" ],,)
    if test "$FOUND_AALIB" = "yes"; then
        AALIBS=-laa
        if test -x "`which aalib-config 2>/dev/null`"; then
            AALIBS=`aalib-config --libs`
        fi
    fi
else
    echo "*** aalib support disabled"
fi

AC_SUBST(LIBDV)
LIBDV=""
if test "$enable_dv" != "no"; then
    AC_CHECK_LIB(dv, dv_decoder_new,
        AC_DEFINE(HAVE_DV,1,"have dv") FOUND_DV="yes"; LIBDV="-ldv -lm",,
		-lm $LIBPTHREAD)
else
    echo "*** DV disabled"
fi

dashlglib=$(glib-config --libs 2>/dev/null)
if test "$enable_quicktime" != "no"; then
    AC_CHECK_LIB(quicktime, lqt_query_registry,
	FOUND_LQT="yes"; AC_DEFINE(HAVE_LIBQUICKTIME,1,"have libquicktime"),,
	$DLFLAGS $dashlglib $LIBPTHREAD)
else
    echo "*** quicktime disabled"
fi
QTLIBS=""
if test "$FOUND_LQT" = "yes"; then
    QTLIBS="-lquicktime $DLFLAGS $dashlglib -lm" 
fi
AC_SUBST(QTLIBS)

if test "$enable_xfree_ext" != "no"; then
    AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,,, 
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
    AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,,, 
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
    AC_CHECK_LIB(Xdpms, DPMSQueryExtension,,, 
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
    if test "$ac_cv_lib_Xdpms_DPMSQueryExtension" = "no"; then
	AC_CHECK_LIB(Xext, DPMSQueryExtension,AC_DEFINE(HAVE_LIBXDPMS),,
	    $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
    fi
    AC_CHECK_LIB(Xinerama, XineramaQueryExtension,,,
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
    AC_CHECK_LIB(Xrender, XRenderQueryExtension,,,
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
    AC_CHECK_LIB(Xrandr, XRRConfigCurrentConfiguration,,,
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
else
    echo "*** XFree extentions disabled"
fi

if test "$enable_xvideo" != "no"; then
    AC_CHECK_LIB(Xv, XvQueryExtension,,,
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
else
    echo "*** Xvideo extention disabled"
fi

if test "$enable_motif" != "no"; then
    AC_CHECK_LIB(Xm,XmStringGenerate, [ FOUND_MOTIF="yes" ],,
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
else
    echo "*** motif support disabled"
fi

AC_SUBST(LIBGL)
LIBGL=""
if test "$enable_gl" != "no"; then
    AC_CHECK_LIB(GL, glXChooseVisual,
        AC_DEFINE(HAVE_GL,1,"have opengl") FOUND_GL="yes"; LIBGL="-lGL -lm",,
	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS -lm)
else
    echo "*** OpenGL disabled"
fi

VERSION="`(cd $srcdir; pwd) | sed -e 's/.*-//'`"
AC_SUBST(VERSION)

dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(for X11 config directory)
x11conf=/usr/lib/X11
if test -d /etc/X11; then
	x11conf=/etc/X11
fi
AC_MSG_RESULT($x11conf)
AC_SUBST(x11conf)

AC_MSG_CHECKING(for X11 app-defaults directory)
resdir=/usr/lib/X11
if test -d /etc/X11/app-defaults; then
	resdir=/etc/X11
fi
AC_MSG_RESULT($resdir/app-defaults)
AC_SUBST(resdir)

dnl ---------------------------------------------------------------------
dnl for screenlock
AC_DEFINE(HAVE_XMU,1,"have xmu")

dnl ---------------------------------------------------------------------
dnl deinterlace plugins
AC_MSG_CHECKING(if mmx should be used)
AC_SUBST(USE_MMX)
if test "$enable_mmx" = "no" -o "$enable_mmx" = "yes"; then
	USE_MMX="$enable_mmx"
else
	case "`uname -m`" in
		i586 | i686)
			USE_MMX="yes"
			;;
		*)
			USE_MMX="no"
			;;
	esac
fi
AC_MSG_RESULT($USE_MMX)

dnl ---------------------------------------------------------------------
AC_OUTPUT(Makefile xawtv.spec)
for dir in \
	common console debug fonts jwz libvbi vbistuff x11 structs \
	libng libng/plugins libng/contrib-plugins mk
do
	test -d $dir && continue
	mkdir -p $dir
done

Privacy Policy