@@ -167,30 +167,31 @@ AM_CONDITIONAL(WNCKLET_INPROCESS, test -n "$WNCKLET_COMPILE_INPROCESS")
167167# For the run dialog
168168gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
169169
170- must_enable_x11=no
171- must_enable_wayland=no
172- try_all_backends=yes
173-
170+ # $enable_x11 and $enable_wayland will be set to "yes", "no" or "auto"
174171AC_ARG_ENABLE ( x11 ,
175172 [ AC_HELP_STRING ([ --enable-x11] ,
176- [ Enable X11 support and disable Wayland (unless it's also enabled explicitly)
177- @<:@ default=yes@:>@ ] )] ,
178- [ must_enable_x11=yes
179- try_all_backends=no] ,)
173+ [ Explicitly enable or disable X11 support
174+ (default is to enable only if X development libraries are detected)
175+ @<:@ default=auto:>@] )] ,
176+ [ enable_x11=$enableval] ,
177+ [ enable_x11=auto] )
180178
181179AC_ARG_ENABLE ( wayland ,
182180 [ AC_HELP_STRING ([ --enable-wayland] ,
183- [ Enable Wayland support and disable X11 (unless it's also enabled explicitly)
184- @<:@ default=yes@:>@ ] )] ,
185- [ must_enable_wayland=yes
186- try_all_backends=no] ,)
181+ [ Explicitly enable or disable Wayland support
182+ (default is to enable only if Wayland client development library is detected)
183+ @<:@ default=auto:>@] )] ,
184+ [ enable_wayland=$enableval] ,
185+ [ enable_wayland=auto] )
187186
188187# Check if we have wayland-client installed, and thus should build with Wayland support
189-
190188have_wayland=no
191-
192- if test "x$must_enable_wayland" = "xyes" -o "x$try_all_backends" = "xyes"; then
193- PKG_CHECK_MODULES(WAYLAND, wayland-client, have_wayland=yes,)
189+ if test "x$enable_wayland" != "xno"; then
190+ PKG_CHECK_MODULES(WAYLAND, wayland-client, have_wayland=yes, [
191+ if test "x$enable_wayland" = "xyes"; then
192+ AC_MSG_ERROR ( [ Wayland client library not found] )
193+ fi
194+ ] )
194195fi
195196
196197AM_CONDITIONAL(ENABLE_WAYLAND, [ test "x$have_wayland" = "xyes"] )
@@ -199,19 +200,14 @@ if test "x$have_wayland" = "xyes"; then
199200 AC_DEFINE ( HAVE_WAYLAND , 1 , [ Have the Wayland development library] )
200201fi
201202
202- # Error out if Wayland was required but not found
203- if test "x$have_wayland" != "xyes" -a "x$must_enable_wayland" = "xyes"; then
204- # The user has explicitly told us to use Wayland, but we can't find the library :(
205- AC_MSG_ERROR ( [ Wayland client library not found] )
206- fi
207-
208203# Check if we have the X development libraries
209- # (we can compile with X and/or Wayland supported)
210-
211204have_x11=no
212-
213- if test "x$must_enable_x11" = "xyes" -o "x$try_all_backends" = "xyes"; then
214- PKG_CHECK_MODULES(X, x11 xau, have_x11=yes, AC_MSG_ERROR ( [ X development libraries not found] ) )
205+ if test "x$enable_x11" != "xno"; then
206+ PKG_CHECK_MODULES(X, x11 xau, have_x11=yes, [
207+ if test "x$enable_x11" = "xyes"; then
208+ AC_MSG_ERROR ( [ X development libraries not found] )
209+ fi
210+ ] )
215211fi
216212
217213AM_CONDITIONAL(ENABLE_X11, [ test "x$have_x11" = "xyes"] )
@@ -221,7 +217,11 @@ if test "x$have_x11" = "xyes"; then
221217fi
222218
223219if test "x$have_x11" != "xyes" -a "x$have_wayland" != "xyes"; then
224- AC_MSG_ERROR ( [ No usable backend available, install X or Wayland development libraries] )
220+ if test "x$enable_wayland" = "xno" -a "x$enable_x11" = "xno"; then
221+ AC_MSG_ERROR ( [ At least one backend must be enabled] )
222+ else
223+ AC_MSG_ERROR ( [ No usable backend found, install X11 or Wayland development libraries] )
224+ fi
225225fi
226226
227227AC_SUBST ( X_LIBS )
@@ -362,8 +362,8 @@ echo "
362362 Maintainer mode: ${USE_MAINTAINER_MODE}
363363 Use *_DISABLE_DEPRECATED: ${enable_deprecation_flags}
364364 Applets to build in-process: ${PANEL_INPROCESS_APPLETS}
365- X11 support: ${have_x11}
366365 Wayland support: ${have_wayland}
366+ X11 support: ${have_x11}
367367 XRandr support: ${have_randr}
368368 Build introspection support: ${found_introspection}
369369 Build gtk-doc documentation: ${enable_gtk_doc}
0 commit comments