5858 fi
5959fi
6060
61+ AC_ARG_WITH ( [ udev] ,
62+ [ AS_HELP_STRING ( [ --with-udev] ,
63+ [ Build with udev support @<:@ default=auto@:>@ ] ) ] ,
64+ [ with_udev=$withval] ,
65+ [ with_udev=auto] )
66+ if test "x$with_udev" = "xauto"; then
67+ AC_MSG_CHECKING ( [ for udev] )
68+ PKG_CHECK_EXISTS([ udev] ,
69+ [ AC_MSG_RESULT ( [ yes] )
70+ with_udev=yes] ,
71+ [ AC_MSG_RESULT ( [ no] ) ] )
72+ fi
73+ if test "x$with_udev" = "xyes"; then
74+ AC_DEFINE ( [ HAVE_UDEV] , [ 1] , [ Define to enable udev support] )
75+ fi
76+
6177AC_ARG_WITH ( [ udevrulesdir] ,
6278 AS_HELP_STRING ( [ --with-udevrulesdir=DIR] ,
63- [ Directory for udev rules] ) ,
79+ [ Directory for udev rules @<:@ default=auto @:>@ ] ) ,
6480 [ ] ,
6581 [ with_udevrulesdir=auto] )
6682if 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
83+ PKG_CHECK_VAR([ UDEVDIR] , [ udev] , [ udevdir] ,
84+ [ with_udevrulesdir="${UDEVDIR}/rules.d"] ,
85+ [ with_udevrulesdir="${libdir}/udev/rules.d"] )
7386fi
87+ AC_SUBST ( [ udevrulesdir] , [ $with_udevrulesdir] )
88+ AM_CONDITIONAL([ WANT_UDEV] , [ test -n "$with_udevrulesdir" -a "x$with_udevrulesdir" != xno -a "x$with_udev" = "xyes"] )
7489
7590AC_ARG_WITH ( [ systemd] ,
76- [ AS_HELP_STRING ( [ --without -systemd] ,
77- [ do not build with systemd support @<:@ default=yes @:>@ ] ) ] ,
91+ [ AS_HELP_STRING ( [ --with -systemd] ,
92+ [ Build with systemd support @<:@ default=auto @:>@ ] ) ] ,
7893 [ with_systemd=$withval] ,
79- [ with_systemd=yes] )
94+ [ with_systemd=auto] )
95+ if test "x$with_systemd" = "xauto"; then
96+ AC_MSG_CHECKING ( [ for systemd] )
97+ PKG_CHECK_EXISTS([ systemd] ,
98+ [ AC_MSG_RESULT ( [ yes] )
99+ with_systemd=yes] ,
100+ [ AC_MSG_RESULT ( [ no] ) ] )
101+ fi
102+ if test "x$with_systemd" = "xyes"; then
103+ AC_DEFINE ( [ HAVE_SYSTEMD] , [ 1] , [ Define to enable systemd support] )
104+ fi
80105
81106AC_ARG_WITH ( [ systemdsystemunitdir] ,
82107 [ 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] )
108+ [ Directory for systemd service files @<:@ default=auto@:>@ ] ) ] ,
109+ [ ] ,
110+ [ with_systemdsystemunitdir=auto] )
111+ if test "x$with_systemdsystemunitdir" = "xauto"; then
112+ PKG_CHECK_VAR([ SYSTEMDSYSTEMUNITDIR] , [ systemd] , [ systemdsystemunitdir] ,
113+ [ with_systemdsystemunitdir="${SYSTEMDSYSTEMUNITDIR}"] ,
114+ [ with_systemdsystemunitdir=""] )
89115fi
90- AM_CONDITIONAL(WANT_SYSTEMD, [ test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes" ] )
116+ AC_SUBST ( [ systemdsystemunitdir] , [ $with_systemdsystemunitdir] )
117+ AM_CONDITIONAL([ WANT_SYSTEMD] , [ test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes"] )
91118
92119if test "x$with_systemd" = xyes; then
93120 udev_activation_rule="ENV{SYSTEMD_WANTS}=\"usbmuxd.service\""
@@ -116,8 +143,6 @@ AC_CHECK_FUNCS([ppoll clock_gettime localtime_r])
116143
117144# Check for operating system
118145AC_MSG_CHECKING ( [ whether to enable WIN32 build settings] )
119- UDEV_SUB=
120- SYSTEMD_SUB=
121146case ${host_os} in
122147 *mingw32*|*cygwin*)
123148 win32=true
@@ -135,24 +160,19 @@ case ${host_os} in
135160 *)
136161 win32=false
137162 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 ***"
163+ if test "x$with_udev" = "xyes"; then
144164 activation_method="udev"
165+ elif test "x$with_systemd" = "xyes"; then
166+ activation_method="systemd"
167+ echo "*** Note: support for udev activation has been disabled, using systemd activation instead ***"
145168 else
146- AC_DEFINE ( HAVE_SYSTEMD , 1 , [ Define to enable systemd support ] )
147- SYSTEMD_SUB= systemd
169+ activation_method="manual"
170+ echo "*** Note: support for udev/ systemd activation have been disabled, using manual activation instead ***"
148171 fi
149172 ;;
150173esac
151174AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
152175
153- AC_SUBST ( [ UDEV_SUB] )
154- AC_SUBST ( [ SYSTEMD_SUB] )
155-
156176AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter")
157177AC_SUBST ( GLOBAL_CFLAGS )
158178
@@ -180,11 +200,11 @@ Configuration for $PACKAGE $VERSION:
180200 preflight worker support ..: $have_limd
181201 activation method .........: $activation_method"
182202
183- if test "x$activation_method " = "xsystemd "; then
203+ if test "x$with_systemd " = "xyes "; then
184204 echo " systemd unit directory ....: ${systemdsystemunitdir}"
185205fi
186206
187- if test -n "$udevrulesdir "; then
207+ if test "x$with_udev" = "xyes "; then
188208 echo " udev rules directory ......: ${udevrulesdir}"
189209fi
190210
0 commit comments