configure.in 3.55 KB
Newer Older
Michel Lespinasse's avatar
Michel Lespinasse committed
1
dnl Process this file with autoconf to produce a configure script.
Michel Lespinasse's avatar
Michel Lespinasse committed
2
AC_PREREQ(2.54)
3
4
AC_INIT
AC_CONFIG_SRCDIR([src/mpeg2dec.c])
Michel Lespinasse's avatar
Michel Lespinasse committed
5
AC_CONFIG_AUX_DIR(autotools)
6
AC_CONFIG_FILES([Makefile autotools/Makefile include/Makefile test/Makefile
Michel Lespinasse's avatar
Michel Lespinasse committed
7
8
    doc/Makefile src/Makefile libmpeg2/Makefile libvo/Makefile vc++/Makefile
    libmpeg2/libmpeg2.pc src/libcpuaccel.pc])
Michel Lespinasse's avatar
Michel Lespinasse committed
9
AM_INIT_AUTOMAKE([mpeg2dec],[0.2.2-cvs])
Michel Lespinasse's avatar
Michel Lespinasse committed
10
AC_CONFIG_HEADERS([include/config.h])
Michel Lespinasse's avatar
Michel Lespinasse committed
11
12
13
14
15
16
17
AM_MAINTAINER_MODE
AC_CANONICAL_HOST

dnl Checks for compiler
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL

18
19
20
21
dnl CC-specific flags
if test x"$CC" = x"checkergcc"; then
    enable_sdl=no
elif test x"$GCC" = x"yes"; then
Michel Lespinasse's avatar
Michel Lespinasse committed
22

23
    dnl GCC-specific flags
Michel Lespinasse's avatar
Michel Lespinasse committed
24

25
    dnl -Wall
Michel Lespinasse's avatar
.    
Michel Lespinasse committed
26
    dnl -Werror moved to the end to not disturb the configure script
27
28
29
    OPT_CFLAGS="$CFLAGS -Wall"
    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])

Michel Lespinasse's avatar
Michel Lespinasse committed
30
31
    dnl -O3
    changequote(<<,>>)
32
    OPT_CFLAGS=`echo "$CFLAGS"|sed "s/-O[0-9]*//g"`
Michel Lespinasse's avatar
Michel Lespinasse committed
33
34
35
36
37
38
39
40
41
    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 arch-specific flags
Michel Lespinasse's avatar
Michel Lespinasse committed
42
    case "$host" in
43
    i?86-* | k?-* | x86_64-*)
Michel Lespinasse's avatar
Michel Lespinasse committed
44
	AC_DEFINE([ARCH_X86],,[x86 architecture])
Michel Lespinasse's avatar
Michel Lespinasse committed
45
	case "$host" in
Michel Lespinasse's avatar
Michel Lespinasse committed
46
47
48
49
50
51
52
	i386-*) OPT_CFLAGS="$CFLAGS -mcpu=i386";;
	i486-*) OPT_CFLAGS="$CFLAGS -mcpu=i486";;
	i586-*) OPT_CFLAGS="$CFLAGS -mcpu=pentium";;
	i686-*) OPT_CFLAGS="$CFLAGS -mcpu=pentiumpro";;
	k6-*)   OPT_CFLAGS="$CFLAGS -mcpu=k6";;
	esac
	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
53
    ppc-* | powerpc-*)
54
	OPT_CFLAGS="$CFLAGS -Wa,-m7400"
Michel Lespinasse's avatar
Michel Lespinasse committed
55
56
	AC_TRY_CFLAGS([$OPT_CFLAGS],
	    [CFLAGS=$OPT_CFLAGS; AC_DEFINE([ARCH_PPC],,[ppc architecture])]);;
57
58
    sparc-* | sparc64-*)
	OPT_CFLAGS="$CFLAGS -mcpu=ultrasparc -mvis -Wa,-Av9"
Michel Lespinasse's avatar
Michel Lespinasse committed
59
60
	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
    esac
61
elif test x"$CC" = x"tcc" -a x"`$CC -version 2>&1 | grep TenDRA`" != x""; then
Michel Lespinasse's avatar
Michel Lespinasse committed
62
    dnl TenDRA portability checking compiler
63
    TENDRA=yes
64
    CFLAGS="-Xp -Yansi -f`pwd`/include/tendra.h -DELIDE_CODE"
Michel Lespinasse's avatar
Michel Lespinasse committed
65
66
67
    enable_mlib=no
    no_x=yes
    enable_sdl=no
Michel Lespinasse's avatar
Michel Lespinasse committed
68
69
70
elif test x"$CC" = x"icc" -a x"`$CC -V 2>&1 | grep Intel`" != x""; then
    dnl Intel C++ compiler
    CFLAGS="-g -O3 -unroll -ip"
Michel Lespinasse's avatar
Michel Lespinasse committed
71
72
else
    dnl non-gcc flags - we probably need exact configuration triplets here.
Michel Lespinasse's avatar
Michel Lespinasse committed
73
    case "$host" in
Michel Lespinasse's avatar
Michel Lespinasse committed
74
75
76
77
78
79
80
    sparc-sun-solaris*)
	OPT_CFLAGS="$CFLAGS -xCC -fast -xO5"
	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
    esac
fi

dnl Checks for libtool - this must be done after we set cflags
81
AC_DISABLE_SHARED
Michel Lespinasse's avatar
Michel Lespinasse committed
82
AC_LIBTOOL_WIN32_DLL
83
AC_PROG_LIBTOOL
Michel Lespinasse's avatar
Michel Lespinasse committed
84
85
86
87
88

dnl Checks for libraries.

dnl Checks for header files.
INCLUDES='-I$(top_srcdir)/include -I$(top_builddir)/include'
89
AC_SUBST([INCLUDES])
90
AC_CHECK_HEADERS([sys/time.h sys/timeb.h io.h])
91
AC_CHECK_GENERATE_INTTYPES([include])
Michel Lespinasse's avatar
Michel Lespinasse committed
92
93
94

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
95
AC_C_ALWAYS_INLINE
96
AC_C_RESTRICT
97
AC_C_BUILTIN_EXPECT
Michel Lespinasse's avatar
Michel Lespinasse committed
98
99
100
101
AC_TYPE_SIZE_T
AC_C_BIGENDIAN

dnl Checks for library functions.
102
AC_CHECK_FUNCS([memalign gettimeofday ftime])
Michel Lespinasse's avatar
Michel Lespinasse committed
103
104
105
106
107
108
AC_TYPE_SIGNAL

builtin([include],[libmpeg2/configure.incl])
builtin([include],[libvo/configure.incl])

AC_ARG_ENABLE([warnings],
Michel Lespinasse's avatar
Michel Lespinasse committed
109
110
    [  --enable-warnings       treat warnings as errors])
if test x"$enable_warnings" = x"yes" -a x"$GCC" = x"yes"; then
Michel Lespinasse's avatar
Michel Lespinasse committed
111
    dnl compiler warnings
112
    OPT_CFLAGS="$CFLAGS -Werror"
Michel Lespinasse's avatar
Michel Lespinasse committed
113
    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])
114
elif test x"$TENDRA" = x"yes"; then
Michel Lespinasse's avatar
Michel Lespinasse committed
115
116
    dnl TenDRA portability checking compiler
    CFLAGS="$CFLAGS -DTenDRA_check"
Michel Lespinasse's avatar
Michel Lespinasse committed
117
118
fi

Michel Lespinasse's avatar
Michel Lespinasse committed
119
120
builtin([include],[src/configure.incl])

Michel Lespinasse's avatar
Michel Lespinasse committed
121
122
AC_C_ATTRIBUTE_ALIGNED

123
AC_OUTPUT