Commit 51c90306 authored by Sam Hocevar's avatar Sam Hocevar

* acinclude.m4: split this file into separate .m4 subfiles.

  * configure.ac: remove include constructs because aclocal isn't clever
    enough to look for missing macros in these files.
parent dcee265e
SUBDIRS = libmpeg2 include libvo src test SUBDIRS = libmpeg2 include libvo src test
DIST_SUBDIRS = doc vc++ $(SUBDIRS) DIST_SUBDIRS = doc vc++ $(SUBDIRS)
EXTRA_DIST = bootstrap CodingStyle EXTRA_DIST = bootstrap CodingStyle \
m4/cflags.m4 m4/inttypes.m4 m4/keywords.m4 m4/nonpic.m4
ACLOCAL_AMFLAGS = -I m4
...@@ -154,8 +154,67 @@ AC_SYS_LARGEFILE ...@@ -154,8 +154,67 @@ AC_SYS_LARGEFILE
dnl Checks for library functions. dnl Checks for library functions.
AC_CHECK_FUNCS([gettimeofday ftime]) AC_CHECK_FUNCS([gettimeofday ftime])
builtin([include],[libmpeg2/configure.incl]) case "$target" in
builtin([include],[libvo/configure.incl]) dnl avoid -fPIC on 32-bit x86 platforms
i?86-*|k?-*)
AC_LIBTOOL_NON_PIC([LIBMPEG2_CFLAGS="$LIBMPEG2_CFLAGS -prefer-non-pic"])
;;
esac
AC_SUBST([LIBMPEG2_CFLAGS])
dnl check for cpudetect
AC_ARG_ENABLE([accel-detect],
[ --disable-accel-detect make a version without accel detection code])
if test x"$enable_accel_detect" != x"no"; then
AC_DEFINE([ACCEL_DETECT],,[autodetect accelerations])
fi
dnl check for X11
AC_PATH_XTRA
if test x"$no_x" != x"yes"; then
dnl check for Xshm
AC_CHECK_LIB([Xext],[XShmCreateImage],
[AC_DEFINE([LIBVO_X11],,[libvo X11 support])
LIBVO_CFLAGS="$LIBVO_CFLAGS $X_CFLAGS"
LIBVO_LIBS="$LIBVO_LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXext -lX11"
dnl check for Xv
AC_CHECK_LIB([Xv],[XvShmCreateImage],
[AC_DEFINE([LIBVO_XV],,[libvo Xv support])
LIBVO_LIBS="$LIBVO_LIBS -lXv"],,
[$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXext -lX11])],,
[$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lX11])
fi
dnl check for DirectX
AC_ARG_ENABLE([directx],
[ --enable-directx=DIR use Win32 DirectX headers in DIR])
case $enable_directx in
""|yes) AC_CHECK_HEADER([ddraw.h],
[AC_DEFINE([LIBVO_DX],,[libvo DirectX support])
LIBVO_LIBS="$LIBVO_LIBS -lgdi32"]);;
no) ;;
*) if test -f "$enable_directx/ddraw.h"; then
AC_DEFINE([LIBVO_DX],,[libvo DirectX support])
LIBVO_CFLAGS="$LIBVO_CFLAGS -I$enable_directx"
LIBVO_LIBS="$LIBVO_LIBS -lgdi32"
else
AC_MSG_ERROR([Cannot find $enable_directx/ddraw.h])
fi;;
esac
dnl check for SDL
AC_ARG_ENABLE([sdl],[ --disable-sdl make a version not using SDL])
if test x"$enable_sdl" != x"no"; then
AC_CHECK_PROG([SDLCONFIG],[sdl-config],[yes])
if test x"$SDLCONFIG" = x"yes"; then
AC_DEFINE([LIBVO_SDL],,[libvo SDL support])
LIBVO_CFLAGS="$LIBVO_CFLAGS `sdl-config --cflags`"
LIBVO_LIBS="$LIBVO_LIBS `sdl-config --libs`"
fi
fi
AC_SUBST([LIBVO_CFLAGS])
AC_SUBST([LIBVO_LIBS])
AC_ARG_ENABLE([warnings], AC_ARG_ENABLE([warnings],
[ --enable-warnings treat warnings as errors]) [ --enable-warnings treat warnings as errors])
...@@ -168,7 +227,16 @@ elif test x"$TENDRA" = x"yes"; then ...@@ -168,7 +227,16 @@ elif test x"$TENDRA" = x"yes"; then
OPT_CFLAGS="$OPT_CFLAGS -DTenDRA_check" OPT_CFLAGS="$OPT_CFLAGS -DTenDRA_check"
fi fi
builtin([include],[src/configure.incl]) MPEG2DEC_CFLAGS="$OPT_CFLAGS"
AC_ARG_ENABLE([gprof],[ --enable-gprof make a version using gprof])
if test x"$enable_gprof" = x"yes"; then
AC_DEFINE([MPEG2DEC_GPROF],,[mpeg2dec profiling])
MPEG2DEC_CFLAGS=`echo "$MPEG2DEC_CFLAGS"|sed "s/-fomit-frame-pointer//g"`
MPEG2DEC_CFLAGS="$MPEG2DEC_CFLAGS -p"
fi
AC_SUBST([MPEG2DEC_CFLAGS])
AC_C_ATTRIBUTE_ALIGNED AC_C_ATTRIBUTE_ALIGNED
......
...@@ -21,4 +21,4 @@ libmpeg2arch_la_CFLAGS = $(OPT_CFLAGS) $(ARCH_OPT_CFLAGS) $(LIBMPEG2_CFLAGS) ...@@ -21,4 +21,4 @@ libmpeg2arch_la_CFLAGS = $(OPT_CFLAGS) $(ARCH_OPT_CFLAGS) $(LIBMPEG2_CFLAGS)
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libmpeg2.pc pkgconfig_DATA = libmpeg2.pc
EXTRA_DIST = configure.incl vlc.h mpeg2_internal.h EXTRA_DIST = vlc.h mpeg2_internal.h
AC_SUBST([LIBMPEG2_CFLAGS])
case "$target" in
dnl avoid -fPIC on 32-bit x86 platforms
i?86-*|k?-*)
AC_LIBTOOL_NON_PIC([LIBMPEG2_CFLAGS="$LIBMPEG2_CFLAGS -prefer-non-pic"])
;;
esac
dnl check for cpudetect
AC_ARG_ENABLE([accel-detect],
[ --disable-accel-detect make a version without accel detection code])
if test x"$enable_accel_detect" != x"no"; then
AC_DEFINE([ACCEL_DETECT],,[autodetect accelerations])
fi
...@@ -3,5 +3,3 @@ AM_CFLAGS = $(OPT_CFLAGS) $(LIBVO_CFLAGS) ...@@ -3,5 +3,3 @@ AM_CFLAGS = $(OPT_CFLAGS) $(LIBVO_CFLAGS)
noinst_LIBRARIES = libvo.a noinst_LIBRARIES = libvo.a
libvo_a_SOURCES = video_out.c video_out_x11.c video_out_dx.c video_out_sdl.c \ libvo_a_SOURCES = video_out.c video_out_x11.c video_out_dx.c video_out_sdl.c \
video_out_null.c video_out_pgm.c vo_internal.h video_out_null.c video_out_pgm.c vo_internal.h
EXTRA_DIST = configure.incl
AC_SUBST([LIBVO_CFLAGS])
AC_SUBST([LIBVO_LIBS])
dnl check for X11
AC_PATH_XTRA
if test x"$no_x" != x"yes"; then
dnl check for Xshm
AC_CHECK_LIB([Xext],[XShmCreateImage],
[AC_DEFINE([LIBVO_X11],,[libvo X11 support])
LIBVO_CFLAGS="$LIBVO_CFLAGS $X_CFLAGS"
LIBVO_LIBS="$LIBVO_LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXext -lX11"
dnl check for Xv
AC_CHECK_LIB([Xv],[XvShmCreateImage],
[AC_DEFINE([LIBVO_XV],,[libvo Xv support])
LIBVO_LIBS="$LIBVO_LIBS -lXv"],,
[$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXext -lX11])],,
[$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lX11])
fi
dnl check for DirectX
AC_ARG_ENABLE([directx],
[ --enable-directx=DIR use Win32 DirectX headers in DIR])
case $enable_directx in
""|yes) AC_CHECK_HEADER([ddraw.h],
[AC_DEFINE([LIBVO_DX],,[libvo DirectX support])
LIBVO_LIBS="$LIBVO_LIBS -lgdi32"]);;
no) ;;
*) if test -f "$enable_directx/ddraw.h"; then
AC_DEFINE([LIBVO_DX],,[libvo DirectX support])
LIBVO_CFLAGS="$LIBVO_CFLAGS -I$enable_directx"
LIBVO_LIBS="$LIBVO_LIBS -lgdi32"
else
AC_MSG_ERROR([Cannot find $enable_directx/ddraw.h])
fi;;
esac
dnl check for SDL
AC_ARG_ENABLE([sdl],[ --disable-sdl make a version not using SDL])
if test x"$enable_sdl" != x"no"; then
AC_CHECK_PROG([SDLCONFIG],[sdl-config],[yes])
if test x"$SDLCONFIG" = x"yes"; then
AC_DEFINE([LIBVO_SDL],,[libvo SDL support])
LIBVO_CFLAGS="$LIBVO_CFLAGS `sdl-config --cflags`"
LIBVO_LIBS="$LIBVO_LIBS `sdl-config --libs`"
fi
fi
dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
dnl check if $CC supports a given set of cflags
AC_DEFUN([AC_TRY_CFLAGS],
[AC_MSG_CHECKING([if $CC supports $1 flags])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$1"
AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no])
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT([$ac_cv_try_cflags_ok])
if test x"$ac_cv_try_cflags_ok" = x"yes"; then
ifelse([$2],[],[:],[$2])
else
ifelse([$3],[],[:],[$3])
fi])
dnl AC_C_RESTRICT
dnl Do nothing if the compiler accepts the restrict keyword.
dnl Otherwise define restrict to __restrict__ or __restrict if one of
dnl those work, otherwise define restrict to be empty.
AC_DEFUN([AC_C_RESTRICT],
[AC_MSG_CHECKING([for restrict])
ac_cv_c_restrict=no
for ac_kw in restrict __restrict__ __restrict; do
AC_TRY_COMPILE([],[char * $ac_kw p;],[ac_cv_c_restrict=$ac_kw; break])
done
AC_MSG_RESULT([$ac_cv_c_restrict])
case $ac_cv_c_restrict in
restrict) ;;
no) AC_DEFINE([restrict],,
[Define as `__restrict' if that's what the C compiler calls
it, or to nothing if it is not supported.]) ;;
*) AC_DEFINE_UNQUOTED([restrict],$ac_cv_c_restrict) ;;
esac])
dnl AC_C_BUILTIN_EXPECT
dnl Check whether compiler understands __builtin_expect.
AC_DEFUN([AC_C_BUILTIN_EXPECT],
[AC_CACHE_CHECK([for __builtin_expect],[ac_cv_builtin_expect],
[cat > conftest.c <<EOF
#line __oline__ "configure"
int foo (int a)
{
a = __builtin_expect (a, 10);
return a == 10 ? 0 : 1;
}
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS -nostdlib -nostartfiles
-o conftest conftest.c -lgcc >&AC_FD_CC]); then
ac_cv_builtin_expect=yes
else
ac_cv_builtin_expect=no
fi
rm -f conftest*])
if test x"$ac_cv_builtin_expect" = x"yes"; then
AC_DEFINE(HAVE_BUILTIN_EXPECT,,
[Define if you have the `__builtin_expect' function.])
fi])
dnl AC_C_ALWAYS_INLINE
dnl Define inline to something appropriate, including the new always_inline
dnl attribute from gcc 3.1
AC_DEFUN([AC_C_ALWAYS_INLINE],
[AC_C_INLINE
if test x"$GCC" = x"yes" -a x"$ac_cv_c_inline" = x"inline"; then
AC_MSG_CHECKING([for always_inline])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE([],
[__attribute__ ((__always_inline__)) void f (void);
#ifdef __cplusplus
42 = 42; // obviously illegal - we want c++ to fail here
#endif],
[ac_cv_always_inline=yes],[ac_cv_always_inline=no])
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT([$ac_cv_always_inline])
if test x"$ac_cv_always_inline" = x"yes"; then
AC_DEFINE_UNQUOTED([inline],[__attribute__ ((__always_inline__))])
fi
fi])
dnl AC_C_ATTRIBUTE_ALIGNED
dnl define ATTRIBUTE_ALIGNED_MAX to the maximum alignment if this is supported
AC_DEFUN([AC_C_ATTRIBUTE_ALIGNED],
[SAV_CFLAGS=$CFLAGS;
if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -Werror"; fi
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
[ac_cv_c_attribute_aligned],
[ac_cv_c_attribute_aligned=0
for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
AC_TRY_COMPILE([],
[static struct s {
char a;
char b __attribute__ ((aligned($ac_cv_c_attr_align_try)));
} S = {0, 0};
switch (1) {
case 0:
case (long)(&((struct s *)0)->b) == $ac_cv_c_attr_align_try:
return 0;
}
return (long)&S;],
[ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try])
done])
if test x"$ac_cv_c_attribute_aligned" != x"0"; then
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
[$ac_cv_c_attribute_aligned],[maximum supported data alignment])
fi
CFLAGS=$SAV_CFLAGS])
dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
dnl check if $CC supports a given set of cflags
AC_DEFUN([AC_TRY_CFLAGS],
[AC_MSG_CHECKING([if $CC supports $1 flags])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$1"
AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no])
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT([$ac_cv_try_cflags_ok])
if test x"$ac_cv_try_cflags_ok" = x"yes"; then
ifelse([$2],[],[:],[$2])
else
ifelse([$3],[],[:],[$3])
fi])
dnl AC_LIBTOOL_NON_PIC ([ACTION-IF-WORKS], [ACTION-IF-FAILS])
dnl check for nonbuggy libtool -prefer-non-pic
AC_DEFUN([AC_LIBTOOL_NON_PIC],
[AC_MSG_CHECKING([if libtool supports -prefer-non-pic flag])
mkdir ac_test_libtool; cd ac_test_libtool; ac_cv_libtool_non_pic=no
echo "int g (int i); static int h (int i) {return g (i);} int f (int i) {return h (i);}" >f.c
echo "int (* hook) (int) = 0; int g (int i) {if (hook) i = hook (i); return i + 1;}" >g.c
../libtool --mode=compile $CC $CFLAGS -prefer-non-pic \
-c f.c >/dev/null 2>&1 && \
../libtool --mode=compile $CC $CFLAGS -prefer-non-pic \
-c g.c >/dev/null 2>&1 && \
../libtool --mode=link $CC $CFLAGS -prefer-non-pic -o libfoo.la \
-rpath / f.lo g.lo >/dev/null 2>&1 &&
ac_cv_libtool_non_pic=yes
cd ..; rm -fr ac_test_libtool; AC_MSG_RESULT([$ac_cv_libtool_non_pic])
if test x"$ac_cv_libtool_non_pic" = x"yes"; then
ifelse([$1],[],[:],[$1])
else
ifelse([$2],[],[:],[$2])
fi])
dnl AC_CHECK_GENERATE_INTTYPES_H (INCLUDE-DIRECTORY) dnl AC_CHECK_GENERATE_INTTYPES_H (INCLUDE-DIRECTORY)
dnl generate a default inttypes.h if the header file does not exist already dnl generate a default inttypes.h if the header file does not exist already
AC_DEFUN([AC_CHECK_GENERATE_INTTYPES], AC_DEFUN([AC_CHECK_GENERATE_INTTYPES],
......
dnl AC_C_RESTRICT
dnl Do nothing if the compiler accepts the restrict keyword.
dnl Otherwise define restrict to __restrict__ or __restrict if one of
dnl those work, otherwise define restrict to be empty.
AC_DEFUN([AC_C_RESTRICT],
[AC_MSG_CHECKING([for restrict])
ac_cv_c_restrict=no
for ac_kw in restrict __restrict__ __restrict; do
AC_TRY_COMPILE([],[char * $ac_kw p;],[ac_cv_c_restrict=$ac_kw; break])
done
AC_MSG_RESULT([$ac_cv_c_restrict])
case $ac_cv_c_restrict in
restrict) ;;
no) AC_DEFINE([restrict],,
[Define as `__restrict' if that's what the C compiler calls
it, or to nothing if it is not supported.]) ;;
*) AC_DEFINE_UNQUOTED([restrict],$ac_cv_c_restrict) ;;
esac])
dnl AC_C_BUILTIN_EXPECT
dnl Check whether compiler understands __builtin_expect.
AC_DEFUN([AC_C_BUILTIN_EXPECT],
[AC_CACHE_CHECK([for __builtin_expect],[ac_cv_builtin_expect],
[cat > conftest.c <<EOF
#line __oline__ "configure"
int foo (int a)
{
a = __builtin_expect (a, 10);
return a == 10 ? 0 : 1;
}
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS -nostdlib -nostartfiles
-o conftest conftest.c -lgcc >&AC_FD_CC]); then
ac_cv_builtin_expect=yes
else
ac_cv_builtin_expect=no
fi
rm -f conftest*])
if test x"$ac_cv_builtin_expect" = x"yes"; then
AC_DEFINE(HAVE_BUILTIN_EXPECT,,
[Define if you have the `__builtin_expect' function.])
fi])
dnl AC_C_ALWAYS_INLINE
dnl Define inline to something appropriate, including the new always_inline
dnl attribute from gcc 3.1
AC_DEFUN([AC_C_ALWAYS_INLINE],
[AC_C_INLINE
if test x"$GCC" = x"yes" -a x"$ac_cv_c_inline" = x"inline"; then
AC_MSG_CHECKING([for always_inline])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE([],
[__attribute__ ((__always_inline__)) void f (void);
#ifdef __cplusplus
42 = 42; // obviously illegal - we want c++ to fail here
#endif],
[ac_cv_always_inline=yes],[ac_cv_always_inline=no])
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT([$ac_cv_always_inline])
if test x"$ac_cv_always_inline" = x"yes"; then
AC_DEFINE_UNQUOTED([inline],[__attribute__ ((__always_inline__))])
fi
fi])
dnl AC_C_ATTRIBUTE_ALIGNED
dnl define ATTRIBUTE_ALIGNED_MAX to the maximum alignment if this is supported
AC_DEFUN([AC_C_ATTRIBUTE_ALIGNED],
[SAV_CFLAGS=$CFLAGS;
if test x"$GCC" = xyes; then CFLAGS="$CFLAGS -Werror"; fi
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
[ac_cv_c_attribute_aligned],
[ac_cv_c_attribute_aligned=0
for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
AC_TRY_COMPILE([],
[static struct s {
char a;
char b __attribute__ ((aligned($ac_cv_c_attr_align_try)));
} S = {0, 0};
switch (1) {
case 0:
case (long)(&((struct s *)0)->b) == $ac_cv_c_attr_align_try:
return 0;
}
return (long)&S;],
[ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try])
done])
if test x"$ac_cv_c_attribute_aligned" != x"0"; then
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
[$ac_cv_c_attribute_aligned],[maximum supported data alignment])
fi
CFLAGS=$SAV_CFLAGS])
dnl AC_LIBTOOL_NON_PIC ([ACTION-IF-WORKS], [ACTION-IF-FAILS])
dnl check for nonbuggy libtool -prefer-non-pic
AC_DEFUN([AC_LIBTOOL_NON_PIC],
[AC_MSG_CHECKING([if libtool supports -prefer-non-pic flag])
mkdir ac_test_libtool; cd ac_test_libtool; ac_cv_libtool_non_pic=no
echo "int g (int i); static int h (int i) {return g (i);} int f (int i) {return h (i);}" >f.c
echo "int (* hook) (int) = 0; int g (int i) {if (hook) i = hook (i); return i + 1;}" >g.c
../libtool --mode=compile $CC $CFLAGS -prefer-non-pic \
-c f.c >/dev/null 2>&1 && \
../libtool --mode=compile $CC $CFLAGS -prefer-non-pic \
-c g.c >/dev/null 2>&1 && \
../libtool --mode=link $CC $CFLAGS -prefer-non-pic -o libfoo.la \
-rpath / f.lo g.lo >/dev/null 2>&1 &&
ac_cv_libtool_non_pic=yes
cd ..; rm -fr ac_test_libtool; AC_MSG_RESULT([$ac_cv_libtool_non_pic])
if test x"$ac_cv_libtool_non_pic" = x"yes"; then
ifelse([$1],[],[:],[$1])
else
ifelse([$2],[],[:],[$2])
fi])
...@@ -12,4 +12,4 @@ corrupt_mpeg2_SOURCES = corrupt_mpeg2.c getopt.c ...@@ -12,4 +12,4 @@ corrupt_mpeg2_SOURCES = corrupt_mpeg2.c getopt.c
man_MANS = mpeg2dec.1 extract_mpeg2.1 man_MANS = mpeg2dec.1 extract_mpeg2.1
EXTRA_DIST = configure.incl getopt.h gettimeofday.h $(man_MANS) EXTRA_DIST = getopt.h gettimeofday.h $(man_MANS)
AC_SUBST([MPEG2DEC_CFLAGS])
MPEG2DEC_CFLAGS="$OPT_CFLAGS"
AC_ARG_ENABLE([gprof],[ --enable-gprof make a version using gprof])
if test x"$enable_gprof" = x"yes"; then
AC_DEFINE([MPEG2DEC_GPROF],,[mpeg2dec profiling])
MPEG2DEC_CFLAGS=`echo "$MPEG2DEC_CFLAGS"|sed "s/-fomit-frame-pointer//g"`
MPEG2DEC_CFLAGS="$MPEG2DEC_CFLAGS -p"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment