1dnl Process this file with autoconf to produce a configure script. 2AC_PREREQ(2.54) 3AC_INIT([libmpeg2],[0.5.1],[]) 4 5AC_CONFIG_SRCDIR([src/mpeg2dec.c]) 6AC_CONFIG_AUX_DIR(.auto) 7AC_CONFIG_FILES([Makefile include/Makefile test/Makefile 8 doc/Makefile src/Makefile libmpeg2/Makefile libmpeg2/convert/Makefile 9 libvo/Makefile 10 libmpeg2/libmpeg2.pc libmpeg2/convert/libmpeg2convert.pc]) 11AC_CONFIG_HEADERS([include/config.h]) 12AC_CANONICAL_HOST 13 14AM_INIT_AUTOMAKE([1.5 -Wall foreign]) 15AM_MAINTAINER_MODE 16 17dnl Checks for compiler 18AC_PROG_CC 19AC_PROG_GCC_TRADITIONAL 20AM_PROG_AS 21 22AM_PROG_AR 23 24dnl Checks for headers. We do this before the CC-specific section because 25dnl autoconf generates tests for generic headers before the first header test. 26AC_CHECK_HEADERS([sys/time.h time.h sys/timeb.h io.h]) 27 28dnl CC-specific flags 29AC_SUBST([OPT_CFLAGS]) 30AC_SUBST([ARCH_OPT_CFLAGS]) 31if test x"$CC" = x"checkergcc"; then 32 enable_sdl=no 33elif test x"$GCC" = x"yes"; then 34 35 dnl GCC-specific flags 36 37 dnl -Wall 38 dnl -Werror moved to the end to not disturb the configure script 39 TRY_CFLAGS="$OPT_CFLAGS -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" 40 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]) 41 42 dnl -O3 43 changequote(<<,>>) 44 TRY_CFLAGS=`echo "$OPT_CFLAGS $CFLAGS"|sed "s/-O[0-9]*//g"` 45 changequote([,]) 46 TRY_CFLAGS="$TRY_CFLAGS -O3" 47 AC_TRY_CFLAGS([$TRY_CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]) 48 49 AC_ARG_ENABLE([debug], 50 [ --enable-debug debug mode configuration]) 51 if test x"$enable_debug" = x"yes"; then 52 AC_DEFINE([DEBUG],,[debug mode configuration]) 53 else 54 dnl -fomit-frame-pointer 55 TRY_CFLAGS="$OPT_CFLAGS -fomit-frame-pointer" 56 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]) 57 fi 58 59 dnl -fno-common 60 TRY_CFLAGS="$OPT_CFLAGS -fno-common" 61 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]) 62 63 dnl -std=gnu89 64 TRY_CFLAGS="$OPT_CFLAGS -std=gnu89" 65 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]) 66 67 dnl arch-specific flags 68 arm_conditional=false 69 case "$host" in 70 i?86-* | k?-* | x86_64-* | amd64-*) 71 AC_DEFINE([ARCH_X86],,[x86 architecture]) 72 case "$host" in 73 i386-*) TRY_CFLAGS="$OPT_CFLAGS -mcpu=i386";; 74 i486-*) TRY_CFLAGS="$OPT_CFLAGS -mcpu=i486";; 75 i586-*) TRY_CFLAGS="$OPT_CFLAGS -mcpu=pentium";; 76 i686-*) TRY_CFLAGS="$OPT_CFLAGS -mcpu=pentiumpro";; 77 k6-*) TRY_CFLAGS="$OPT_CFLAGS -mcpu=k6";; 78 esac 79 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]);; 80 ppc-* | powerpc-*) 81 have_altivec=no 82 for TRY_CFLAGS in "-mpim-altivec -force_cpusubtype_ALL" -faltivec -maltivec -fvec; do 83 AC_TRY_CFLAGS([$OPT_CFLAGS $TRY_CFLAGS $CFLAGS], 84 [save_CFLAGS="$CFLAGS" 85 CFLAGS="$OPT_CFLAGS $TRY_CFLAGS $CFLAGS" 86 AC_MSG_CHECKING([if <altivec.h> is needed]) 87 AC_TRY_COMPILE([], 88 [typedef vector int t; 89 vec_ld(0, (unsigned char *)0);], 90 [have_altivec=yes; AC_MSG_RESULT(no)], 91 [AC_TRY_COMPILE([#include <altivec.h>], 92 [typedef vector int t; vec_ld(0, (unsigned char *)0);], 93 [AC_DEFINE([HAVE_ALTIVEC_H],, 94 [Define to 1 if you have the <altivec.h> header.]) 95 have_altivec=yes; AC_MSG_RESULT(yes)], 96 [AC_MSG_RESULT(unsupported)])]) 97 CFLAGS="$save_CFLAGS"]) 98 if test "$have_altivec" = "yes"; then 99 ARCH_OPT_CFLAGS="$TRY_CFLAGS" 100 AC_DEFINE([ARCH_PPC],,[ppc architecture]) 101 break 102 fi 103 done;; 104 sparc-* | sparc64-*) 105 AC_DEFINE([ARCH_SPARC],,[sparc architecture]) 106 TRY_CFLAGS="$OPT_CFLAGS -mcpu=ultrasparc -mvis" 107 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]);; 108 alpha*) 109 AC_DEFINE([ARCH_ALPHA],,[alpha architecture]);; 110 arm*) 111 arm_conditional=: 112 AC_DEFINE([ARCH_ARM],,[ARM architecture]);; 113 esac 114elif test x"$CC" = x"tendracc"; then 115 dnl TenDRA portability checking compiler 116 TENDRA=yes 117 OPT_CFLAGS="-Xp -Yansi -f`pwd`/include/tendra.h -DELIDE_CODE" 118 no_x=yes 119 enable_sdl=no 120elif test x"$CC" = x"icc" -a x"`$CC -V 2>&1 | grep Intel`" != x""; then 121 dnl Intel C++ compiler 122 OPT_CFLAGS="-g -O3 -unroll -ip" 123else 124 dnl non-gcc flags - we probably need exact configuration triplets here. 125 case "$host" in 126 sparc-sun-solaris*) 127 TRY_CFLAGS="$OPT_CFLAGS -xCC -fast -xO5" 128 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]);; 129 esac 130fi 131 132AM_CONDITIONAL(ARCH_ARM, ${arm_conditional}) 133 134dnl Checks for libtool - this must be done after we set cflags 135AC_LIBTOOL_WIN32_DLL 136AC_PROG_LIBTOOL 137 138dnl Checks for libraries. 139 140dnl Checks for header files. 141AM_CPPFLAGS='-I$(top_srcdir)/include -I$(top_builddir)/include' 142AC_SUBST([AM_CPPFLAGS]) 143AC_HEADER_TIME 144AC_CHECK_TYPES([struct timeval], [], [], 145 [#include <sys/time.h> 146 #include <time.h>]) 147AC_CHECK_GENERATE_INTTYPES([include]) 148 149dnl Checks for typedefs, structures, and compiler characteristics. 150AC_C_CONST 151AC_C_RESTRICT 152AC_C_BUILTIN_EXPECT 153AC_C_BIGENDIAN 154AC_C_VOLATILE 155AC_TYPE_SIZE_T 156AC_TYPE_SIGNAL 157AC_SYS_LARGEFILE 158 159dnl Checks for library functions. 160AC_CHECK_FUNCS([gettimeofday ftime]) 161 162case "$target" in 163 dnl avoid -fPIC on 32-bit x86 platforms 164 i?86-*|k?-*) 165 AC_LIBTOOL_NON_PIC([LIBMPEG2_CFLAGS="$LIBMPEG2_CFLAGS -prefer-non-pic"]) 166 ;; 167esac 168AC_SUBST([LIBMPEG2_CFLAGS]) 169 170dnl check for cpudetect 171AC_ARG_ENABLE([accel-detect], 172 [ --disable-accel-detect make a version without accel detection code]) 173if test x"$enable_accel_detect" != x"no"; then 174 AC_DEFINE([ACCEL_DETECT],,[autodetect accelerations]) 175fi 176 177dnl check for X11 178AC_PATH_XTRA 179if test x"$no_x" != x"yes"; then 180 dnl check for Xshm 181 AC_CHECK_LIB([Xext],[XShmCreateImage], 182 [AC_DEFINE([LIBVO_X11],,[libvo X11 support]) 183 LIBVO_CFLAGS="$LIBVO_CFLAGS $X_CFLAGS" 184 LIBVO_LIBS="$LIBVO_LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXext -lX11" 185 dnl check for Xv 186 AC_CHECK_LIB([Xv],[XvShmCreateImage], 187 [AC_DEFINE([LIBVO_XV],,[libvo Xv support]) 188 LIBVO_LIBS="$LIBVO_LIBS -lXv"],, 189 [$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXext -lX11])],, 190 [$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lX11]) 191fi 192 193dnl check for DirectX 194AC_ARG_ENABLE([directx], 195 [ --enable-directx=DIR use Win32 DirectX headers in DIR]) 196case $enable_directx in 197 ""|yes) AC_CHECK_HEADER([ddraw.h], 198 [AC_DEFINE([LIBVO_DX],,[libvo DirectX support]) 199 LIBVO_LIBS="$LIBVO_LIBS -lgdi32"]);; 200 no) ;; 201 *) if test -f "$enable_directx/ddraw.h"; then 202 AC_DEFINE([LIBVO_DX],,[libvo DirectX support]) 203 LIBVO_CFLAGS="$LIBVO_CFLAGS -I$enable_directx" 204 LIBVO_LIBS="$LIBVO_LIBS -lgdi32" 205 else 206 AC_MSG_ERROR([Cannot find $enable_directx/ddraw.h]) 207 fi;; 208esac 209 210dnl check for SDL 211AC_ARG_ENABLE([sdl],[ --disable-sdl make a version not using SDL]) 212if test x"$enable_sdl" != x"no"; then 213 AC_CHECK_PROG([SDLCONFIG],[sdl-config],[yes]) 214 if test x"$SDLCONFIG" = x"yes"; then 215 AC_DEFINE([LIBVO_SDL],,[libvo SDL support]) 216 LIBVO_CFLAGS="$LIBVO_CFLAGS `sdl-config --cflags`" 217 LIBVO_LIBS="$LIBVO_LIBS `sdl-config --libs`" 218 fi 219fi 220 221AC_SUBST([LIBVO_CFLAGS]) 222AC_SUBST([LIBVO_LIBS]) 223 224AC_ARG_ENABLE([warnings], 225 [ --enable-warnings treat warnings as errors]) 226if test x"$enable_warnings" = x"yes" -a x"$GCC" = x"yes"; then 227 dnl compiler warnings 228 TRY_CFLAGS="$OPT_CFLAGS -Werror" 229 AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"]) 230elif test x"$TENDRA" = x"yes"; then 231 dnl TenDRA portability checking compiler 232 OPT_CFLAGS="$OPT_CFLAGS -DTenDRA_check" 233fi 234 235MPEG2DEC_CFLAGS="$OPT_CFLAGS" 236 237AC_ARG_ENABLE([gprof],[ --enable-gprof make a version using gprof]) 238if test x"$enable_gprof" = x"yes"; then 239 AC_DEFINE([MPEG2DEC_GPROF],,[mpeg2dec profiling]) 240 MPEG2DEC_CFLAGS=`echo "$MPEG2DEC_CFLAGS"|sed "s/-fomit-frame-pointer//g"` 241 MPEG2DEC_CFLAGS="$MPEG2DEC_CFLAGS -p" 242fi 243 244AC_SUBST([MPEG2DEC_CFLAGS]) 245 246AC_C_ATTRIBUTE_ALIGNED 247 248AC_OUTPUT 249