blob: 0e5398efb547fa01061a1543afc1b8c6a3cc1804 [file] [log] [blame]
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00001# Process this file with autoconf to produce a configure script.
2AC_PREREQ(2.52)
alistair_boyle5e5fcb72008-11-17 14:38:19 +00003AC_INIT([libmtp], [0.3.5], [libmtp-discuss@lists.sourceforge.net])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00004AM_INIT_AUTOMAKE([foreign])
5AC_CONFIG_SRCDIR([src/libmtp.c])
Linus Walleij8609af32006-12-28 21:25:17 +00006AM_CONFIG_HEADER(config.h)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00007
8# This can be overridden by the command line switch
9if test "$program_prefix" = NONE; then
10 program_prefix=mtp-
11 program_transform_name="s,^,$program_prefix,;$program_transform_name"
12fi
13
14# Checks for programs.
15AC_PROG_CC
16AC_PROG_INSTALL
17AC_PROG_LN_S
18AC_LIBTOOL_WIN32_DLL
19AC_PROG_LIBTOOL
20# Check for doxygen
21AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
22AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
23if test $HAVE_DOXYGEN = "false"; then
24 AC_MSG_WARN([*** doxygen not found, docs will not be built])
25fi
26
27# Check for Darwin
28AC_MSG_CHECKING([if the host operating system is Darwin])
29case "$host" in
30 *-darwin*)
31 AC_MSG_RESULT([yes])
32 CFLAGS="$CFLAGS -DUSE_DARWIN"
33 OSFLAGS="-framework IOKit"
34 ;;
35 *) AC_MSG_RESULT([no]) ;;
36esac
37AC_SUBST(OSFLAGS)
38
39# Check for mingw compiler platform
40AC_MSG_CHECKING([For MinGW32])
41case "$host" in
42 *-*-mingw*)
43 AC_MSG_RESULT([yes])
44 mingw_compiler=yes
45 ;;
46 *) AC_MSG_RESULT([no]) ;;
47esac
48AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"])
49
50
51# Checks for libraries.
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000052AC_CHECK_LIB([usb], [usb_control_msg],,
53 AC_MSG_ERROR([I can't find the libusb libraries on your system. You
54 may need to set the LDFLAGS environment variable to include the
55 search path where you have libusb installed before running
56 configure (e.g. setenv LDFLAGS=-L/usr/local/lib)]), "$OSFLAGS")
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000057
58# Checks for header files.
59AC_HEADER_STDC
60AC_HEADER_TIME
61# zlib.h the day we need to decompress firmware
62AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \
Linus Walleij56c63952008-06-08 21:55:58 +000063 limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \
Linus Walleij8b8c8502008-08-18 19:58:36 +000064 iconv.h langinfo.h locale.h])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000065AC_CHECK_HEADER([usb.h],,
66 AC_MSG_ERROR([I can't find the libusb header file on your system.
67 You may need to set the CPPFLAGS environment variable to include
68 the search path where you have libusb installed before running
69 configure (e.g. setenv CPPFLAGS=-I/usr/local/include)]))
70
71# Checks for typedefs, structures, and compiler characteristics.
72AC_C_CONST
73AC_TYPE_OFF_T
74AC_TYPE_SIGNAL
75AC_TYPE_SIZE_T
76AC_STRUCT_ST_BLKSIZE
77
78# Checks for library functions.
79AC_FUNC_MALLOC
80AC_FUNC_MEMCMP
81AC_FUNC_STAT
82AC_CHECK_FUNCS(basename memset select strdup strerror strrchr strtoul usleep)
83
84# Switches.
Linus Walleij05358382007-08-06 20:46:35 +000085# Enable LFS (Large File Support)
86CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000087# Stick in "-Werror" if you want to be more aggressive.
88# (No need to use AC_SUBST on this default substituted environment variable.)
89CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
90
91# Output files
Linus Walleije8c54642006-03-28 09:45:00 +000092
93# Create a stdint.h-like file containing size-specific integer definitions
94# that will always be available. The <stdint.h> file is required by the
95# library, but we provide this anyway because the libptp2 stuff wants this
96# file.
Linus Walleij2a84ca42008-12-14 00:00:23 +000097AX_NEED_STDINT_H([src/_stdint.h])
Linus Walleij6fd2f082006-03-28 07:19:22 +000098
Linus Walleije8c54642006-03-28 09:45:00 +000099# Create a header file containing NetBSD-style byte swapping macros.
100# This m4 macros has caused severe pain, I am considering creating a
101# hard-coded byte swapper that will be eternally portable.
Linus Walleijb02a0662006-04-25 08:05:09 +0000102AC_NEED_BYTEORDER_H(src/gphoto2-endian.h)
Linus Walleij6fd2f082006-03-28 07:19:22 +0000103
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000104AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile
105 examples/Makefile libmtp.sh hotplug.sh libmtp.pc])
106AC_OUTPUT
Linus Walleij0f2e7732006-08-17 20:48:32 +0000107chmod +x hotplug.sh