1# Process this file with autoconf to produce a configure script. 2AC_PREREQ(2.52) 3AC_INIT([libmtp], [1.0.1], [libmtp-discuss@lists.sourceforge.net]) 4AC_CONFIG_MACRO_DIR([m4]) 5AM_INIT_AUTOMAKE([foreign]) 6AC_CONFIG_SRCDIR([src/libmtp.c]) 7AM_CONFIG_HEADER(config.h) 8 9# This can be overridden by the command line switch 10if test "$program_prefix" = NONE; then 11 program_prefix=mtp- 12 program_transform_name="s,^,$program_prefix,;$program_transform_name" 13fi 14 15# Checks for programs. 16AC_PROG_CC 17AC_PROG_INSTALL 18AC_PROG_LN_S 19AC_LIBTOOL_WIN32_DLL 20AC_PROG_LIBTOOL 21AM_ICONV 22 23# Check for doxygen 24AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false) 25AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) 26if test $HAVE_DOXYGEN = "false"; then 27 AC_MSG_WARN([*** doxygen not found, docs will not be built]) 28fi 29 30# Check for Darwin 31AC_MSG_CHECKING([if the host operating system is Darwin]) 32case "$host" in 33 *-darwin*) 34 AC_MSG_RESULT([yes]) 35 CFLAGS="$CFLAGS -DUSE_DARWIN" 36 OSFLAGS="-framework IOKit" 37 ;; 38 *) AC_MSG_RESULT([no]) ;; 39esac 40AC_SUBST(OSFLAGS) 41 42# Check for mingw compiler platform 43AC_MSG_CHECKING([For MinGW32]) 44case "$host" in 45 *-*-mingw*) 46 AC_MSG_RESULT([yes]) 47 mingw_compiler=yes 48 ;; 49 *) AC_MSG_RESULT([no]) ;; 50esac 51AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"]) 52 53# Check if Microsoft LIB.EXE is available 54if test "$mingw_compiler" = "yes"; then 55 AC_CHECK_PROG(ms_lib_exe, lib.exe, yes, no) 56fi 57AM_CONDITIONAL(MS_LIB_EXE, test x$ms_lib_exe = xyes) 58 59# Checks for libraries. 60AC_CHECK_LIB([usb], [usb_control_msg],, 61 AC_MSG_ERROR([I can't find the libusb libraries on your system. You 62 may need to set the LDFLAGS environment variable to include the 63 search path where you have libusb installed before running 64 configure (e.g. setenv LDFLAGS=-L/usr/local/lib)]), "$OSFLAGS") 65 66# Checks for header files. 67AC_HEADER_STDC 68AC_HEADER_TIME 69# zlib.h the day we need to decompress firmware 70AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \ 71 limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \ 72 iconv.h langinfo.h locale.h arpa/inet.h byteswap.h sys/uio.h]) 73AC_CHECK_HEADER([usb.h],, 74 AC_MSG_ERROR([I can't find the libusb header file on your system. 75 You may need to set the CPPFLAGS environment variable to include 76 the search path where you have libusb installed before running 77 configure (e.g. setenv CPPFLAGS=-I/usr/local/include)])) 78 79# Checks for typedefs, structures, and compiler characteristics. 80AC_C_CONST 81AC_TYPE_OFF_T 82AC_TYPE_SIGNAL 83AC_TYPE_SIZE_T 84AC_STRUCT_ST_BLKSIZE 85 86# Checks for library functions. 87AC_FUNC_MALLOC 88AC_FUNC_MEMCMP 89AC_FUNC_STAT 90AC_CHECK_FUNCS(basename memset select strdup strerror strrchr strtoul usleep mkstemp) 91 92# Switches. 93# Enable LFS (Large File Support) 94AC_SYS_LARGEFILE 95# Stick in "-Werror" if you want to be more aggressive. 96# (No need to use AC_SUBST on this default substituted environment variable.) 97CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" 98 99# Output files 100 101# Create a stdint.h-like file containing size-specific integer definitions 102# that will always be available. The <stdint.h> file is required by the 103# library, but we provide this anyway because the libptp2 stuff wants this 104# file. 105AX_NEED_STDINT_H([src/_stdint.h]) 106 107# Create a header file containing NetBSD-style byte swapping macros. 108# This m4 macros has caused severe pain, I am considering creating a 109# hard-coded byte swapper that will be eternally portable. 110AC_NEED_BYTEORDER_H(src/gphoto2-endian.h) 111 112AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile 113 examples/Makefile libmtp.sh hotplug.sh libmtp.pc]) 114AC_OUTPUT 115chmod +x hotplug.sh 116