summaryrefslogtreecommitdiff
blob: 015a92fbd78fe9d40c0137c48e25540dc6c1225a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
https://bugs.gentoo.org/927380

Allow non-gui builds to configure without gui dependencies.

--- a/ac/qt6.m4
+++ b/ac/qt6.m4
@@ -113,13 +113,15 @@ HEADERS = configure.h
 SOURCES = configure.cpp
 EOT
 
-  "$QMAKE6" -makefile -nocache $QMAKE_SPEC configure.pro 2>&5 > /dev/null
-  result2=$?
+  if test x"$enable_gui" = xyes; then
+    "$QMAKE6" -makefile -nocache $QMAKE_SPEC configure.pro 2>&5 > /dev/null
+    result2=$?
 
-  if test $result2 != 0; then
-    cd "$old_wd"
-    AC_MSG_RESULT(no: not all of the required Qt6 modules were found (needed: core gui widgets network concurrent svg multimedia))
-    return
+    if test $result2 != 0; then
+      cd "$old_wd"
+      AC_MSG_RESULT(no: not all of the required Qt6 modules were found (needed: core gui widgets network concurrent svg multimedia))
+      return
+    fi
   fi
 
   if test -f Makefile.Release; then
@@ -135,7 +137,7 @@ EOT
 
   cd "$old_wd"
 
-  if test $result != 0 -o $result2 != 0 -o $result3 != 0; then
+  if test $result != 0 -o $result3 != 0; then
     AC_MSG_CHECKING(for Qt 6)
     AC_MSG_RESULT(no: qmake6 couldn't be run for a dummy project)
 
@@ -169,9 +171,15 @@ EOT
 
   qt_searchpath="$qt_libexecdir:$qt_bindir:$PATH"
 
-  QT_CFLAGS="`$ac_cv_path_EGREP '^DEFINES *=' "$qmake_dir/Makefile" | sed 's/^DEFINES *= *//'`"
-  QT_CFLAGS="$QT_CFLAGS `$ac_cv_path_EGREP '^CXXFLAGS *=' "$qmake_dir/Makefile" | sed -e 's/^CXXFLAGS *= *//' -e 's/-pipe//g' -e 's/-O.//g' -e 's/ -f[[a-z]][[^ ]]*//g' -e 's/ -W[[^ ]]*//g' -e 's/-std=[[^ ]]*//g' -e 's/\$([[^)]]*)//g'`"
-  QT_INCFLAGS="`$ac_cv_path_EGREP '^INCPATH *=' "$qmake_dir/Makefile" | sed -e 's/^INCPATH *= *//'`"
+  if test x"$enable_gui" = xyes; then
+    QT_CFLAGS="`$ac_cv_path_EGREP '^DEFINES *=' "$qmake_dir/Makefile" | sed 's/^DEFINES *= *//'`"
+    QT_CFLAGS="$QT_CFLAGS `$ac_cv_path_EGREP '^CXXFLAGS *=' "$qmake_dir/Makefile" | sed -e 's/^CXXFLAGS *= *//' -e 's/-pipe//g' -e 's/-O.//g' -e 's/ -f[[a-z]][[^ ]]*//g' -e 's/ -W[[^ ]]*//g' -e 's/-std=[[^ ]]*//g' -e 's/\$([[^)]]*)//g'`"
+    QT_INCFLAGS="`$ac_cv_path_EGREP '^INCPATH *=' "$qmake_dir/Makefile" | sed -e 's/^INCPATH *= *//'`"
+  else
+    QT_CFLAGS="`$ac_cv_path_EGREP '^DEFINES *=' "$qmake_dir/Makefile.non_gui" | sed 's/^DEFINES *= *//'`"
+    QT_CFLAGS="$QT_CFLAGS `$ac_cv_path_EGREP '^CXXFLAGS *=' "$qmake_dir/Makefile.non_gui" | sed -e 's/^CXXFLAGS *= *//' -e 's/-pipe//g' -e 's/-O.//g' -e 's/ -f[[a-z]][[^ ]]*//g' -e 's/ -W[[^ ]]*//g' -e 's/-std=[[^ ]]*//g' -e 's/\$([[^)]]*)//g'`"
+    QT_INCFLAGS="`$ac_cv_path_EGREP '^INCPATH *=' "$qmake_dir/Makefile.non_gui" | sed -e 's/^INCPATH *= *//'`"
+  fi
 
   # If under MinGW/MSYS2, fix relative include paths
   if ! test -z "${MINGW_PREFIX}"; then
@@ -181,16 +189,18 @@ EOT
   QT_INCFLAGS="`echo $QT_INCFLAGS | sed -e 's:-I[[^/]][[^ ]]*::g'`"
   QT_CFLAGS="$QT_CFLAGS $QT_INCFLAGS"
   QT_CFLAGS="`echo $QT_CFLAGS | sed -e 's/\$(EXPORT_ARCH_ARGS)//'`"
-  QT_LIBS="`$ac_cv_path_EGREP '^LFLAGS *=' "$qmake_dir/Makefile" | sed -e 's/^LFLAGS *= *//' -e 's/-Wl,-O[[^ ]]*//g' -e 's/ -f[[a-z]][[^ ]]*//g'`"
-  QT_LIBS="$QT_LIBS `$ac_cv_path_EGREP '^LIBS *=' "$qmake_dir/Makefile" | sed -e 's/^LIBS *= *//' -e 's/\$([[^)]]*)//g' -e 's:-L[[^/]][[^ ]]*::g'`"
-  QT_LIBS="`echo $QT_LIBS | sed -e 's/\$(EXPORT_ARCH_ARGS)//'`"
+  if test x"$enable_gui" = xyes; then
+    QT_LIBS="`$ac_cv_path_EGREP '^LFLAGS *=' "$qmake_dir/Makefile" | sed -e 's/^LFLAGS *= *//' -e 's/-Wl,-O[[^ ]]*//g' -e 's/ -f[[a-z]][[^ ]]*//g'`"
+    QT_LIBS="$QT_LIBS `$ac_cv_path_EGREP '^LIBS *=' "$qmake_dir/Makefile" | sed -e 's/^LIBS *= *//' -e 's/\$([[^)]]*)//g' -e 's:-L[[^/]][[^ ]]*::g'`"
+    QT_LIBS="`echo $QT_LIBS | sed -e 's/\$(EXPORT_ARCH_ARGS)//'`"
+  fi
   QT_LIBS_NON_GUI="`$ac_cv_path_EGREP '^LFLAGS *=' "$qmake_dir/Makefile.non_gui" | sed -e 's/^LFLAGS *= *//' -e 's/-Wl,-O[[^ ]]*//g' -e 's/ -f[[a-z]][[^ ]]*//g'`"
   QT_LIBS_NON_GUI="$QT_LIBS_NON_GUI `$ac_cv_path_EGREP '^LIBS *=' "$qmake_dir/Makefile.non_gui" | sed -e 's/^LIBS *= *//' -e 's/\$([[^)]]*)//g' -e 's:-L[[^/]][[^ ]]*::g'`"
   QT_LIBS_NON_GUI="`echo $QT_LIBS_NON_GUI | sed -e 's/\$(EXPORT_ARCH_ARGS)//' -e 's/-Wl,-subsystem,windows *//g'`"
 
   rm -rf "$qmake_dir"
 
-  if test x"$QT_CFLAGS" = x -o x"$QT_LIBS" = x -o x"$QT_LIBS_NON_GUI" = x; then
+  if test x"$QT_CFLAGS" = x -o [ x"$enable_gui" = xyes -a x"$QT_LIBS" = x ] -o x"$QT_LIBS_NON_GUI" = x; then
     AC_MSG_CHECKING(for Qt 6)
     AC_MSG_RESULT(no: could not extract one or more compiler flags from Makefile generated by qmake6)
     return
@@ -223,7 +233,7 @@ EOT
     ac_save_CXXFLAGS="$CXXFLAGS"
     ac_save_LIBS="$LIBS"
     CXXFLAGS="$STD_CXX $CXXFLAGS $QT_CFLAGS -fPIC"
-    LIBS="$LDFLAGS $QT_LIBS"
+    LIBS="$LDFLAGS $QT_LIBS_NON_GUI"
     unset ac_cv_qt_compilation
 
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[