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

1117 lines (917 sloc) 31.644 kb
AC_INIT(CVD,0.7)
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 tr1_shared_ptr assembler"
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 to 1
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_$1" == "yes"
then
have_$1=yes
elif test "$with_$1" != "no"
then
TEST_AND_SET_CXXFLAG([$2], [$3], [for $1 support],run)
have_$1="$ts_success"
fi
if test "$have_$1" == yes
then
AC_DEFINE(CVD_HAVE_$1, 1)
AC_SUBST(have_[]m4_tolower($1), yes)
APPEND(simd_options, m4_tolower($1))
fi
fi])
################################################################################
#
# 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
#
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
#Host detection
AC_CANONICAL_HOST
########################################
#
# 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
AC_MSG_CHECKING([for best optimize flags])
AC_MSG_RESULT([])
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
AC_MSG_CHECKING([CPU type])
AC_ARG_WITH(cpu, [ --with-cpu=[type] Specify pocessor type for optimization selection:
X86:
p3 p4 p4_64 xeon pM core2 core2_64 opteron
opteron_64 athlon athlon64 athlon64_64
SPARC:
sparc
Autodetection works on Linux only.])
if test "$with_cpu" == ""
then
case "$host" in
*86*linux*)
cpu="`awk '
/Pentium III/ {print "p3";exit}
/Intel\(R\) Pentium\(R\) 4/ {print "p4";exit}
/Intel\(R\) Pentium\(R\) D/ {print "p4";exit}
/Intel\(R\) Pentium\(R\) M/ {print "pM";exit}
/Intel\(R\) Core\(TM\)2/ {print "core2";exit}
/Intel\(R\) Xeon\(TM\)/ {print "xeon";exit}
/Intel\(R\) XEON\(TM\)/ {print "xeon";exit}
/AMD Athlon\(tm\) 64 Processor/ {print "athlon64";exit}
/AMD Athlon\(tm\)/ {print "athlon";exit}
/AMD Opteron\(tm\)/ {print "opteron";exit}' /proc/cpuinfo`"
;;
sparc*)
cpu=sparc
;;
esac
cpu="${cpu:-unknown}"
else
cpu="$with_cpu"
fi
AC_MSG_RESULT($cpu)
#Find possible lest of compiler flags
#FIXME, only GCC is currently supported
cpuoptlist="`$AWK '/^'$cpu'/{$1=""; print}' make/march_flags`"
for mwhat in -march= -mcpu=
do
for i in $cpuoptlist
do
TEST_AND_SET_CXXFLAG($mwhat$i)
if test $ts_success == yes
then
break 2
fi
done
done
if test $ts_success == no
then
AC_MSG_WARN([I do not know what the best flags are for this processor ($cpu).])
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])
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(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(dvbuffer, [ --without-dvbuffer compile without dvbuffer (libDC1394v1) support (Linux only)])
AC_ARG_WITH(dvbuffer3, [ --without-dvbuffer3 compile without dvbuffer3 (libDC1394v{1,2}) support (Linux only)])
AC_ARG_WITH(dc1394v2, [ --without-dc1394v2 do not use libDC1394v2 (use v1 instead) for dvbuffer3 (Linux only)])
AC_ARG_WITH(v4l1buffer,[ --without-v4l1buffer compile without v4l1bffer (Video4Linux) support (Linux only)])
AC_ARG_WITH(v4l2, [ --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)])
case "$host" in
*linux*)
os_all_options="dc1394v2 dvbuffer dvbuffer3 v4l2buffer v4l1buffer v4lbuffer"
CHECK_FOR_OPTION(dc1394v2, [
AC_CHECK_HEADERS(dc1394/dc1394.h, [], [a=1])
AC_CHECK_LIB(dc1394, main,[],[a=1])
])
CHECK_FOR_OPTION(dvbuffer, [
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])
])
CHECK_FOR_OPTION(dvbuffer3, [
if test "$have_dc1394v2" != yes && test "$have_dvbuffer" != yes
then
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/videodev.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
if test "$cross_compiling" = yes
then
uname_r=
else
uname_r="`uname -r`"
fi
AC_ARG_WITH(linux, [ --with-linux=UNAME specify the output of uname -r ],[uname_r="$withval"])
if test "$uname_r" = ""
then
AC_MSG_WARN([No kernel type specified. Assming 2.6.20])
uname_r=2.6.20
fi
AC_MSG_CHECKING([kernel major number])
kernel_major=[`echo $uname_r | $AWK -F'[.-]' '{print $1}'`]
AC_MSG_RESULT($kernel_major)
AC_DEFINE_UNQUOTED(CVD_KERNEL_MAJOR,$kernel_major)
AC_MSG_CHECKING([kernel minor number])
kernel_minor=[`echo $uname_r | $AWK -F'[.-]' '{print $2}'`]
AC_MSG_RESULT($kernel_minor)
AC_DEFINE_UNQUOTED(CVD_KERNEL_MINOR,$kernel_minor)
AC_MSG_CHECKING([kernel release number])
kernel_release=[`echo $uname_r | $AWK -F'[.-]' '{print $3}'`]
AC_MSG_RESULT($kernel_release)
AC_DEFINE_UNQUOTED(CVD_KERNEL_RELEASE,$kernel_release)
if test $kernel_major.$kernel_minor == 2.4
then
AC_SUBST(have_linux_2_4, yes)
elif test $kernel_major.$kernel_minor == 2.6
then
AC_SUBST(have_linux_2_6, yes)
fi
;;
*sgi*)
os_all_options="o2buffer"
CHECK_FOR_OPTION(o2buffer, [
echo "I hope all SGIs have stuff needed for O2buffer. Disable (--without-o2buffer) if I'm wrong."
])
;;
esac
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"
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 optional libraries
#
echo
echo -------------------------------
echo Checking for optional libraries
echo -------------------------------
AC_ARG_WITH(videodisplay, [ --without-vidoedisplay 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(toon, [ --withot-toon Compile without TooN support])
AC_ARG_WITH(tr1_shared_ptr, [ --withot-tr1_shared_ptr Compile without tr1::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,[
AC_PATH_X
if test x$x_includes != x
then
APPEND(CXXFLAGS, -I$x_includes)
fi
if test "$host_vendor" == apple
then
APPEND(LIBS, [-L$x_libraries -lX11 -lXext -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib])
else
APPEND(LIBS, [-L$x_libraries -lX11 -lXext])
fi
AC_CHECK_LIB(GL,glDrawPixels, [], [a=1])
])
CHECK_FOR_OPTION(tr1_shared_ptr, [
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])
])
CHECK_FOR_OPTION(toon, [
AC_MSG_CHECKING([for 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=1])
AC_MSG_CHECKING([Old TooN])
AC_COMPILE_IFELSE([#include <TooN/TooN.h>
using namespace TooN;
int main()
{
Matrix<> m1(10,10);
Matrix<3,3> m2;
m1.slice(0,0,3,3) += m2;
return 0;
}], [AC_MSG_RESULT(no)],[AC_MSG_RESULT(yes); a=1])
if test x$a = x1
then
AC_MSG_WARN([Your version of TooN is too old for this version of GCC.
You need a recent version (SNAPSHOT_20080725 or later), or GCC version
less than 4.2.0.
])
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(pthread_yield, AC_DEFINE(CVD_HAVE_PTHREAD_YIELD),a=1$a)
AC_CHECK_FUNC(pthread_yield_np, AC_DEFINE(CVD_HAVE_PTHREAD_YIELD_NP),a=1$a)
if test x$a = x11
then
APPEND(dodginess_options, no_pthread_yield)
fi
])
CHECK_FOR_OPTION(png, [
AC_CHECK_HEADERS(png.h, [], [a=1])
AC_CHECK_LIB(png, png_init_io, [], [a=1])
])
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_CHECK_HEADERS(ffmpeg/avcodec.h ffmpeg/avformat.h ffmpeg/swscale.h, [ffmpeg_old_headers=1], [])
AC_CHECK_HEADERS(libavcodec/avcodec.h libavformat/avformat.h libswscale/swscale.h, [ffmpeg_new_headers=1], [])
if test "$ffmpeg_old_headers" == 1 || test "$ffmpeg_new_headers" == 1
then
if test "$ffmpeg_old_headers" == 1
then
AC_DEFINE(CVD_INTERNAL_HAVE_FFMPEG_OLD_HEADERS, 1)
fi
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])
else
a=1
fi
else
a=1
AC_MSG_WARN([FFMPEG currently requires the use of --enable-gpl])
fi
#if test "$with_ffmpeg" != yes
#then
# APPEND(LIBS, [-L $with_ffmpeg])
# fi
# if test "`$CXX -dumpversion`" = 4.1.0
# then
# APPEND(CXXFLAGS, -D__STDC_CONSTANT_MACROS)
# fi
#Old ffmpeg?
#AC_CHECK_HEADERS(ffmpeg/avcodec.h ffmpeg/avformat.h, [], [a=1])
#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_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 mmxext 32bit x86
cvd_src/i686/yuv411_to_stuff_MMX_64 mmxext x86
cvd_src/yuv411_to_stuff END
cvd_src/i686/halfsample,HALFSAMPLE_MMX8 mmx 32bit x86 assembler END
HALFSAMPLE_SSE16 sse2 END
YV402P_MMX mmx 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/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
#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/faster_corner_9 sse2 ssefast9 fast9
cvd_src/slower_corner_9 fast9 END
cvd_src/faster_corner_10 sse2 ssefast10 fast10
cvd_src/slower_corner_10 fast10 END
cvd_src/faster_corner_12 sse2 ssefast12 fast12
cvd_src/slower_corner_12 fast12 END
#General OS specific bits
cvd_src/Linux/dvbuffer dvbuffer END
cvd_src/Linux/dvbuffer3_dc1394v2 dvbuffer3 dc1394v2
cvd_src/Linux/dvbuffer3_dc1394v1 dvbuffer3 dvbuffer END
cvd_src/Linux/v4l1buffer v4l1buffer END
cvd_src/Linux/v4lbuffer,V4LBUFFER v4l2buffer linux_2_6 END
cvd_src/Linux/v4l2buffer v4l2buffer END
cvd_src/Linux/v4lcontrol v4l2buffer linux_2_6 END
cvd_src/IRIX/O2buffer,cvd_src/IRIX/sgi-video o2buffer END
cvd_src/OSX/qtbuffer qtbuffer END
#Libraries
cvd_src/synchronized,cvd_src/eventobject,cvd_src/thread pthread END
cvd_src/thread/runnable_batch tr1_shared_ptr pthread
cvd_src/nothread/runnable_batch tr1_shared_ptr END
cvd_src/noarch/posix_memalign memalign
cvd_src/noarch/default_memalign END
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 ffmpeg END
cvd_src/globlist glob END
#Numerics dependencies
cvd_src/tensor_voting,cvd_src/brezenham toon 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@:>@/{print "CVD_INTERNAL_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/img_play videodisplay END
progs/cvd_display_image videodisplay END
progs/img_play_bw videodisplay END
progs/img_play_deinterlace videodisplay END
progs/video_play_source videodisplay END
progs/video_play videodisplay ffmpeg END
progs/video_play_bw videodisplay ffmpeg 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/test_images END
test/v4l1buffer_mono videodisplay v4l1buffer 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
ENDPROGS
AC_SUBST(testprogs, ["`cat config.dep_testprogs | tr '\n' ' ' `"])
if echo "$dep_objects" | grep -q v4lbuffer
then
APPEND(options, v4lbuffer)
fi
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
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.