aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 37c2871d41253db1c0756ec42c4cdc1d9e6ddd68 (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
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT(tvtime, 1.0.3, http://linuxtv.org/)
AC_CONFIG_SRCDIR([src/tvtime.c])
AM_INIT_AUTOMAKE(tvtime,1.0.3)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
if test x"$host_alias" = x""; then host_alias="$host"; fi

# Check for compilers.
AC_PROG_CC
AC_CHECK_PROG(found_cc, "$CC", yes, no)
test "x$found_cc" = "xyes" || exit 1

AC_PROG_CXX
AC_CHECK_PROG(found_cxx, "$CXX", yes, no)
test "x$found_cxx" = "xyes" || exit 1

# Check for libtool.
AC_PROG_LIBTOOL

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h langinfo.h math.h netinet/in.h pwd.h signal.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/resource.h sys/stat.h sys/time.h sys/wait.h sys/types.h unistd.h wordexp.h locale.h])

AC_CHECK_HEADER([linux/videodev2.h], [], AC_MSG_ERROR(linux/videodev2.h not found))

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME

# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MMAP
AC_CHECK_FUNCS([asprintf atexit fork execlp getopt_long getpriority gettimeofday seteuid memset setreuid setpriority signal sigemptyset sigaction strerror vsscanf wordexp wordfree])

# Check for gettext
AM_GNU_GETTEXT

dnl ---------------------------------------------
dnl zlib
dnl ---------------------------------------------
dnl Test for libz
AC_CHECK_LIB(z, gzsetparams,
        [ AC_CHECK_HEADER(zlib.h,
          have_zlib=yes
          ZLIB_LIBS="-lz",)], AC_MSG_ERROR(zlib needed))

AM_CONDITIONAL(HAVE_ZLIB, [test x"$have_zlib" = "xyes"])
AC_SUBST(ZLIB_LIBS)


dnl ---------------------------------------------
dnl libpng
dnl ---------------------------------------------
dnl Test for libpng
AC_CHECK_LIB(png, png_read_png,
        [ AC_CHECK_HEADER(png.h,
          have_libpng=yes
          PNG_LIBS="-lpng $ZLIB_LIBS -lm",)], AC_MSG_ERROR(libpng needed), "$ZLIB_LIBS" -lm)

AM_CONDITIONAL(HAVE_LIBPNG, [test x"$have_libpng" = "xyes"])
AC_SUBST(PNG_LIBS)


dnl ---------------------------------------------
dnl freetype
dnl ---------------------------------------------
dnl Test for freetype
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
if test "$FREETYPE_CONFIG" = "no" ; then
  AC_MSG_ERROR(freetype2 needed and freetype-config not found)
fi

dnl ---------------------------------------------
dnl libxml2
dnl ---------------------------------------------
dnl Test for libxml2
AC_PATH_PROG(LIBXML2_CONFIG,xml2-config,no)
if test "$LIBXML2_CONFIG" = "no" ; then
	AC_MSG_ERROR(libxml2 needed and xml2-config not found)
else
	XML2_LIBS="`$LIBXML2_CONFIG --libs`"
	XML2_FLAG="`$LIBXML2_CONFIG --cflags`"
	AC_DEFINE(HAVE_LIBXML2,,[LIBXML2 support])
fi
AC_SUBST(XML2_LIBS)
AC_SUBST(XML2_FLAG)

dnl ---------------------------------------------
dnl libasound2
dnl ---------------------------------------------
dnl Test for ALSA
AM_PATH_ALSA(1.0.9,
	[ AC_DEFINE(HAVE_ALSA,1,[Define this if you have Alsa (libasound) installed]) ],
	AC_MSG_RESULT(libasound needed and not found))
AM_CONDITIONAL(HAVE_ALSA, test x"$no_alsa" != "yes")


dnl ---------------------------------------------
dnl asound
dnl ---------------------------------------------
dnl Test for libasound
AC_CHECK_LIB(asound, snd_pcm_open,
        [ AC_CHECK_HEADER(alsa/asoundlib.h,
          have_asound=yes
          ASOUND_LIBS="-lasound",)], AC_MSG_ERROR(asound needed))

AM_CONDITIONAL(HAVE_ASOUND, [test x"$have_asound" = "xyes"])
AC_SUBST(ASOUND_LIBS)

dnl ---------------------------------------------
dnl check for gtk+-2.0
dnl ---------------------------------------------
dnl PKG_CHECK_MODULES(GTK, gtk+-2.0)
dnl AC_SUBST(GTK_CFLAGS)
dnl AC_SUBST(GTK_LIBS)


dnl ---------------------------------------------
dnl check for X11, Xv and XF86VidModeExtension
dnl ---------------------------------------------
AC_PATH_XTRA
if test x"$no_x" != x"yes"; then
    dnl check for Xshm
    AC_CHECK_LIB([Xext],[XShmCreateImage],
	[AC_DEFINE([HAVE_X11],,[X11 support])
	X11_CFLAGS="$X_CFLAGS"
	X11_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext"

	dnl check for Xv
	AC_CHECK_LIB([Xv],[XvShmCreateImage],
	    [AC_DEFINE([HAVE_XV],,[Xv support])
	    X11_LIBS="$X11_LIBS -lXv"],,
	    [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])

	dnl check for Xinerama
	AC_CHECK_LIB([Xinerama],[XineramaQueryScreens],
	    [AC_DEFINE([HAVE_XINERAMA],,[Xinerama support])
	    X11_LIBS="$X11_LIBS -lXinerama"],,
	    [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])

	dnl check for XSs
	PKG_CHECK_MODULES(XSS, xscrnsaver >= 1.2.0,
		AC_DEFINE([HAVE_XSSEXTENSION],,[XScrnSaver support])
		AC_SUBST(XSS_LIBS)
		X11_LIBS="$X11_LIBS $XSS_LIBS",)

	dnl check for Xvidmode
	AC_CHECK_LIB([Xxf86vm],[XF86VidModeGetModeLine],
	    [AC_DEFINE([HAVE_XF86VIDMODE],,[XF86VidModeExtension support])
	    X11_LIBS="$X11_LIBS -lXxf86vm"],,
	    [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])],,
	[$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS])
else
    AC_MSG_ERROR(X needed and no X libraries or development headers found)
fi
AC_SUBST(X11_CFLAGS)
AC_SUBST(X11_LIBS)

dnl This stuff looked kinda cool in the mpeg2dec source tree.

dnl GCC-specific flags
if test x"$GCC" = x"yes"; then

    dnl -Wall -Werror moved to the end to not disturb the configure script

    dnl -O3
    changequote(<<,>>)
    OPT_CFLAGS=`echo "$CFLAGS"|sed "s/-O[0-9]*//g;"`
    changequote([,])
    OPT_CFLAGS="$OPT_CFLAGS -O3"
    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])

    dnl -fomit-frame-pointer
    OPT_CFLAGS="$CFLAGS -fomit-frame-pointer"
    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])

    dnl -std=gnu99
    OPT_CFLAGS="$CFLAGS -std=gnu99"
    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])

    dnl arch-specific flags
    case "$host_alias" in
    i?86-* | k?-*)
	    AC_DEFINE([ARCH_X86],,[x86 architecture])
	    AC_DEFINE([ARCH_386],,[386 architecture])
	    ARCH_X86=yes
	    ARCH_386=yes
	    OPT_CFLAGS="$CFLAGS"
	    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
    x86_64-*)
            AC_DEFINE([ARCH_X86],,[x86 architecture])
            AC_DEFINE([ARCH_X86_64],,[x86_64 architecture])
            ARCH_X86=yes
            ARCH_X86_64=yes;;
    ppc-* | powerpc-*)
	    OPT_CFLAGS="$CFLAGS -Wa,-m7400"
	    AC_TRY_CFLAGS([$OPT_CFLAGS],
	    [CFLAGS=$OPT_CFLAGS; AC_DEFINE([ARCH_PPC],,[ppc architecture])]);;
    sparc-* | sparc64-*)
	    OPT_CFLAGS="$CFLAGS -mcpu=ultrasparc -mvis -Wa,-Av9"
	    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
    mips-sgi-irix6.*)	dnl do we need to be that specific ?
	    OPT_CFLAGS="$CFLAGS -mabi=64"
	    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
    esac
elif test x"$CC" = x"tcc"; then
    dnl TenDRA portability checking compiler
    CFLAGS="-Xp -Yansi -f`pwd`/include/tendra.h"
    enable_mlib=no
    no_x=yes
    enable_sdl=no
else
    dnl non-gcc flags - we probably need exact configuration triplets here.
    case "$host_alias" in
    mips-sgi-irix6.*)
	OPT_CFLAGS="$CFLAGS -64"
	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
    sparc-sun-solaris*)
	OPT_CFLAGS="$CFLAGS -xCC -fast -xO5"
	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
    esac
fi
AM_CONDITIONAL(ARCH_X86, [test "$ARCH_X86" = "yes"])
AM_CONDITIONAL(ARCH_386, [test "$ARCH_386" = "yes"])
AM_CONDITIONAL(ARCH_X86_64, [test "$ARCH_X86_64" = "yes"])

dnl Checks for library functions.
AC_CHECK_FUNCS([memalign])
AC_TYPE_SIGNAL

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_C_BIGENDIAN
AC_C_ATTRIBUTE_ALIGNED

AC_CONFIG_FILES([
	Makefile
	docs/Makefile
	data/Makefile
	plugins/Makefile
	src/Makefile
	intl/Makefile
	po/Makefile.in
	m4/Makefile
	docs/man/Makefile
	docs/man/de/Makefile
	docs/man/en/Makefile
	docs/man/es/Makefile
])
AC_OUTPUT

Privacy Policy