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([ with_systemdsystemunitdir] , [ systemd] , [ systemdsystemunitdir] )
89113fi
90- AM_CONDITIONAL(WANT_SYSTEMD, [ test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes" ] )
114+ AC_SUBST ( [ systemdsystemunitdir] , [ $with_systemdsystemunitdir] )
115+ AM_CONDITIONAL([ WANT_SYSTEMD] , [ test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno -a "x$with_systemd" = "xyes"] )
91116
92117if test "x$with_systemd" = xyes; then
93118 udev_activation_rule="ENV{SYSTEMD_WANTS}=\"usbmuxd.service\""
@@ -116,8 +141,6 @@ AC_CHECK_FUNCS([ppoll clock_gettime localtime_r])
116141
117142# Check for operating system
118143AC_MSG_CHECKING ( [ whether to enable WIN32 build settings] )
119- UDEV_SUB=
120- SYSTEMD_SUB=
121144case ${host_os} in
122145 *mingw32*|*cygwin*)
123146 win32=true
@@ -135,24 +158,19 @@ case ${host_os} in
135158 *)
136159 win32=false
137160 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 ***"
161+ if test "x$with_udev" = "xyes"; then
144162 activation_method="udev"
163+ elif test "x$with_systemd" = "xyes"; then
164+ activation_method="systemd"
165+ echo "*** Note: support for udev activation has been disabled, using systemd activation instead ***"
145166 else
146- AC_DEFINE ( HAVE_SYSTEMD , 1 , [ Define to enable systemd support ] )
147- SYSTEMD_SUB= systemd
167+ activation_method="manual"
168+ echo "*** Note: support for udev/ systemd activation have been disabled, using manual activation instead ***"
148169 fi
149170 ;;
150171esac
151172AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
152173
153- AC_SUBST ( [ UDEV_SUB] )
154- AC_SUBST ( [ SYSTEMD_SUB] )
155-
156174AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter")
157175AC_SUBST ( GLOBAL_CFLAGS )
158176
@@ -180,11 +198,11 @@ Configuration for $PACKAGE $VERSION:
180198 preflight worker support ..: $have_limd
181199 activation method .........: $activation_method"
182200
183- if test "x$activation_method " = "xsystemd "; then
201+ if test "x$with_systemd " = "xyes "; then
184202 echo " systemd unit directory ....: ${systemdsystemunitdir}"
185203fi
186204
187- if test -n "$udevrulesdir "; then
205+ if test "x$with_udev" = "xyes "; then
188206 echo " udev rules directory ......: ${udevrulesdir}"
189207fi
190208
0 commit comments