Mercurial > dwindows
comparison configure @ 2748:d8db838d5616
Rewrite the configure GTK and WebKitGTK test section.
The old code was way too confusing and complicated with nested ifs.
Simplify the code with a primary and alternate webkit package.
Display the selected GTK version and WebKit package during configure.
This change removed a "WebKitGtk" package, which I am not sure what it was
from... but if it causes problems revisit later. --with-gtk4 will override
--with-gtk2 now and will always default to GTK3. If --with-gtk2 is used with
no GTK2 installed or --with-gtk4 is used with no GTK4 installed use GTK3.
Then in a second pass we check the package we have selected and add any
necessary defines so the correct code paths are followed during compile.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 28 Dec 2021 11:00:26 +0000 |
parents | c83d6261ce3e |
children | 7479ab54e014 |
comparison
equal
deleted
inserted
replaced
2747:c83d6261ce3e | 2748:d8db838d5616 |
---|---|
5477 $as_echo "no" >&6; } | 5477 $as_echo "no" >&6; } |
5478 fi | 5478 fi |
5479 | 5479 |
5480 | 5480 |
5481 if test x"$PKG_CFG" != x; then | 5481 if test x"$PKG_CFG" != x; then |
5482 # Figure out the best available GTK packages... | |
5483 # Preference order GTK3>GTK4>GTK2, WebKit2>WebKit1.1>WebKit1.0>WebKit | |
5482 GTK_LIBS="" | 5484 GTK_LIBS="" |
5483 if test $with_gtk2 = "yes"; then | 5485 GTK_PACKAGES="" |
5484 DW_DIR=gtk | 5486 WEBKIT_PKG="" |
5485 GTK_PACKAGES="gtk+-2.0 gthread-2.0" | 5487 WEBKIT_ALT_PKG="" |
5486 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` | |
5487 fi | |
5488 # Default WebKitGTK test is 4.0 for GTK3 | |
5489 WEBKIT_PKG="webkit2gtk-4.0" | |
5490 if test $with_gtk4 = "yes"; then | 5488 if test $with_gtk4 = "yes"; then |
5491 DW_DIR=gtk4 | |
5492 # First try the X11 version so we can call Xlib directly | 5489 # First try the X11 version so we can call Xlib directly |
5493 # to fill in the holes not available with Wayland | 5490 # to fill in the holes not available with Wayland |
5494 GTK_PACKAGES="gtk4-x11" | 5491 GTK_PACKAGES="gtk4-x11" |
5495 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` | 5492 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` |
5496 if test x"$GTK_LIBS" = x; then | 5493 if test x"$GTK_LIBS" = x; then |
5497 GTK_PACKAGES="gtk4" | 5494 GTK_PACKAGES="gtk4" |
5498 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` | 5495 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` |
5499 fi | 5496 fi |
5500 # WebKitGTK built for GTK4 becomes 5.0 | 5497 if test x"$GTK_LIBS" != x; then |
5501 WEBKIT_PKG="webkitgtk-5.0" | 5498 DW_DIR=gtk4 |
5499 # WebKit2GTK built for GTK4 becomes 5.0 | |
5500 WEBKIT_PKG="webkit2gtk-5.0" | |
5501 fi | |
5502 else | |
5503 # Put the GTK2 test here since --with-gtk2 is mutually | |
5504 # exclusive with --with-gtk4 | |
5505 if test $with_gtk2 = "yes"; then | |
5506 GTK_PACKAGES="gtk+-2.0 gthread-2.0" | |
5507 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` | |
5508 if test x"$GTK_LIBS" != x; then | |
5509 DW_DIR=gtk | |
5510 WEBKIT_PKG="webkit-1.1" | |
5511 WEBKIT_ALT_PKG="webkit-1.0" | |
5512 fi | |
5513 fi | |
5502 fi | 5514 fi |
5515 # We did not successfully find a GTK installation after | |
5516 # handling --with-gtk2 and --with-gtk4 so try GTK3 | |
5503 if test x"$GTK_LIBS" = x; then | 5517 if test x"$GTK_LIBS" = x; then |
5518 # GTK3 Defaults section | |
5504 GTK_PACKAGES="gtk+-3.0" | 5519 GTK_PACKAGES="gtk+-3.0" |
5505 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` | 5520 GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES` |
5506 else | 5521 WEBKIT_PKG="webkit2gtk-4.0" |
5507 WEBKIT_PKG="webkit-1.1" | 5522 WEBKIT_ALT_PKG="webkitgtk-3.0" |
5508 fi | 5523 fi |
5509 # test for webkit2gtk or webkitgtk packages | 5524 echo "checking for GTK version: $DW_DIR" |
5510 WEBKIT_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG` | 5525 # Test for the preferred WebKit package |
5511 if test x"$WEBKIT_CFLAGS" = x; then | 5526 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG` |
5512 # no webkit2gtk-4.0 or webkitgtk-1.1 | 5527 if test x"$WEBKIT_LIBS" = x; then |
5513 if test $DW_DIR = "gtk"; then | 5528 # Preferred package is not available, try the alternate if defined |
5514 WEBKIT_PKG="webkit-1.0" | 5529 if test x"$WEBKIT_ALT_PKG" != x; then |
5515 WEBKIT_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG` | 5530 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_ALT_PKG` |
5516 if test x"$WEBKIT_CFLAGS" = x; then | 5531 if test x"$WEBKIT_LIBS" != x; then |
5517 WEBKIT_PKG="WebKitGtk" | 5532 WEBKIT_PKG=$WEBKIT_ALT_PKG |
5518 WEBKIT_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG` | |
5519 if test x"$WEBKIT_CFLAGS" = x; then | |
5520 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG` | |
5521 fi | |
5522 else | |
5523 $as_echo "#define USE_WEBKIT10 1" >>confdefs.h | |
5524 | |
5525 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG` | |
5526 fi | |
5527 else | |
5528 if test $DW_DIR = "gtk3"; then | |
5529 WEBKIT_PKG="webkitgtk-3.0" | |
5530 WEBKIT_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG` | |
5531 if test x"$WEBKIT_CFLAGS" = x; then | |
5532 WEBKIT_PKG="webkitgtk-1.0" | |
5533 WEBKIT_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG` | |
5534 if test x"$WEBKIT_CFLAGS" = x; then | |
5535 $as_echo "#define USE_WEBKIT10 1" >>confdefs.h | |
5536 | |
5537 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG` | |
5538 fi | |
5539 else | |
5540 $as_echo "#define USE_WEBKIT11 1" >>confdefs.h | |
5541 | |
5542 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG` | |
5543 fi | |
5544 fi | 5533 fi |
5545 fi | 5534 fi |
5546 else | 5535 fi |
5547 WEBKIT_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG` | 5536 echo "checking for WebKit package: $WEBKIT_PKG" |
5548 if test $with_gtk2 = "yes"; then | 5537 WEBKIT_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG` |
5538 # If we got a WebKit package that might work... | |
5539 # Add defintitions necessary for the correct code paths | |
5540 if test x"$WEBKIT_LIBS" != x; then | |
5541 if test "$WEBKIT_PKG" = "webkit-1.0"; then | |
5542 $as_echo "#define USE_WEBKIT10 1" >>confdefs.h | |
5543 | |
5544 fi | |
5545 if test "$WEBKIT_PKG" = "webkit-1.1"; then | |
5549 $as_echo "#define USE_WEBKIT11 1" >>confdefs.h | 5546 $as_echo "#define USE_WEBKIT11 1" >>confdefs.h |
5550 | 5547 |
5551 else | 5548 fi |
5549 if test "$WEBKIT_PKG" = "webkit2gtk-4.0"; then | |
5552 $as_echo "#define USE_WEBKIT2 1" >>confdefs.h | 5550 $as_echo "#define USE_WEBKIT2 1" >>confdefs.h |
5553 | 5551 |
5554 fi | 5552 fi |
5555 fi | 5553 fi |
5556 if test x"$RPATH" != x; then | 5554 if test x"$RPATH" != x; then |