blob: a9aef8727228eff831ee370cdb7c5b00fa7e4a71 [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 Walleij677e6652011-01-08 23:11:59 +00003AC_INIT([libmtp], [1.0.4], [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
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00009# Checks for programs.
10AC_PROG_CC
11AC_PROG_INSTALL
12AC_PROG_LN_S
13AC_LIBTOOL_WIN32_DLL
14AC_PROG_LIBTOOL
Linus Walleijd4637502009-06-14 23:03:33 +000015AM_ICONV
16
Linus Walleij925cd452010-12-05 21:26:48 +000017# For this library the default libexecdir is the udev
18# dir, because it's only used for the udev probe program
19# nothing else makes sense for this.
Linus Walleij1130ab52011-01-18 13:14:15 +010020libexecdir=/lib/udev
Linus Walleij925cd452010-12-05 21:26:48 +000021
Denis Dupeyronbc442cd2011-01-16 21:57:39 -070022# Optionally enable and check for doxygen
23AC_ARG_ENABLE([doxygen],
24 AS_HELP_STRING([--enable-doxygen], [Build API documentation using Doxygen]),
25 [ac_enable_doxygen=$enableval], [ac_enable_doxygen=auto])
26if test "x$ac_enable_doxygen" != "xno"; then
27 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
28 if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$ac_enable_doxygen" = "xyes"; then
29 AC_MSG_ERROR([*** API documentation explicitly requested but Doxygen not found])
30 fi
31 AC_MSG_NOTICE([API documentation will be generated using Doxygen])
32else
33 HAVE_DOXYGEN=false
34 AC_MSG_NOTICE([API documentation will not be generated])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000035fi
Denis Dupeyronbc442cd2011-01-16 21:57:39 -070036AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000037
38# Check for Darwin
39AC_MSG_CHECKING([if the host operating system is Darwin])
40case "$host" in
41 *-darwin*)
42 AC_MSG_RESULT([yes])
43 CFLAGS="$CFLAGS -DUSE_DARWIN"
44 OSFLAGS="-framework IOKit"
45 ;;
46 *) AC_MSG_RESULT([no]) ;;
47esac
48AC_SUBST(OSFLAGS)
49
Linus Walleij9e44f182010-12-07 20:33:13 +000050AC_MSG_CHECKING([if the host operating system is Linux])
51AC_TRY_COMPILE([#ifndef __linux__
52 #error "FAIL"
53 #endif
54 ],
55 [int test;],
56 [ AC_MSG_RESULT(yes)
57 AM_CONDITIONAL(USE_LINUX, true)
58 ],
59 [ AC_MSG_RESULT(no)
60 AM_CONDITIONAL(USE_LINUX, false)
61 ])
62
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000063# Check for mingw compiler platform
64AC_MSG_CHECKING([For MinGW32])
65case "$host" in
66 *-*-mingw*)
67 AC_MSG_RESULT([yes])
68 mingw_compiler=yes
69 ;;
70 *) AC_MSG_RESULT([no]) ;;
71esac
72AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"])
73
Linus Walleij6f050022009-05-06 21:14:41 +000074# Check if Microsoft LIB.EXE is available
75if test "$mingw_compiler" = "yes"; then
76 AC_CHECK_PROG(ms_lib_exe, lib.exe, yes, no)
77fi
78AM_CONDITIONAL(MS_LIB_EXE, test x$ms_lib_exe = xyes)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000079
80# Checks for libraries.
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000081AC_CHECK_LIB([usb], [usb_control_msg],,
82 AC_MSG_ERROR([I can't find the libusb libraries on your system. You
83 may need to set the LDFLAGS environment variable to include the
84 search path where you have libusb installed before running
85 configure (e.g. setenv LDFLAGS=-L/usr/local/lib)]), "$OSFLAGS")
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000086
87# Checks for header files.
88AC_HEADER_STDC
89AC_HEADER_TIME
90# zlib.h the day we need to decompress firmware
91AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \
Linus Walleij56c63952008-06-08 21:55:58 +000092 limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \
Linus Walleij6f050022009-05-06 21:14:41 +000093 iconv.h langinfo.h locale.h arpa/inet.h byteswap.h sys/uio.h])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000094AC_CHECK_HEADER([usb.h],,
95 AC_MSG_ERROR([I can't find the libusb header file on your system.
96 You may need to set the CPPFLAGS environment variable to include
97 the search path where you have libusb installed before running
98 configure (e.g. setenv CPPFLAGS=-I/usr/local/include)]))
99
100# Checks for typedefs, structures, and compiler characteristics.
101AC_C_CONST
102AC_TYPE_OFF_T
103AC_TYPE_SIGNAL
104AC_TYPE_SIZE_T
105AC_STRUCT_ST_BLKSIZE
106
107# Checks for library functions.
108AC_FUNC_MALLOC
109AC_FUNC_MEMCMP
110AC_FUNC_STAT
Richard Low8d97bad2010-09-12 17:31:12 +0000111AC_CHECK_FUNCS(basename memset select strdup strerror strndup strrchr strtoul usleep mkstemp)
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000112
113# Switches.
Linus Walleij05358382007-08-06 20:46:35 +0000114# Enable LFS (Large File Support)
Linus Walleij2f1b6402009-06-15 19:49:33 +0000115AC_SYS_LARGEFILE
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000116# Stick in "-Werror" if you want to be more aggressive.
117# (No need to use AC_SUBST on this default substituted environment variable.)
118CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
119
120# Output files
Linus Walleije8c54642006-03-28 09:45:00 +0000121
122# Create a stdint.h-like file containing size-specific integer definitions
123# that will always be available. The <stdint.h> file is required by the
124# library, but we provide this anyway because the libptp2 stuff wants this
125# file.
Linus Walleij2a84ca42008-12-14 00:00:23 +0000126AX_NEED_STDINT_H([src/_stdint.h])
Linus Walleij6fd2f082006-03-28 07:19:22 +0000127
Linus Walleije8c54642006-03-28 09:45:00 +0000128# Create a header file containing NetBSD-style byte swapping macros.
129# This m4 macros has caused severe pain, I am considering creating a
130# hard-coded byte swapper that will be eternally portable.
Linus Walleijb02a0662006-04-25 08:05:09 +0000131AC_NEED_BYTEORDER_H(src/gphoto2-endian.h)
Linus Walleij6fd2f082006-03-28 07:19:22 +0000132
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000133AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile
Linus Walleij6d3c2222010-11-30 23:42:32 +0000134 examples/Makefile util/Makefile libmtp.sh hotplug.sh libmtp.pc])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000135AC_OUTPUT
Linus Walleij0f2e7732006-08-17 20:48:32 +0000136chmod +x hotplug.sh