summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac195
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
4AC_PREREQ([2.68])
5AC_INIT([usbmuxd], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/usbmuxd/issues], [], [https://libimobiledevice.org])
6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news])
7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
8AC_CONFIG_SRCDIR([src/])
9AC_CONFIG_HEADERS([config.h])
10AC_CONFIG_MACRO_DIR([m4])
11
12# Check if we have a version defined
13if 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.])
15fi
16
17# Checks for programs.
18AC_PROG_CC
19AM_PROG_CC_C_O
20LT_INIT
21
22# Checks for libraries.
23PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.9)
24PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.6.0)
25PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.3.0, have_limd=yes, have_limd=no)
26PKG_CHECK_MODULES(limd_glue, libimobiledevice-glue-1.0 >= 1.0.0)
27
28AC_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
34if 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
55else
56 if test "x$with_preflight" == "xyes"; then
57 AC_MSG_ERROR([preflight worker support requested but libimobiledevice could not be found])
58 fi
59fi
60
61AC_ARG_WITH([udevrulesdir],
62 AS_HELP_STRING([--with-udevrulesdir=DIR],
63 [Directory for udev rules]),
64 [],
65 [with_udevrulesdir=auto])
66if 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
73fi
74
75AC_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
81AC_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
87if test "x$with_systemdsystemunitdir" != xno; then
88 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
89fi
90AM_CONDITIONAL(WANT_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes" ])
91
92if test "x$with_systemd" = xyes; then
93 udev_activation_rule="ENV{SYSTEMD_WANTS}=\"usbmuxd.service\""
94else
95 udev_activation_rule="RUN+=\"@sbindir@/usbmuxd --user usbmux --udev\""
96fi
97AC_SUBST(udev_activation_rule)
98
99# Checks for header files.
100AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
101
102# Checks for typedefs, structures, and compiler characteristics.
103AC_C_CONST
104AC_TYPE_SIZE_T
105AC_TYPE_SSIZE_T
106AC_TYPE_UINT16_T
107AC_TYPE_UINT32_T
108AC_TYPE_UINT8_T
109
110# Check if clock_gettime requires -lrt (old GNU systems)
111AC_SEARCH_LIBS([clock_gettime],[rt posix4])
112
113# Checks for library functions.
114AC_CHECK_FUNCS([strcasecmp strdup strerror strndup malloc realloc])
115AC_CHECK_FUNCS([ppoll clock_gettime localtime_r])
116
117# Check for operating system
118AC_MSG_CHECKING([whether to enable WIN32 build settings])
119UDEV_SUB=
120SYSTEMD_SUB=
121case ${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 ;;
150esac
151AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
152
153AC_SUBST([UDEV_SUB])
154AC_SUBST([SYSTEMD_SUB])
155
156AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter")
157AC_SUBST(GLOBAL_CFLAGS)
158
159m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
160
161# workaround for older autoconf versions
162if test "x$runstatedir" == "x"; then
163 runstatedir=$localstatedir/run
164fi
165
166AC_CONFIG_FILES([
167Makefile
168src/Makefile
169udev/Makefile
170systemd/Makefile
171docs/Makefile
172])
173AC_OUTPUT
174
175echo "
176Configuration for $PACKAGE $VERSION:
177-------------------------------------------
178
179 install prefix ............: $prefix
180 preflight worker support ..: $have_limd
181 activation method .........: $activation_method"
182
183if test "x$activation_method" = "xsystemd"; then
184 echo " systemd unit directory ....: ${systemdsystemunitdir}"
185fi
186
187if test -n "$udevrulesdir"; then
188 echo " udev rules directory ......: ${udevrulesdir}"
189fi
190
191echo " compiler ..................: ${CC}
192
193 Now type 'make' to build $PACKAGE $VERSION,
194 and then 'make install' for installation.
195"