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 | |
Linus Walleij | 5cf12e7 | 2011-01-18 15:33:09 +0100 | [diff] [blame^] | 22 | # Optionally set udev rules file name |
| 23 | UDEV_RULES_FILE=libmtp.rules |
| 24 | AC_ARG_WITH(udev-rules-file, |
| 25 | AC_HELP_STRING([--with-udev-rules-file=NAME], |
| 26 | [udev rules file name [default=libmtp.rules]]), [UDEV_RULES_FILE="$withval"], []) |
| 27 | AC_SUBST(UDEV_RULES_FILE) |
| 28 | |
Denis Dupeyron | bc442cd | 2011-01-16 21:57:39 -0700 | [diff] [blame] | 29 | # Optionally enable and check for doxygen |
| 30 | AC_ARG_ENABLE([doxygen], |
| 31 | AS_HELP_STRING([--enable-doxygen], [Build API documentation using Doxygen]), |
| 32 | [ac_enable_doxygen=$enableval], [ac_enable_doxygen=auto]) |
| 33 | if test "x$ac_enable_doxygen" != "xno"; then |
| 34 | AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false) |
| 35 | if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$ac_enable_doxygen" = "xyes"; then |
| 36 | AC_MSG_ERROR([*** API documentation explicitly requested but Doxygen not found]) |
| 37 | fi |
| 38 | AC_MSG_NOTICE([API documentation will be generated using Doxygen]) |
| 39 | else |
| 40 | HAVE_DOXYGEN=false |
| 41 | AC_MSG_NOTICE([API documentation will not be generated]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 42 | fi |
Denis Dupeyron | bc442cd | 2011-01-16 21:57:39 -0700 | [diff] [blame] | 43 | AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 44 | |
| 45 | # Check for Darwin |
| 46 | AC_MSG_CHECKING([if the host operating system is Darwin]) |
| 47 | case "$host" in |
| 48 | *-darwin*) |
| 49 | AC_MSG_RESULT([yes]) |
| 50 | CFLAGS="$CFLAGS -DUSE_DARWIN" |
| 51 | OSFLAGS="-framework IOKit" |
| 52 | ;; |
| 53 | *) AC_MSG_RESULT([no]) ;; |
| 54 | esac |
| 55 | AC_SUBST(OSFLAGS) |
| 56 | |
Linus Walleij | 9e44f18 | 2010-12-07 20:33:13 +0000 | [diff] [blame] | 57 | AC_MSG_CHECKING([if the host operating system is Linux]) |
| 58 | AC_TRY_COMPILE([#ifndef __linux__ |
| 59 | #error "FAIL" |
| 60 | #endif |
| 61 | ], |
| 62 | [int test;], |
| 63 | [ AC_MSG_RESULT(yes) |
| 64 | AM_CONDITIONAL(USE_LINUX, true) |
| 65 | ], |
| 66 | [ AC_MSG_RESULT(no) |
| 67 | AM_CONDITIONAL(USE_LINUX, false) |
| 68 | ]) |
| 69 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 70 | # Check for mingw compiler platform |
| 71 | AC_MSG_CHECKING([For MinGW32]) |
| 72 | case "$host" in |
| 73 | *-*-mingw*) |
| 74 | AC_MSG_RESULT([yes]) |
| 75 | mingw_compiler=yes |
| 76 | ;; |
| 77 | *) AC_MSG_RESULT([no]) ;; |
| 78 | esac |
| 79 | AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"]) |
| 80 | |
Linus Walleij | 6f05002 | 2009-05-06 21:14:41 +0000 | [diff] [blame] | 81 | # Check if Microsoft LIB.EXE is available |
| 82 | if test "$mingw_compiler" = "yes"; then |
| 83 | AC_CHECK_PROG(ms_lib_exe, lib.exe, yes, no) |
| 84 | fi |
| 85 | AM_CONDITIONAL(MS_LIB_EXE, test x$ms_lib_exe = xyes) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 86 | |
| 87 | # Checks for libraries. |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 88 | AC_CHECK_LIB([usb], [usb_control_msg],, |
| 89 | AC_MSG_ERROR([I can't find the libusb libraries on your system. You |
| 90 | may need to set the LDFLAGS environment variable to include the |
| 91 | search path where you have libusb installed before running |
| 92 | configure (e.g. setenv LDFLAGS=-L/usr/local/lib)]), "$OSFLAGS") |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 93 | |
| 94 | # Checks for header files. |
| 95 | AC_HEADER_STDC |
| 96 | AC_HEADER_TIME |
| 97 | # zlib.h the day we need to decompress firmware |
| 98 | 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] | 99 | 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] | 100 | 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] | 101 | AC_CHECK_HEADER([usb.h],, |
| 102 | AC_MSG_ERROR([I can't find the libusb header file on your system. |
| 103 | You may need to set the CPPFLAGS environment variable to include |
| 104 | the search path where you have libusb installed before running |
| 105 | configure (e.g. setenv CPPFLAGS=-I/usr/local/include)])) |
| 106 | |
| 107 | # Checks for typedefs, structures, and compiler characteristics. |
| 108 | AC_C_CONST |
| 109 | AC_TYPE_OFF_T |
| 110 | AC_TYPE_SIGNAL |
| 111 | AC_TYPE_SIZE_T |
| 112 | AC_STRUCT_ST_BLKSIZE |
| 113 | |
| 114 | # Checks for library functions. |
| 115 | AC_FUNC_MALLOC |
| 116 | AC_FUNC_MEMCMP |
| 117 | AC_FUNC_STAT |
Richard Low | 8d97bad | 2010-09-12 17:31:12 +0000 | [diff] [blame] | 118 | 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] | 119 | |
| 120 | # Switches. |
Linus Walleij | 0535838 | 2007-08-06 20:46:35 +0000 | [diff] [blame] | 121 | # Enable LFS (Large File Support) |
Linus Walleij | 2f1b640 | 2009-06-15 19:49:33 +0000 | [diff] [blame] | 122 | AC_SYS_LARGEFILE |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 123 | # Stick in "-Werror" if you want to be more aggressive. |
| 124 | # (No need to use AC_SUBST on this default substituted environment variable.) |
| 125 | CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" |
| 126 | |
| 127 | # Output files |
Linus Walleij | e8c5464 | 2006-03-28 09:45:00 +0000 | [diff] [blame] | 128 | |
| 129 | # Create a stdint.h-like file containing size-specific integer definitions |
| 130 | # that will always be available. The <stdint.h> file is required by the |
| 131 | # library, but we provide this anyway because the libptp2 stuff wants this |
| 132 | # file. |
Linus Walleij | 2a84ca4 | 2008-12-14 00:00:23 +0000 | [diff] [blame] | 133 | AX_NEED_STDINT_H([src/_stdint.h]) |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 134 | |
Linus Walleij | e8c5464 | 2006-03-28 09:45:00 +0000 | [diff] [blame] | 135 | # Create a header file containing NetBSD-style byte swapping macros. |
| 136 | # This m4 macros has caused severe pain, I am considering creating a |
| 137 | # hard-coded byte swapper that will be eternally portable. |
Linus Walleij | b02a066 | 2006-04-25 08:05:09 +0000 | [diff] [blame] | 138 | AC_NEED_BYTEORDER_H(src/gphoto2-endian.h) |
Linus Walleij | 6fd2f08 | 2006-03-28 07:19:22 +0000 | [diff] [blame] | 139 | |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 140 | 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] | 141 | examples/Makefile util/Makefile libmtp.sh hotplug.sh libmtp.pc]) |
Linus Walleij | eb8c6fe | 2006-02-03 09:46:22 +0000 | [diff] [blame] | 142 | AC_OUTPUT |
Linus Walleij | 0f2e773 | 2006-08-17 20:48:32 +0000 | [diff] [blame] | 143 | chmod +x hotplug.sh |