diff options
| author | 2014-07-26 17:08:41 +0200 | |
|---|---|---|
| committer | 2014-09-19 18:54:02 +0200 | |
| commit | 577538f213cd7132c7450db393fd6fef6bb46b5a (patch) | |
| tree | 74a21364696e0e2f375613e1c45006d5e6779dc0 /configure.ac | |
| parent | b7976d2a53b27ec9c42f81a22e91704dbcc5fb53 (diff) | |
| download | usbmuxd-577538f213cd7132c7450db393fd6fef6bb46b5a.tar.gz usbmuxd-577538f213cd7132c7450db393fd6fef6bb46b5a.tar.bz2 | |
Add systemd activation autofoo with fallback for udev and manual activation
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 82 |
1 files changed, 78 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 6737f6f..33f6151 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -42,6 +42,45 @@ else | |||
| 42 | fi | 42 | fi |
| 43 | fi | 43 | fi |
| 44 | 44 | ||
| 45 | AC_ARG_WITH([udevrulesdir], | ||
| 46 | AS_HELP_STRING([--with-udevrulesdir=DIR], | ||
| 47 | [Directory for udev rules]), | ||
| 48 | [], | ||
| 49 | [with_udevrulesdir=auto]) | ||
| 50 | if test "x$with_udevrulesdir" = "xauto"; then | ||
| 51 | udevdir=$($PKG_CONFIG --variable=udevdir udev) | ||
| 52 | if test "x$udevdir" != "x"; then | ||
| 53 | with_udevrulesdir=$udevdir"/rules.d" | ||
| 54 | else | ||
| 55 | with_udevrulesdir=$prefix/lib/udev/rules.d | ||
| 56 | fi | ||
| 57 | fi | ||
| 58 | AC_SUBST([udevrulesdir], [$with_udevrulesdir]) | ||
| 59 | |||
| 60 | AC_ARG_WITH([systemd], | ||
| 61 | [AS_HELP_STRING([--without-systemd], | ||
| 62 | [do not build with systemd support @<:@default=yes@:>@])], | ||
| 63 | [with_systemd=no], | ||
| 64 | [with_systemd=yes]) | ||
| 65 | |||
| 66 | AC_ARG_WITH([systemdsystemunitdir], | ||
| 67 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], | ||
| 68 | [directory for systemd service files])], | ||
| 69 | [with_systemdsystemunitdir=$withval], | ||
| 70 | [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) | ||
| 71 | |||
| 72 | if test "x$with_systemdsystemunitdir" != xno; then | ||
| 73 | AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) | ||
| 74 | fi | ||
| 75 | AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes" ]) | ||
| 76 | |||
| 77 | if test "x$with_systemd" = xyes; then | ||
| 78 | udev_activation_rule="TAG+=\"systemd\", ENV{SYSTEMD_WANTS}=\"usbmuxd.service\"" | ||
| 79 | else | ||
| 80 | udev_activation_rule="RUN+=\"@sbindir@/usbmuxd -u -U usbmux\"" | ||
| 81 | fi | ||
| 82 | AC_SUBST(udev_activation_rule) | ||
| 83 | |||
| 45 | # Checks for header files. | 84 | # Checks for header files. |
| 46 | AC_HEADER_STDC | 85 | AC_HEADER_STDC |
| 47 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) | 86 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) |
| @@ -61,20 +100,40 @@ AC_CHECK_FUNCS([strcasecmp strdup strerror strndup stpcpy]) | |||
| 61 | 100 | ||
| 62 | # Check for operating system | 101 | # Check for operating system |
| 63 | AC_MSG_CHECKING([whether to enable WIN32 build settings]) | 102 | AC_MSG_CHECKING([whether to enable WIN32 build settings]) |
| 103 | UDEV_SUB= | ||
| 104 | SYSTEMD_SUB= | ||
| 64 | case ${host_os} in | 105 | case ${host_os} in |
| 65 | *mingw32*|*cygwin*) | 106 | *mingw32*|*cygwin*) |
| 66 | win32=true | 107 | win32=true |
| 67 | AC_MSG_RESULT([yes]) | 108 | AC_MSG_RESULT([yes]) |
| 68 | AC_CHECK_TOOL([WINDRES], [windres], AC_MSG_ERROR([windres not found])) | 109 | AC_CHECK_TOOL([WINDRES], [windres], AC_MSG_ERROR([windres not found])) |
| 69 | AC_SUBST(WINDRES) | 110 | AC_SUBST(WINDRES) |
| 111 | activation_method="manual" | ||
| 112 | ;; | ||
| 113 | darwin*) | ||
| 114 | win32=false | ||
| 115 | AC_MSG_RESULT([no]) | ||
| 116 | activation_method="launchd" | ||
| 70 | ;; | 117 | ;; |
| 71 | *) | 118 | *) |
| 72 | win32=false | 119 | win32=false |
| 73 | AC_MSG_RESULT([no]) | 120 | AC_MSG_RESULT([no]) |
| 121 | UDEV_SUB=udev | ||
| 122 | activation_method="systemd" | ||
| 123 | if test "x$with_systemd" != "xyes"; then | ||
| 124 | echo "*** Note: support for systemd activation has been disabled, using udev activation instead ***" | ||
| 125 | activation_method="udev" | ||
| 126 | else | ||
| 127 | AC_DEFINE(WITH_SYSTEMD, 1, [Define to enable systemd support]) | ||
| 128 | SYSTEMD_SUB=systemd | ||
| 129 | fi | ||
| 74 | ;; | 130 | ;; |
| 75 | esac | 131 | esac |
| 76 | AM_CONDITIONAL(WIN32, test x$win32 = xtrue) | 132 | AM_CONDITIONAL(WIN32, test x$win32 = xtrue) |
| 77 | 133 | ||
| 134 | AC_SUBST([UDEV_SUB]) | ||
| 135 | AC_SUBST([SYSTEMD_SUB]) | ||
| 136 | |||
| 78 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-g -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") | 137 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-g -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") |
| 79 | AC_SUBST(GLOBAL_CFLAGS) | 138 | AC_SUBST(GLOBAL_CFLAGS) |
| 80 | 139 | ||
| @@ -83,15 +142,30 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | |||
| 83 | AC_OUTPUT([ | 142 | AC_OUTPUT([ |
| 84 | Makefile | 143 | Makefile |
| 85 | src/Makefile | 144 | src/Makefile |
| 86 | udev/39-usbmuxd.rules | 145 | udev/Makefile |
| 146 | systemd/Makefile | ||
| 87 | ]) | 147 | ]) |
| 88 | 148 | ||
| 89 | echo " | 149 | echo -n " |
| 90 | Configuration for $PACKAGE $VERSION: | 150 | Configuration for $PACKAGE $VERSION: |
| 91 | ------------------------------------------- | 151 | ------------------------------------------- |
| 92 | 152 | ||
| 93 | Install prefix: ...........: $prefix | 153 | install prefix ............: $prefix |
| 94 | Preflight worker support ..: $have_limd | 154 | preflight worker support ..: $have_limd |
| 155 | activation method .........: $activation_method | ||
| 156 | " | ||
| 157 | |||
| 158 | if test "x$activation_method" = "xsystemd"; then | ||
| 159 | echo -n " systemd unit directory ....: ${systemdsystemunitdir} | ||
| 160 | " | ||
| 161 | fi | ||
| 162 | |||
| 163 | if test -n "$udevrulesdir"; then | ||
| 164 | echo -n " udev rules directory ......: ${udevrulesdir} | ||
| 165 | " | ||
| 166 | fi | ||
| 167 | |||
| 168 | echo " compiler ..................: ${CC} | ||
| 95 | 169 | ||
| 96 | Now type 'make' to build $PACKAGE $VERSION, | 170 | Now type 'make' to build $PACKAGE $VERSION, |
| 97 | and then 'make install' for installation. | 171 | and then 'make install' for installation. |
