Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 1 | # Process this file with autoconf to produce a configure script. |
| 2 | AC_PREREQ(2.52) |
Linus Walleij | db90623 | 2007-08-07 15:59:09 +0000 | [diff] [blame] | 3 | AC_INIT([libmtp], [0.2.1], [libmtp-users@lists.sourceforge.net]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 4 | AM_INIT_AUTOMAKE([foreign]) |
| 5 | AC_CONFIG_SRCDIR([src/libmtp.c]) |
Linus Walleij | 8609af3 | 2006-12-28 21:25:17 +0000 | [diff] [blame] | 6 | AM_CONFIG_HEADER(config.h) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 7 | |
| 8 | # This can be overridden by the command line switch |
| 9 | if test "$program_prefix" = NONE; then |
| 10 | program_prefix=mtp- |
| 11 | program_transform_name="s,^,$program_prefix,;$program_transform_name" |
| 12 | fi |
| 13 | |
| 14 | # Checks for programs. |
| 15 | AC_PROG_CC |
| 16 | AC_PROG_INSTALL |
| 17 | AC_PROG_LN_S |
| 18 | AC_LIBTOOL_WIN32_DLL |
| 19 | AC_PROG_LIBTOOL |
| 20 | # Check for doxygen |
| 21 | AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false) |
| 22 | AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) |
| 23 | if test $HAVE_DOXYGEN = "false"; then |
| 24 | AC_MSG_WARN([*** doxygen not found, docs will not be built]) |
| 25 | fi |
| 26 | |
| 27 | # Check for Darwin |
| 28 | AC_MSG_CHECKING([if the host operating system is Darwin]) |
| 29 | case "$host" in |
| 30 | *-darwin*) |
| 31 | AC_MSG_RESULT([yes]) |
| 32 | CFLAGS="$CFLAGS -DUSE_DARWIN" |
| 33 | OSFLAGS="-framework IOKit" |
| 34 | ;; |
| 35 | *) AC_MSG_RESULT([no]) ;; |
| 36 | esac |
| 37 | AC_SUBST(OSFLAGS) |
| 38 | |
| 39 | # Check for mingw compiler platform |
| 40 | AC_MSG_CHECKING([For MinGW32]) |
| 41 | case "$host" in |
| 42 | *-*-mingw*) |
| 43 | AC_MSG_RESULT([yes]) |
| 44 | mingw_compiler=yes |
| 45 | ;; |
| 46 | *) AC_MSG_RESULT([no]) ;; |
| 47 | esac |
| 48 | AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"]) |
| 49 | |
| 50 | |
| 51 | # Checks for libraries. |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 52 | AC_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 Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 57 | |
| 58 | # Checks for header files. |
| 59 | AC_HEADER_STDC |
| 60 | AC_HEADER_TIME |
| 61 | # zlib.h the day we need to decompress firmware |
| 62 | AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \ |
Linus Walleij | 16571dc | 2006-08-17 20:27:46 +0000 | [diff] [blame] | 63 | limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h iconv.h]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 64 | AC_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. |
| 71 | AC_C_CONST |
| 72 | AC_TYPE_OFF_T |
| 73 | AC_TYPE_SIGNAL |
| 74 | AC_TYPE_SIZE_T |
| 75 | AC_STRUCT_ST_BLKSIZE |
| 76 | |
| 77 | # Checks for library functions. |
| 78 | AC_FUNC_MALLOC |
| 79 | AC_FUNC_MEMCMP |
| 80 | AC_FUNC_STAT |
| 81 | AC_CHECK_FUNCS(basename memset select strdup strerror strrchr strtoul usleep) |
| 82 | |
| 83 | # Switches. |
Linus Walleij | 0535838 | 2007-08-06 20:46:35 +0000 | [diff] [blame] | 84 | # Enable LFS (Large File Support) |
| 85 | CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 86 | # Stick in "-Werror" if you want to be more aggressive. |
| 87 | # (No need to use AC_SUBST on this default substituted environment variable.) |
| 88 | CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" |
| 89 | |
| 90 | # Output files |
Linus Walleij | e8c5464 | 2006-03-28 09:45:00 +0000 | [diff] [blame] | 91 | |
| 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 Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 96 | AX_NEED_STDINT_H([src/libptp-stdint.h]) |
| 97 | |
Linus Walleij | e8c5464 | 2006-03-28 09:45:00 +0000 | [diff] [blame] | 98 | # 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 Walleij | b02a066 | 2006-04-25 08:05:09 +0000 | [diff] [blame] | 101 | AC_NEED_BYTEORDER_H(src/gphoto2-endian.h) |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 102 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 103 | AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile |
| 104 | examples/Makefile libmtp.sh hotplug.sh libmtp.pc]) |
| 105 | AC_OUTPUT |
Linus Walleij | 0f2e773 | 2006-08-17 20:48:32 +0000 | [diff] [blame] | 106 | chmod +x hotplug.sh |