blob: eca7ab3a05fb8f6bd10ed02dc6ba339a8a96f54e [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 Walleij16571dc2006-08-17 20:27:46 +00003AC_INIT([libmtp], [0.0.12], [libmtp-users@lists.sourceforge.net])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00004AM_INIT_AUTOMAKE([foreign])
5AC_CONFIG_SRCDIR([src/libmtp.c])
6AC_CONFIG_HEADER([config.h])
7
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.
52AC_CHECK_LIB([curses], [initscr], AC_SUBST([CURSESPLAY], cursesplay))
53AC_CHECK_LIB([usb], [usb_control_msg],,
54 AC_MSG_ERROR([I can't find the libusb libraries on your system. You
55 may need to set the LDFLAGS environment variable to include the
56 search path where you have libusb installed before running
57 configure (e.g. setenv LDFLAGS=-L/usr/local/lib)]), "$OSFLAGS")
58AC_CHECK_LIB([z], [uncompress], AC_SUBST([SAMPLE_LDADD], [-lz]))
59
60# Checks for header files.
61AC_HEADER_STDC
62AC_HEADER_TIME
63# zlib.h the day we need to decompress firmware
64AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \
Linus Walleij16571dc2006-08-17 20:27:46 +000065 limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h iconv.h])
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000066AC_CHECK_HEADER([usb.h],,
67 AC_MSG_ERROR([I can't find the libusb header file on your system.
68 You may need to set the CPPFLAGS environment variable to include
69 the search path where you have libusb installed before running
70 configure (e.g. setenv CPPFLAGS=-I/usr/local/include)]))
71
72# Checks for typedefs, structures, and compiler characteristics.
73AC_C_CONST
74AC_TYPE_OFF_T
75AC_TYPE_SIGNAL
76AC_TYPE_SIZE_T
77AC_STRUCT_ST_BLKSIZE
78
79# Checks for library functions.
80AC_FUNC_MALLOC
81AC_FUNC_MEMCMP
82AC_FUNC_STAT
83AC_CHECK_FUNCS(basename memset select strdup strerror strrchr strtoul usleep)
84
85# Switches.
86# Stick in "-Werror" if you want to be more aggressive.
87# (No need to use AC_SUBST on this default substituted environment variable.)
88CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
89
90# Output files
Linus Walleije8c54642006-03-28 09:45:00 +000091
92# Create a stdint.h-like file containing size-specific integer definitions
93# that will always be available. The <stdint.h> file is required by the
94# library, but we provide this anyway because the libptp2 stuff wants this
95# file.
Linus Walleij6fd2f082006-03-28 07:19:22 +000096AX_NEED_STDINT_H([src/libptp-stdint.h])
97
Linus Walleije8c54642006-03-28 09:45:00 +000098# Create a header file containing NetBSD-style byte swapping macros.
99# This m4 macros has caused severe pain, I am considering creating a
100# hard-coded byte swapper that will be eternally portable.
Linus Walleijb02a0662006-04-25 08:05:09 +0000101AC_NEED_BYTEORDER_H(src/gphoto2-endian.h)
Linus Walleij6fd2f082006-03-28 07:19:22 +0000102
Linus Walleijeb8c6fe2006-02-03 09:46:22 +0000103AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile
104 examples/Makefile libmtp.sh hotplug.sh libmtp.pc])
105AC_OUTPUT
Linus Walleij0f2e7732006-08-17 20:48:32 +0000106chmod +x hotplug.sh