blob: ddb729e6658d411e7659609b44b643f9b906bab5 [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 Walleije66d2742010-05-22 23:08:26 +00003AC_INIT([libmtp], [1.0.3], [libmtp-discuss@lists.sourceforge.net])
Linus Walleijd4637502009-06-14 23:03:33 +00004AC_CONFIG_MACRO_DIR([m4])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00005AM_INIT_AUTOMAKE([foreign])
6AC_CONFIG_SRCDIR([src/libmtp.c])
Linus Walleij8609af32006-12-28 21:25:17 +00007AM_CONFIG_HEADER(config.h)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00008
9# This can be overridden by the command line switch
10if test "$program_prefix" = NONE; then
11 program_prefix=mtp-
12 program_transform_name="s,^,$program_prefix,;$program_transform_name"
13fi
14
15# Checks for programs.
16AC_PROG_CC
17AC_PROG_INSTALL
18AC_PROG_LN_S
19AC_LIBTOOL_WIN32_DLL
20AC_PROG_LIBTOOL
Linus Walleijd4637502009-06-14 23:03:33 +000021AM_ICONV
22
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000023# Check for doxygen
24AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
25AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
26if test $HAVE_DOXYGEN = "false"; then
27 AC_MSG_WARN([*** doxygen not found, docs will not be built])
28fi
29
30# Check for Darwin
31AC_MSG_CHECKING([if the host operating system is Darwin])
32case "$host" in
33 *-darwin*)
34 AC_MSG_RESULT([yes])
35 CFLAGS="$CFLAGS -DUSE_DARWIN"
36 OSFLAGS="-framework IOKit"
37 ;;
38 *) AC_MSG_RESULT([no]) ;;
39esac
40AC_SUBST(OSFLAGS)
41
42# Check for mingw compiler platform
43AC_MSG_CHECKING([For MinGW32])
44case "$host" in
45 *-*-mingw*)
46 AC_MSG_RESULT([yes])
47 mingw_compiler=yes
48 ;;
49 *) AC_MSG_RESULT([no]) ;;
50esac
51AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"])
52
Linus Walleij6f050022009-05-06 21:14:41 +000053# Check if Microsoft LIB.EXE is available
54if test "$mingw_compiler" = "yes"; then
55 AC_CHECK_PROG(ms_lib_exe, lib.exe, yes, no)
56fi
57AM_CONDITIONAL(MS_LIB_EXE, test x$ms_lib_exe = xyes)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000058
59# Checks for libraries.
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000060AC_CHECK_LIB([usb], [usb_control_msg],,
61 AC_MSG_ERROR([I can't find the libusb libraries on your system. You
62 may need to set the LDFLAGS environment variable to include the
63 search path where you have libusb installed before running
64 configure (e.g. setenv LDFLAGS=-L/usr/local/lib)]), "$OSFLAGS")
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000065
66# Checks for header files.
67AC_HEADER_STDC
68AC_HEADER_TIME
69# zlib.h the day we need to decompress firmware
70AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \
Linus Walleij56c63952008-06-08 21:55:58 +000071 limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \
Linus Walleij6f050022009-05-06 21:14:41 +000072 iconv.h langinfo.h locale.h arpa/inet.h byteswap.h sys/uio.h])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000073AC_CHECK_HEADER([usb.h],,
74 AC_MSG_ERROR([I can't find the libusb header file on your system.
75 You may need to set the CPPFLAGS environment variable to include
76 the search path where you have libusb installed before running
77 configure (e.g. setenv CPPFLAGS=-I/usr/local/include)]))
78
79# Checks for typedefs, structures, and compiler characteristics.
80AC_C_CONST
81AC_TYPE_OFF_T
82AC_TYPE_SIGNAL
83AC_TYPE_SIZE_T
84AC_STRUCT_ST_BLKSIZE
85
86# Checks for library functions.
87AC_FUNC_MALLOC
88AC_FUNC_MEMCMP
89AC_FUNC_STAT
Richard Low8d97bad2010-09-12 17:31:12 +000090AC_CHECK_FUNCS(basename memset select strdup strerror strndup strrchr strtoul usleep mkstemp)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000091
92# Switches.
Linus Walleij05358382007-08-06 20:46:35 +000093# Enable LFS (Large File Support)
Linus Walleij2f1b6402009-06-15 19:49:33 +000094AC_SYS_LARGEFILE
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000095# Stick in "-Werror" if you want to be more aggressive.
96# (No need to use AC_SUBST on this default substituted environment variable.)
97CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
98
99# Output files
Linus Walleije8c54642006-03-28 09:45:00 +0000100
101# Create a stdint.h-like file containing size-specific integer definitions
102# that will always be available. The <stdint.h> file is required by the
103# library, but we provide this anyway because the libptp2 stuff wants this
104# file.
Linus Walleij2a84ca42008-12-14 00:00:23 +0000105AX_NEED_STDINT_H([src/_stdint.h])
Linus Walleij6fd2f082006-03-28 07:19:22 +0000106
Linus Walleije8c54642006-03-28 09:45:00 +0000107# Create a header file containing NetBSD-style byte swapping macros.
108# This m4 macros has caused severe pain, I am considering creating a
109# hard-coded byte swapper that will be eternally portable.
Linus Walleijb02a0662006-04-25 08:05:09 +0000110AC_NEED_BYTEORDER_H(src/gphoto2-endian.h)
Linus Walleij6fd2f082006-03-28 07:19:22 +0000111
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000112AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile
Linus Walleij6d3c2222010-11-30 23:42:32 +0000113 examples/Makefile util/Makefile libmtp.sh hotplug.sh libmtp.pc])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000114AC_OUTPUT
Linus Walleij0f2e7732006-08-17 20:48:32 +0000115chmod +x hotplug.sh