summaryrefslogtreecommitdiff
path: root/configure.in
blob: b367c1509dc7a7a252c15db6cf075efd4d26b565 (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
126
127
128
dnl Process this file with autoconf to produce a configure script.

PACKAGE=gphoto
VERSION=2.0pre1
libdir=${prefix}/lib/gphoto2

AC_INIT(include/gphoto2.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gphoto, 2.0pre1)
AM_MAINTAINER_MODE

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL

dnl Solaris hack for grep and tr
if test -n "`echo $host_os | grep [sS]olaris`"; then
  TR=/usr/xpg4/bin/tr
  GREP=/usr/xpg4/bin/grep  
else
  TR=tr
  GREP=grep
fi

dnl Checks for libraries.
dnl Replace `main' with a function in -ldl:
AC_CHECK_LIB(dl, main)
dnl Replace `main' with a function in -libs:
AC_CHECK_LIB(ibs, main)

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T

dnl Checks for library functions.
AC_CHECK_FUNCS(mkdir strdup)

AC_PATH_PROG(LIBGPIO_CONFIG,gpio-config)
if test -n "${LIBGPIO_CONFIG}"; then
  CFLAGS="$CFLAGS `$LIBGPIO_CONFIG --cflags`"
  LIBS="$LIBS `$LIBGPIO_CONFIG --libs`"
else
  AC_MSG_ERROR([
***
*** libgpio is required. Available from gPhoto's SourceForge CVS.
*** Check http://www.gphoto.net/download.html for details.
***])
  exit 1
fi

LIBGPHOTO2_INCLUDEDIR='-I${includedir}'
LIBGPHOTO2_LIBDIR='-L${libdir}'
LIBGPHOTO2_LIBS="-lgphoto2"
LIBGPHOTO2_VERSION=$VERSION

AC_SUBST(LIBGPHOTO2_INCLUDEDIR)
AC_SUBST(LIBGPHOTO2_LIBDIR)
AC_SUBST(LIBGPHOTO2_LIBS)
AC_SUBST(LIBGPHOTO2_VERSION)

AC_SUBST(CFLAGS)
AC_SUBST(LIBS)

dnl Find out which drivers to compile
camlibs='barbie canon directory sierra konica panasonic digita sonydscf1'
AC_SUBST(SUBDIRS_CAMLIBS)
for i in $camlibs; do
  d=`echo $i | $TR a-z A-Z`
  eval "CONFIG_DRIVER_$d=n"
done
AC_MSG_CHECKING(which drivers to compile)
AC_ARG_WITH(drivers,
  [  --with-drivers=<list>     compile drivers in <list>; ]
  [                            drivers may be separated with commas; ]
  [                            'all' compiles all drivers; ]
  [                            possible drivers are: ]
  [                            barbie, canon, digita, directory, ]
  [                            sierra, konica, panasonic, sonydscf1 ],
  drivers="$withval", drivers="all")
if test "$drivers" = "all"; then
  for i in $camlibs; do
    d=`echo $i | $TR a-z A-Z`
    eval "CONFIG_DRIVER_$d=y"
    AC_DEFINE_UNQUOTED(CONFIG_DRIVER_$d)
    SUBDIRS_CAMLIBS="$SUBDIRS_CAMLIBS $i"
  done

  AC_MSG_RESULT(all)
else
  drivers=`echo $drivers | sed 's/,/ /g'`
  for driver in $drivers; do
    if test -n "`echo $camlibs | $GREP -E \"(^| )$driver( |\$)\"`"; then
      d=`echo $driver | $TR a-z A-Z`
      eval "CONFIG_DRIVER_$d=y"
      AC_DEFINE_UNQUOTED(CONFIG_DRIVER_$d)
      SUBDIRS_CAMLIBS="$SUBDIRS_CAMLIBS $driver"
    else
      echo "Unknown driver $driver, exiting!"
      exit 1
    fi
  done
  AC_MSG_RESULT($drivers)
fi

AC_OUTPUT(\
Makefile \
camlibs/Makefile \
camlibs/barbie/Makefile \
camlibs/sierra/Makefile \
camlibs/directory/Makefile \
camlibs/panasonic/Makefile \
camlibs/konica/Makefile \
camlibs/digita/Makefile \
camlibs/canon/Makefile \
camlibs/sonydscf1/Makefile \
camlibs/template/Makefile \
frontends/Makefile \
frontends/command-line/Makefile \
frontends/libgphoto2_frontend/Makefile \
include/Makefile \
libgphoto2/Makefile \
gphoto2-config \
)