Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 1098 lines (893 sloc) 31.953 kb
AC_INIT(CVD,0.8)
AC_COPYRIGHT(Copyright foo)
AC_CONFIG_HEADERS
AC_HEADER_STDC
#Use builtin autoconf checks for all the programs we need.
AC_PROG_AWK
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
#Switch testing language to C++
AC_LANG(C++)
AC_REQUIRE_CPP
#Start the compiler
cvd_major=`echo $PACKAGE_VERSION | $AWK -F'\\\\.' '{print $1}'`
cvd_minor=`echo $PACKAGE_VERSION | $AWK -F'\\\\.' '{print $2}'`
AC_DEFINE_UNQUOTED(CVD_MAJOR_VERSION,$cvd_major)
AC_SUBST(major, $cvd_major)
AC_DEFINE_UNQUOTED(CVD_MINOR_VERSION,$cvd_minor)
AC_SUBST(minor, $cvd_minor)
################################################################################
#
#Lists of optional components
#
all_options="videodisplay jpeg tiff png ffmpeg toon lapack pthread glob memalign shared_ptr assembler inline_asm posix_rt"
dodginess_options=
options=
simd_all_options=
simd_options=
os_all_options=
################################################################################
#
# Useful macros
#
dnl APPEND(var, value)
dnl This appends vale to a shell variable var
define(APPEND, [$1="$$1 $2"])
dnl TEST_AND_SET_CXXFLAG(flag, [program], [run])
dnl
dnl This attempts to compile a and run program with a certain compiler flag.
dnl If no program is given, then the minimal C++ program is compiled, and
dnl this tests just the validity of the compiler flag.
dnl
define([TEST_AND_SET_CXXFLAG],[
if test "$3" == ""
then
AC_MSG_CHECKING([if compiler flag $1 works])
else
AC_MSG_CHECKING([$3])
fi
save_CXXFLAGS="$CXXFLAGS"
APPEND(CXXFLAGS, [$1])
m4_if([$2],[],[pushdef(prog, [int main(){}])], [pushdef(prog, [$2])])
m4_if([$4],[run],
[AC_RUN_IFELSE([prog], [cvd_conf_test=1],[cvd_conf_test=0], [cvd_conf_test=0])],
[AC_COMPILE_IFELSE([prog], [cvd_conf_test=1],[cvd_conf_test=0])]
)
popdef([prog])
if test $cvd_conf_test = 1
then
AC_MSG_RESULT(yes)
ts_success=yes
else
AC_MSG_RESULT(no)
CXXFLAGS="$save_CXXFLAGS"
ts_success=no
fi
])
dnl CHECK_FOR_OPTION(option, code, [success], [fail])
dnl option corresponds to the first parameter for the corresponding
dnl AC_ARG_WITH. If the library is present, then have_option and CVD_HAVE_OPTION
dnl are set. If with_option is "", it will be set to yes.
dnl
dnl The test code shall do nothing on success, and set the shell variable a
dnl on failure. For convenience, LIBS and CXXFLAGS are checkpointed
dnl automatically. On failure, they are restored automatically.
dnl
dnl On success, "option" is appended to options, and the code "success" is run
dnl On failure including --without) fail is run.
define(CHECK_FOR_OPTION,[
if test "$with_$1" != no && test "$have_$1" != yes
then
if test "$with_$1" == ""
then
with_$1=yes
fi
save_LIBS="$LIBS"
save_CXXFLAGS="$CXXFLAGS"
a=
$2
if test x$a == x
then
AC_DEFINE(CVD_HAVE_[]m4_toupper($1), 1)
AC_SUBST(have_$1, yes)
APPEND(options, $1)
$3
else
LIBS="$save_LIBS"
CXXFLAGS="$save_CXXFLAGS"
fi
fi
if test "$have_$1" != yes
then
:
$4
fi
])
dnl SIMD_TEST(name, flag, code)
dnl This tests for SIMD code (with name), using the compiler flag "flag"
dnl and the provided test code. It respects with_simd and with_name
dnl
dnl On success, "name" is appended to simd_options
define(SIMD_TEST, [
if test "$with_simd" != no
then
if test "$with_[]m4_tolower($1)" == "yes"
then
have_[]m4_tolower($1)=yes
elif test "$with_[]m4_tolower($1)" != "no"
then
TEST_AND_SET_CXXFLAG([$2], [$3], [for $1 support],run)
have_[]m4_tolower($1)="$ts_success"
fi
if test "$have_[]m4_tolower($1)" == yes
then
AC_DEFINE(CVD_HAVE_$1, 1)
AC_SUBST(have_[]m4_tolower($1), yes)
APPEND(simd_options, m4_tolower($1))
fi
fi])
#Host detection
AC_CANONICAL_HOST
################################################################################
#
# Compiler flags and optimization
#
#
TEST_AND_SET_CXXFLAG(-Wall)
TEST_AND_SET_CXXFLAG(-Wextra)
TEST_AND_SET_CXXFLAG(-pipe)
APPEND(CPPFLAGS, [-I"$(eval echo $includedir)"])
########################################
#
# Remove -O2 from CXXFLAGS
#
CXXFLAGS="$(echo "$CXXFLAGS" | sed -e's/-O2//')"
########################################
#
# Extra debugging
#
AC_ARG_WITH(debug, [ --with-debug=flags compile with debug support],[debug="$withval"], [debug=yes])
if test "$debug" = yes
then
TEST_AND_SET_CXXFLAG(-ggdb)
elif test "$debug" != no
then
APPEND(CXXFLAGS, $debug)
fi
########################################
#
# Position independent code
#
# MinGW is always PIC
if ! echo $host | grep mingw
then
TEST_AND_SET_CXXFLAG(-fPIC)
if test $ts_success == no
then
AC_MSG_WARN(["I don't know how to compile position independent code."])
fi
fi
########################################
#
# CPU type detection and optimization
#
noopt_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_ARG_WITH(optimize, [ --without-optimize compile without optimizations ],[optimize=no],[])
AC_ARG_WITH(optimize, [ --with-optimize=flags compile with optimization flags],[optimize="$withval"], [optimize=-O3])
if test "$optimize" != no
then
TEST_AND_SET_CXXFLAG(-O3)
if test $ts_success == no
then
AC_MSG_WARN([I do not know how to switch on optimizing for this compiler])
fi
fi
OFLAGS="$CXXFLAGS"
CXXFLAGS="$noopt_CXXFLAGS"
################################################################################
#
# Processor/Platform specific parts
#
echo
echo ------------------------------------
echo Checking processor specific features
echo ------------------------------------
echo
AC_C_BIGENDIAN
if test x$ac_cv_c_bigendian = xno
then
AC_DEFINE(CVD_ARCH_LITTLE_ENDIAN)
else
AC_DEFINE(CVD_ARCH_BIG_ENDIAN)
fi
AC_ARG_WITH(simd, [ --without-simd disable SIMD code. Use --without- or --with-
to force presence/absence and disable autodetection.])
AC_ARG_WITH(mmx, [ --with-mmx force presence or absence of MMX (x86 only)])
AC_ARG_WITH(mmxext, [ --with-mmxext force presence or absence of MMXEXT (x86 only) ])
AC_ARG_WITH(sse, [ --with-sse force presence or absence of SSE (x86 only)])
AC_ARG_WITH(sse2, [ --with-sse2 force presence or absence of SSE2 (x86 only)])
AC_ARG_WITH(assembler, [ --with-assembler force presence or absence of asm])
AC_ARG_WITH(inline_asm, [ --with-inline_asm force presence or absence of inline asm])
case "$host" in
*86*)
AC_SUBST(have_x86, yes)
simd_all_options="mmx mmxext sse sse2 sse3"
SIMD_TEST(MMX, -mmmx, [
#include <mmintrin.h>
int main()
{
__m64 a;
a = _mm_setzero_si64();
a = _mm_and_si64(a, a);
return 0;
}], [for MMX support])
SIMD_TEST(MMXEXT, -msse,[
#include <xmmintrin.h>
int main()
{
__m64 a;
a = _mm_setzero_si64();
a = _mm_shuffle_pi16(a, 0);
return 0;}], [for MMXEXT support])
SIMD_TEST(SSE, -msse, [
#include <xmmintrin.h>
int main()
{
__m128 a;
a = _mm_setzero_ps();
a = _mm_add_ps(a, a);
return 0;
}], [for SSE spport])
SIMD_TEST(SSE2, -msse2, [
#include <emmintrin.h>
int main()
{
__m128d a;
a = _mm_setzero_pd();
a = _mm_add_pd(a, a);
return 0;
}], [for SSE2 support])
SIMD_TEST(SSE3, -msse3, [
#include <pmmintrin.h>
int main()
{
__m128 a;
a = _mm_setzero_ps();
a = _mm_hadd_ps(a, a);
return 0;
}], [for SSE3 support])
;;
esac
AC_CHECK_SIZEOF([void*])
if test "$ac_cv_sizeof_voidp" == 4
then
AC_SUBST(have_32bit,yes)
fi
CHECK_FOR_OPTION(inline_asm, [
AC_MSG_CHECKING([for inline asm statement])
AC_COMPILE_IFELSE([int main() { asm(""); }],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no);a=1])
])
CHECK_FOR_OPTION(assembler, [
AC_MSG_CHECKING([assembler supports .type pseudo-op])
AS_IF([echo '.globl test
.type test, @function' | as &> /dev/null],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no);a=1])
])
################################################################################
#
# Operating system specific parts
#
########################################
#
# An OSX specific hack to get at stuff in /sw automatically
#
echo
echo -----------------------------------------------
echo Checking for operating system specific features
echo -----------------------------------------------
AC_ARG_ENABLE(gpl, [ --enable-gpl Allow the use of GPL libraries.])
AC_ARG_WITH(dc1394v1v2,[ --with-dc1394v1v2 Force libDC1394 v1 and v2 co-exist. This will break FORMAT_7.])
AC_ARG_WITH(dc1394v1, [ --without-dc1394v1 do not use libDC1394v1 (use try v2 instead) for dvbuffer3 (Linux/OSX). Disable dvbuffer (Linux).])
AC_ARG_WITH(dc1394v2, [ --without-dc1394v2 do not use libDC1394v2 (use try v1 instead) for dvbuffer3 (Linux/OSX). ])
AC_ARG_WITH(v4l1buffer,[ --without-v4l1buffer compile without v4l1bffer (Video4Linux) support (Linux only)])
AC_ARG_WITH(v4l2buffer,[ --without-v4l2buffer compile without v4l2buffer (Video4Linux2) support (Linux only)])
AC_ARG_WITH(o2buffer, [ --without-o2buffer compile without sgi video (IRIX only)])
AC_ARG_WITH(qtbuffer, [ --without-qtbuffer compile without quicktime buffer support (MacOSX only)])
if test "$host_vendor" == apple
then
AC_CHECK_FILE(/opt/local, [
APPEND(CPPFLAGS, [-I/opt/local/include])
APPEND(LIBS, [-L/opt/local/lib])],
[])
AC_CHECK_FILE(/sw, [
APPEND(CPPFLAGS, [-I/sw/include])
APPEND(LIBS, [-L/sw/lib])],
[])
APPEND(CPPFLAGS, [-I/usr/X11R6/include])
AC_MSG_NOTICE([Adding /usr/X11R6/include to the build path.])
AC_SUBST(osx_hacks,yes)
os_all_options="qtbuffer dc1394v2"
fi
CHECK_FOR_OPTION(dc1394v2, [
AC_CHECK_HEADERS(dc1394/dc1394.h, [], [a=1])
AC_CHECK_LIB(dc1394, main,[],[a=1])
])
case "$host" in
*linux*)
os_all_options="dc1394v2 dc1394v1 v4l2buffer v4l1buffer"
if test "$have_dc1394v2" != yes || test "$with_dc1394v1v2" == "yes"
then
CHECK_FOR_OPTION(dc1394v1, [
AC_CHECK_HEADERS(libraw1394/raw1394.h libdc1394/dc1394_control.h, [], [a=1])
AC_CHECK_LIB(raw1394, main,[],[a=1])
AC_CHECK_LIB(dc1394_control, main,[],[a=1])
])
fi
CHECK_FOR_OPTION(v4l2buffer,[
AC_MSG_CHECKING(for v4l2)
AC_COMPILE_IFELSE([ #include <sys/types.h>
#include <linux/types.h>
#include <linux/videodev2.h>
int main(){V4L2_PIX_FMT_GREY;return 0;}],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); a=1])
if test x$a = x1
then
a=
AC_MSG_CHECKING(for strange v4l2)
AC_COMPILE_IFELSE([ #include <sys/types.h>
#include <linux/types.h>
#include <videodevx/videodev.h>
int main(){V4L2_PIX_FMT_GREY;return 0;}],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); a=1])
if test x$a = x
then
APPEND(dodginess_options, strange_v4l2)
strange_v4l2=yes
AC_DEFINE(CVD_INTERNAL_HAVE_STRANGE_V4L2, 1)
fi
fi
])
if test x$strange_v4l2 != xyes
then
CHECK_FOR_OPTION(v4l1buffer, [AC_CHECK_HEADERS(linux/videodev.h,[], [a=1])])
else
CHECK_FOR_OPTION(v4l1buffer, [
AC_MSG_CHECKING(for strange v4l)
AC_COMPILE_IFELSE([ #include <videodevx/videodev.h>
int main(){VIDEO_PALETTE_GREY;return 0;}],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); a=1])])
fi
;;
*windows*)
AC_SUBST(have_windows, yes)
;;
esac
if test "$host_vendor" == apple
then
CHECK_FOR_OPTION(qtbuffer,[
APPEND(LIBS, [-framework Carbon -framework QuickTime])
AC_MSG_CHECKING(Carbon and QuickTime framework)
AC_COMPILE_IFELSE([ #include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h>
int main(){InitCursor();EnterMovies();return 0;}],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); a=1])
])
fi
#Check for POSIX clock_getres
AC_ARG_WITH(posix_rt, [ --without-posix_rt compile without POSIX-RT (better cvd_timer) support])
CHECK_FOR_OPTION(posix_rt, [
AC_CHECK_LIB(rt, clock_getres, [], [a=1])
])
################################################################################
#
#Check for optional libraries
#
echo
echo -------------------------------
echo Checking for optional libraries
echo -------------------------------
AC_ARG_WITH(videodisplay, [ --without-videodisplay compile without videodisplay support])
AC_ARG_WITH(pthread, [ --without-pthread compile without PThread support])
AC_ARG_WITH(jpeg, [ --without-jpeg compile without JPEG support])
AC_ARG_WITH(jpegbuffer, [ --with-jpegbuffer=N Set JPEG read buffer size. N>1 will not be able to read multiple JPEGS from a stream.])
AC_ARG_WITH(tiff, [ --without-tiff compile without TIFF support])
AC_ARG_WITH(tiff, [ --with-tiff=forceold Debug/wierd build environment only. Force use of older library facilities.])
AC_ARG_WITH(png, [ --without-png compile without PNG support])
AC_ARG_WITH(ffmpeg, [ --without-ffmpeg compile without FFMPEG support.])
AC_ARG_WITH(oldffmpeg, [ --with-oldffmpeg compile with old FFMPEG support.])
AC_ARG_WITH(toon, [ --without-toon Compile without TooN support])
AC_ARG_WITH(shared_ptr, [ --without-shared_ptr Compile without shared_ptr support])
AC_ARG_WITH(lapack, [ --without-lapack Disable BLAS and LAPACK.])
AC_ARG_WITH(acml, [ --with-acml[[=directory]] Use BLAS and LAPACK routines from the ACML library [[located in the specified directory]] ], [opt_acml_dir=$withval])
CHECK_FOR_OPTION(videodisplay,[
if test "$host_vendor" == apple
then
APPEND(LIBS, [ -framework OpenGL /usr/X11R6/lib/libX11.dylib /usr/X11R6/lib/libGLU.dylib /usr/X11R6/lib/libGL.dylib])
# all of the following is already covered in the framework
# AC_CHECK_LIB(GL,glDrawPixels, [], [a=1])
# AC_CHECK_HEADERS(GL/glu.h, [], [a=1])
# AC_CHECK_LIB(GLU,gluGetString, [], [a=1])
else
AC_PATH_X
if test x$x_includes != x
then
APPEND(CXXFLAGS, -I$x_includes)
fi
APPEND(LIBS, [-L$x_libraries -lX11 -lXext])
AC_CHECK_LIB(GL,glDrawPixels, [], [a=1])
AC_CHECK_HEADERS(GL/glu.h, [], [a=1])
AC_CHECK_LIB(GLU,gluGetString, [], [a=1])
fi
])
CHECK_FOR_OPTION(shared_ptr, [
AC_MSG_CHECKING([for shared_ptr])
AC_COMPILE_IFELSE([#include <memory>
int main(){std::shared_ptr<int> i; return 0;}], [AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no); a=1])
if test x$a == x1
then
a=0
AC_MSG_CHECKING([for tr1::shared_ptr])
AC_COMPILE_IFELSE([#include <tr1/memory>
int main(){std::tr1::shared_ptr<int> i; return 0;}], [AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no); a=1])
AC_DEFINE(CVD_INTERNAL_NEED_TR1)
APPEND(dodginess_options, tr1_shared_ptr)
fi
])
CHECK_FOR_OPTION(toon, [
AC_MSG_CHECKING([for TooN])
AC_COMPILE_IFELSE([#include <TooN/TooN.h>
int main(){TooN::Vector<2, double> v=TooN::Zeros;return 0;}], [AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no); a=1])
if test x$a = x1
then
AC_MSG_CHECKING([for old TooN])
AC_COMPILE_IFELSE([#include <TooN/TooN.h>
int main(){TooN::Vector<2> v;return 0;}], [AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no); a=2])
if test x$a = x1
then
AC_MSG_WARN([Your version of TooN is too old. You need version 2.0-beta3 or later.])
fi
a=1
fi
])
CHECK_FOR_OPTION(lapack, [
if test "$with_acml" != no
then
if test "$with_acml" != yes & test "$with_acml" != ""
then
APPEND(LIBS, -L $with_acml)
else
APPEND(LIBS, -L/opt/acml/gnu64/lib)
fi
APPEND(LIBS, -lacml_mv)
AC_CHECK_LIB(acml, dgesvd_, [], [a=1])
else
a=1
fi
])
CHECK_FOR_OPTION(lapack, [
AC_MSG_CHECKING(if Accelerate framework is needed for LAPACK)
AC_MSG_RESULT()
APPEND(LIBS, -framework Accelerate)
AC_CHECK_FUNC(dgesvd_, [], [a=1])
])
CHECK_FOR_OPTION(lapack, [
AC_CHECK_LIB(lapack, dgesvd_, [], [a=1])
])
CHECK_FOR_OPTION(lapack, [
AC_MSG_CHECKING(if blas is needed for LAPACK)
AC_MSG_RESULT()
APPEND(LIBS, -lblas)
AC_CHECK_LIB(lapack, zupmtr_, [], [a=1])
])
CHECK_FOR_OPTION(lapack, [
AC_MSG_CHECKING(if f2c is needed for LAPACK)
AC_MSG_RESULT()
APPEND(LIBS, -lf2c)
AC_CHECK_LIB(lapack, dpotrf_, [], [a=1])
])
CHECK_FOR_OPTION(lapack, [
AC_MSG_CHECKING(if g2c is needed for LAPACK)
AC_MSG_RESULT()
APPEND(LIBS, -lg2c)
AC_CHECK_LIB(lapack, dpotrs_, [], [a=1])
])
CHECK_FOR_OPTION(lapack, [
AC_MSG_CHECKING(if gfortran is needed for LAPACK)
AC_MSG_RESULT()
APPEND(LIBS, -lgfortran)
AC_CHECK_LIB(lapack, dpotri_, [], [a=1])
])
CHECK_FOR_OPTION(pthread, [
APPEND(CXXFLAGS, -pthread)
APPEND(LIBS, -pthread)
AC_MSG_CHECKING(for working pthreads)
AC_COMPILE_IFELSE([#include <pthread.h>
void*foo(void*){}
int main(){pthread_create(0,0,foo,0);return 0;}],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); a=1])
], [
# check for existence of pthread_yield
# Mac OS X only has pthread_yield_np
a=
AC_CHECK_FUNC(sched_yield, AC_SUBST(have_sched_yield, yes), a=sy)
if test x$a != x
then
AC_CHECK_FUNC(pthread_yield, AC_SUBST(have_pthread_yield, yes),a=py)
fi
if test x$a != x
then
AC_CHECK_FUNC(pthread_yield_np, AC_SUBST(have_pthread_yield_np, yes),a=pyn)
fi
if test x$a = xpyn
then
APPEND(dodginess_options, no_pthread_yield)
APPEND(dodginess_options, no_sched_yield)
elif test x$a = py
then
APPEND(dodginess_options, no_sched_yield)
fi
])
CHECK_FOR_OPTION(png, [
AC_CHECK_HEADERS(png.h, [], [a=1])
AC_CHECK_LIB(png, png_init_io, [], [a=1])
oldpng=0
AC_CHECK_LIB(png, png_set_expand_gray_1_2_4_to_8, [], [oldpng=1])
if test $oldpng == 1
then
APPEND(dodginess_options, oldpng)
AC_DEFINE(CVD_INTERNAL_HAVE_OLD_PNG, 1)
fi
])
CHECK_FOR_OPTION(jpeg, [
AC_CHECK_HEADERS(jpeglib.h, [], [a=1])
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, [], [a=1])
],[
AC_MSG_CHECKING([JPEG read buffer size])
jpegbuffersize="`echo $with_jpegbuffer | awk '$1 = ($1+0<= 0)?1:$1'`"
if test "$jpegbuffersize" -gt 1
then
AC_MSG_RESULT([$jpegbuffersize (unsafe reading)]);
APPEND(dodginess_options, unsafe_jpeg)
else
jpegbuffersize=1
AC_MSG_RESULT([1 (safe reading)]);
fi
AC_DEFINE_UNQUOTED(CVD_INTERNAL_JPEG_BUFFER_SIZE, $jpegbuffersize)
])
CHECK_FOR_OPTION(tiff, [
AC_CHECK_HEADERS(tiffio.h,[],[a=1])
AC_CHECK_LIB(tiff, TIFFReadRGBAImage,[],[a=1])
])
CHECK_FOR_OPTION(tiff, [
AC_MSG_CHECKING([if perhaps libtiff requires zlib])
AC_MSG_RESULT([])
unset ac_cv_lib_tiff_TIFFReadRGBAImage
AC_CHECK_HEADERS(tiffio.h,[],[a=1])
AC_CHECK_LIB(z, deflate,[],[a=1])
AC_CHECK_LIB(tiff, TIFFReadRGBAImage,[],[a=1])
],[
APPEND(dodginess_options, tiff_needs_zlib)
])
if test "$have_tiff" == yes
then
a=
if test "$with_tiff" != forceold
then
AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented, a=1)
fi
if test x$a = x
then
APPEND(dodginess_options, oldtiff)
else
AC_DEFINE(CVD_INTERNAL_HAVE_TIFF_ORIENTED, 1)
fi
fi
CHECK_FOR_OPTION(ffmpeg, [
if test "$enable_gpl" != no && test "$enable_gpl" != ""
then
AC_MSG_CHECKING([for ffmpeg headers])
AC_COMPILE_IFELSE([
#define __STDC_CONSTANT_MACROS
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
int main(){}
], [ ffmpeg_new_headers=1], [])
if test "$ffmpeg_new_headers" == 1
then
AC_CHECK_LIB(avutil, main, [], [a=1])
AC_CHECK_LIB(avformat, av_open_input_file, [], [a=1])
AC_CHECK_LIB(avformat, av_read_frame, [ffmpeg_recent=yes], [a=1]) #only in >= 0.4.9
AC_CHECK_LIB(avcodec, avcodec_open, [], [a=1])
AC_CHECK_LIB(swscale, sws_getContext, [], [a=1])
if test "$with_oldffmpeg" == yes
then
AC_SUBST(have_oldffmpeg, yes)
fi
have_avcodec_decode_video2=0
AC_CHECK_LIB(avcodec, avcodec_decode_video2, [have_avcodec_decode_video2=1])
if test $have_avcodec_decode_video2==1
then
AC_DEFINE(CVD_INTERNAL_FFMPEG_USE_AVCODEC_DECODE_VIDEO2)
fi
else
a=1
fi
else
a=1
AC_MSG_WARN([FFMPEG currently requires the use of --enable-gpl])
fi
])
AC_CHECK_PROG(docs, doxygen, docs, no)
################################################################################
#
# platform compatibility
# All of these ought to be yes
echo
echo -----------------------------------
echo Checking for platform compatibility
echo -----------------------------------
AC_ARG_WITH(glob, [ --without-glob Compile without diskbuffer glob matching (for debugging only) ])
AC_ARG_WITH(memalign, [ --without-memalign Compile without posix_memalign (for debugging only) ])
CHECK_FOR_OPTION(glob, [
AC_CHECK_HEADERS(glob.h,[], [a=1])
AC_CHECK_FUNC(glob,[], [a=1])
],[
AC_MSG_CHECKING([for GLOB_BRACE and GLOB_TILDE in glob.h])
AC_COMPILE_IFELSE([#include <glob.h>
int main(){glob(0, GLOB_BRACE|GLOB_TILDE,0,0);}],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
AC_DEFINE(CVD_INTERNAL_GLOB_IS_BAD)
APPEND(dodginess_options, broken_glob)
])
], [
APPEND(dodginess_options, no_glob)
])
a=
AC_CHECK_DECL(feenableexcept, [a=1], [a= ], [#include <fenv.h>])
if test x$a = x1
then
AC_DEFINE(CVD_HAVE_FENV_H)
else
dodginess_options="$dodginess_options missing_c99_feenableexcept"
fi
CHECK_FOR_OPTION(memalign, [
AC_CHECK_FUNC(posix_memalign, [], [a=1])
], [], [APPEND(dodginess_options, no_posix_memalign)])
################################################################################
#
# Extra build options
echo
echo --------------------------------
echo Checking for extra build options
echo --------------------------------
AC_ARG_ENABLE(ssefast9, [ --disable-ssefast9 Disable the probably OK SSE FAST-9 detector (debgging only)])
AC_ARG_ENABLE(ssefast10, [ --disable-ssefast10 Disable the probably OK SSE FAST-10 detector (debgging only)])
AC_ARG_ENABLE(ssefast12, [ --disable-ssefast12 Disable the probably OK SSE FAST-12 detector (debgging only)])
AC_ARG_ENABLE(fast7, [ --disable-fast7 compile without the FAST-7 detector (use on low memory systems). ])
AC_ARG_ENABLE(fast8, [ --disable-fast8 compile without the FAST-8 detector (use on low memory systems). ])
AC_ARG_ENABLE(fast9, [ --disable-fast9 compile without the FAST-9 detector (use on low memory systems). ])
AC_ARG_ENABLE(fast10, [ --disable-fast10 compile without the FAST-10 detector (use on low memory systems). ])
AC_ARG_ENABLE(fast11, [ --disable-fast11 compile without the FAST-11 detector (use on low memory systems). ])
AC_ARG_ENABLE(fast12, [ --disable-fast12 compile without the FAST-12 detector (use on low memory systems). ])
test "$enable_fast7" != no && AC_SUBST(have_fast7, yes)
test "$enable_fast8" != no && AC_SUBST(have_fast8, yes)
test "$enable_fast9" != no && AC_SUBST(have_fast9, yes)
test "$enable_fast10" != no && AC_SUBST(have_fast10, yes)
test "$enable_fast11" != no && AC_SUBST(have_fast11, yes)
test "$enable_fast12" != no && AC_SUBST(have_fast12, yes)
test "$enable_ssefast9" != no && AC_SUBST(have_ssefast9, yes)
test "$enable_ssefast10" != no && AC_SUBST(have_ssefast10, yes)
test "$enable_ssefast12" != no && AC_SUBST(have_ssefast12, yes)
################################################################################
#
# Compute dependencies
#
#First, extract all the have_* variables
for i in `echo $ac_subst_vars | tr ' ' '\n' | grep have_`
do
eval echo $i \$$i
done > config.have_bits
#The dependency list
#The file format is as follows:
#
# have_feature1 [yes]
#
# dependee_list_1 dependency_list_1
# dependee_list_2 dependency_list_2
# ...
# dependee_list_N dependee_list_N END
#
#
# dependee_list is comma separated. dependency_list is whitespace separated.
# If all the dependencies in dependency list are present (have_* is yes), then
# dependee list is buildable. The lowest numbered dependee list is selected.
#
# The dependee list has a comma separated list of object files (minus the .o)
# to be build. If a `file' is all caps, it is treated as a define, instead.
#
# Blank lines, and those starting with # are ignored
cat config.have_bits - <<ENDDEPS | awk -f make/compile_deps.awk > config.dep_tmp
#SIMD dependencies
cvd_src/i686/yuv411_to_stuff_MMX inline_asm mmxext 32bit x86
cvd_src/i686/yuv411_to_stuff_MMX_64 inline_asm mmxext x86
cvd_src/yuv411_to_stuff END
cvd_src/SSE2/half_sample sse2
cvd_src/i686/halfsample,cvd_src/MMX/half_sample mmx 32bit x86 assembler
cvd_src/noarch/half_sample END
cvd_src/i686/rgb_to_gray,cvd_src/i686/convert_rgb_to_y 32bit mmxext x86 assembler
cvd_src/noarch/convert_rgb_to_y END
cvd_src/i686/convolve_gaussian sse2
cvd_src/noarch/convolve_gaussian END
cvd_src/i686/gradient sse2
cvd_src/noarch/gradient END
cvd_src/i686/yuv420p_to_rgb,cvd_src/i686/yuv420p_to_rgb_runner mmx 32bit x86 assembler
cvd_src/noarch/yuv420p_to_rgb_runner END
cvd_src/i686/yuv422_to_rgb,cvd_src/i686/yuv422_to_grey,cvd_src/i686/yuv422_wrapper mmxext 32bit x86 assembler
cvd_src/noarch/yuv422_wrapper END
cvd_src/i686/median_3x3 sse2
cvd_src/noarch/median_3x3 END
cvd_src/i686/utility_float sse
cvd_src/noarch/utility_float END
cvd_src/i686/utility_byte_differences mmx
cvd_src/noarch/utility_byte_differences END
cvd_src/i686/utility_double_int sse2
cvd_src/noarch/utility_double_int END
cvd_src/SSE2/two_thirds_sample sse2
cvd_src/noarch/two_thirds_sample END
#FAST corner detection specifics
cvd_src/fast/fast_7_detect,cvd_src/fast/fast_7_score,cvd_src/slower_corner_7 fast7 END
cvd_src/fast/fast_8_detect,cvd_src/fast/fast_8_score,cvd_src/slower_corner_8 fast8 END
cvd_src/fast/fast_9_detect,cvd_src/fast/fast_9_score,cvd_src/fast_corner_9_nonmax fast9 END
cvd_src/fast/fast_10_detect,cvd_src/fast/fast_10_score fast10 END
cvd_src/fast/fast_11_detect,cvd_src/fast/fast_11_score,cvd_src/slower_corner_11 fast11 END
cvd_src/fast/fast_12_detect,cvd_src/fast/fast_12_score fast12 END
cvd_src/SSE2/faster_corner_9 sse2 ssefast9 fast9
cvd_src/noarch/slower_corner_9 fast9 END
cvd_src/SSE2/faster_corner_10 sse2 ssefast10 fast10
cvd_src/noarch/slower_corner_10 fast10 END
cvd_src/SSE2/faster_corner_12 sse2 ssefast12 fast12
cvd_src/noarch/slower_corner_12 fast12 END
#General OS specific bits
cvd_src/Linux/dvbuffer3_dc1394v2,cvd_src/Linux/dvbuffer,cvd_src/videosource_dvbuffer,DVBUFFER3 dc1394v2 dc1394v1 dc1394v1v2
cvd_src/Linux/dvbuffer3_dc1394v2,cvd_src/videosource_dvbuffer,DVBUFFER3 dc1394v2
cvd_src/Linux/dvbuffer3_dc1394v1,cvd_src/Linux/dvbuffer,cvd_src/videosource_dvbuffer,DVBUFFER dc1394v1
cvd_src/videosource_nodvbuffer END
cvd_src/Linux/v4l1buffer,cvd_src/Linux/videosource_v4l1buffer v4l1buffer
cvd_src/Linux/videosource_nov4l1buffer END
cvd_src/Linux/v4lbuffer,V4LBUFFER,cvd_src/Linux/videosource_v4lbuffer v4l2buffer
cvd_src/Linux/videosource_nov4lbuffer END
cvd_src/Linux/v4l2buffer v4l2buffer END
cvd_src/Linux/v4lcontrol v4l2buffer END
cvd_src/IRIX/O2buffer,cvd_src/IRIX/sgi-video o2buffer END
cvd_src/OSX/qtbuffer,cvd_src/OSX/videosource_qtbuffer qtbuffer
cvd_src/OSX/videosource_noqtbuffer END
nothing windows
cvd_src/posix/get_time_of_day_ns posix_rt
cvd_src/get_time_of_day_ns END
#Libraries
cvd_src/synchronized,cvd_src/eventobject,cvd_src/thread pthread END
cvd_src/posix/sched_yield pthread sched_yield
cvd_src/posix/pthread_yield pthread pthread_yield
cvd_src/posix/pthread_yield_np pthread pthread_yield_np
nothing END
cvd_src/thread/runnable_batch tr1_shared_ptr pthread
cvd_src/nothread/runnable_batch tr1_shared_ptr END
nothing windows
cvd_src/noarch/posix_memalign memalign
cvd_src/noarch/default_memalign END
cvd_src/Win32/glwindow,cvd_src/gltext windows
cvd_src/videodisplay,cvd_src/glwindow,cvd_src/gltext videodisplay END
pnm_src/jpeg jpeg END
pnm_src/tiff,pnm_src/tiffwrite tiff END
pnm_src/png png END
cvd_src/videofilebuffer,cvd_src/videosource_videofilebuffer,cvd_src/videofilebuffer_exceptions oldffmpeg ffmpeg
cvd_src/videofilebuffer2,cvd_src/videosource_videofilebuffer,cvd_src/videofilebuffer_exceptions ffmpeg
cvd_src/videosource_novideofilebuffer END
nothing windows
cvd_src/globlist glob END
cvd_src/Win32/win32 windows END
#Numerics dependencies
cvd_src/tensor_voting,cvd_src/brezenham toon END
cvd_src/draw_toon toon END
cvd_src/dummy_lapack lapack END
ENDDEPS
#Split in to object files and defines
#@<:@ is a quadrigraph for [
AC_SUBST(dep_objects, ["`awk -v ORS=' ' '/@<:@a-z@:>@/{print $0".o"}' config.dep_tmp`"])
for i in `awk '!/@<:@a-z@:>@/{if(/^INTERNAL_/) print "CVD_INTERNAL_HAVE_" substr($0, 10); else print "CVD_HAVE_"$0}' config.dep_tmp`
do
AC_DEFINE_UNQUOTED($i, 1)
done
cat config.have_bits - << ENDPROGS | awk -f make/compile_deps.awk > config.dep_progs
progs/se3_exp toon lapack END
progs/se3_ln toon lapack END
progs/se3_pre_mul toon lapack END
progs/se3_post_mul toon lapack END
progs/se3_inv toon lapack END
progs/calibrate toon videodisplay lapack END
progs/cvd_display_image videodisplay END
progs/video_play_source videodisplay END
ENDPROGS
AC_SUBST(progs, ["`cat config.dep_progs | tr '\n' ' ' `"])
cat config.have_bits - << ENDPROGS | awk -f make/compile_deps.awk > config.dep_testprogs
test/fast_test videodisplay faster_test sse2 END
test/diskbuffer2 videodisplay END
test/dvbuffer_mono videodisplay dc1394v1 END
test/dvbuffer_yuvrgb videodisplay dc1394v1 END
test/dvbuffer3_mono videodisplay dvbuffer3 END
test/dvbuffer3_bayerrgb videodisplay dvbuffer3 END
test/test_images END
test/v4lbuffer_mono videodisplay v4l2buffer END
test/v4lbuffer_bayerrgb videodisplay v4l2buffer END
test/v4l2buffer videodisplay v4l2buffer END
test/dvbuffer_controls videodisplay dc1394v1 END
test/dvbuffer_rgb videodisplay dc1394v1 END
test/o2buffer videodisplay o2buffer END
test/v4l1buffer_bayer videodisplay v4l1buffer END
test/v4l1buffer_rgb videodisplay v4l1buffer END
test/qtbuffer_yuvrgb videodisplay qtbuffer END
test/font videodisplay END
test/bayer_test END
ENDPROGS
AC_SUBST(testprogs, ["`cat config.dep_testprogs | tr '\n' ' ' `"])
echo
echo
echo Options:
echo $options $os_options
echo
echo Missing options for $host_os:
echo $options $all_options $os_all_options | tr ' ' '\n' | sort | uniq -u | xargs echo
echo
echo Dodgy things:
echo $dodginess_options
echo
echo
echo SIMD support:
echo $simd_options
echo
echo Missing SIMD support for $host:
echo $simd_all_options $simd_options | tr ' ' '\n' | sort | uniq -u | xargs echo
echo
AC_SUBST(CXXFLAGS, $CXXFLAGS)
AC_SUBST(OFLAGS, $OFLAGS)
echo $CXXFLAGS
echo $LIBS
#Create config.h file, in a temporary location,
#then compare it to the existing config.h file.
#Do nothing if they are the same. This prevents
#excessive rebuilding.
echo -n 'Generating config... '
cat << FOO > cvd/config_tmp.h
#ifndef CVD_CONFIG_H
#define CVD_CONFIG_H
#ifdef WIN32
#include <cvd/internal/win.h>
#endif
FOO
echo '#define CVD_HAVE_CPU_'$host_cpu 1 | cat - confdefs.h | grep CVD_ | sort | sed 's/#define CVD_.*HAVE_\(.*\) .*/#ifndef CVD_DISABLE_\1\
&\
#endif/' >> cvd/config_tmp.h
echo '#endif' >> cvd/config_tmp.h
if ! diff -q cvd/config_tmp.h cvd/config.h
then
echo 'New configuration'
mv cvd/config_tmp.h cvd/config.h
else
echo 'configuration unchanged'
rm cvd/config_tmp.h
fi
AC_OUTPUT(Makefile)
Jump to Line
Something went wrong with that request. Please try again.