1 dnl Process this file with autoreconf to produce a configure script.
3 AC_INIT([libgphoto2 port access library], [0.8.0], [gphoto-devel@lists.sourceforge.net], [libgphoto2_port])
4 AC_CONFIG_SRCDIR([libgphoto2_port/gphoto2-port-version.c])
5 AC_CONFIG_HEADERS([config.h])
6 AC_CONFIG_MACRO_DIR([auto-m4])
7 AC_CONFIG_AUX_DIR([auto-aux])
8 dnl Working around bug in automake <= 1.9.6:
9 dnl - Please do not add filename-length-max=99 here.
10 dnl - Otherwise "make distdir" will fail in libgphoto2
11 dnl The generated Makefile rule fails to remove the absolute part at
12 dnl the beginning of the /path/to/buildroot/PACKAGE-VERSION/foo/bar
13 dnl before determining the string length. However, the only relevant
14 dnl string to determine the length of would be PACKAGE-VERSION/foo/bar
15 AM_INIT_AUTOMAKE([-Wall gnu 1.9 dist-bzip2 check-news])
18 dnl ---------------------------------------------------------------------------
19 dnl Advanced information about versioning:
20 dnl * "Writing shared libraries" by Mike Hearn
21 dnl http://navi.cx/~mike/writing-shared-libraries.html
22 dnl * libtool.info chapter "Versioning"
23 dnl * libtool.info chapter "Updating library version information"
24 dnl ---------------------------------------------------------------------------
26 dnl - CURRENT (Major): Increment if the interface has changes. AGE is always
27 dnl *changed* at the same time.
28 dnl - AGE (Micro): Increment if any interfaces have been added; set to 0
29 dnl if any interfaces have been removed. Removal has
30 dnl precedence over adding, so set to 0 if both happened.
31 dnl It denotes upward compatibility.
32 dnl - REVISION (Minor): Increment any time the source changes; set to
33 dnl 0 if you incremented CURRENT.
35 dnl To summarize. Any interface *change* increment CURRENT. If that interface
36 dnl change does not break upward compatibility (ie it is an addition),
37 dnl increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
38 dnl REVISION is set to 0, otherwise REVISION is incremented.
39 dnl ---------------------------------------------------------------------------
40 dnl A:R:C=6:1:6 libgphoto2_port-0.6.1 libgphoto2-2.2.1
41 dnl A:R:C=7:0:7 libgphoto2_port-0.7.0 libgphoto2-2.3
42 dnl A:R:C=7:1:7 libgphoto2_port-0.7.1 libgphoto2-2.3.x
43 dnl A:R:C=8:0:8 libgphoto2_port-0.8.0 libgphoto2-2.4.x
44 AC_SUBST([LIBGPHOTO2_PORT_AGE], [8])
45 AC_SUBST([LIBGPHOTO2_PORT_REVISION], [0])
46 AC_SUBST([LIBGPHOTO2_PORT_CURRENT], [8])
47 AC_SUBST([LIBGPHOTO2_PORT_CURRENT_MIN],
48 [`expr $LIBGPHOTO2_PORT_CURRENT - $LIBGPHOTO2_PORT_AGE`])
49 AC_SUBST([LIBGPHOTO2_PORT_VERSION_INFO],
50 [$LIBGPHOTO2_PORT_CURRENT:$LIBGPHOTO2_PORT_REVISION:$LIBGPHOTO2_PORT_AGE])
53 dnl ---------------------------------------------------------------------------
54 dnl Checks for programs.
55 dnl ---------------------------------------------------------------------------
61 dnl Something with the sequences is not quite alright yet.
62 dnl SED is supposed to be set in AC_LIBTOOL_SETUP, but the
63 dnl sequence seems to get mixed up.
66 dnl check for/set up libtool and libltdl
69 dnl AC_LIBLTDL_CONVENIENCE([libltdl])
77 dnl We are using our own libltdl checks instead of AC_WITH_LTDL
78 dnl because we do not want to ship our own copy of libltdl any more.
79 dnl Not shipping libltdl makes it possible to ditch our own autogen.sh
80 dnl and relying on standard autoconf's "autoreconf".
83 # report on compiler/libtool setup
84 GP_CONFIG_MSG([Build])
85 GP_CONFIG_MSG([Source directory],[${srcdir}])
86 GP_CONFIG_MSG([Compiler],[${CC}])
87 #GP_CONFIG_MSG([libltdl includes],[$LTDLINCL])
88 #GP_CONFIG_MSG([libltdl library],[$LIBLTDL])
90 AC_DEFINE_UNQUOTED(HAVE_CC,"$CC",[The C compiler we're using])
92 AM_CPPFLAGS="$CPPFLAGS"
93 AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)"
95 # ----------------------------------------------------------------------
96 # References to external resources (web sites, mailing listes, etc.)
97 # ----------------------------------------------------------------------
102 dnl ---------------------------------------------------------------------------
104 dnl ---------------------------------------------------------------------------
106 dnl The following is a hack to get gphoto2 to build on gettext-0.10.35
107 dnl systems - BUILD_INCLUDED_LIBINTL is set only in gettext-0.10.37 which is
108 dnl the gettext version provided with gphoto2.
109 dnl BUILD_INCLUDED_LIBINTL=no
110 dnl AC_SUBST(BUILD_INCLUDED_LIBINTL)
111 dnl USE_INCLUDED_LIBINTL=no
112 dnl AC_SUBST(USE_INCLUDED_LIBINTL)
114 GP_GETTEXT_HACK([${PACKAGE}-${LIBGPHOTO2_PORT_CURRENT_MIN}],[Lutz Mueller and others],[${MAIL_GPHOTO_TRANSLATION}])
115 ALL_LINGUAS="cs da de fr es eu it ja nl pl pt_BR ru sk sv uk vi zh_CN zh_TW"
116 AM_GNU_GETTEXT_VERSION([0.14.1])
117 AM_GNU_GETTEXT([external])
122 AC_SUBST([localedir],["\$(datadir)/locale"])
123 AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\""
125 AC_CHECK_FUNC(gettext, gettext_without_libintl=true)
126 # same trick as with libdl in libgphoto2:
127 # if gettext() doesn't require linking against libintl,
128 # we don't have to check for gettext in libintl. Otherwise
129 # we may even require libintl.
130 dnl AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"])
131 if test "$gettext_without_libintl" != "true" -a "$USE_NLS" = "yes"; then
132 AC_CHECK_LIB(intl, gettext, [INTLLIBS="$INTLLIBS -lintl"])
136 dnl ---------------------------------------------------------------------------
137 dnl Checks for header files.
138 dnl ---------------------------------------------------------------------------
145 AC_CHECK_HEADERS(stdlib.h unistd.h stdio.h fcntl.h errno.h sys/time.h \
146 sys/param.h sys/select.h termios.h sgetty.h ttold.h ioctl-types.h \
147 fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h unistd.h \
148 endian.h byteswap.h asm/io.h mntent.h sys/mntent.h sys/mnttab.h \
151 dnl FIXME: Provide regex.h with the corresponding object code for
152 dnl platforms which do not have it, e.g. Windows.
153 AC_CHECK_HEADER([regex.h],
154 [AC_DEFINE([HAVE_REGEX],1,[whether we have regex.h])],
156 *** We need regex.h and its object code to compile
157 *** But we could not find it.
161 dnl ---------------------------------------------------------------------------
162 dnl Apple Bonjour / mDNSResponder multicast DNS queries.
163 dnl ---------------------------------------------------------------------------
165 AC_ARG_WITH([bonjour],
166 AS_HELP_STRING([--without-bonjour], [whether to exclude Bonjour PTP/IP autodetection]),
172 if test "x$with_bonjour" = "xyes"; then
173 AC_CHECK_HEADER([dns_sd.h],[
174 AC_CHECK_LIB(dns_sd,DNSServiceResolve,[
176 AC_DEFINE(HAVE_MDNS_BONJOUR,1,[Define if you have Bonjour/mDNSResponder.])
182 dnl Check for mnt_mountp in struct mnttab
183 AC_MSG_CHECKING([for mnt_mountp in struct mnttab])
184 AC_COMPILE_IFELSE([dnl
186 #if defined(HAVE_SYS_MNTENT_H) && defined(HAVE_SYS_MNTTAB_H)
187 # include <sys/mntent.h>
188 # include <sys/mnttab.h>
195 AC_DEFINE(HAVE_MNTTAB,1,whether struct mnttag has mnt_mountp field)
204 dnl Checks for library functions.
205 AC_CHECK_FUNCS(setmntent endmntent strerror snprintf vsnprintf)
207 dnl Check if TIOCM_RTS is included in one of several possible files
208 AC_TRY_COMPILE([#include <termios.h>], [int foo = TIOCM_RTS;],
209 AC_DEFINE(HAVE_RTS_IOCTL,1,[Define if you have TIOCM_RTS.]))
210 AC_TRY_COMPILE([#include <termio.h>], [int foo = TIOCM_RTS;],
211 AC_DEFINE(HAVE_RTS_IOCTL,1,[Define if you have TIOCM_RTS.]))
212 AC_TRY_COMPILE([#include <ioctl-types.h>], [int foo = TIOCM_RTS;],
213 AC_DEFINE(HAVE_RTS_IOCTL,1,[Define if you have TIOCM_TRS.]))
214 AC_TRY_COMPILE([#include <sys/ioctl.h>], [int foo = TIOCM_RTS;],
215 AC_DEFINE(HAVE_RTS_IOCTL,1,[Define if you have TIOCM_TRS.]))
217 # Check for va_copy()
221 dnl ---------------------------------------------------------------------------
223 dnl ---------------------------------------------------------------------------
230 AC_ARG_ENABLE([serial],
231 [AS_HELP_STRING([--disable-serial],
232 [do not compile in SERIAL support])],
234 if test x$enableval = xno; then
243 if $have_serial; then
244 IOLIB_SUBDIRS="$IOLIB_SUBDIRS serial"
245 AC_DEFINE([HAVE_SERIAL],1,[Whether you have serial support enabled])
247 GP_CONFIG_MSG([Serial ports])
248 GP_CONFIG_MSG([Serial support],[$serial_msg])
251 if $have_serial; then
253 dnl -----------------------------------------
254 dnl Serial port locking: We try to use either
255 dnl (1) resmgr support
259 dnl -----------------------------------------
260 AC_DEFUN([GP_SERLOCK],[dnl
263 [AS_HELP_STRING([--disable-][$1],
264 [do not use ][$1][ library])
266 if test x$enableval = xno; then
271 GP_SERLOCK([baudboy])dnl
272 GP_SERLOCK([ttylock])dnl
273 GP_SERLOCK([lockdev])dnl
274 GP_SERLOCK([resmgr])dnl
278 AC_CHECK_HEADER(resmgr.h,[
279 AC_CHECK_LIB(resmgr, rsm_lock_device,[
281 SERIAL_LIBS="-lresmgr"
282 AC_DEFINE(HAVE_RESMGR,1,[Define if we have the resmgr library.])
286 GP_CONFIG_MSG([resmgr locking],[${resmgr_msg}])
289 if $try_baudboy; then
290 AC_CHECK_HEADER(baudboy.h,[
294 AC_DEFINE(HAVE_BAUDBOY,1,[Define if you have Baudboy serial locking.])
297 GP_CONFIG_MSG([baudboy locking],[${baudboy_msg}])
300 if $try_ttylock; then
301 AC_CHECK_HEADER([lockdev.h])
302 AC_CHECK_HEADER([ttylock.h],[
304 AC_TRY_LINK([#include <ttylock.h>],[ttylocked ("/dev/foo");],[
306 AC_DEFINE(HAVE_TTYLOCK,1,[Define if you have ttylock based tty locking.])
309 LDFLAGS="$LDFLAGS -llockdev"
310 AC_TRY_LINK([#include <ttylock.h>],[ttylocked ("/dev/foo");],[
312 AC_DEFINE(HAVE_TTYLOCK,1,[Define if you have ttylock based tty locking.])
315 SERIAL_LIBS=-llockdev
318 AC_MSG_CHECKING([if ttylock needs lockdev])
319 AC_MSG_RESULT([${lockdev_result}])
320 ],[],[#ifdef HAVE_LOCKDEV_H
321 # include <lockdev.h>
325 GP_CONFIG_MSG([ttylock locking],[${ttylock_msg}])
328 if $try_lockdev; then
329 AC_CHECK_LIB(lockdev, dev_lock,[
330 AC_CHECK_HEADER(lockdev.h,[
331 AC_DEFINE(HAVE_LOCKDEV,1,[Define if you have dev_lock/lockdev based locking.])
333 SERIAL_LIBS=-llockdev
337 GP_CONFIG_MSG([lockdev locking],[${lockdev_msg}])
341 AC_SUBST([SERIAL_LIBS])
344 dnl ---------------------------------------------------------------------------
346 dnl ---------------------------------------------------------------------------
348 dnl libusb 1 links against libpthread, but is loaded too late.
349 dnl we need to load libpthread directly.
350 AC_CHECK_LIB(pthread, pthread_create)
352 GP_CONFIG_MSG([USB ports])
353 GP_CHECK_LIBRARY([LIBUSB],[libusb],[>= 0.1.4],
355 IOLIB_SUBDIRS="$IOLIB_SUBDIRS usb usbdiskdirect usbscsi"
357 [disable-explicitly],
358 [http://libusb.sourceforge.net/]
361 dnl depends on libusb's availability
362 GP_UDEV([test "x$have_LIBUSB" = xyes])
364 dnl ---------------------------------------------------------------------------
365 dnl disk - hal and various stuff
366 dnl ---------------------------------------------------------------------------
368 AS_HELP_STRING([--with-hal], [whether to enable HAL disk autodetection [default=yes]]),
371 if test "x$with_hal" = "xyes"; then
373 PKG_CHECK_MODULES(HAL, [dbus-1 >= 0.31 hal >= 0.5.0],
376 if test "x$have_hal" = "xtrue"; then
379 AC_DEFINE(HAVE_HAL,1,[defined if HAL is available])
383 AC_ARG_ENABLE([disk],
384 AS_HELP_STRING([--disable-disk], [enable the 'disk' port driver]),
387 dnl ---------------------------------------------------------------------------
388 dnl disk port also work everywhere, but its not really necessary
389 dnl ---------------------------------------------------------------------------
390 if test "x$enable_disk" = "xyes"; then
391 IOLIB_SUBDIRS="$IOLIB_SUBDIRS disk"
394 dnl ---------------------------------------------------------------------------
395 dnl ptpip - works 'everywhere' with TCP/IP stack.
396 dnl number of supported cameras is however very small.
397 dnl ---------------------------------------------------------------------------
398 AC_ARG_ENABLE([ptpip],
399 AS_HELP_STRING([--disable-ptpip], [enable the 'ptpip' port driver for TCP/IP connected PTP cameras]),
401 if test "x$enable_ptpip" = "xyes"; then
402 IOLIB_SUBDIRS="$IOLIB_SUBDIRS ptpip"
406 # ----------------------------------------------------------------------
408 # ----------------------------------------------------------------------
410 AC_SUBST(IOLIB_SUBDIRS)
411 AC_SUBST([iolibdir],["\$(libdir)/\$(PACKAGE_TARNAME)/\$(VERSION)"])
412 AM_CPPFLAGS="$AM_CPPFLAGS -DIOLIBS=\\\"${iolibdir}\\\""
415 dnl --------------------------------------------------------------------
416 dnl guess directory to install *.pc into
417 dnl --------------------------------------------------------------------
418 pkgconfigdir='${libdir}/pkgconfig'
419 AC_SUBST([pkgconfigdir])
422 dnl ----------------------------------------------------------------------
424 dnl ----------------------------------------------------------------------
425 AC_CHECK_FUNC(re_compile_pattern,
426 AC_DEFINE(HAVE_GNU_REGEX,1,[Define if you have GNU regex.])
430 dnl ----------------------------------------------------------------------
431 dnl disable debugging if requested
432 dnl ----------------------------------------------------------------------
433 AC_ARG_ENABLE([debug],
434 AS_HELP_STRING([--disable-debug],[do not include debugging code]),
436 if test "$enableval" = "no"; then
437 AC_DEFINE(DISABLE_DEBUGGING,1,[Define if you want to disabled debugging.])
442 # ----------------------------------------------------------------------
444 # ----------------------------------------------------------------------
445 GP_CONFIG_MSG([Documentation])
446 GP_CHECK_DOC_DIR()dnl
447 GP_BUILD_GTK_DOCS()dnl
450 # Make sure that the *FLAGS given at ./configure time will be active by
451 # default in AM_*FLAGS
452 AM_CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
453 AM_CFLAGS="$AM_CFLAGS $CFLAGS"
454 AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
455 AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
457 dnl ---------------------------------------------------------------------------
458 dnl Turn on all warnings when using gcc
459 dnl ---------------------------------------------------------------------------
460 if test "$GCC" = "yes"; then
461 AM_CPPFLAGS="$AM_CPPFLAGS -Wall"
462 AM_CPPFLAGS="$AM_CPPFLAGS -Wmissing-declarations -Wmissing-prototypes"
463 AM_LDFLAGS="$AM_LDFLAGS -Wall"
464 # FIXME: Check for --enable-debug here
465 AM_CPPFLAGS="$AM_CPPFLAGS -g"
466 AM_LDFLAGS="$AM_LDFLAGS -g"
469 # Activate internal code
470 AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_INTERNAL_CODE"
472 # Activate Samsung patch
473 AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_SAMSUNG_PATCH_"
475 # CPPFLAGS: C PreProcessor flags
476 AC_SUBST([AM_CPPFLAGS])
477 # CFLAGS: C compiler flags
478 AC_SUBST([AM_CFLAGS])
479 # CXXFLAGS: C++ compiler flags
480 AC_SUBST([AM_CXXFLAGS])
481 # LDFLAGS: Linker flags
482 AC_SUBST([AM_LDFLAGS])
485 # ---------------------------------------------------------------------------
486 # Create output files
487 # ---------------------------------------------------------------------------
491 libgphoto2_port/Makefile
493 libgphoto2_port-uninstalled.pc
496 usbdiskdirect/Makefile