blob: 725b371bd46991fddb9d5fc7307f8c9ce46ee716 [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 Walleij4096c882009-03-16 23:32:34 +00003AC_INIT([libmtp], [0.3.7], [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
Linus Walleij6f050022009-05-06 21:14:41 +000020AM_ICONV
21
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000022# Check for doxygen
23AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
24AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
25if test $HAVE_DOXYGEN = "false"; then
26 AC_MSG_WARN([*** doxygen not found, docs will not be built])
27fi
28
29# Check for Darwin
30AC_MSG_CHECKING([if the host operating system is Darwin])
31case "$host" in
32 *-darwin*)
33 AC_MSG_RESULT([yes])
34 CFLAGS="$CFLAGS -DUSE_DARWIN"
35 OSFLAGS="-framework IOKit"
36 ;;
37 *) AC_MSG_RESULT([no]) ;;
38esac
39AC_SUBST(OSFLAGS)
40
41# Check for mingw compiler platform
42AC_MSG_CHECKING([For MinGW32])
43case "$host" in
44 *-*-mingw*)
45 AC_MSG_RESULT([yes])
46 mingw_compiler=yes
47 ;;
48 *) AC_MSG_RESULT([no]) ;;
49esac
50AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"])
51
Linus Walleij6f050022009-05-06 21:14:41 +000052# Check if Microsoft LIB.EXE is available
53if test "$mingw_compiler" = "yes"; then
54 AC_CHECK_PROG(ms_lib_exe, lib.exe, yes, no)
55fi
56AM_CONDITIONAL(MS_LIB_EXE, test x$ms_lib_exe = xyes)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000057
58# Checks for libraries.
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000059AC_CHECK_LIB([usb], [usb_control_msg],,
60 AC_MSG_ERROR([I can't find the libusb libraries on your system. You
61 may need to set the LDFLAGS environment variable to include the
62 search path where you have libusb installed before running
63 configure (e.g. setenv LDFLAGS=-L/usr/local/lib)]), "$OSFLAGS")
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000064
65# Checks for header files.
66AC_HEADER_STDC
67AC_HEADER_TIME
68# zlib.h the day we need to decompress firmware
69AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \
Linus Walleij56c63952008-06-08 21:55:58 +000070 limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \
Linus Walleij6f050022009-05-06 21:14:41 +000071 iconv.h langinfo.h locale.h arpa/inet.h byteswap.h sys/uio.h])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000072AC_CHECK_HEADER([usb.h],,
73 AC_MSG_ERROR([I can't find the libusb header file on your system.
74 You may need to set the CPPFLAGS environment variable to include
75 the search path where you have libusb installed before running
76 configure (e.g. setenv CPPFLAGS=-I/usr/local/include)]))
77
78# Checks for typedefs, structures, and compiler characteristics.
79AC_C_CONST
80AC_TYPE_OFF_T
81AC_TYPE_SIGNAL
82AC_TYPE_SIZE_T
83AC_STRUCT_ST_BLKSIZE
84
85# Checks for library functions.
86AC_FUNC_MALLOC
87AC_FUNC_MEMCMP
88AC_FUNC_STAT
Linus Walleij6f050022009-05-06 21:14:41 +000089AC_CHECK_FUNCS(basename memset select strdup strerror strrchr strtoul usleep mkstemp)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000090
91# Switches.
Linus Walleij05358382007-08-06 20:46:35 +000092# Enable LFS (Large File Support)
93CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000094# Stick in "-Werror" if you want to be more aggressive.
95# (No need to use AC_SUBST on this default substituted environment variable.)
96CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
97
98# Output files
Linus Walleije8c54642006-03-28 09:45:00 +000099
100# Create a stdint.h-like file containing size-specific integer definitions
101# that will always be available. The <stdint.h> file is required by the
102# library, but we provide this anyway because the libptp2 stuff wants this
103# file.
Linus Walleij2a84ca42008-12-14 00:00:23 +0000104AX_NEED_STDINT_H([src/_stdint.h])
Linus Walleij6fd2f082006-03-28 07:19:22 +0000105
Linus Walleije8c54642006-03-28 09:45:00 +0000106# Create a header file containing NetBSD-style byte swapping macros.
107# This m4 macros has caused severe pain, I am considering creating a
108# hard-coded byte swapper that will be eternally portable.
Linus Walleijb02a0662006-04-25 08:05:09 +0000109AC_NEED_BYTEORDER_H(src/gphoto2-endian.h)
Linus Walleij6fd2f082006-03-28 07:19:22 +0000110
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000111AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile
112 examples/Makefile libmtp.sh hotplug.sh libmtp.pc])
113AC_OUTPUT
Linus Walleij0f2e7732006-08-17 20:48:32 +0000114chmod +x hotplug.sh