aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: e4e4f36854e898ddc5ef65c8e182ff5f65836b86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.65)
AC_INIT([pix-opencv],[0.2-rc6-svn],[lluisgomez@hangar.org],[pix-opencv-dev],[http://www.hangar.org/wikis/lab/doku.php?id=start:puredata_opencv])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
AC_DISABLE_OPTION_CHECKING

make clean

GEM_OPENCV_VERSION="0.2"
PD_DIR=/usr/local/pd
GEM_DIR=/usr/local/pd/gem
SOURCES_OPT=

echo $host
# Check for DarwinPorts and/or Fink on Mac OS X/Darwin
case "$host" in
  *-darwin* | *-macos10*)
     if test -d /sw ; then
       # Fink
       PATH="/sw/bin:/sw/sbin:$PATH"
       CFLAGS="$CFLAGS -I/sw/include"
       CPPFLAGS="$CPPFLAGS -I/sw/include"
       LDFLAGS="$LDFLAGS -L/sw/lib"
     elif test -d /opt/local ; then
       # DarwinPorts
       PATH="/opt/local/bin:/opt/local/sbin:$PATH"
       CFLAGS="$CFLAGS -I/opt/local/include"
       CPPFLAGS="$CPPFLAGS -I/opt/local/include"
       LDFLAGS="$LDFLAGS -L/opt/local/lib"
     fi
  ;;
esac

AC_ARG_WITH(pdsources, [  --with-pd=PATH          pd source tree])
if ! test -z "${with_pd}"
then
  pd_tree="`cd ${with_pd} 2>/dev/null && pwd`"
  if test -z "${pd_tree}"
  then
   dnl  The given directory can't be found
   AC_MSG_ERROR([pd sources not found in ${with_pd}])
  else
   PD_DIR=${pd_tree}
  fi
fi

AC_ARG_WITH(gemsources, [  --with-gem=PATH         gem source tree])
if ! test -z "${with_gem}"
then
  gem_tree="`cd ${with_gem} 2>/dev/null && pwd`"
  if test -z "${gem_tree}"
  then
   dnl  The given directory can't be found
   AC_MSG_ERROR([gem sources not found in ${with_gem}])
  else
   GEM_DIR=${gem_tree}
  fi
fi

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_SANITY_CHECK

AM_MAINTAINER_MODE
AM_WITH_DMALLOC

# Very basic check for OpenCV. This does not collect any compile flags; these
# are currently set in Makefile.in through pkg-config
# TODO: use a more robust and well-established OpenCV configure approach
AC_CHECK_LIB([cv], [cvSobel], [], [
  # try another lib name used in other versions of OpenCV
  AC_CHECK_LIB([opencv_imgproc], [cvSobel], [],
    [AC_MSG_ERROR([[missing a library from opencv try installing libcv]])
  ])
])

AC_CHECK_LIB([highgui], [cvNamedWindow], [], [
  AC_CHECK_LIB([opencv_highgui], [cvNamedWindow], [], [
    AC_MSG_ERROR([[missing a library from opencv, try installing libhighgui]])
  ])
])

AC_CHECK_LIB([cvaux], [cvSegmentImage], [], [
  AC_CHECK_LIB([opencv_legacy], [cvSegmentImage], [], [
    AC_MSG_ERROR([[missing a library from opencv try installing libcvaux]])
  ])
])

echo -n "looking for pd sources (required) ... "
if test -f $PD_DIR/src/m_pd.h
then
  AC_SUBST(PD_DIR)
  echo "ok." 
else
  echo "pd source tree not found... install it and use the --with-pd=<path> configuration option."
  exit -1
fi

echo -n "looking for gem sources (required) ... "
if test -f $GEM_DIR/src/Base/GemBase.h
then
  AC_SUBST(GEM_DIR)
  echo "ok." 
else
  echo "gem source tree not found... install it and use the --with-gem=<path> configuration option."
  exit -1
fi

AC_CHECK_LIB(cv, cvExtractSURF, SOURCES_OPT="pix_opencv_surf.cc",,-L/usr/local/lib)

AC_SUBST(GEM_OPENCV_VERSION)
AC_SUBST(PD_DIR)
AC_SUBST(GEM_DIR)
AC_SUBST(SOURCES_OPT)

AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT