diff options
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..3bf88ef --- /dev/null +++ b/configure.ac | |||
| @@ -0,0 +1,195 @@ | |||
| 1 | # -*- Autoconf -*- | ||
| 2 | # Process this file with autoconf to produce a configure script. | ||
| 3 | |||
| 4 | AC_PREREQ([2.68]) | ||
| 5 | AC_INIT([usbmuxd], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/usbmuxd/issues], [], [https://libimobiledevice.org]) | ||
| 6 | AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news]) | ||
| 7 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) | ||
| 8 | AC_CONFIG_SRCDIR([src/]) | ||
| 9 | AC_CONFIG_HEADERS([config.h]) | ||
| 10 | AC_CONFIG_MACRO_DIR([m4]) | ||
| 11 | |||
| 12 | # Check if we have a version defined | ||
| 13 | if test -z $PACKAGE_VERSION; then | ||
| 14 | AC_MSG_ERROR([PACKAGE_VERSION is not defined. Make sure to configure a source tree checked out from git or that .tarball-version is present.]) | ||
| 15 | fi | ||
| 16 | |||
| 17 | # Checks for programs. | ||
| 18 | AC_PROG_CC | ||
| 19 | AM_PROG_CC_C_O | ||
| 20 | LT_INIT | ||
| 21 | |||
| 22 | # Checks for libraries. | ||
| 23 | PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.9) | ||
| 24 | PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.6.0) | ||
| 25 | PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.3.0, have_limd=yes, have_limd=no) | ||
| 26 | PKG_CHECK_MODULES(limd_glue, libimobiledevice-glue-1.0 >= 1.0.0) | ||
| 27 | |||
| 28 | AC_ARG_WITH([preflight], | ||
| 29 | [AS_HELP_STRING([--without-preflight], | ||
| 30 | [do not build with preflight worker support @<:@default=yes@:>@])], | ||
| 31 | [with_preflight=$withval], | ||
| 32 | [with_preflight=yes]) | ||
| 33 | |||
| 34 | if test "x$have_limd" = "xyes"; then | ||
| 35 | if test "x$with_preflight" != "xyes"; then | ||
| 36 | have_limd=no | ||
| 37 | echo "*** Note: preflight worker support has been disabled ***" | ||
| 38 | else | ||
| 39 | AC_DEFINE(HAVE_LIBIMOBILEDEVICE, 1, [Define if you have libimobiledevice support]) | ||
| 40 | AC_SUBST(libimobiledevice_CFLAGS) | ||
| 41 | AC_SUBST(libimobiledevice_LIBS) | ||
| 42 | CACHED_CFLAGS="$CFLAGS" | ||
| 43 | CFLAGS="$CFLAGS $libimobiledevice_CFLAGS" | ||
| 44 | AC_CACHE_CHECK(for enum idevice_connection_type, ac_cv_enum_idevice_connection_type, | ||
| 45 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ | ||
| 46 | #include <libimobiledevice/libimobiledevice.h> | ||
| 47 | ], [ | ||
| 48 | enum idevice_connection_type conn_type = CONNECTION_USBMUXD; | ||
| 49 | ])], ac_cv_enum_idevice_connection_type=yes, ac_cv_enum_idevice_connection_type=no)) | ||
| 50 | CFLAGS="$CACHED_CFLAGS" | ||
| 51 | if (test "$ac_cv_enum_idevice_connection_type" = "yes"); then | ||
| 52 | AC_DEFINE(HAVE_ENUM_IDEVICE_CONNECTION_TYPE, 1, [Define if enum idevice_connection_type is available]) | ||
| 53 | fi | ||
| 54 | fi | ||
| 55 | else | ||
| 56 | if test "x$with_preflight" == "xyes"; then | ||
| 57 | AC_MSG_ERROR([preflight worker support requested but libimobiledevice could not be found]) | ||
| 58 | fi | ||
| 59 | fi | ||
| 60 | |||
| 61 | AC_ARG_WITH([udevrulesdir], | ||
| 62 | AS_HELP_STRING([--with-udevrulesdir=DIR], | ||
| 63 | [Directory for udev rules]), | ||
| 64 | [], | ||
| 65 | [with_udevrulesdir=auto]) | ||
| 66 | if test "x$with_udevrulesdir" = "xauto"; then | ||
| 67 | udevdir=$($PKG_CONFIG --variable=udevdir udev) | ||
| 68 | if test "x$udevdir" != "x"; then | ||
| 69 | with_udevrulesdir=$udevdir"/rules.d" | ||
| 70 | else | ||
| 71 | with_udevrulesdir=$prefix/lib/udev/rules.d | ||
| 72 | fi | ||
| 73 | fi | ||
| 74 | |||
| 75 | AC_ARG_WITH([systemd], | ||
| 76 | [AS_HELP_STRING([--without-systemd], | ||
| 77 | [do not build with systemd support @<:@default=yes@:>@])], | ||
| 78 | [with_systemd=$withval], | ||
| 79 | [with_systemd=yes]) | ||
| 80 | |||
| 81 | AC_ARG_WITH([systemdsystemunitdir], | ||
| 82 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], | ||
| 83 | [directory for systemd service files])], | ||
| 84 | [with_systemdsystemunitdir=$withval], | ||
| 85 | [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) | ||
| 86 | |||
| 87 | if test "x$with_systemdsystemunitdir" != xno; then | ||
| 88 | AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) | ||
| 89 | fi | ||
| 90 | AM_CONDITIONAL(WANT_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes" ]) | ||
| 91 | |||
| 92 | if test "x$with_systemd" = xyes; then | ||
| 93 | udev_activation_rule="ENV{SYSTEMD_WANTS}=\"usbmuxd.service\"" | ||
| 94 | else | ||
| 95 | udev_activation_rule="RUN+=\"@sbindir@/usbmuxd --user usbmux --udev\"" | ||
| 96 | fi | ||
| 97 | AC_SUBST(udev_activation_rule) | ||
| 98 | |||
| 99 | # Checks for header files. | ||
| 100 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) | ||
| 101 | |||
| 102 | # Checks for typedefs, structures, and compiler characteristics. | ||
| 103 | AC_C_CONST | ||
| 104 | AC_TYPE_SIZE_T | ||
| 105 | AC_TYPE_SSIZE_T | ||
| 106 | AC_TYPE_UINT16_T | ||
| 107 | AC_TYPE_UINT32_T | ||
| 108 | AC_TYPE_UINT8_T | ||
| 109 | |||
| 110 | # Check if clock_gettime requires -lrt (old GNU systems) | ||
| 111 | AC_SEARCH_LIBS([clock_gettime],[rt posix4]) | ||
| 112 | |||
| 113 | # Checks for library functions. | ||
| 114 | AC_CHECK_FUNCS([strcasecmp strdup strerror strndup malloc realloc]) | ||
| 115 | AC_CHECK_FUNCS([ppoll clock_gettime localtime_r]) | ||
| 116 | |||
| 117 | # Check for operating system | ||
| 118 | AC_MSG_CHECKING([whether to enable WIN32 build settings]) | ||
| 119 | UDEV_SUB= | ||
| 120 | SYSTEMD_SUB= | ||
| 121 | case ${host_os} in | ||
| 122 | *mingw32*|*cygwin*) | ||
| 123 | win32=true | ||
| 124 | AC_MSG_RESULT([yes]) | ||
| 125 | AC_CHECK_TOOL([WINDRES], [windres], AC_MSG_ERROR([windres not found])) | ||
| 126 | AC_SUBST(WINDRES) | ||
| 127 | activation_method="manual" | ||
| 128 | ;; | ||
| 129 | darwin*) | ||
| 130 | win32=false | ||
| 131 | AC_MSG_RESULT([no]) | ||
| 132 | # No support for launchd yet | ||
| 133 | activation_method="manual" | ||
| 134 | ;; | ||
| 135 | *) | ||
| 136 | win32=false | ||
| 137 | AC_MSG_RESULT([no]) | ||
| 138 | UDEV_SUB=udev | ||
| 139 | AC_SUBST([udevrulesdir], [$with_udevrulesdir]) | ||
| 140 | AC_DEFINE(HAVE_UDEV, 1, [Define to enable udev support]) | ||
| 141 | activation_method="systemd" | ||
| 142 | if test "x$with_systemd" != "xyes"; then | ||
| 143 | echo "*** Note: support for systemd activation has been disabled, using udev activation instead ***" | ||
| 144 | activation_method="udev" | ||
| 145 | else | ||
| 146 | AC_DEFINE(HAVE_SYSTEMD, 1, [Define to enable systemd support]) | ||
| 147 | SYSTEMD_SUB=systemd | ||
| 148 | fi | ||
| 149 | ;; | ||
| 150 | esac | ||
| 151 | AM_CONDITIONAL(WIN32, test x$win32 = xtrue) | ||
| 152 | |||
| 153 | AC_SUBST([UDEV_SUB]) | ||
| 154 | AC_SUBST([SYSTEMD_SUB]) | ||
| 155 | |||
| 156 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") | ||
| 157 | AC_SUBST(GLOBAL_CFLAGS) | ||
| 158 | |||
| 159 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | ||
| 160 | |||
| 161 | # workaround for older autoconf versions | ||
| 162 | if test "x$runstatedir" == "x"; then | ||
| 163 | runstatedir=$localstatedir/run | ||
| 164 | fi | ||
| 165 | |||
| 166 | AC_CONFIG_FILES([ | ||
| 167 | Makefile | ||
| 168 | src/Makefile | ||
| 169 | udev/Makefile | ||
| 170 | systemd/Makefile | ||
| 171 | docs/Makefile | ||
| 172 | ]) | ||
| 173 | AC_OUTPUT | ||
| 174 | |||
| 175 | echo " | ||
| 176 | Configuration for $PACKAGE $VERSION: | ||
| 177 | ------------------------------------------- | ||
| 178 | |||
| 179 | install prefix ............: $prefix | ||
| 180 | preflight worker support ..: $have_limd | ||
| 181 | activation method .........: $activation_method" | ||
| 182 | |||
| 183 | if test "x$activation_method" = "xsystemd"; then | ||
| 184 | echo " systemd unit directory ....: ${systemdsystemunitdir}" | ||
| 185 | fi | ||
| 186 | |||
| 187 | if test -n "$udevrulesdir"; then | ||
| 188 | echo " udev rules directory ......: ${udevrulesdir}" | ||
| 189 | fi | ||
| 190 | |||
| 191 | echo " compiler ..................: ${CC} | ||
| 192 | |||
| 193 | Now type 'make' to build $PACKAGE $VERSION, | ||
| 194 | and then 'make install' for installation. | ||
| 195 | " | ||
