| 1 |
# configure.ac - Configure script for FreeBob. |
|---|
| 2 |
# Copyright (C) 2005,06 by Daniel Wagner. |
|---|
| 3 |
# Copyright (C) 2006 by Pieter Palmers. |
|---|
| 4 |
# |
|---|
| 5 |
# This file is part of FreeBob. |
|---|
| 6 |
# |
|---|
| 7 |
# FreeBob is free software; you can redistribute it and/or modify |
|---|
| 8 |
# it under the terms of the GNU General Public License as published by |
|---|
| 9 |
# the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 |
# (at your option) any later version. |
|---|
| 11 |
# FreeBob is distributed in the hope that it will be useful, |
|---|
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 |
# GNU General Public License for more details. |
|---|
| 15 |
# You should have received a copy of the GNU General Public License |
|---|
| 16 |
# along with FreeBob; if not, write to the Free Software |
|---|
| 17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 |
# |
|---|
| 19 |
# -*- Autoconf -*- |
|---|
| 20 |
# Process this file with autoconf to produce a configure script. |
|---|
| 21 |
|
|---|
| 22 |
AC_PREREQ(2.57) |
|---|
| 23 |
|
|---|
| 24 |
m4_define(freebob_major_version, 0) |
|---|
| 25 |
m4_define(freebob_minor_version, 9) |
|---|
| 26 |
m4_define(freebob_micro_version, 0) |
|---|
| 27 |
|
|---|
| 28 |
m4_define(freebob_version, freebob_major_version.freebob_minor_version.freebob_micro_version) |
|---|
| 29 |
|
|---|
| 30 |
AC_INIT(libfreebob, freebob_version, <freebob-devel@lists.sf.net>) |
|---|
| 31 |
|
|---|
| 32 |
# Before making a release, the LT_VERSION string should be modified. |
|---|
| 33 |
# The string is of the form C:R:A. |
|---|
| 34 |
# - If interfaces have been changed or added, but binary compatibility has |
|---|
| 35 |
# been preserved, change to C+1:0:A+1 |
|---|
| 36 |
# - If binary compatibility has been broken (eg removed or changed interfaces) |
|---|
| 37 |
# change to C+1:0:0 |
|---|
| 38 |
# - If the interface is the same as the previous version, change to C:R+1:A |
|---|
| 39 |
|
|---|
| 40 |
LT_VERSION=1:0:1 |
|---|
| 41 |
AC_SUBST(LT_VERSION) |
|---|
| 42 |
|
|---|
| 43 |
AC_DEFINE(FREEBOB_MAJOR_VERSION, freebob_major_version,[Freebob major version]) |
|---|
| 44 |
AC_DEFINE(FREEBOB_MINOR_VERSION, freebob_minor_version,[Freebob minor version]) |
|---|
| 45 |
AC_DEFINE(FREEBOB_MICRO_VERSION, freebob_micro_version,[Freebob micro version]) |
|---|
| 46 |
AC_SUBST(FREEBOB_MINOR_VERSION, freebob_minor_version) |
|---|
| 47 |
AC_SUBST(FREEBOB_MAJOR_VERSION, freebob_major_version) |
|---|
| 48 |
AC_SUBST(FREEBOB_MICRO_VERSION, freebob_micro_version) |
|---|
| 49 |
|
|---|
| 50 |
AM_INIT_AUTOMAKE([subdir-objects]) |
|---|
| 51 |
AM_MAINTAINER_MODE |
|---|
| 52 |
AC_CONFIG_SRCDIR([src/freebob.cpp]) |
|---|
| 53 |
AC_CONFIG_HEADER([config.h]) |
|---|
| 54 |
AC_GNU_SOURCE |
|---|
| 55 |
AC_LANG(C++) |
|---|
| 56 |
|
|---|
| 57 |
# Prefix handling |
|---|
| 58 |
AC_MSG_CHECKING(prefix) |
|---|
| 59 |
defaultprefix=/usr/local |
|---|
| 60 |
if test -z "$prefix" -o "$prefix" = "NONE"; then |
|---|
| 61 |
prefix=$defaultprefix |
|---|
| 62 |
fi |
|---|
| 63 |
AC_PREFIX_DEFAULT($prefix) |
|---|
| 64 |
AC_MSG_RESULT($prefix) |
|---|
| 65 |
|
|---|
| 66 |
maintainer_mode=${enable_maintainer_mode-no} |
|---|
| 67 |
|
|---|
| 68 |
# Checks for programs. |
|---|
| 69 |
# AC_PROG_CC and AC_PROG_CXX will add by default "-g -O2" if |
|---|
| 70 |
# CFLAGS and CXXFLAGS do not exists. Disable this feature. |
|---|
| 71 |
test ".$CFLAGS" = "." && CFLAGS="" |
|---|
| 72 |
test ".$CXXFLAGS" = "." && CXXFLAGS="" |
|---|
| 73 |
AC_PROG_CC |
|---|
| 74 |
AC_PROG_CXX |
|---|
| 75 |
AM_PROG_AS |
|---|
| 76 |
AM_PROG_CC_C_O |
|---|
| 77 |
AC_PROG_LIBTOOL |
|---|
| 78 |
AC_CHECK_TOOL([AR], [ar], :) |
|---|
| 79 |
AC_CHECK_TOOL([NM], [nm], :) |
|---|
| 80 |
AC_PATH_PROG([SED], [sed], :) |
|---|
| 81 |
AC_PATH_PROG([SORT], [sort], :) |
|---|
| 82 |
|
|---|
| 83 |
# Required for building the documentation |
|---|
| 84 |
|
|---|
| 85 |
# Checks for libraries. |
|---|
| 86 |
AC_PROG_LIBTOOL |
|---|
| 87 |
|
|---|
| 88 |
# Checks for typedefs, structures, and compiler characteristics. |
|---|
| 89 |
AC_CANONICAL_HOST |
|---|
| 90 |
AC_C_CONST |
|---|
| 91 |
AC_C_VOLATILE |
|---|
| 92 |
AC_TYPE_SIZE_T |
|---|
| 93 |
|
|---|
| 94 |
# XXX Debian specific hack: |
|---|
| 95 |
# by Marcelo Magallon <mmagallo@efis.ucr.ac.cr> |
|---|
| 96 |
# Turn around -rpath problem with libtool 1.0c |
|---|
| 97 |
# This define should be improbable enough to not conflict with anything |
|---|
| 98 |
case ${host} in |
|---|
| 99 |
*-pc-linux-gnu) |
|---|
| 100 |
AC_MSG_RESULT([Fixing libtool for -rpath problems.]) |
|---|
| 101 |
sed < libtool > libtool-2 \ |
|---|
| 102 |
's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' |
|---|
| 103 |
mv libtool-2 libtool |
|---|
| 104 |
chmod 755 libtool |
|---|
| 105 |
;; |
|---|
| 106 |
esac |
|---|
| 107 |
|
|---|
| 108 |
AC_CHECK_LIB(pthread, pthread_create,, |
|---|
| 109 |
[ |
|---|
| 110 |
AC_ERROR(You need the pthread library to compile freebob) |
|---|
| 111 |
]) |
|---|
| 112 |
|
|---|
| 113 |
# Check for dependencies |
|---|
| 114 |
PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 1.2.1) |
|---|
| 115 |
PKG_CHECK_MODULES(LIBIEC61883, libiec61883 >= 1.1.0) |
|---|
| 116 |
PKG_CHECK_MODULES(LIBAVC1394, libavc1394 >= 0.5.3) |
|---|
| 117 |
PKG_CHECK_MODULES(ALSA, alsa >= 1.0.0) |
|---|
| 118 |
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.6.0) |
|---|
| 119 |
|
|---|
| 120 |
# Setup CFLAGS and CXXFLAGS |
|---|
| 121 |
AC_ARG_ENABLE(debug, |
|---|
| 122 |
[ --enable-debug Turn on debugging], |
|---|
| 123 |
[case "${enableval}" in |
|---|
| 124 |
yes) debug=true;; |
|---|
| 125 |
no) ;; |
|---|
| 126 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; |
|---|
| 127 |
esac],[debug=false]) |
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
dnl Check for MMX assembly |
|---|
| 131 |
|
|---|
| 132 |
AC_ARG_ENABLE(mmx, |
|---|
| 133 |
[ --enable-mmx enable MMX support (default=auto)],, |
|---|
| 134 |
enable_mmx=yes) |
|---|
| 135 |
|
|---|
| 136 |
AC_ARG_ENABLE(sse, |
|---|
| 137 |
[ --enable-sse enable SSE support (default=auto)],, |
|---|
| 138 |
enable_sse=$enable_mmx) |
|---|
| 139 |
|
|---|
| 140 |
if test "x$enable_mmx" = xyes; then |
|---|
| 141 |
|
|---|
| 142 |
AC_MSG_CHECKING(whether we can compile MMX code) |
|---|
| 143 |
|
|---|
| 144 |
AC_COMPILE_IFELSE([asm ("movq 0, %mm0");], |
|---|
| 145 |
|
|---|
| 146 |
AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.]) |
|---|
| 147 |
AC_MSG_RESULT(yes) |
|---|
| 148 |
MMX_FLAGS="-mmmx -DENABLE_MMX" |
|---|
| 149 |
|
|---|
| 150 |
if test "x$enable_sse" = xyes; then |
|---|
| 151 |
|
|---|
| 152 |
AC_MSG_CHECKING(whether we can compile SSE code) |
|---|
| 153 |
|
|---|
| 154 |
AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");], |
|---|
| 155 |
AC_DEFINE(USE_SSE, 1, |
|---|
| 156 |
[Define to 1 if SSE assembly is available.]) |
|---|
| 157 |
SSE_FLAGS="-msse -mfpmath=sse -DENABLE_SSE" |
|---|
| 158 |
AC_MSG_RESULT(yes) |
|---|
| 159 |
, |
|---|
| 160 |
enable_sse=no |
|---|
| 161 |
AC_MSG_RESULT(no) |
|---|
| 162 |
AC_MSG_WARN( |
|---|
| 163 |
[The assembler does not support the SSE command set.] |
|---|
| 164 |
) |
|---|
| 165 |
) |
|---|
| 166 |
|
|---|
| 167 |
fi |
|---|
| 168 |
, |
|---|
| 169 |
enable_mmx=no |
|---|
| 170 |
AC_MSG_RESULT(no) |
|---|
| 171 |
AC_MSG_WARN([The assembler does not support the MMX command set.]) |
|---|
| 172 |
) |
|---|
| 173 |
fi |
|---|
| 174 |
|
|---|
| 175 |
AC_DEFINE(x86, 1, "Nope it's intel") |
|---|
| 176 |
COMMON_X86_OPT_FLAGS="-DREENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops" |
|---|
| 177 |
|
|---|
| 178 |
if test "$target_cpu" = "i586"; then |
|---|
| 179 |
FREEBOB_OPT_CFLAGS="-march=i586 " |
|---|
| 180 |
elif test "$target_cpu" = "i686"; then |
|---|
| 181 |
FREEBOB_OPT_CFLAGS="-march=i686" |
|---|
| 182 |
else |
|---|
| 183 |
: |
|---|
| 184 |
fi |
|---|
| 185 |
|
|---|
| 186 |
FREEBOB_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS $FREEBOB_OPT_CFLAGS $MMX_FLAGS $SSE_FLAGS" |
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
AC_ARG_ENABLE(optimize, |
|---|
| 190 |
AC_HELP_STRING([--enable-optimize], |
|---|
| 191 |
[ask the compiler for its best optimizations]), |
|---|
| 192 |
[ if test x$enable_optimize != xno ; then |
|---|
| 193 |
CFLAGS="$CFLAGS $FREEBOB_OPT_CFLAGS" ; |
|---|
| 194 |
CXXFLAGS="$CXXFLAGS $FREEBOB_OPT_CFLAGS" |
|---|
| 195 |
fi |
|---|
| 196 |
] |
|---|
| 197 |
) |
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
CFLAGS="$CFLAGS -Wall -std=gnu99" |
|---|
| 201 |
CXXFLAGS="$CXXFLAGS -Wall" |
|---|
| 202 |
|
|---|
| 203 |
if test "${debug}" = true; then |
|---|
| 204 |
CFLAGS="$CFLAGS -g -DDEBUG" |
|---|
| 205 |
CXXFLAGS="$CXXFLAGS -g -DDEBUG" |
|---|
| 206 |
else |
|---|
| 207 |
CFLAGS="$CFLAGS -O2" |
|---|
| 208 |
CXXFLAGS="$CXXFLAGS -O2" |
|---|
| 209 |
fi; |
|---|
| 210 |
|
|---|
| 211 |
AC_SUBST([CFLAGS]) |
|---|
| 212 |
AC_SUBST([CXXFLAGS]) |
|---|
| 213 |
|
|---|
| 214 |
# Configure components. |
|---|
| 215 |
AC_ENABLE_STATIC(yes) |
|---|
| 216 |
AC_ENABLE_SHARED(yes) |
|---|
| 217 |
|
|---|
| 218 |
AC_SUBST([LIBSIGC_CFLAGS]) |
|---|
| 219 |
AC_SUBST([LIBSIGC_LIBS]) |
|---|
| 220 |
AC_SUBST([ALSA_CFLAGS]) |
|---|
| 221 |
AC_SUBST([ALSA_LIBS]) |
|---|
| 222 |
AC_SUBST([LIBRAW1394_CFLAGS]) |
|---|
| 223 |
AC_SUBST([LIBRAW1394_LIBS]) |
|---|
| 224 |
AC_SUBST([LIBIEC61883_CFLAGS]) |
|---|
| 225 |
AC_SUBST([LIBIEC61883_LIBS]) |
|---|
| 226 |
AC_SUBST([LIBAVC1394_CFLAGS]) |
|---|
| 227 |
AC_SUBST([LIBAVC1394_LIBS]) |
|---|
| 228 |
AC_SUBST([LIBXML_LIBS]) |
|---|
| 229 |
AC_SUBST([LIBXML_CFLAGS]) |
|---|
| 230 |
|
|---|
| 231 |
AC_CONFIG_FILES([Makefile |
|---|
| 232 |
libfreebob/Makefile |
|---|
| 233 |
src/debugmodule/Makefile |
|---|
| 234 |
src/libfreebobavc/Makefile |
|---|
| 235 |
src/libfreebobstreaming/Makefile |
|---|
| 236 |
src/Makefile |
|---|
| 237 |
tests/Makefile |
|---|
| 238 |
tests/streaming/Makefile |
|---|
| 239 |
libfreebob.pc]) |
|---|
| 240 |
|
|---|
| 241 |
AC_OUTPUT |
|---|
| 242 |
|
|---|
| 243 |
# Print a summary so that important information isn't missed. |
|---|
| 244 |
AC_MSG_RESULT([ |
|---|
| 245 |
|
|---|
| 246 |
FreeBob $VERSION is now configured for $canonical_host_type |
|---|
| 247 |
|
|---|
| 248 |
Source directory: $srcdir |
|---|
| 249 |
Installation prefix: $prefix |
|---|
| 250 |
C++ compiler: $CXX $CXXFLAGS |
|---|
| 251 |
|
|---|
| 252 |
libraw1394 CFLAGS: $LIBRAW1394_CFLAGS |
|---|
| 253 |
libraw1394 LIBS: $LIBRAW1394_LIBS |
|---|
| 254 |
libiec61883 CFLAGS: $LIBIEC61883_CFLAGS |
|---|
| 255 |
libiec61883 LIBS: $LIBIEC61883_LIBS |
|---|
| 256 |
libavc1394 CFLAGS: $LIBAVC1394_CFLAGS |
|---|
| 257 |
libavc1394 LIBS: $LIBAVC1394_LIBS |
|---|
| 258 |
]) |
|---|