Mercurial > minori
comparison m4/m4_ax_have_qt.m4 @ 241:06d6c351925c
*: reorganize resources, +docs, build translations with autotools
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Mon, 22 Jan 2024 16:36:19 -0500 |
| parents | 6ffe42286978 |
| children | 82470f83f0c2 |
comparison
equal
deleted
inserted
replaced
| 240:6ffe42286978 | 241:06d6c351925c |
|---|---|
| 47 # | 47 # |
| 48 # LICENSE | 48 # LICENSE |
| 49 # | 49 # |
| 50 # Copyright (c) 2008 Bastiaan Veelo <Bastiaan@Veelo.net> | 50 # Copyright (c) 2008 Bastiaan Veelo <Bastiaan@Veelo.net> |
| 51 # Copyright (c) 2014 Alex Henrie <alexhenrie24@gmail.com> | 51 # Copyright (c) 2014 Alex Henrie <alexhenrie24@gmail.com> |
| 52 # Copyright (c) 2024 Paper <mrpapersonic@gmail.com> | |
| 53 # | 52 # |
| 54 # Copying and distribution of this file, with or without modification, are | 53 # Copying and distribution of this file, with or without modification, are |
| 55 # permitted in any medium without royalty provided the copyright notice | 54 # permitted in any medium without royalty provided the copyright notice |
| 56 # and this notice are preserved. This file is offered as-is, without any | 55 # and this notice are preserved. This file is offered as-is, without any |
| 57 # warranty. | 56 # warranty. |
| 59 #serial 25 | 58 #serial 25 |
| 60 | 59 |
| 61 AU_ALIAS([BNV_HAVE_QT], [AX_HAVE_QT]) | 60 AU_ALIAS([BNV_HAVE_QT], [AX_HAVE_QT]) |
| 62 AC_DEFUN([AX_HAVE_QT], | 61 AC_DEFUN([AX_HAVE_QT], |
| 63 [ | 62 [ |
| 64 AC_REQUIRE([AC_PROG_CXX]) | 63 AC_REQUIRE([AC_PROG_CXX]) |
| 65 AC_REQUIRE([AC_PATH_X]) | 64 AC_REQUIRE([AC_PATH_X]) |
| 66 AC_REQUIRE([AC_PATH_XTRA]) | 65 AC_REQUIRE([AC_PATH_XTRA]) |
| 67 # openSUSE leap 15.3 installs qmake-qt5, not qmake, for example. | 66 # openSUSE leap 15.3 installs qmake-qt5, not qmake, for example. |
| 68 # Store the full name (like qmake-qt5) into QMAKE | 67 # Store the full name (like qmake-qt5) into QMAKE |
| 69 # and the specifier (like -qt5 or empty) into am_have_qt_qmexe_suff. | 68 # and the specifier (like -qt5 or empty) into am_have_qt_qmexe_suff. |
| 70 AC_ARG_VAR([QMAKE],"Qt make tool") | 69 AC_ARG_VAR([QMAKE],"Qt make tool") |
| 71 AC_CHECK_TOOLS([QMAKE],[qmake qmake-qt6 qmake-qt5],[false]) | 70 AC_CHECK_TOOLS([QMAKE],[qmake qmake-qt6 qmake-qt5],[false]) |
| 72 | 71 |
| 73 AC_MSG_CHECKING(for Qt) | 72 AC_MSG_CHECKING(for Qt) |
| 74 am_have_qt_qmexe_suff=`echo $QMAKE | sed 's,^.*qmake,,'` | 73 am_have_qt_qmexe_suff=`echo $QMAKE | sed 's,^.*qmake,,'` |
| 75 # If we have Qt5 or later in the path, we're golden | 74 # If we have Qt5 or later in the path, we're golden |
| 76 ver=`$QMAKE --version | grep -o "Qt version ."` | 75 ver=`$QMAKE --version | grep -o "Qt version ."` |
| 77 | 76 |
| 78 if test "$ver" ">" "Qt version 4"; then | 77 if test "$ver" ">" "Qt version 4"; then |
| 79 have_qt=yes | 78 have_qt=yes |
| 80 # This pro file dumps qmake's variables, but it only works on Qt 5 or later | 79 # This pro file dumps qmake's variables, but it only works on Qt 5 or later |
| 81 am_have_qt_dir=`mktemp -d` | 80 am_have_qt_dir=`mktemp -d` |
| 82 am_have_qt_pro="$am_have_qt_dir/test.pro" | 81 am_have_qt_pro="$am_have_qt_dir/test.pro" |
| 83 am_have_qt_stash="$am_have_qt_dir/.qmake.stash" | 82 am_have_qt_stash="$am_have_qt_dir/.qmake.stash" |
| 84 am_have_qt_makefile="$am_have_qt_dir/Makefile" | 83 am_have_qt_makefile="$am_have_qt_dir/Makefile" |
| 85 am_have_qt_makefile_cxxflags="$am_have_qt_dir/cxxm" | 84 # http://qt-project.org/doc/qt-5/qmake-variable-reference.html#qt |
| 86 am_have_qt_makefile_libs="$am_have_qt_dir/libsm" | 85 cat > $am_have_qt_pro << EOF |
| 87 # http://qt-project.org/doc/qt-5/qmake-variable-reference.html#qt | |
| 88 cat > $am_have_qt_pro << EOF | |
| 89 win32 { | 86 win32 { |
| 90 CONFIG -= debug_and_release | 87 CONFIG -= debug_and_release |
| 91 CONFIG += release | 88 CONFIG += release |
| 92 } | 89 } |
| 93 mac { | |
| 94 CONFIG += sdk_no_version_check | |
| 95 } | |
| 96 # commented out all the modules we don't use | |
| 97 # - paper | |
| 98 #qtHaveModule(axcontainer): QT += axcontainer | 90 #qtHaveModule(axcontainer): QT += axcontainer |
| 99 #qtHaveModule(axserver): QT += axserver | 91 #qtHaveModule(axserver): QT += axserver |
| 100 #qtHaveModule(concurrent): QT += concurrent | 92 #qtHaveModule(concurrent): QT += concurrent |
| 101 qtHaveModule(core): QT += core | 93 qtHaveModule(core): QT += core |
| 102 #qtHaveModule(dbus): QT += dbus | 94 #qtHaveModule(dbus): QT += dbus |
| 127 qtHaveModule(widgets): QT += widgets | 119 qtHaveModule(widgets): QT += widgets |
| 128 percent.target = % | 120 percent.target = % |
| 129 percent.commands = @echo -n "\$(\$(@))\ " | 121 percent.commands = @echo -n "\$(\$(@))\ " |
| 130 QMAKE_EXTRA_TARGETS += percent | 122 QMAKE_EXTRA_TARGETS += percent |
| 131 EOF | 123 EOF |
| 132 cat > $am_have_qt_makefile_cxxflags << EOF | 124 $QMAKE $am_have_qt_pro -o $am_have_qt_makefile |
| 133 include $am_have_qt_makefile | 125 QT_CXXFLAGS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile CXXFLAGS INCPATH` |
| 134 | 126 QT_LIBS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile LIBS` |
| 135 VAR: | 127 rm $am_have_qt_pro $am_have_qt_stash $am_have_qt_makefile |
| 136 @echo \$(CXXFLAGS) \$(INCPATH) | 128 rmdir $am_have_qt_dir |
| 137 EOF | 129 |
| 138 cat > $am_have_qt_makefile_libs << EOF | 130 # Look for specific tools in $PATH |
| 139 include $am_have_qt_makefile | 131 QT_MOC=`which moc$am_have_qt_qmexe_suff` |
| 140 | 132 QT_UIC=`which uic$am_have_qt_qmexe_suff` |
| 141 VAR: | 133 QT_RCC=`which rcc$am_have_qt_qmexe_suff` |
| 142 @echo \$(LIBS) | 134 QT_LRELEASE=`which lrelease$am_have_qt_qmexe_suff` |
| 143 EOF | 135 QT_LUPDATE=`which lupdate$am_have_qt_qmexe_suff` |
| 144 $QMAKE "$am_have_qt_pro" -o "$am_have_qt_makefile" | 136 |
| 145 QT_CXXFLAGS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile_cxxflags VAR` | 137 # Get Qt version from qmake |
| 146 QT_LIBS=`cd $am_have_qt_dir; make -s -f $am_have_qt_makefile_libs VAR` | 138 QT_DIR=`$QMAKE --version | grep -o -E /.+` |
| 147 rm $am_have_qt_pro $am_have_qt_stash $am_have_qt_makefile $am_have_qt_makefile_cxxflags $am_have_qt_makefile_libs | 139 |
| 148 rmdir $am_have_qt_dir | 140 # All variables are defined, report the result |
| 149 | 141 AC_MSG_RESULT([$have_qt: |
| 150 # Look for specific tools in $PATH | 142 QT_CXXFLAGS=$QT_CXXFLAGS |
| 151 QT_MOC=`which moc$am_have_qt_qmexe_suff` | 143 QT_DIR=$QT_DIR |
| 152 QT_UIC=`which uic$am_have_qt_qmexe_suff` | 144 QT_LIBS=$QT_LIBS |
| 153 QT_RCC=`which rcc$am_have_qt_qmexe_suff` | 145 QT_UIC=$QT_UIC |
| 154 QT_LRELEASE=`which lrelease$am_have_qt_qmexe_suff` | 146 QT_MOC=$QT_MOC |
| 155 QT_LUPDATE=`which lupdate$am_have_qt_qmexe_suff` | 147 QT_RCC=$QT_RCC |
| 156 | 148 QT_LRELEASE=$QT_LRELEASE |
| 157 # Get Qt version from qmake | 149 QT_LUPDATE=$QT_LUPDATE]) |
| 158 QT_DIR=`$QMAKE --version | grep -o -E /.+` | 150 else |
| 159 | 151 # Qt was not found |
| 160 # All variables are defined, report the result | 152 have_qt=no |
| 161 AC_MSG_RESULT([$have_qt: | 153 QT_CXXFLAGS= |
| 162 QT_CXXFLAGS=$QT_CXXFLAGS | 154 QT_DIR= |
| 163 QT_DIR=$QT_DIR | 155 QT_LIBS= |
| 164 QT_LIBS=$QT_LIBS | 156 QT_UIC= |
| 165 QT_UIC=$QT_UIC | 157 QT_MOC= |
| 166 QT_MOC=$QT_MOC | 158 QT_RCC= |
| 167 QT_RCC=$QT_RCC | 159 QT_LRELEASE= |
| 168 QT_LRELEASE=$QT_LRELEASE | 160 QT_LUPDATE= |
| 169 QT_LUPDATE=$QT_LUPDATE]) | 161 AC_MSG_RESULT($have_qt) |
| 170 else | 162 fi |
| 171 # Qt was not found | 163 AC_SUBST(QT_CXXFLAGS) |
| 172 have_qt=no | 164 AC_SUBST(QT_DIR) |
| 173 QT_CXXFLAGS= | 165 AC_SUBST(QT_LIBS) |
| 174 QT_DIR= | 166 AC_SUBST(QT_UIC) |
| 175 QT_LIBS= | 167 AC_SUBST(QT_MOC) |
| 176 QT_UIC= | 168 AC_SUBST(QT_RCC) |
| 177 QT_MOC= | 169 AC_SUBST(QT_LRELEASE) |
| 178 QT_RCC= | 170 AC_SUBST(QT_LUPDATE) |
| 179 QT_LRELEASE= | 171 AC_SUBST(QMAKE) |
| 180 QT_LUPDATE= | 172 |
| 181 AC_MSG_RESULT($have_qt) | 173 #### Being paranoid: |
| 182 fi | 174 if test x"$have_qt" = xyes; then |
| 183 AC_SUBST(QT_CXXFLAGS) | 175 AC_MSG_CHECKING(correct functioning of Qt installation) |
| 184 AC_SUBST(QT_DIR) | 176 AC_CACHE_VAL(ax_cv_qt_test_result, |
| 185 AC_SUBST(QT_LIBS) | 177 [ |
| 186 AC_SUBST(QT_UIC) | 178 cat > ax_qt_test.h << EOF |
| 187 AC_SUBST(QT_MOC) | |
| 188 AC_SUBST(QT_RCC) | |
| 189 AC_SUBST(QT_LRELEASE) | |
| 190 AC_SUBST(QT_LUPDATE) | |
| 191 AC_SUBST(QMAKE) | |
| 192 | |
| 193 #### Being paranoid: | |
| 194 if test x"$have_qt" = xyes; then | |
| 195 AC_MSG_CHECKING(correct functioning of Qt installation) | |
| 196 AC_CACHE_VAL(ax_cv_qt_test_result, | |
| 197 [ | |
| 198 cat > ax_qt_test.h << EOF | |
| 199 #include <qobject.h> | 179 #include <qobject.h> |
| 200 class Test : public QObject | 180 class Test : public QObject |
| 201 { | 181 { |
| 202 Q_OBJECT | 182 Q_OBJECT |
| 203 public: | 183 public: |
| 204 Test() {} | 184 Test() {} |
| 205 ~Test() {} | 185 ~Test() {} |
| 206 public slots: | 186 public slots: |
| 207 void receive() {} | 187 void receive() {} |
| 208 signals: | 188 signals: |
| 209 void send(); | 189 void send(); |
| 210 }; | 190 }; |
| 211 EOF | 191 EOF |
| 212 | 192 |
| 213 cat > ax_qt_main.$ac_ext << EOF | 193 cat > ax_qt_main.$ac_ext << EOF |
| 214 #include "ax_qt_test.h" | 194 #include "ax_qt_test.h" |
| 215 #include <qapplication.h> | 195 #include <qapplication.h> |
| 216 int main( int argc, char **argv ) | 196 int main( int argc, char **argv ) |
| 217 { | 197 { |
| 218 QApplication app( argc, argv ); | 198 QApplication app( argc, argv ); |
| 219 Test t; | 199 Test t; |
| 220 QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) ); | 200 QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) ); |
| 221 } | 201 } |
| 222 EOF | 202 EOF |
| 223 | 203 |
| 224 ax_cv_qt_test_result="failure" | 204 ax_cv_qt_test_result="failure" |
| 225 ax_try_1="$QT_MOC ax_qt_test.h -o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null" | 205 ax_try_1="$QT_MOC ax_qt_test.h -o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null" |
| 226 AC_TRY_EVAL(ax_try_1) | 206 AC_TRY_EVAL(ax_try_1) |
| 227 if test x"$ac_status" != x0; then | 207 if test x"$ac_status" != x0; then |
| 228 echo "$ax_err_1" >&AS_MESSAGE_LOG_FD | 208 echo "$ax_err_1" >&AS_MESSAGE_LOG_FD |
| 229 echo "configure: could not run $QT_MOC on:" >&AS_MESSAGE_LOG_FD | 209 echo "configure: could not run $QT_MOC on:" >&AS_MESSAGE_LOG_FD |
| 230 cat ax_qt_test.h >&AS_MESSAGE_LOG_FD | 210 cat ax_qt_test.h >&AS_MESSAGE_LOG_FD |
| 231 else | 211 else |
| 232 ax_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_ax_qt_test.o moc_ax_qt_test.$ac_ext >AS_MESSAGE_LOG_FD 2>&1" | 212 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" |
| 233 AC_TRY_EVAL(ax_try_2) | 213 AC_TRY_EVAL(ax_try_2) |
| 234 if test x"$ac_status" != x0; then | 214 if test x"$ac_status" != x0; then |
| 235 echo "$ax_err_2" >&AS_MESSAGE_LOG_FD | 215 echo "$ax_err_2" >&AS_MESSAGE_LOG_FD |
| 236 echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD | 216 echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD |
| 237 cat moc_ax_qt_test.$ac_ext >&AS_MESSAGE_LOG_FD | 217 cat moc_ax_qt_test.$ac_ext >&AS_MESSAGE_LOG_FD |
| 238 else | 218 else |
| 239 ax_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o ax_qt_main.o ax_qt_main.$ac_ext >/dev/null 2>/dev/null" | 219 ax_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o ax_qt_main.o ax_qt_main.$ac_ext >/dev/null 2>/dev/null" |
| 240 AC_TRY_EVAL(ax_try_3) | 220 AC_TRY_EVAL(ax_try_3) |
| 241 if test x"$ac_status" != x0; then | 221 if test x"$ac_status" != x0; then |
| 242 echo "$ax_err_3" >&AS_MESSAGE_LOG_FD | 222 echo "$ax_err_3" >&AS_MESSAGE_LOG_FD |
| 243 echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD | 223 echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD |
| 244 cat ax_qt_main.$ac_ext >&AS_MESSAGE_LOG_FD | 224 cat ax_qt_main.$ac_ext >&AS_MESSAGE_LOG_FD |
| 245 else | 225 else |
| 246 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" | 226 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" |
| 247 AC_TRY_EVAL(ax_try_4) | 227 AC_TRY_EVAL(ax_try_4) |
| 248 if test x"$ac_status" != x0; then | 228 if test x"$ac_status" != x0; then |
| 249 echo "$ax_err_4" >&AS_MESSAGE_LOG_FD | 229 echo "$ax_err_4" >&AS_MESSAGE_LOG_FD |
| 250 else | 230 else |
| 251 ax_cv_qt_test_result="success" | 231 ax_cv_qt_test_result="success" |
| 252 fi | 232 fi |
| 253 fi | 233 fi |
| 254 fi | 234 fi |
| 255 fi | 235 fi |
| 256 ])dnl AC_CACHE_VAL ax_cv_qt_test_result | 236 ])dnl AC_CACHE_VAL ax_cv_qt_test_result |
| 257 AC_MSG_RESULT([$ax_cv_qt_test_result]) | 237 AC_MSG_RESULT([$ax_cv_qt_test_result]) |
| 258 if test x"$ax_cv_qt_test_result" = "xfailure"; then | 238 if test x"$ax_cv_qt_test_result" = "xfailure"; then |
| 259 AC_MSG_ERROR([Failed to find matching components of a complete | 239 AC_MSG_ERROR([Failed to find matching components of a complete |
| 260 Qt installation. Try using more options, | 240 Qt installation. Try using more options, |
| 261 see ./configure --help.]) | 241 see ./configure --help.]) |
| 262 fi | 242 fi |
| 263 | 243 |
| 264 rm -f ax_qt_test.h moc_ax_qt_test.$ac_ext moc_ax_qt_test.o \ | 244 rm -f ax_qt_test.h moc_ax_qt_test.$ac_ext moc_ax_qt_test.o \ |
| 265 ax_qt_main.$ac_ext ax_qt_main.o ax_qt_main | 245 ax_qt_main.$ac_ext ax_qt_main.o ax_qt_main |
| 266 fi | 246 fi |
| 267 ]) | 247 ]) |
