comparison m4/m4_ax_have_qt.m4 @ 258:862d0d8619f6

*: HUUUGE changes animia has been renamed to animone, so instead of thinking of a health condition, you think of a beautiful flower :) I've also edited some of the code for animone, but I have no idea if it even works or not because I don't have a mac or windows machine lying around. whoops! ... anyway, all of the changes divergent from Anisthesia are now licensed under BSD. it's possible that I could even rewrite most of the code to where I don't even have to keep the MIT license, but that's thinking too far into the future I've been slacking off on implementing the anime seasons page, mostly out of laziness. I think I'd have to create another db file specifically for the seasons anyway, this code is being pushed *primarily* because the hard drive it's on is failing! yay :)
author Paper <paper@paper.us.eu.org>
date Mon, 01 Apr 2024 02:43:44 -0400
parents
children 9a04802848c0
comparison
equal deleted inserted replaced
257:699a20c57dc8 258:862d0d8619f6
1 # ===========================================================================
2 # https://www.gnu.org/software/autoconf-archive/ax_have_qt.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_HAVE_QT
8 #
9 # DESCRIPTION
10 #
11 # Searches $PATH and queries qmake for Qt include files, libraries and Qt
12 # binary utilities. The macro only supports Qt5 or later.
13 #
14 # The following shell variable is set to either "yes" or "no":
15 #
16 # have_qt
17 #
18 # Additionally, the following variables are exported:
19 #
20 # QT_CXXFLAGS
21 # QT_LIBS
22 # QT_MOC
23 # QT_UIC
24 # QT_RCC
25 # QT_LRELEASE
26 # QT_LUPDATE
27 # QT_DIR
28 # QMAKE
29 #
30 # which respectively contain an "-I" flag pointing to the Qt include
31 # directory, link flags necessary to link with Qt and X, the full path to
32 # the meta object compiler and the user interface compiler both, and
33 # finally the variable QTDIR as Qt likes to see it defined.
34 #
35 # Example lines for Makefile.in:
36 #
37 # CXXFLAGS = @QT_CXXFLAGS@
38 # MOC = @QT_MOC@
39 #
40 # After the variables have been set, a trial compile and link is performed
41 # to check the correct functioning of the meta object compiler. This test
42 # may fail when the different detected elements stem from different
43 # releases of the Qt framework. In that case, an error message is emitted
44 # and configure stops.
45 #
46 # No common variables such as $LIBS or $CFLAGS are polluted.
47 #
48 # LICENSE
49 #
50 # Copyright (c) 2008 Bastiaan Veelo <Bastiaan@Veelo.net>
51 # Copyright (c) 2014 Alex Henrie <alexhenrie24@gmail.com>
52 #
53 # Copying and distribution of this file, with or without modification, are
54 # permitted in any medium without royalty provided the copyright notice
55 # and this notice are preserved. This file is offered as-is, without any
56 # warranty.
57
58 #serial 25
59
60 AU_ALIAS([BNV_HAVE_QT], [AX_HAVE_QT])
61 AC_DEFUN([AX_HAVE_QT],
62 [
63 AC_REQUIRE([AC_PROG_CXX])
64 AC_REQUIRE([AC_PATH_X])
65 AC_REQUIRE([AC_PATH_XTRA])
66 # openSUSE leap 15.3 installs qmake-qt5, not qmake, for example.
67 # Store the full name (like qmake-qt5) into QMAKE
68 # and the specifier (like -qt5 or empty) into am_have_qt_qmexe_suff.
69 AC_ARG_VAR([QMAKE],"Qt make tool")
70 AC_CHECK_TOOLS([QMAKE],[qmake qmake-qt6 qmake-qt5],[false])
71
72 AC_MSG_CHECKING(for Qt)
73 am_have_qt_qmexe_suff=`echo $QMAKE | sed 's,^.*qmake,,'`
74 # If we have Qt5 or later in the path, we're golden
75 ver=`$QMAKE --version | grep -o "Qt version ."`
76
77 if test "$ver" ">" "Qt version 4"; then
78 have_qt=yes
79 # This pro file dumps qmake's variables, but it only works on Qt 5 or later
80 am_have_qt_dir=`mktemp -d`
81 am_have_qt_pro="$am_have_qt_dir/test.pro"
82 am_have_qt_stash="$am_have_qt_dir/.qmake.stash"
83 am_have_qt_makefile="$am_have_qt_dir/Makefile"
84 # http://qt-project.org/doc/qt-5/qmake-variable-reference.html#qt
85 cat > $am_have_qt_pro << EOF
86 win32 {
87 CONFIG -= debug_and_release
88 CONFIG += release
89 }
90 qtHaveModule(core): QT += core
91 qtHaveModule(gui): QT += gui
92 qtHaveModule(widgets): QT += widgets
93 percent.target = %
94 percent.commands = @echo -n "\$(\$(@))\ "
95 QMAKE_EXTRA_TARGETS += percent
96 EOF
97 $QMAKE $am_have_qt_pro -o $am_have_qt_makefile
98 QT_CXXFLAGS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile CXXFLAGS INCPATH`
99 QT_LIBS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile LIBS`
100 rm $am_have_qt_pro $am_have_qt_stash $am_have_qt_makefile
101 rmdir $am_have_qt_dir
102
103 # Look for specific tools in $PATH
104 QT_MOC=`which moc$am_have_qt_qmexe_suff`
105 QT_UIC=`which uic$am_have_qt_qmexe_suff`
106 QT_RCC=`which rcc$am_have_qt_qmexe_suff`
107 QT_LRELEASE=`which lrelease$am_have_qt_qmexe_suff`
108 QT_LUPDATE=`which lupdate$am_have_qt_qmexe_suff`
109
110 # Get Qt version from qmake
111 QT_DIR=`$QMAKE --version | grep -o -E /.+`
112
113 # All variables are defined, report the result
114 AC_MSG_RESULT([$have_qt:
115 QT_CXXFLAGS=$QT_CXXFLAGS
116 QT_DIR=$QT_DIR
117 QT_LIBS=$QT_LIBS
118 QT_UIC=$QT_UIC
119 QT_MOC=$QT_MOC
120 QT_RCC=$QT_RCC
121 QT_LRELEASE=$QT_LRELEASE
122 QT_LUPDATE=$QT_LUPDATE])
123 else
124 # Qt was not found
125 have_qt=no
126 QT_CXXFLAGS=
127 QT_DIR=
128 QT_LIBS=
129 QT_UIC=
130 QT_MOC=
131 QT_RCC=
132 QT_LRELEASE=
133 QT_LUPDATE=
134 AC_MSG_RESULT($have_qt)
135 fi
136 AC_SUBST(QT_CXXFLAGS)
137 AC_SUBST(QT_DIR)
138 AC_SUBST(QT_LIBS)
139 AC_SUBST(QT_UIC)
140 AC_SUBST(QT_MOC)
141 AC_SUBST(QT_RCC)
142 AC_SUBST(QT_LRELEASE)
143 AC_SUBST(QT_LUPDATE)
144 AC_SUBST(QMAKE)
145
146 #### Being paranoid:
147 if test x"$have_qt" = xyes; then
148 AC_MSG_CHECKING(correct functioning of Qt installation)
149 AC_CACHE_VAL(ax_cv_qt_test_result,
150 [
151 cat > ax_qt_test.h << EOF
152 #include <qobject.h>
153 class Test : public QObject
154 {
155 Q_OBJECT
156 public:
157 Test() {}
158 ~Test() {}
159 public slots:
160 void receive() {}
161 signals:
162 void send();
163 };
164 EOF
165
166 cat > ax_qt_main.$ac_ext << EOF
167 #include "ax_qt_test.h"
168 #include <qapplication.h>
169 int main( int argc, char **argv )
170 {
171 QApplication app( argc, argv );
172 Test t;
173 QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
174 }
175 EOF
176
177 ax_cv_qt_test_result="failure"
178 ax_try_1="$QT_MOC ax_qt_test.h -o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null"
179 AC_TRY_EVAL(ax_try_1)
180 if test x"$ac_status" != x0; then
181 echo "$ax_err_1" >&AS_MESSAGE_LOG_FD
182 echo "configure: could not run $QT_MOC on:" >&AS_MESSAGE_LOG_FD
183 cat ax_qt_test.h >&AS_MESSAGE_LOG_FD
184 else
185 ax_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_ax_qt_test.o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null"
186 AC_TRY_EVAL(ax_try_2)
187 if test x"$ac_status" != x0; then
188 echo "$ax_err_2" >&AS_MESSAGE_LOG_FD
189 echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD
190 cat moc_ax_qt_test.$ac_ext >&AS_MESSAGE_LOG_FD
191 else
192 ax_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o ax_qt_main.o ax_qt_main.$ac_ext >/dev/null 2>/dev/null"
193 AC_TRY_EVAL(ax_try_3)
194 if test x"$ac_status" != x0; then
195 echo "$ax_err_3" >&AS_MESSAGE_LOG_FD
196 echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD
197 cat ax_qt_main.$ac_ext >&AS_MESSAGE_LOG_FD
198 else
199 ax_try_4="$CXX -o ax_qt_main ax_qt_main.o moc_ax_qt_test.o $QT_LIBS $LIBS >/dev/null 2>/dev/null"
200 AC_TRY_EVAL(ax_try_4)
201 if test x"$ac_status" != x0; then
202 echo "$ax_err_4" >&AS_MESSAGE_LOG_FD
203 else
204 ax_cv_qt_test_result="success"
205 fi
206 fi
207 fi
208 fi
209 ])dnl AC_CACHE_VAL ax_cv_qt_test_result
210 AC_MSG_RESULT([$ax_cv_qt_test_result])
211 if test x"$ax_cv_qt_test_result" = "xfailure"; then
212 AC_MSG_ERROR([Failed to find matching components of a complete
213 Qt installation. Try using more options,
214 see ./configure --help.])
215 fi
216
217 rm -f ax_qt_test.h moc_ax_qt_test.$ac_ext moc_ax_qt_test.o \
218 ax_qt_main.$ac_ext ax_qt_main.o ax_qt_main
219 fi
220 ])