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 | 677e665 | 2011-01-08 23:11:59 +0000 | [diff] [blame] | 3 | AC_INIT([libmtp], [1.0.4], [libmtp-discuss@lists.sourceforge.net]) |
Linus Walleij | d463750 | 2009-06-14 23:03:33 +0000 | [diff] [blame] | 4 | AC_CONFIG_MACRO_DIR([m4]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 5 | AM_INIT_AUTOMAKE([foreign]) |
| 6 | AC_CONFIG_SRCDIR([src/libmtp.c]) |
Linus Walleij | 8609af3 | 2006-12-28 21:25:17 +0000 | [diff] [blame] | 7 | AM_CONFIG_HEADER(config.h) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 8 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 9 | # Checks for programs. |
| 10 | AC_PROG_CC |
| 11 | AC_PROG_INSTALL |
| 12 | AC_PROG_LN_S |
| 13 | AC_LIBTOOL_WIN32_DLL |
| 14 | AC_PROG_LIBTOOL |
Linus Walleij | d463750 | 2009-06-14 23:03:33 +0000 | [diff] [blame] | 15 | AM_ICONV |
| 16 | |
Linus Walleij | 925cd45 | 2010-12-05 21:26:48 +0000 | [diff] [blame] | 17 | # 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 Walleij | 1130ab5 | 2011-01-18 13:14:15 +0100 | [diff] [blame] | 20 | libexecdir=/lib/udev |
Linus Walleij | 925cd45 | 2010-12-05 21:26:48 +0000 | [diff] [blame] | 21 | |
Denis Dupeyron | bc442cd | 2011-01-16 21:57:39 -0700 | [diff] [blame^] | 22 | # Optionally enable and check for doxygen |
| 23 | AC_ARG_ENABLE([doxygen], |
| 24 | AS_HELP_STRING([--enable-doxygen], [Build API documentation using Doxygen]), |
| 25 | [ac_enable_doxygen=$enableval], [ac_enable_doxygen=auto]) |
| 26 | if 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]) |
| 32 | else |
| 33 | HAVE_DOXYGEN=false |
| 34 | AC_MSG_NOTICE([API documentation will not be generated]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 35 | fi |
Denis Dupeyron | bc442cd | 2011-01-16 21:57:39 -0700 | [diff] [blame^] | 36 | AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 37 | |
| 38 | # Check for Darwin |
| 39 | AC_MSG_CHECKING([if the host operating system is Darwin]) |
| 40 | case "$host" in |
| 41 | *-darwin*) |
| 42 | AC_MSG_RESULT([yes]) |
| 43 | CFLAGS="$CFLAGS -DUSE_DARWIN" |
| 44 | OSFLAGS="-framework IOKit" |
| 45 | ;; |
| 46 | *) AC_MSG_RESULT([no]) ;; |
| 47 | esac |
| 48 | AC_SUBST(OSFLAGS) |
| 49 | |
Linus Walleij | 9e44f18 | 2010-12-07 20:33:13 +0000 | [diff] [blame] | 50 | AC_MSG_CHECKING([if the host operating system is Linux]) |
| 51 | AC_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 Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 63 | # Check for mingw compiler platform |
| 64 | AC_MSG_CHECKING([For MinGW32]) |
| 65 | case "$host" in |
| 66 | *-*-mingw*) |
| 67 | AC_MSG_RESULT([yes]) |
| 68 | mingw_compiler=yes |
| 69 | ;; |
| 70 | *) AC_MSG_RESULT([no]) ;; |
| 71 | esac |
| 72 | AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"]) |
| 73 | |
Linus Walleij | 6f05002 | 2009-05-06 21:14:41 +0000 | [diff] [blame] | 74 | # Check if Microsoft LIB.EXE is available |
| 75 | if test "$mingw_compiler" = "yes"; then |
| 76 | AC_CHECK_PROG(ms_lib_exe, lib.exe, yes, no) |
| 77 | fi |
| 78 | AM_CONDITIONAL(MS_LIB_EXE, test x$ms_lib_exe = xyes) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 79 | |
| 80 | # Checks for libraries. |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 81 | AC_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 Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 86 | |
| 87 | # Checks for header files. |
| 88 | AC_HEADER_STDC |
| 89 | AC_HEADER_TIME |
| 90 | # zlib.h the day we need to decompress firmware |
| 91 | AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \ |
Linus Walleij | 56c6395 | 2008-06-08 21:55:58 +0000 | [diff] [blame] | 92 | limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \ |
Linus Walleij | 6f05002 | 2009-05-06 21:14:41 +0000 | [diff] [blame] | 93 | iconv.h langinfo.h locale.h arpa/inet.h byteswap.h sys/uio.h]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 94 | AC_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. |
| 101 | AC_C_CONST |
| 102 | AC_TYPE_OFF_T |
| 103 | AC_TYPE_SIGNAL |
| 104 | AC_TYPE_SIZE_T |
| 105 | AC_STRUCT_ST_BLKSIZE |
| 106 | |
| 107 | # Checks for library functions. |
| 108 | AC_FUNC_MALLOC |
| 109 | AC_FUNC_MEMCMP |
| 110 | AC_FUNC_STAT |
Richard Low | 8d97bad | 2010-09-12 17:31:12 +0000 | [diff] [blame] | 111 | AC_CHECK_FUNCS(basename memset select strdup strerror strndup strrchr strtoul usleep mkstemp) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 112 | |
| 113 | # Switches. |
Linus Walleij | 0535838 | 2007-08-06 20:46:35 +0000 | [diff] [blame] | 114 | # Enable LFS (Large File Support) |
Linus Walleij | 2f1b640 | 2009-06-15 19:49:33 +0000 | [diff] [blame] | 115 | AC_SYS_LARGEFILE |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 116 | # Stick in "-Werror" if you want to be more aggressive. |
| 117 | # (No need to use AC_SUBST on this default substituted environment variable.) |
| 118 | CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" |
| 119 | |
| 120 | # Output files |
Linus Walleij | e8c5464 | 2006-03-28 09:45:00 +0000 | [diff] [blame] | 121 | |
| 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 Walleij | 2a84ca4 | 2008-12-14 00:00:23 +0000 | [diff] [blame] | 126 | AX_NEED_STDINT_H([src/_stdint.h]) |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 127 | |
Linus Walleij | e8c5464 | 2006-03-28 09:45:00 +0000 | [diff] [blame] | 128 | # 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 Walleij | b02a066 | 2006-04-25 08:05:09 +0000 | [diff] [blame] | 131 | AC_NEED_BYTEORDER_H(src/gphoto2-endian.h) |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 132 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 133 | AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile |
Linus Walleij | 6d3c222 | 2010-11-30 23:42:32 +0000 | [diff] [blame] | 134 | examples/Makefile util/Makefile libmtp.sh hotplug.sh libmtp.pc]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 135 | AC_OUTPUT |
Linus Walleij | 0f2e773 | 2006-08-17 20:48:32 +0000 | [diff] [blame] | 136 | chmod +x hotplug.sh |