blob: 2b3d4bef8ffe5d09a5675dea3084d17f324d2ba2 [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)
Linus Walleij2978f1a2006-11-30 14:00:26 +00003AC_INIT([libmtp], [0.1.0], [libmtp-users@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 Walleij16571dc2006-08-17 20:27:46 +000063 limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h iconv.h])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000064AC_CHECK_HEADER([usb.h],,
65 AC_MSG_ERROR([I can't find the libusb header file on your system.
66 You may need to set the CPPFLAGS environment variable to include
67 the search path where you have libusb installed before running
68 configure (e.g. setenv CPPFLAGS=-I/usr/local/include)]))
69
70# Checks for typedefs, structures, and compiler characteristics.
71AC_C_CONST
72AC_TYPE_OFF_T
73AC_TYPE_SIGNAL
74AC_TYPE_SIZE_T
75AC_STRUCT_ST_BLKSIZE
76
77# Checks for library functions.
78AC_FUNC_MALLOC
79AC_FUNC_MEMCMP
80AC_FUNC_STAT
81AC_CHECK_FUNCS(basename memset select strdup strerror strrchr strtoul usleep)
82
83# Switches.
84# Stick in "-Werror" if you want to be more aggressive.
85# (No need to use AC_SUBST on this default substituted environment variable.)
86CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
87
88# Output files
Linus Walleije8c54642006-03-28 09:45:00 +000089
90# Create a stdint.h-like file containing size-specific integer definitions
91# that will always be available. The <stdint.h> file is required by the
92# library, but we provide this anyway because the libptp2 stuff wants this
93# file.
Linus Walleij6fd2f082006-03-28 07:19:22 +000094AX_NEED_STDINT_H([src/libptp-stdint.h])
95
Linus Walleije8c54642006-03-28 09:45:00 +000096# Create a header file containing NetBSD-style byte swapping macros.
97# This m4 macros has caused severe pain, I am considering creating a
98# hard-coded byte swapper that will be eternally portable.
Linus Walleijb02a0662006-04-25 08:05:09 +000099AC_NEED_BYTEORDER_H(src/gphoto2-endian.h)
Linus Walleij6fd2f082006-03-28 07:19:22 +0000100
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000101AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile
102 examples/Makefile libmtp.sh hotplug.sh libmtp.pc])
103AC_OUTPUT
Linus Walleij0f2e7732006-08-17 20:48:32 +0000104chmod +x hotplug.sh