1dnl aclocal.m4 -- extra macros for configuring Octave 2dnl 3dnl -------------------------------------------------------------------- 4dnl 5dnl Copyright (C) 1995-2021 The Octave Project Developers 6dnl 7dnl See the file COPYRIGHT.md in the top-level directory of this 8dnl or <https://octave.org/copyright/>. 9dnl 10dnl 11dnl This file is part of Octave. 12dnl 13dnl Octave is free software: you can redistribute it and/or modify it 14dnl under the terms of the GNU General Public License as published by 15dnl the Free Software Foundation, either version 3 of the License, or 16dnl (at your option) any later version. 17dnl 18dnl Octave is distributed in the hope that it will be useful, but 19dnl WITHOUT ANY WARRANTY; without even the implied warranty of 20dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21dnl GNU General Public License for more details. 22dnl 23dnl You should have received a copy of the GNU General Public License 24dnl along with Octave; see the file COPYING. If not, see 25dnl <https://www.gnu.org/licenses/>. 26dnl 27dnl -------------------------------------------------------------------- 28dnl 29dnl Alphabetical list of macros in the OCTAVE_ namespace 30dnl 31dnl 32dnl Figure out the hardware-vendor-os info. 33dnl 34AC_DEFUN([OCTAVE_CANONICAL_HOST], [ 35 AC_CANONICAL_HOST 36 if test -z "$host"; then 37 host=unknown-unknown-unknown 38 AC_MSG_WARN([configuring Octave for unknown system type]) 39 fi 40 canonical_host_type=$host 41 AC_SUBST(canonical_host_type) 42 if test -z "$host_cpu"; then 43 host_cpu=unknown 44 fi 45 if test -z "$host_vendor"; then 46 host_vendor=unknown 47 fi 48 if test -z "$host_os"; then 49 host_os=unknown 50 fi 51]) 52dnl 53dnl Check if the Carbon Framework defines CGDisplayBitsPerPixel. 54dnl 55AC_DEFUN([OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL], [ 56 AC_CACHE_CHECK([whether CGDisplayBitsPerPixel is defined in the Carbon Framework], 57 [octave_cv_func_carbon_cgdisplaybitsperpixel], 58 [AC_LANG_PUSH(C++) 59 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 60 #include <Carbon/Carbon.h> 61 ]], [[ 62 CGDirectDisplayID display = CGMainDisplayID (); 63 size_t depth = CGDisplayBitsPerPixel (display); 64 ]])], 65 octave_cv_func_carbon_cgdisplaybitsperpixel=yes, 66 octave_cv_func_carbon_cgdisplaybitsperpixel=no) 67 AC_LANG_POP(C++) 68 ]) 69 if test $octave_cv_func_carbon_cgdisplaybitsperpixel = yes; then 70 AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL, 1, 71 [Define to 1 if Carbon Framework has CGDisplayBitsPerPixel.]) 72 fi 73]) 74dnl 75dnl Check if C compiler handles FLAG command line option. If two 76dnl arguments are specified, execute the second arg as shell commands. 77dnl Otherwise, add FLAG to CFLAGS if the compiler accepts the flag. 78dnl 79AC_DEFUN([OCTAVE_CC_FLAG], [ 80 ac_safe=`echo "$1" | $SED 'y% ./+-:=%___p___%'` 81 AC_MSG_CHECKING([whether ${CC-cc} accepts $1]) 82 AC_CACHE_VAL([octave_cv_cc_flag_$ac_safe], 83 [AC_LANG_PUSH(C) 84 ac_octave_save_CFLAGS="$CFLAGS" 85 CFLAGS="$CFLAGS $1" 86 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 87 [eval "octave_cv_cc_flag_$ac_safe=yes"], 88 [eval "octave_cv_cc_flag_$ac_safe=no"]) 89 CFLAGS="$ac_octave_save_CFLAGS" 90 AC_LANG_POP(C) 91 ]) 92 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then 93 AC_MSG_RESULT([yes]) 94 ifelse([$2], , 95 [CFLAGS="$CFLAGS $1" 96 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) 97 else 98 AC_MSG_RESULT([no]) 99 ifelse([$3], , , [$3]) 100 fi 101]) 102dnl 103dnl Check for broken stl_algo.h header file in gcc versions 4.8.0, 4.8.1, 4.8.2 104dnl which leads to failures in nth_element. 105dnl 106AC_DEFUN([OCTAVE_CHECK_BROKEN_STL_ALGO_H], [ 107 AC_CACHE_CHECK([whether stl_algo.h is broken], 108 [octave_cv_broken_stl_algo_h], 109 [AC_LANG_PUSH(C++) 110 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 111// Based on code from a GCC test program. 112 113// Copyright (C) 2013 Free Software Foundation, Inc. 114// 115// This file is part of the GNU ISO C++ Library. This library is free 116// software; you can redistribute it and/or modify it under the 117// terms of the GNU General Public License as published by the 118// Free Software Foundation; either version 3, or (at your option) 119// any later version. 120 121// This library is distributed in the hope that it will be useful, 122// but WITHOUT ANY WARRANTY; without even the implied warranty of 123// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 124// GNU General Public License for more details. 125 126// You should have received a copy of the GNU General Public License along 127// with this library; see the file COPYING3. If not see 128// <https://www.gnu.org/licenses/>. 129 130// 25.3.2 [lib.alg.nth.element] 131 132// { dg-options "-std=gnu++11" } 133 134#include <algorithm> 135#include <vector> 136 ]], [[ 137std::vector<int> v (7); 138 139v[0] = 207089; 140v[1] = 202585; 141v[2] = 180067; 142v[3] = 157549; 143v[4] = 211592; 144v[5] = 216096; 145v[6] = 207089; 146 147std::nth_element (v.begin (), v.begin () + 3, v.end ()); 148 149return v[3] == 207089 ? 0 : 1; 150 ]])], 151 octave_cv_broken_stl_algo_h=no, 152 octave_cv_broken_stl_algo_h=yes, 153 [case "$GXX_VERSION" in 154 *4.8.2*) 155 octave_cv_broken_stl_algo_h=yes 156 ;; 157 *) 158 octave_cv_broken_stl_algo_h=no 159 ;; 160 esac 161 ]) 162 AC_LANG_POP(C++) 163 ]) 164 if test "$GXX" = yes; then 165 if test $octave_cv_broken_stl_algo_h = yes; then 166 case "$GXX_VERSION" in 167 4.8.[[012]]) 168 ;; 169 *) 170 octave_cv_broken_stl_algo_h=no 171 warn_stl_algo_h="UNEXPECTED: found nth_element broken in g++ $GXX_VERSION. Refusing to fix except for g++ 4.8.0, 4.8.1, or 4.8.2. You appear to have g++ $GXX_VERSION." 172 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h]) 173 ;; 174 esac 175 else 176 case "$GXX_VERSION" in 177 4.8.2) 178 warn_stl_algo_h="UNEXPECTED: found nth_element working in g++ 4.8.2. Has it been patched on your system?" 179 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h]) 180 ;; 181 esac 182 fi 183 else 184 octave_cv_broken_stl_algo_h=no 185 warn_stl_algo_h="UNEXPECTED: nth_element test failed. Refusing to fix except for g++ 4.8.2." 186 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h]) 187 fi 188]) 189dnl 190dnl Check if pthread stack size accounts for thread-local storage. 191dnl 192dnl This program should succeed if the pthread library allocates memory 193dnl for thread-local (__thread) variables independently of the 194dnl requested thread stack size. 195dnl 196dnl It will fail if (as in the current version of glibc) the storage 197dnl for thread-local variables is subtracted from the memory allocated 198dnl for the thread stack. (This can cause problems for Java and for 199dnl other libraries.) 200dnl 201dnl This bug is tracked in glibc at: 202dnl https://sourceware.org/bugzilla/show_bug.cgi?id=11787 203dnl 204AC_DEFUN([OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE], [ 205 AC_CACHE_CHECK([whether pthread stack size does not account for thread-local storage], 206 [octave_cv_broken_pthread_stacksize], 207 [AC_LANG_PUSH(C) 208 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 209#include <stdio.h> 210#include <string.h> 211#include <pthread.h> 212 213static char __thread data[100 * 1024]; 214 215static void * threadfunc(void *arg) 216{ 217 return data; 218} 219 ]], [[ 220 pthread_attr_t attr; 221 pthread_t thread; 222 int errnum; 223 224 pthread_attr_init (&attr); 225 errnum = pthread_attr_setstacksize (&attr, 64 * 1024); 226 if (errnum != 0) 227 { 228 fprintf (stderr, "pthread_attr_setstacksize: %s\n", strerror(errnum)); 229 return 1; 230 } 231 errnum = pthread_create (&thread, &attr, &threadfunc, NULL); 232 if (errnum != 0) 233 { 234 fprintf (stderr, "pthread_create: %s\n", strerror(errnum)); 235 return 1; 236 } 237 errnum = pthread_join (thread, NULL); 238 if (errnum != 0) 239 { 240 fprintf (stderr, "pthread_join: %s\n", strerror(errnum)); 241 return 1; 242 } 243 244 pthread_attr_destroy (&attr); 245 return 0; 246 ]])], 247 octave_cv_broken_pthread_stacksize=no, 248 octave_cv_broken_pthread_stacksize=yes, 249 octave_cv_broken_pthread_stacksize=no) 250 AC_LANG_POP(C) 251 ]) 252 if test $octave_cv_broken_pthread_stacksize = yes; then 253 AC_DEFINE(HAVE_BROKEN_PTHREAD_STACKSIZE, 1, 254 [Define to 1 if pthread stack size does not account for thread-local storage.]) 255 fi 256]) 257dnl 258dnl Check whether CXSparse is version 2.2 or later 259dnl FIXME: This test uses a version number. It potentially could 260dnl be re-written to actually call a function, but is it worth it? 261dnl 262AC_DEFUN([OCTAVE_CHECK_CXSPARSE_VERSION_OK], [ 263 AC_CACHE_CHECK([whether CXSparse is version 2.2 or later], 264 [octave_cv_cxsparse_version_ok], 265 [ac_octave_save_CPPFLAGS="$CPPFLAGS" 266 CPPFLAGS="$CXSPARSE_CPPFLAGS $CPPFLAGS" 267 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ 268 #if defined (HAVE_SUITESPARSE_CS_H) 269 #include <suitesparse/cs.h> 270 #elif defined (HAVE_UFSPARSE_CS_H) 271 #include <ufsparse/cs.h> 272 #elif defined (HAVE_CXSPARSE_CS_H) 273 #include <cxsparse/cs.h> 274 #elif defined (HAVE_CS_H) 275 #include <cs.h> 276 #endif 277 ]], [[ 278 #if (defined (HAVE_CXSPARSE) \ 279 && (! defined (CS_VER) \ 280 || CS_VER < 2 \ 281 || (CS_VER == 2 && CS_SUBVER < 2))) 282 #error "Octave requires CXSparse version 2.2 or later" 283 #endif 284 ]])], 285 octave_cv_cxsparse_version_ok=yes, 286 octave_cv_cxsparse_version_ok=no) 287 CPPFLAGS="$ac_octave_save_CPPFLAGS" 288 ]) 289 if test $octave_cv_cxsparse_version_ok = yes; then 290 AC_DEFINE(HAVE_CXSPARSE_VERSION_OK, 1, 291 [Define to 1 if CXSparse is version 2.2 or later.]) 292 fi 293]) 294dnl 295dnl Check whether the FFTW library supports multi-threading. This macro 296dnl should be called once per FFTW precision passing in the library 297dnl variant (e.g. "fftw3") and a function in the thread support API 298dnl (e.g. "fftw_plan_with_nthreads"). Depending on how FFTW was built, 299dnl the thread functions could be compiled into the main FFTW library or 300dnl could be a separate add-on library that is passed to the linker 301dnl ahead of the main FFTW library. 302dnl 303AC_DEFUN([OCTAVE_CHECK_FFTW_THREADS], [ 304 ac_octave_save_CPPFLAGS="$CPPFLAGS" 305 ac_octave_save_LDFLAGS="$LDFLAGS" 306 ac_octave_save_LIBS="$LIBS" 307 CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS" 308 LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS" 309 LIBS="$m4_toupper([$1])_LIBS $LIBS" 310 AC_CACHE_CHECK([for $1 multi-threading support], 311 [octave_cv_[$1]_threads_lib], 312 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 313 #include <fftw3.h> 314 ]], [[ 315 $2 (2); 316 ]])], 317 [octave_cv_[$1]_threads_lib=yes], 318 [LIBS="-l[$1]_threads $LIBS" 319 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 320 #include <fftw3.h> 321 ]], [[ 322 $2 (2); 323 ]])], 324 [octave_cv_[$1]_threads_lib="-l[$1]_threads"], 325 [octave_cv_[$1]_threads_lib=no]) 326 ]) 327 ]) 328 case $octave_cv_[$1]_threads_lib in 329 -l*) 330 m4_toupper([$1])_LIBS="$octave_cv_[$1]_threads_lib $m4_toupper([$1])_LIBS" 331 ;; 332 no) 333 AC_MSG_WARN([No $1 multi-threading support found.]) 334 AC_MSG_WARN([The single-threaded library will be used instead.]) 335 ;; 336 esac 337 if test $octave_cv_[$1]_threads_lib != no; then 338 AC_DEFINE([HAVE_]m4_toupper([$1])[_THREADS], 1, 339 [Define to 1 if ]m4_toupper([$1])[ has multi-threading support.]) 340 fi 341 CPPFLAGS="$ac_octave_save_CPPFLAGS" 342 LDFLAGS="$ac_octave_save_LDFLAGS" 343 LIBS="$ac_octave_save_LIBS" 344]) 345dnl 346dnl Check if function gluTessCallback is called with "(...)". 347dnl 348AC_DEFUN([OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS], [ 349 AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"], 350 [octave_cv_func_glutesscallback_threedots], 351 [AC_LANG_PUSH(C++) 352 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 353 #if defined (HAVE_GL_GLU_H) 354 # include <GL/glu.h> 355 #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL 356 # include <OpenGL/glu.h> 357 #endif 358 ]], [[ 359 GLvoid (*func)(...); 360 gluTessCallback(0, 0, func); 361 ]])], 362 octave_cv_func_glutesscallback_threedots=yes, 363 octave_cv_func_glutesscallback_threedots=no) 364 AC_LANG_POP(C++) 365 ]) 366 if test $octave_cv_func_glutesscallback_threedots = yes; then 367 AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1, 368 [Define to 1 if gluTessCallback is called with (...).]) 369 fi 370]) 371dnl 372dnl Check whether the Qt class QAbstractItemModel exists and has the 373dnl beginResetModel and endResetModel member functions. These member 374dnl functions were introduced in Qt 4.6. 375dnl 376dnl FIXME: Delete this entirely when we can safely assume that Qt 4.6 or later 377dnl is in use everywhere, or when we drop support for Qt 4. 378dnl 379AC_DEFUN([OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL], [ 380 AC_CACHE_CHECK([for QAbstractItemModel::beginResetModel in <QAbstractItemModel>], 381 [octave_cv_func_qabstractitemmodel_beginresetmodel], 382 [AC_LANG_PUSH(C++) 383 ac_octave_save_CPPFLAGS="$CPPFLAGS" 384 ac_octave_save_CXXFLAGS="$CXXFLAGS" 385 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 386 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 388 #include <QAbstractItemModel> 389 class item_model : public QAbstractItemModel 390 { 391 public: 392 item_model (QObject *parent = 0) : QAbstractItemModel (parent) {} 393 ~item_model () {} 394 QModelIndex index (int, int, const QModelIndex& m) const { return m; } 395 QModelIndex parent (const QModelIndex& m) const { return m; } 396 int columnCount (const QModelIndex&) const { return 0; } 397 int rowCount (const QModelIndex&) const { return 0; } 398 QVariant data (const QModelIndex&, int) const { return QVariant(); } 399 void update_model () 400 { 401 this->beginResetModel (); 402 this->endResetModel (); 403 } 404 }; 405 ]], [[ 406 item_model model; 407 model.update_model (); 408 ]])], 409 octave_cv_func_qabstractitemmodel_beginresetmodel=yes, 410 octave_cv_func_qabstractitemmodel_beginresetmodel=no) 411 CPPFLAGS="$ac_octave_save_CPPFLAGS" 412 CXXFLAGS="$ac_octave_save_CXXFLAGS" 413 AC_LANG_POP(C++) 414 ]) 415 if test $octave_cv_func_qabstractitemmodel_beginresetmodel = yes; then 416 AC_DEFINE(HAVE_QABSTRACTITEMMODEL_BEGINRESETMODEL, 1, 417 [Define to 1 if you have the `QAbstractItemModel::beginResetModel' member function.]) 418 fi 419]) 420dnl 421dnl Check whether the Qt QComboBox class has the setCurrentText 422dnl function. This function was introduced in Qt 5. 423dnl 424dnl FIXME: Delete this entirely when we drop support for Qt 4. 425dnl 426AC_DEFUN([OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT], [ 427 AC_CACHE_CHECK([for QComboBox::setCurrentText], 428 [octave_cv_func_qcombobox_setcurrenttext], 429 [AC_LANG_PUSH(C++) 430 ac_octave_save_CPPFLAGS="$CPPFLAGS" 431 ac_octave_save_CXXFLAGS="$CXXFLAGS" 432 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 433 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 434 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 435 #include <QComboBox> 436 ]], [[ 437 QComboBox combo_box (nullptr); 438 combo_box.setCurrentText ("text"); 439 ]])], 440 octave_cv_func_qcombobox_setcurrenttext=yes, 441 octave_cv_func_qcombobox_setcurrenttext=no) 442 CPPFLAGS="$ac_octave_save_CPPFLAGS" 443 CXXFLAGS="$ac_octave_save_CXXFLAGS" 444 AC_LANG_POP(C++) 445 ]) 446 if test $octave_cv_func_qcombobox_setcurrenttext = yes; then 447 AC_DEFINE(HAVE_QCOMBOBOX_SETCURRENTTEXT, 1, 448 [Define to 1 if you have the `QComboBox::setCurrentText' member function.]) 449 fi 450]) 451dnl 452dnl Check whether the Qt QGuiApplication class has the setDesktopFileName 453dnl static member function. This function was introduced in Qt 5.7. 454dnl 455dnl FIXME: Delete this entirely when we drop support for Qt 5.6 or older. 456dnl 457AC_DEFUN([OCTAVE_CHECK_FUNC_QGUIAPPLICATION_SETDESKTOPFILENAME], [ 458 AC_CACHE_CHECK([for QGuiApplication::setDesktopFileName], 459 [octave_cv_func_qguiapplication_setdesktopfilename], 460 [AC_LANG_PUSH(C++) 461 ac_octave_save_CPPFLAGS="$CPPFLAGS" 462 ac_octave_save_CXXFLAGS="$CXXFLAGS" 463 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 464 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 465 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 466 #include <QGuiApplication> 467 ]], [[ 468 QGuiApplication::setDesktopFileName ("com.example.Example.desktop"); 469 ]])], 470 octave_cv_func_qguiapplication_setdesktopfilename=yes, 471 octave_cv_func_qguiapplication_setdesktopfilename=no) 472 CPPFLAGS="$ac_octave_save_CPPFLAGS" 473 CXXFLAGS="$ac_octave_save_CXXFLAGS" 474 AC_LANG_POP(C++) 475 ]) 476 if test $octave_cv_func_qguiapplication_setdesktopfilename = yes; then 477 AC_DEFINE(HAVE_QGUIAPPLICATION_SETDESKTOPFILENAME, 1, 478 [Define to 1 if you have the `QGuiApplication::setDesktopFileName' member function.]) 479 fi 480]) 481dnl 482dnl Check whether the Qt QHeaderView class has the setSectionResizeMode 483dnl function. This function was introduced in Qt 5. 484dnl 485dnl FIXME: Delete this entirely when we drop support for Qt 4. 486dnl 487AC_DEFUN([OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONRESIZEMODE], [ 488 AC_CACHE_CHECK([for QHeaderView::setSectionResizeMode], 489 [octave_cv_func_qheaderview_setsectionresizemode], 490 [AC_LANG_PUSH(C++) 491 ac_octave_save_CPPFLAGS="$CPPFLAGS" 492 ac_octave_save_CXXFLAGS="$CXXFLAGS" 493 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 494 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 495 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 496 #include <QHeaderView> 497 ]], [[ 498 QHeaderView header_view (Qt::Horizontal); 499 header_view.setSectionResizeMode (QHeaderView::Interactive); 500 ]])], 501 octave_cv_func_qheaderview_setsectionresizemode=yes, 502 octave_cv_func_qheaderview_setsectionresizemode=no) 503 CPPFLAGS="$ac_octave_save_CPPFLAGS" 504 CXXFLAGS="$ac_octave_save_CXXFLAGS" 505 AC_LANG_POP(C++) 506 ]) 507 if test $octave_cv_func_qheaderview_setsectionresizemode = yes; then 508 AC_DEFINE(HAVE_QHEADERVIEW_SETSECTIONRESIZEMODE, 1, 509 [Define to 1 if you have the `QHeaderView::setSectionResizeMode' member function.]) 510 fi 511]) 512dnl 513dnl Check whether the Qt QHeaderView class has the setSectionsClickable 514dnl function. This function was introduced in Qt 5. 515dnl 516dnl FIXME: Delete this entirely when we drop support for Qt 4. 517dnl 518AC_DEFUN([OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSCLICKABLE], [ 519 AC_CACHE_CHECK([for QHeaderView::setSectionsClickable], 520 [octave_cv_func_qheaderview_setsectionsclickable], 521 [AC_LANG_PUSH(C++) 522 ac_octave_save_CPPFLAGS="$CPPFLAGS" 523 ac_octave_save_CXXFLAGS="$CXXFLAGS" 524 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 525 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 527 #include <QHeaderView> 528 ]], [[ 529 QHeaderView header_view (Qt::Horizontal); 530 header_view.setSectionsClickable (true); 531 ]])], 532 octave_cv_func_qheaderview_setsectionsclickable=yes, 533 octave_cv_func_qheaderview_setsectionsclickable=no) 534 CPPFLAGS="$ac_octave_save_CPPFLAGS" 535 CXXFLAGS="$ac_octave_save_CXXFLAGS" 536 AC_LANG_POP(C++) 537 ]) 538 if test $octave_cv_func_qheaderview_setsectionsclickable = yes; then 539 AC_DEFINE(HAVE_QHEADERVIEW_SETSECTIONSCLICKABLE, 1, 540 [Define to 1 if you have the `QHeaderView::setSectionsClickable' member function.]) 541 fi 542]) 543dnl 544dnl Check whether the Qt QHeaderView class has the setSectionsMovable 545dnl function. This function was introduced in Qt 5. 546dnl 547dnl FIXME: Delete this entirely when we drop support for Qt 4. 548dnl 549AC_DEFUN([OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSMOVABLE], [ 550 AC_CACHE_CHECK([for QHeaderView::setSectionsMovable], 551 [octave_cv_func_qheaderview_setsectionsmovable], 552 [AC_LANG_PUSH(C++) 553 ac_octave_save_CPPFLAGS="$CPPFLAGS" 554 ac_octave_save_CXXFLAGS="$CXXFLAGS" 555 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 556 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 557 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 558 #include <QHeaderView> 559 ]], [[ 560 QHeaderView header_view (Qt::Horizontal); 561 header_view.setSectionsMovable (true); 562 ]])], 563 octave_cv_func_qheaderview_setsectionsmovable=yes, 564 octave_cv_func_qheaderview_setsectionsmovable=no) 565 CPPFLAGS="$ac_octave_save_CPPFLAGS" 566 CXXFLAGS="$ac_octave_save_CXXFLAGS" 567 AC_LANG_POP(C++) 568 ]) 569 if test $octave_cv_func_qheaderview_setsectionsmovable = yes; then 570 AC_DEFINE(HAVE_QHEADERVIEW_SETSECTIONSMOVABLE, 1, 571 [Define to 1 if you have the `QHeaderView::setSectionsMovable' member function.]) 572 fi 573]) 574dnl 575dnl Check whether the Qt QHelpSearchQueryWidget class has the searchInput 576dnl member function. This function was introduced in Qt 5.9. 577dnl 578dnl FIXME: Delete this entirely when we drop support for Qt 5.8 or older. 579dnl 580AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT], [ 581 AC_CACHE_CHECK([for QHelpSearchQueryWidget::searchInput], 582 [octave_cv_func_qhelpsearchquerywidget_searchinput], 583 [AC_LANG_PUSH(C++) 584 ac_octave_save_CPPFLAGS="$CPPFLAGS" 585 ac_octave_save_CXXFLAGS="$CXXFLAGS" 586 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 587 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 589 #include <QHelpSearchQueryWidget> 590 #include <QString> 591 ]], [[ 592 QHelpSearchQueryWidget *query_widget = new QHelpSearchQueryWidget (); 593 QString search_input = query_widget->searchInput (); 594 ]])], 595 octave_cv_func_qhelpsearchquerywidget_searchinput=yes, 596 octave_cv_func_qhelpsearchquerywidget_searchinput=no) 597 CPPFLAGS="$ac_octave_save_CPPFLAGS" 598 CXXFLAGS="$ac_octave_save_CXXFLAGS" 599 AC_LANG_POP(C++) 600 ]) 601 if test $octave_cv_func_qhelpsearchquerywidget_searchinput = yes; then 602 AC_DEFINE(HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT, 1, 603 [Define to 1 if you have the `QHelpSearchQueryWidget::searchInput' member function.]) 604 fi 605]) 606dnl 607dnl Check whether new API is used with QHelpIndexWidget. 608dnl Under new API, QHelpIndexWidget emits documentActivates. 609dnl Under old API, QHelpIndexWidget emits linkActivated. 610dnl New structure/signal API was introduced in Qt 5.15. 611dnl 612dnl FIXME: Delete this entirely when we drop support for Qt 5.14 or older. 613dnl 614AC_DEFUN([OCTAVE_CHECK_NEW_QHELPINDEXWIDGET_API], [ 615 AC_CACHE_CHECK([for new QHelpIndexWidget API], 616 [octave_cv_new_qhelpindexwidget_api], 617 [AC_LANG_PUSH(C++) 618 ac_octave_save_CPPFLAGS="$CPPFLAGS" 619 ac_octave_save_CXXFLAGS="$CXXFLAGS" 620 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 621 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 622 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 623 #include <QHelpLink> 624 ]], [[ 625 QHelpLink link; 626 ]])], 627 octave_cv_new_qhelpindexwidget_api=yes, 628 octave_cv_new_qhelpindexwidget_api=no) 629 CPPFLAGS="$ac_octave_save_CPPFLAGS" 630 CXXFLAGS="$ac_octave_save_CXXFLAGS" 631 AC_LANG_POP(C++) 632 ]) 633 if test $octave_cv_new_qhelpindexwidget_api = yes; then 634 AC_DEFINE(HAVE_NEW_QHELPINDEXWIDGET_API, 1, 635 [Define to 1 if using new QHelpIndexWidget API.]) 636 fi 637]) 638dnl 639dnl Check whether the Qt function qInstallMessageHandler is available. 640dnl This function was introduced in Qt 5. 641dnl 642dnl FIXME: Delete this entirely when we drop support for Qt 4. 643dnl 644AC_DEFUN([OCTAVE_CHECK_FUNC_QINSTALLMESSAGEHANDLER], [ 645 AC_CACHE_CHECK([for qInstallMessageHandler], 646 [octave_cv_func_qinstallmessagehandler], 647 [AC_LANG_PUSH(C++) 648 ac_octave_save_CPPFLAGS="$CPPFLAGS" 649 ac_octave_save_CXXFLAGS="$CXXFLAGS" 650 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 651 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 652 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 653 #include <QtGlobal> 654 ]], [[ 655 qInstallMessageHandler (nullptr); 656 ]])], 657 octave_cv_func_qinstallmessagehandler=yes, 658 octave_cv_func_qinstallmessagehandler=no) 659 CPPFLAGS="$ac_octave_save_CPPFLAGS" 660 CXXFLAGS="$ac_octave_save_CXXFLAGS" 661 AC_LANG_POP(C++) 662 ]) 663 if test $octave_cv_func_qinstallmessagehandler = yes; then 664 AC_DEFINE(HAVE_QINSTALLMESSAGEHANDLER, 1, 665 [Define to 1 if you have the `qInstallMessageHandler' function.]) 666 fi 667]) 668dnl 669dnl Check whether the Qt class QLineEdit has the setPlaceholderText member 670dnl function. This member function was introduced in Qt 4.7. 671dnl 672dnl FIXME: Delete this entirely when we can safely assume that Qt 4.7 or later 673dnl is in use everywhere, or when we drop support for Qt 4. 674dnl 675AC_DEFUN([OCTAVE_CHECK_FUNC_QLINEEDIT_SETPLACEHOLDERTEXT], [ 676 AC_CACHE_CHECK([for QLineEdit::setPlaceholderText in <QLinedEdit>], 677 [octave_cv_func_qlineedit_setplaceholdertext], 678 [AC_LANG_PUSH(C++) 679 ac_octave_save_CPPFLAGS="$CPPFLAGS" 680 ac_octave_save_CXXFLAGS="$CXXFLAGS" 681 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 682 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 684 #include <QLineEdit> 685 ]], [[ 686 QLineEdit line_edit; 687 line_edit.setPlaceholderText ("placeholder text"); 688 ]])], 689 octave_cv_func_qlineedit_setplaceholdertext=yes, 690 octave_cv_func_qlineedit_setplaceholdertext=no) 691 CPPFLAGS="$ac_octave_save_CPPFLAGS" 692 CXXFLAGS="$ac_octave_save_CXXFLAGS" 693 AC_LANG_POP(C++) 694 ]) 695 if test $octave_cv_func_qlineedit_setplaceholdertext = yes; then 696 AC_DEFINE(HAVE_QLINEEDIT_SETPLACEHOLDERTEXT, 1, 697 [Define to 1 if you have the `QLineEdit::setPlaceholderText' member function.]) 698 fi 699]) 700dnl 701dnl Check whether the Qt QMouseEvent class has the localPos function. 702dnl This function was introduced in Qt 5. 703dnl 704dnl FIXME: Delete this entirely when we drop support for Qt 4. 705dnl 706AC_DEFUN([OCTAVE_CHECK_FUNC_QMOUSEEVENT_LOCALPOS], [ 707 AC_CACHE_CHECK([for QMouseEvent::localPos], 708 [octave_cv_func_qmouseevent_localpos], 709 [AC_LANG_PUSH(C++) 710 ac_octave_save_CPPFLAGS="$CPPFLAGS" 711 ac_octave_save_CXXFLAGS="$CXXFLAGS" 712 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 713 CXXFLAGS="$CXXPICFLAG $CPPFLAGS" 714 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 715 #include <QMouseEvent> 716 ]], [[ 717 QMouseEvent *event; 718 event->localPos (); 719 ]])], 720 octave_cv_func_qmouseevent_localpos=yes, 721 octave_cv_func_qmouseevent_localpos=no) 722 CPPFLAGS="$ac_octave_save_CPPFLAGS" 723 CXXFLAGS="$ac_octave_save_CXXFLAGS" 724 AC_LANG_POP(C++) 725 ]) 726 if test $octave_cv_func_qmouseevent_localpos = yes; then 727 AC_DEFINE(HAVE_QMOUSEEVENT_LOCALPOS, 1, 728 [Define to 1 if you have the `QMouseEvent::localPos' member function.]) 729 fi 730]) 731dnl 732dnl Check whether QObject::findChildren accepts Qt::FindChildOptions 733dnl argument. 734dnl 735dnl FIXME: Delete this entirely when we drop support for Qt 4. 736dnl 737AC_DEFUN([OCTAVE_CHECK_FUNC_QOBJECT_FINDCHILDREN_ACCEPTS_FINDCHILDOPTIONS], [ 738 AC_CACHE_CHECK([whether QObject::findChildren accepts Qt::FindChildOptions], 739 [octave_cv_func_qobject_findchildren_accepts_findchildoptions], 740 [AC_LANG_PUSH(C++) 741 ac_octave_save_CPPFLAGS="$CPPFLAGS" 742 ac_octave_save_CXXFLAGS="$CXXFLAGS" 743 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 744 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 745 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 746 #include <QList> 747 #include <QObject> 748 #include <QWidget> 749 ]], [[ 750 QObject obj; 751 QList<QWidget *> widgets 752 = obj.findChildren<QWidget *> ("name", Qt::FindDirectChildrenOnly); 753 ]])], 754 octave_cv_func_qobject_findchildren_accepts_findchildoptions=yes, 755 octave_cv_func_qobject_findchildren_accepts_findchildoptions=no) 756 CPPFLAGS="$ac_octave_save_CPPFLAGS" 757 CXXFLAGS="$ac_octave_save_CXXFLAGS" 758 AC_LANG_POP(C++) 759 ]) 760 if test $octave_cv_func_qobject_findchildren_accepts_findchildoptions = yes; then 761 AC_DEFINE(QOBJECT_FINDCHILDREN_ACCEPTS_FINDCHILDOPTIONS, 1, 762 [Define to 1 if 'QObject::findChildren' accepts 'Qt::FindChildOptions' argument.]) 763 fi 764]) 765dnl 766dnl Check whether the Qt class QMainWindow has the resizeDocks member function. 767dnl This member function was introduced in Qt 5.6. 768dnl 769dnl FIXME: remove this test when we drop support for Qt older than 5.6 770dnl 771AC_DEFUN([OCTAVE_CHECK_FUNC_QMAINWINDOW_RESIZEDOCKS], [ 772 AC_CACHE_CHECK([for QMainWindow::resizeDocks in <QMainWindow>], 773 [octave_cv_func_mainwindow_resizedocks], 774 [AC_LANG_PUSH(C++) 775 ac_octave_save_CPPFLAGS="$CPPFLAGS" 776 ac_octave_save_CXXFLAGS="$CXXFLAGS" 777 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 778 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 780 #include <QMainWindow> 781 #include <QDockWidget> 782 ]], [[ 783 QMainWindow *mw = new QMainWindow (); 784 QDockWidget *dw = new QDockWidget (mw); 785 mw->addDockWidget (Qt::LeftDockWidgetArea, dw); 786 mw->resizeDocks ({dw},{20},Qt::Horizontal); 787 ]])], 788 octave_cv_func_mainwindow_resizedocks=yes, 789 octave_cv_func_mainwindow_resizedocks=no) 790 CPPFLAGS="$ac_octave_save_CPPFLAGS" 791 CXXFLAGS="$ac_octave_save_CXXFLAGS" 792 AC_LANG_POP(C++) 793 ]) 794 if test $octave_cv_func_mainwindow_resizedocks = yes; then 795 AC_DEFINE(HAVE_QMAINWINDOW_RESIZEDOCKS, 1, 796 [Define to 1 if you have the 'QMainWindow::resizeDocks' member function.]) 797 fi 798]) 799dnl 800dnl Check whether the Qt class QScreen has the devicePixelRatio member function. 801dnl This member function was introduced in Qt 5.5. 802dnl 803AC_DEFUN([OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO], [ 804 AC_CACHE_CHECK([for QScreen::devicePixelRatio in <QScreen>], 805 [octave_cv_func_qscreen_devicepixelratio], 806 [AC_LANG_PUSH(C++) 807 ac_octave_save_CPPFLAGS="$CPPFLAGS" 808 ac_octave_save_CXXFLAGS="$CXXFLAGS" 809 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 810 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 811 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 812 #include <QApplication> 813 #include <QScreen> 814 ]], [[ 815 QScreen *screen = QApplication::primaryScreen (); 816 qreal ratio = screen->devicePixelRatio (); 817 ]])], 818 octave_cv_func_qscreen_devicepixelratio=yes, 819 octave_cv_func_qscreen_devicepixelratio=no) 820 CPPFLAGS="$ac_octave_save_CPPFLAGS" 821 CXXFLAGS="$ac_octave_save_CXXFLAGS" 822 AC_LANG_POP(C++) 823 ]) 824 if test $octave_cv_func_qscreen_devicepixelratio = yes; then 825 AC_DEFINE(HAVE_QSCREEN_DEVICEPIXELRATIO, 1, 826 [Define to 1 if you have the `QScreen::devicePixelRatio' member function.]) 827 fi 828]) 829dnl 830dnl Check whether the Qt class QTabWidget has the setMovable member function. 831dnl This member function was introduced in Qt 4.5. 832dnl 833dnl FIXME: Delete this entirely when we can safely assume that Qt 4.5 or later 834dnl is in use everywhere, or when we drop support for Qt 4. 835dnl 836AC_DEFUN([OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE], [ 837 AC_CACHE_CHECK([for QTabWidget::setMovable in <QTabWidget>], 838 [octave_cv_func_qtabwidget_setmovable], 839 [AC_LANG_PUSH(C++) 840 ac_octave_save_CPPFLAGS="$CPPFLAGS" 841 ac_octave_save_CXXFLAGS="$CXXFLAGS" 842 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 843 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 844 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 845 #include <QTabWidget> 846 class tab_widget : public QTabWidget 847 { 848 public: 849 tab_widget (QWidget *parent = 0) : QTabWidget (parent) { this->setMovable (true); } 850 ~tab_widget () {} 851 }; 852 ]], [[ 853 tab_widget tw; 854 ]])], 855 octave_cv_func_qtabwidget_setmovable=yes, 856 octave_cv_func_qtabwidget_setmovable=no) 857 CPPFLAGS="$ac_octave_save_CPPFLAGS" 858 CXXFLAGS="$ac_octave_save_CXXFLAGS" 859 AC_LANG_POP(C++) 860 ]) 861 if test $octave_cv_func_qtabwidget_setmovable = yes; then 862 AC_DEFINE(HAVE_QTABWIDGET_SETMOVABLE, 1, 863 [Define to 1 if you have the `QTabWidget::setMovable' member function.]) 864 fi 865]) 866dnl 867dnl Check whether the Qt class QHelpEngine has the documentsForIdentifier 868dnl function. dnl This member function was introduced in Qt 5.15. 869dnl 870AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER], [ 871 AC_CACHE_CHECK([for QHelpEngine::documentsForIdentifier in <QHelpEngine>], 872 [octave_cv_func_qhelpengine_documentsforidentifier], 873 [AC_LANG_PUSH(C++) 874 ac_octave_save_CPPFLAGS="$CPPFLAGS" 875 ac_octave_save_CXXFLAGS="$CXXFLAGS" 876 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 877 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 878 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 879 #include <QHelpEngine> 880 #include <QHelpLink> 881 #include <QList> 882 #include <QString> 883 #include <QUrl> 884 ]], [[ 885 QString collection_file; 886 QHelpEngine eng (collection_file); 887 QString id; 888 eng.documentsForIdentifier (id); 889 ]])], 890 octave_cv_func_qhelpengine_documentsforidentifier=yes, 891 octave_cv_func_qhelpengine_documentsforidentifier=no) 892 CPPFLAGS="$ac_octave_save_CPPFLAGS" 893 CXXFLAGS="$ac_octave_save_CXXFLAGS" 894 AC_LANG_POP(C++) 895 ]) 896 if test $octave_cv_func_qhelpengine_documentsforidentifier = yes; then 897 AC_DEFINE(HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER, 1, 898 [Define to 1 if you have the `QHelpEngine::documentsForIdentifier' member function.]) 899 fi 900]) 901dnl 902dnl Check whether the Qt class QWheelEvent has the angleDelta member function. 903dnl This member function was introduced in Qt 5. 904dnl 905dnl FIXME: Delete this entirely when we drop support for Qt 4. 906dnl 907AC_DEFUN([OCTAVE_CHECK_FUNC_QWHEELEVENT_ANGLEDELTA], [ 908 AC_CACHE_CHECK([for QWheelEvent::angleDelta in <QWheelEvent>], 909 [octave_cv_func_qwheelevent_angledelta], 910 [AC_LANG_PUSH(C++) 911 ac_octave_save_CPPFLAGS="$CPPFLAGS" 912 ac_octave_save_CXXFLAGS="$CXXFLAGS" 913 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 914 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 915 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 916 #include <QWheelEvent> 917 void foo (const QWheelEvent& ev) 918 { 919 ev.angleDelta (); 920 }; 921 ]])], 922 octave_cv_func_qwheelevent_angledelta=yes, 923 octave_cv_func_qwheelevent_angledelta=no) 924 CPPFLAGS="$ac_octave_save_CPPFLAGS" 925 CXXFLAGS="$ac_octave_save_CXXFLAGS" 926 AC_LANG_POP(C++) 927 ]) 928 if test $octave_cv_func_qwheelevent_angledelta = yes; then 929 AC_DEFINE(HAVE_QWHEELEVENT_ANGLEDELTA, 1, 930 [Define to 1 if you have the `QWheelEvent::angleDelta' member function.]) 931 fi 932]) 933dnl 934dnl Check whether the Qt class QWheelEvent has the position member function. 935dnl This member function was introduced in Qt 5.14. 936dnl 937AC_DEFUN([OCTAVE_CHECK_FUNC_QWHEELEVENT_POSITION], [ 938 AC_CACHE_CHECK([for QWheelEvent::position in <QWheelEvent>], 939 [octave_cv_func_qwheelevent_position], 940 [AC_LANG_PUSH(C++) 941 ac_octave_save_CPPFLAGS="$CPPFLAGS" 942 ac_octave_save_CXXFLAGS="$CXXFLAGS" 943 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 944 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 945 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 946 #include <QWheelEvent> 947 void foo (const QWheelEvent& ev) 948 { 949 ev.position (); 950 }; 951 ]])], 952 octave_cv_func_qwheelevent_position=yes, 953 octave_cv_func_qwheelevent_position=no) 954 CPPFLAGS="$ac_octave_save_CPPFLAGS" 955 CXXFLAGS="$ac_octave_save_CXXFLAGS" 956 AC_LANG_POP(C++) 957 ]) 958 if test $octave_cv_func_qwheelevent_position = yes; then 959 AC_DEFINE(HAVE_QWHEELEVENT_POSITION, 1, 960 [Define to 1 if you have the `QWheelEvent::position' member function.]) 961 fi 962]) 963dnl 964dnl Check whether Qt message handler function accepts QMessageLogContext 965dnl argument. This change was introduced in Qt 5. 966dnl 967dnl FIXME: Delete this entirely when we drop support for Qt 4. 968dnl 969AC_DEFUN([OCTAVE_CHECK_FUNC_QTMESSAGEHANDLER_ACCEPTS_QMESSAGELOGCONTEXT], [ 970 AC_CACHE_CHECK([whether Qt message handler accepts QMessageLogContext], 971 [octave_cv_func_qtmessagehandler_accepts_qmessagelogcontext], 972 [AC_LANG_PUSH(C++) 973 ac_octave_save_CPPFLAGS="$CPPFLAGS" 974 ac_octave_save_CXXFLAGS="$CXXFLAGS" 975 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 976 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 977 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 978 #include <QtGlobal> 979 static void 980 msg_handler (QtMsgType, const QMessageLogContext &, const QString &) 981 { } 982 ]], [[ 983 QtMessageHandler fptr = msg_handler; 984 ]])], 985 octave_cv_func_qtmessagehandler_accepts_qmessagelogcontext=yes, 986 octave_cv_func_qtmessagehandler_accepts_qmessagelogcontext=no) 987 CPPFLAGS="$ac_octave_save_CPPFLAGS" 988 CXXFLAGS="$ac_octave_save_CXXFLAGS" 989 AC_LANG_POP(C++) 990 ]) 991 if test $octave_cv_func_qtmessagehandler_accepts_qmessagelogcontext = yes; then 992 AC_DEFINE(QTMESSAGEHANDLER_ACCEPTS_QMESSAGELOGCONTEXT, 1, 993 [Define to 1 if Qt message handler accepts 'QMessageLogContext' argument.]) 994 fi 995]) 996dnl 997dnl Check whether the Qt class QList has a constructor that accepts 998dnl a pair of iterators. This constructor was introduced in Qt 5.14. 999dnl 1000AC_DEFUN([OCTAVE_CHECK_FUNC_QLIST_ITERATOR_CONSTRUCTOR], [ 1001 AC_CACHE_CHECK([for QList<T>::QList (iterator, iterator) constructor], 1002 [octave_cv_func_qlist_iterator_constructor], 1003 [AC_LANG_PUSH(C++) 1004 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1005 ac_octave_save_CXXFLAGS="$CXXFLAGS" 1006 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 1007 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 1008 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1009 #include <QList> 1010 ]], [[ 1011 QList<int> lst_one; 1012 QList<int> lst_two (lst_one.begin (), lst_one.end ()); 1013 ]])], 1014 octave_cv_func_qlist_iterator_constructor=yes, 1015 octave_cv_func_qlist_iterator_constructor=no) 1016 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1017 CXXFLAGS="$ac_octave_save_CXXFLAGS" 1018 AC_LANG_POP(C++) 1019 ]) 1020 if test $octave_cv_func_qlist_iterator_constructor = yes; then 1021 AC_DEFINE(HAVE_QLIST_ITERATOR_CONSTRUCTOR, 1, 1022 [Define to 1 if you have the `QList<T>::QList (iterator, iterator)' constructor.]) 1023 fi 1024]) 1025dnl 1026dnl Check whether the Qt class QRegion has the iterators and related 1027dnl functions introduced in Qt 5.8. 1028dnl 1029AC_DEFUN([OCTAVE_CHECK_QREGION_ITERATORS], [ 1030 AC_CACHE_CHECK([for QRegion iterators and related functions], 1031 [octave_cv_qregion_iterators], 1032 [AC_LANG_PUSH(C++) 1033 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1034 ac_octave_save_CXXFLAGS="$CXXFLAGS" 1035 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 1036 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 1037 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1038 #include <QRegion> 1039 ]], [[ 1040 QRegion region; 1041 QRegion::const_iterator it; 1042 it = region.begin (); 1043 it = region.end (); 1044 it = region.cbegin (); 1045 it = region.cend (); 1046 QRegion::const_reverse_iterator rit; 1047 rit = region.rbegin (); 1048 rit = region.rend (); 1049 rit = region.crbegin (); 1050 rit = region.crend (); 1051 ]])], 1052 octave_cv_qregion_iterators=yes, 1053 octave_cv_qregion_iterators=no) 1054 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1055 CXXFLAGS="$ac_octave_save_CXXFLAGS" 1056 AC_LANG_POP(C++) 1057 ]) 1058 if test $octave_cv_qregion_iterators = yes; then 1059 AC_DEFINE(HAVE_QREGION_ITERATORS, 1, 1060 [Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.]) 1061 fi 1062]) 1063dnl 1064dnl Check whether the Qt::SplitBehavior enum exists and has 1065dnl Qt::KeepEmptyParts and Qt::SkipEmptyParts members. This enum 1066dnl was introduced or modified in Qt 5.14. 1067dnl 1068AC_DEFUN([OCTAVE_CHECK_QT_SPLITBEHAVIOR_ENUM], [ 1069 AC_CACHE_CHECK([for Qt::SplitBehavior enum], 1070 [octave_cv_qt_splitbehavior_enum], 1071 [AC_LANG_PUSH(C++) 1072 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1073 ac_octave_save_CXXFLAGS="$CXXFLAGS" 1074 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 1075 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 1076 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1077 #include <Qt> 1078 ]], [[ 1079 Qt::SplitBehavior sb_keep = Qt::KeepEmptyParts; 1080 Qt::SplitBehavior sb_skip = Qt::SkipEmptyParts; 1081 ]])], 1082 octave_cv_qt_splitbehavior_enum=yes, 1083 octave_cv_qt_splitbehavior_enum=no) 1084 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1085 CXXFLAGS="$ac_octave_save_CXXFLAGS" 1086 AC_LANG_POP(C++) 1087 ]) 1088 if test $octave_cv_qt_splitbehavior_enum = yes; then 1089 AC_DEFINE(HAVE_QT_SPLITBEHAVIOR_ENUM, 1, 1090 [Define to 1 if you have the `Qt::SplitBehavior' enum.]) 1091 fi 1092]) 1093dnl 1094dnl Check whether the Qt class QFontDatabase has the systemFont member 1095dnl function. This function was introduced in Qt 5.2. 1096dnl 1097AC_DEFUN([OCTAVE_CHECK_FUNC_QFONTDATABASE_SYSTEMFONT], [ 1098 AC_CACHE_CHECK([for QFontDatabase::systemFont function], 1099 [octave_cv_func_qfontdatabase_systemfont], 1100 [AC_LANG_PUSH(C++) 1101 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1102 ac_octave_save_CXXFLAGS="$CXXFLAGS" 1103 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 1104 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 1105 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1106 #include <QFontDatabase> 1107 #include <QFont> 1108 ]], [[ 1109 QFont font = QFontDatabase::systemFont (QFontDatabase::FixedFont); 1110 ]])], 1111 octave_cv_func_qfontdatabase_systemfont=yes, 1112 octave_cv_func_qfontdatabase_systemfont=no) 1113 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1114 CXXFLAGS="$ac_octave_save_CXXFLAGS" 1115 AC_LANG_POP(C++) 1116 ]) 1117 if test $octave_cv_func_qfontdatabase_systemfont = yes; then 1118 AC_DEFINE(HAVE_QFONTDATABASE_SYSTEMFONT, 1, 1119 [Define to 1 if you have the `QFontDatabase::systemFont' function.]) 1120 fi 1121]) 1122dnl 1123dnl Check whether the Qt class QList has a constructor that accepts 1124dnl a pair of iterators. This constructor was introduced in Qt 5.14. 1125dnl 1126AC_DEFUN([OCTAVE_CHECK_FUNC_QFONTMETRICS_HORIZONTAL_ADVANCE], [ 1127 AC_CACHE_CHECK([for QFontMetrics::horizontalAdvance function], 1128 [octave_cv_func_qfontmetrics_horizontal_advance], 1129 [AC_LANG_PUSH(C++) 1130 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1131 ac_octave_save_CXXFLAGS="$CXXFLAGS" 1132 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 1133 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 1134 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1135 #include <QFont> 1136 #include <QFontMetrics> 1137 #include <QString> 1138 ]], [[ 1139 QFont font; 1140 QFontMetrics fm (font); 1141 fm.horizontalAdvance ('x'); 1142 fm.horizontalAdvance (QString ("string")); 1143 ]])], 1144 octave_cv_func_qfontmetrics_horizontal_advance=yes, 1145 octave_cv_func_qfontmetrics_horizontal_advance=no) 1146 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1147 CXXFLAGS="$ac_octave_save_CXXFLAGS" 1148 AC_LANG_POP(C++) 1149 ]) 1150 if test $octave_cv_func_qfontmetrics_horizontal_advance = yes; then 1151 AC_DEFINE(HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE, 1, 1152 [Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.]) 1153 fi 1154]) 1155dnl 1156dnl Check whether HDF5 library has version 1.6 API functions. 1157dnl 1158AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_VER_16_API], [ 1159 AC_CACHE_CHECK([whether HDF5 library has enforced version 1.6 API], 1160 [octave_cv_hdf5_has_ver_16_api], 1161 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1162 #include <hdf5.h> 1163 ]], [[ 1164 H5Eset_auto (0, 0); 1165 ]])], 1166 octave_cv_hdf5_has_ver_16_api=yes, 1167 octave_cv_hdf5_has_ver_16_api=no) 1168 ]) 1169 if test $octave_cv_hdf5_has_ver_16_api != yes; then 1170 AC_DEFINE(HAVE_HDF5_18, 1, [Define to 1 if >=HDF5-1.8 is available.]) 1171 fi 1172]) 1173dnl 1174dnl Usage: 1175dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC, 1176dnl LANG, DOC-STRING, EXTRA-CHECK, PKG-CONFIG-NAME, 1177dnl REQUIRED) 1178dnl 1179AC_DEFUN([OCTAVE_CHECK_LIB], [ 1180 AC_ARG_WITH([m4_tolower($1)-includedir], 1181 [AS_HELP_STRING([--with-m4_tolower($1)-includedir=DIR], 1182 [look for $2 include files in DIR])], 1183 [m4_toupper([$1])_CPPFLAGS="-I$withval"]) 1184 AC_SUBST(m4_toupper([$1])_CPPFLAGS) 1185 1186 AC_ARG_WITH([m4_tolower($1)-libdir], 1187 [AS_HELP_STRING([--with-m4_tolower($1)-libdir=DIR], 1188 [look for $2 libraries in DIR])], 1189 [m4_toupper([$1])_LDFLAGS="-L$withval"]) 1190 AC_SUBST(m4_toupper([$1])_LDFLAGS) 1191 1192 AC_ARG_WITH([m4_tolower($1)], 1193 [ifelse([$#], 10, 1194 [m4_ifblank([$7], 1195 [AS_HELP_STRING([--with-m4_tolower($1)=<lib>], [use $2 library <lib>])], 1196 [AS_HELP_STRING([--with-m4_tolower($1)], [$7])])], 1197 [m4_ifblank([$7], 1198 [AS_HELP_STRING([--without-m4_tolower($1)], [don't use $2 library])], 1199 [AS_HELP_STRING([--without-m4_tolower($1)], [$7])])])], 1200 with_$1=$withval, with_$1=yes) 1201 1202 ac_octave_$1_pkg_check=no 1203 m4_toupper([$1])_LIBS= 1204 warn_$1="$3" 1205 case $with_$1 in 1206 no) 1207 ifelse([$#], 10, 1208 [AC_MSG_ERROR([--without-m4_tolower($1) specified but $2 is required.])], 1209 [warn_$1="--without-m4_tolower($1) specified. Functions or features that depend on $2 will be disabled." 1210 m4_toupper([$1])_LIBS=]) 1211 ;; 1212 yes | "") 1213 ac_octave_$1_pkg_check=yes 1214 m4_toupper([$1])_LIBS="-l$1" 1215 ;; 1216 -* | */* | *.a | *.so | *.so.* | *.o) 1217 m4_toupper([$1])_LIBS="$with_$1" 1218 ;; 1219 *) 1220 m4_toupper([$1])_LIBS="-l$with_$1" 1221 ;; 1222 esac 1223 1224 if test $ac_octave_$1_pkg_check = yes; then 1225 PKG_CHECK_EXISTS(m4_default([$9], [$1]), [ 1226 if test -z "$m4_toupper([$1])_CPPFLAGS"; then 1227 m4_toupper([$1])_CPPFLAGS="$($PKG_CONFIG --cflags-only-I m4_default([$9], [$1]) | $SED -e 's/^ *$//')" 1228 fi 1229 if test -z "$m4_toupper([$1])_LDFLAGS"; then 1230 m4_toupper([$1])_LDFLAGS="$($PKG_CONFIG --libs-only-L m4_default([$9], [$1]) | $SED -e 's/^ *$//')" 1231 fi 1232 m4_toupper([$1])_LIBS="$($PKG_CONFIG --libs-only-l m4_default([$9], [$1]) | $SED -e 's/^ *$//')" 1233 ]) 1234 fi 1235 1236 if test -n "$m4_toupper([$1])_LIBS"; then 1237 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1238 ac_octave_save_LDFLAGS="$LDFLAGS" 1239 ac_octave_save_LIBS="$LIBS" 1240 CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS" 1241 LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS" 1242 LIBS="$m4_toupper([$1])_LIBS $LIBS" 1243 m4_ifnblank([$6], [AC_LANG_PUSH($6)]) 1244 ac_octave_$1_check_for_lib=no 1245 m4_ifblank([$4], [ac_octave_$1_check_for_lib=yes], 1246 [AC_CHECK_HEADERS([$4], [ac_octave_$1_check_for_lib=yes; break])]) 1247 if test $ac_octave_$1_check_for_lib = yes; then 1248 AC_CACHE_CHECK([for $5 in $m4_toupper([$1])_LIBS], 1249 [octave_cv_lib_$1], 1250 [AC_LINK_IFELSE([AC_LANG_CALL([], [$5])], 1251 [octave_cv_lib_$1=yes], [octave_cv_lib_$1=no]) 1252 ]) 1253 if test "$octave_cv_lib_$1" = yes; then 1254 m4_ifblank([$8], [ 1255 warn_$1= 1256 AC_DEFINE([HAVE_]m4_toupper([$1]), 1, 1257 [Define to 1 if $2 is available.])], [$8]) 1258 else 1259 m4_toupper([$1])_LIBS= 1260 fi 1261 else 1262 octave_cv_lib_$1=no 1263 m4_toupper([$1])_LIBS= 1264 fi 1265 m4_ifnblank([$6], [AC_LANG_POP($6)]) 1266 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1267 LDFLAGS="$ac_octave_save_LDFLAGS" 1268 LIBS="$ac_octave_save_LIBS" 1269 else 1270 octave_cv_lib_$1=no 1271 fi 1272 1273 ifelse([$#], 10, [ 1274 if test $octave_cv_lib_$1 = no; then 1275 AC_MSG_ERROR([to build Octave, you must have the $2 library and header files installed]) 1276 fi]) 1277 AC_SUBST(m4_toupper([$1])_LIBS) 1278 if test -n "$warn_$1"; then 1279 OCTAVE_CONFIGURE_WARNING([warn_$1]) 1280 fi 1281]) 1282dnl 1283dnl Check whether ARPACK works (does not crash). 1284dnl 1285dnl Using a pure Fortran program doesn't seem to crash when linked 1286dnl with the buggy ARPACK library, but the C++ program does. Maybe it 1287dnl is the memory allocation that exposes the bug and using statically 1288dnl allocated arrays in Fortran does not? 1289dnl 1290dnl FIXME: it would be nice to avoid the duplication of F77 macros 1291dnl and typedefs here and in the f77-fcn.h header file. Also, the 1292dnl definition of the character handling macros are not right for 1293dnl all systems (but should work on most modern systems in use today). 1294dnl 1295AC_DEFUN([OCTAVE_CHECK_LIB_ARPACK_OK_1], [ 1296 AC_CACHE_CHECK([whether the arpack library works], 1297 [octave_cv_lib_arpack_ok_1], 1298 [AC_LANG_PUSH(C++) 1299 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 1300 1301#include <cfloat> 1302 1303#include <stdint.h> 1304 1305typedef int F77_RET_T; 1306 1307#define F77_CHAR_ARG2(x, l) x 1308#define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) 1309 1310#define F77_CHAR_ARG_LEN(l) , l 1311 1312#define F77_CONST_CHAR_ARG_DECL const char * 1313#define F77_CHAR_ARG_LEN_DECL , long 1314 1315#define F77_INT $OCTAVE_F77_INT_TYPE 1316#define F77_DBLE double 1317 1318extern "C" 1319{ 1320 F77_RET_T 1321 F77_FUNC (dnaupd, DNAUPD) (F77_INT&, 1322 F77_CONST_CHAR_ARG_DECL, 1323 const F77_INT&, 1324 F77_CONST_CHAR_ARG_DECL, 1325 F77_INT&, const F77_DBLE&, 1326 F77_DBLE*, const F77_INT&, F77_DBLE*, 1327 const F77_INT&, F77_INT*, 1328 F77_INT*, F77_DBLE*, F77_DBLE*, 1329 const F77_INT&, F77_INT& 1330 F77_CHAR_ARG_LEN_DECL 1331 F77_CHAR_ARG_LEN_DECL); 1332 1333 F77_RET_T 1334 F77_FUNC (dneupd, DNEUPD) (const F77_INT&, 1335 F77_CONST_CHAR_ARG_DECL, 1336 F77_INT*, F77_DBLE*, F77_DBLE*, 1337 F77_DBLE*, const F77_INT&, const F77_DBLE&, 1338 const F77_DBLE&, F77_DBLE*, 1339 F77_CONST_CHAR_ARG_DECL, 1340 const F77_INT&, 1341 F77_CONST_CHAR_ARG_DECL, 1342 F77_INT&, const F77_DBLE&, F77_DBLE*, 1343 const F77_INT&, F77_DBLE*, 1344 const F77_INT&, F77_INT*, 1345 F77_INT*, F77_DBLE*, F77_DBLE*, 1346 const F77_INT&, F77_INT& 1347 F77_CHAR_ARG_LEN_DECL 1348 F77_CHAR_ARG_LEN_DECL 1349 F77_CHAR_ARG_LEN_DECL); 1350 1351 F77_RET_T 1352 F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL, 1353 const F77_INT&, const F77_INT&, 1354 const F77_DBLE&, const F77_DBLE*, 1355 const F77_INT&, const F77_DBLE*, 1356 const F77_INT&, const F77_DBLE&, 1357 F77_DBLE*, const F77_INT& 1358 F77_CHAR_ARG_LEN_DECL); 1359} 1360 1361void 1362doit (void) 1363{ 1364 // Based on function EigsRealNonSymmetricMatrix from liboctave/eigs-base.cc. 1365 1366 // Problem matrix. See bug #31479. 1367 F77_INT n = 4; 1368 double *m = new double [n * n]; 1369 m[0] = 1, m[4] = 0, m[8] = 0, m[12] = -1; 1370 m[1] = 0, m[5] = 1, m[9] = 0, m[13] = 0; 1371 m[2] = 0, m[6] = 0, m[10] = 1, m[14] = 0; 1372 m[3] = 0, m[7] = 0, m[11] = 2, m[15] = 1; 1373 1374 double *resid = new double [4]; 1375 1376 resid[0] = 0.960966; 1377 resid[1] = 0.741195; 1378 resid[2] = 0.150143; 1379 resid[3] = 0.868067; 1380 1381 F77_INT *ip = new F77_INT [11]; 1382 1383 ip[0] = 1; // ishift 1384 ip[1] = 0; // ip[1] not referenced 1385 ip[2] = 300; // mxiter, maximum number of iterations 1386 ip[3] = 1; // NB blocksize in recurrence 1387 ip[4] = 0; // nconv, number of Ritz values that satisfy convergence 1388 ip[5] = 0; // ip[5] not referenced 1389 ip[6] = 1; // mode 1390 ip[7] = 0; // ip[7] to ip[10] are return values 1391 ip[8] = 0; 1392 ip[9] = 0; 1393 ip[10] = 0; 1394 1395 F77_INT *ipntr = new F77_INT [14]; 1396 1397 F77_INT k = 1; 1398 F77_INT p = 3; 1399 F77_INT lwork = 3 * p * (p + 2); 1400 1401 double *v = new double [n * (p + 1)]; 1402 double *workl = new double [lwork + 1]; 1403 double *workd = new double [3 * n + 1]; 1404 1405 F77_INT ido = 0; 1406 F77_INT info = 0; 1407 1408 double tol = DBL_EPSILON; 1409 1410 do 1411 { 1412 F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 ("I", 1), 1413 n, F77_CONST_CHAR_ARG2 ("LM", 2), 1414 k, tol, resid, p, v, n, ip, ipntr, 1415 workd, workl, lwork, info 1416 F77_CHAR_ARG_LEN (1) 1417 F77_CHAR_ARG_LEN (2)); 1418 1419 if (ido == -1 || ido == 1 || ido == 2) 1420 { 1421 double *x = workd + ipntr[0] - 1; 1422 double *y = workd + ipntr[1] - 1; 1423 1424 F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG2 ("N", 1), 1425 n, n, 1.0, m, n, x, 1, 0.0, y, 1 1426 F77_CHAR_ARG_LEN (1)); 1427 } 1428 else 1429 { 1430 if (info < 0) 1431 return; // Error 1432 1433 break; 1434 } 1435 } 1436 while (1); 1437 1438 F77_INT *sel = new F77_INT [p]; 1439 1440 // In Octave, the dimensions of dr and di are k+1, but k+2 avoids segfault 1441 double *dr = new double [k + 1]; 1442 double *di = new double [k + 1]; 1443 double *workev = new double [3 * p]; 1444 1445 for (F77_INT i = 0; i < k + 1; i++) 1446 dr[i] = di[i] = 0.0; 1447 1448 F77_INT rvec = 1; 1449 1450 double sigmar = 0.0; 1451 double sigmai = 0.0; 1452 1453 // In Octave, this is n*(k+1), but n*(k+2) avoids segfault 1454 double *z = new double [n * (k + 1)]; 1455 1456 F77_FUNC (dneupd, DNEUPD) (rvec, F77_CONST_CHAR_ARG2 ("A", 1), 1457 sel, dr, di, z, n, sigmar, sigmai, workev, 1458 F77_CONST_CHAR_ARG2 ("I", 1), n, 1459 F77_CONST_CHAR_ARG2 ("LM", 2), k, tol, 1460 resid, p, v, n, ip, ipntr, workd, 1461 workl, lwork, info 1462 F77_CHAR_ARG_LEN (1) 1463 F77_CHAR_ARG_LEN (1) 1464 F77_CHAR_ARG_LEN (2)); 1465} 1466 1467]], [[ 1468 1469 for (int i = 0; i < 10; i++) 1470 doit (); 1471 1472 ]])], 1473 octave_cv_lib_arpack_ok_1=yes, 1474 octave_cv_lib_arpack_ok_1=no, 1475 octave_cv_lib_arpack_ok_1=yes) 1476 AC_LANG_POP(C++) 1477 ]) 1478 if test $octave_cv_lib_arpack_ok_1 = yes; then 1479 $1 1480 : 1481 else 1482 $2 1483 : 1484 fi 1485]) 1486dnl 1487dnl Check whether ARPACK is buggy (it doesn't crash, but gets wrong answers). 1488dnl 1489dnl ARPACK versions < 3.3.0 have a bug which results in different eigenvalues 1490dnl being calculated depending on whether eigenvectors are also requested. 1491dnl See bug #52425. 1492dnl 1493AC_DEFUN([OCTAVE_CHECK_LIB_ARPACK_OK_2], [ 1494 AC_CACHE_CHECK([whether the arpack library is free of bugs], 1495 [octave_cv_lib_arpack_ok_2], 1496 [save_FFLAGS="$FFLAGS" 1497 FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" 1498 AC_LANG_PUSH(Fortran 77) 1499 AC_RUN_IFELSE([[ 1500 program bug_52425 1501c 1502 integer maxn, maxnev, maxncv, ldv 1503 parameter (maxn=256, maxnev=10, maxncv=25, 1504 $ ldv=maxn ) 1505c 1506 Double precision 1507 & v(ldv,maxncv), workl(maxncv*(maxncv+8)), 1508 & workd(3*maxn), d(maxncv,2), resid(maxn), 1509 & ax(maxn) 1510 logical select(maxncv) 1511 integer iparam(11), ipntr(11) 1512c 1513 character bmat*1, which*2 1514 integer ido, n, nev, ncv, lworkl, info, ierr, j, 1515 & nx, nconv, maxitr, mode, ishfts 1516 logical rvec 1517 Double precision 1518 & tol, sigma 1519c 1520 Double precision 1521 & zero 1522 parameter (zero = 0.0D+0) 1523c 1524 Double precision 1525 & dnrm2 1526 external dnrm2, daxpy 1527c 1528 intrinsic abs 1529c 1530 n = 20 1531 nev = 4 1532 ncv = 20 1533 bmat = 'I' 1534 which = 'BE' 1535c 1536 lworkl = ncv*(ncv+8) 1537 tol = zero 1538 info = 1 1539 do j = 1,n 1540 resid (j) = 1.0d0 1541 end do 1542 ido = 0 1543c 1544 ishfts = 1 1545 maxitr = 300 1546 mode = 1 1547c 1548 iparam(1) = ishfts 1549 iparam(3) = maxitr 1550 iparam(7) = mode 1551c 1552 10 continue 1553c 1554 call dsaupd ( ido, bmat, n, which, nev, tol, resid, 1555 & ncv, v, ldv, iparam, ipntr, workd, workl, 1556 & lworkl, info ) 1557c 1558 if (ido .eq. -1 .or. ido .eq. 1) then 1559 call av (n, workd(ipntr(1)), workd(ipntr(2))) 1560 go to 10 1561 end if 1562c 1563 if ( info .lt. 0 ) then 1564 stop 1 1565 else 1566 rvec = .false. 1567c 1568 call dseupd ( rvec, 'All', select, d, v, ldv, sigma, 1569 & bmat, n, which, nev, tol, resid, ncv, v, ldv, 1570 & iparam, ipntr, workd, workl, lworkl, ierr ) 1571c 1572 if ( ierr .ne. 0) then 1573 stop 1 1574 else 1575 nconv = iparam(5) 1576 do 20 j=1, nconv 1577 call av(n, v(1,j), ax) 1578 call daxpy(n, -d(j,1), v(1,j), 1, ax, 1) 1579 d(j,2) = dnrm2(n, ax, 1) 1580 d(j,2) = d(j,2) / abs(d(j,1)) 1581c 1582 20 continue 1583c 1584c | Litmus test: return 1 or 0 based on returned eigenvalue 1585c 1586 if (abs(d(1,1) - 2.0810) > 1.0d-4) then 1587 stop 1 1588 else 1589 stop 0 1590 end if 1591 end if 1592 end if 1593c 1594 end 1595c 1596 subroutine av (n, v, w) 1597 integer n, j 1598 Double precision v(n), w(n) 1599c 1600 w(1) = 4*v(1) + v(3) 1601 w(2) = 4*v(2) + v(4) 1602 do 10 j = 3, n - 2 1603 w(j) = v(j-2) + 4*v(j) + v(j+2) 1604 10 continue 1605 w(n-1) = v(n-3) + 4 * v(n-1) 1606 w(n) = v(n-2) + 4 * v(n) 1607 return 1608 end 1609 ]], 1610 octave_cv_lib_arpack_ok_2=yes, 1611 octave_cv_lib_arpack_ok_2=no, 1612 octave_cv_lib_arpack_ok_2=yes) 1613 ## Restore FFLAGS. 1614 FFLAGS="$save_FFLAGS" 1615 AC_LANG_POP(Fortran 77) 1616 ]) 1617 if test $octave_cv_lib_arpack_ok_2 = yes; then 1618 $1 1619 : 1620 else 1621 $2 1622 : 1623 fi 1624]) 1625dnl 1626dnl Check whether GLPK provides the latest API functions required 1627dnl for the glpk function. The glp_iptcp structure was introduced 1628dnl in GLPK version 4.38. 1629dnl 1630AC_DEFUN([OCTAVE_CHECK_LIB_GLPK_OK], [ 1631 AC_CACHE_CHECK([whether the glpk library has glp_interior(glp_prob*, glp_iptcp*)], 1632 [octave_cv_lib_glpk_ok], 1633 [AC_LANG_PUSH(C++) 1634 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1635 extern "C" 1636 { 1637 #if defined (HAVE_GLPK_GLPK_H) 1638 #include <glpk/glpk.h> 1639 #else 1640 #include <glpk.h> 1641 #endif 1642 } 1643 ]], [[ 1644 glp_prob *lp = glp_create_prob (); 1645 glp_iptcp iptcp; 1646 glp_init_iptcp (&iptcp); 1647 int retval = glp_interior (lp, &iptcp); 1648 ]])], 1649 octave_cv_lib_glpk_ok=yes, 1650 octave_cv_lib_glpk_ok=no) 1651 AC_LANG_POP(C++) 1652 ]) 1653 if test $octave_cv_lib_glpk_ok = yes; then 1654 $1 1655 : 1656 else 1657 $2 1658 : 1659 fi 1660]) 1661dnl 1662dnl Check whether using HDF5 DLL under Windows. This is done by 1663dnl testing for a data symbol in the HDF5 library, which would 1664dnl require the definition of _HDF5USEDL_ under MSVC compiler. 1665dnl 1666AC_DEFUN([OCTAVE_CHECK_LIB_HDF5_DLL], [ 1667 AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined], 1668 [octave_cv_lib_hdf5_dll], 1669 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1670 #include <hdf5.h> 1671 ]], [[ 1672 hid_t x = H5T_NATIVE_DOUBLE; 1673 return x 1674 ]])], 1675 [octave_cv_lib_hdf5_dll=no], 1676 [save_CFLAGS="$CFLAGS" 1677 CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_" 1678 save_LIBS="$LIBS" 1679 LIBS="$HDF5_LIBS $LIBS" 1680 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1681 #include <hdf5.h> 1682 ]], [[ 1683 hid_t x = H5T_NATIVE_DOUBLE; 1684 return x 1685 ]])], 1686 octave_cv_lib_hdf5_dll=yes, 1687 octave_cv_lib_hdf5_dll=no) 1688 CFLAGS="$save_CFLAGS" 1689 LIBS="$save_LIBS" 1690 ]) 1691 ]) 1692 if test $octave_cv_lib_hdf5_dll = yes; then 1693 AC_DEFINE(_HDF5USEDLL_, 1, [Define to 1 if using HDF5 dll (Win32).]) 1694 fi 1695]) 1696dnl 1697dnl Check for OpenGL. If found, define OPENGL_LIBS. 1698dnl 1699dnl FIXME: The following tests should probably check for the 1700dnl libraries separately. 1701dnl 1702dnl FIXME: Should we allow a way to specify a directory for OpenGL 1703dnl libraries and header files? 1704dnl 1705AC_DEFUN([OCTAVE_CHECK_LIB_OPENGL], [ 1706 OPENGL_LIBS= 1707 1708 ## On MacOSX systems the OpenGL framework can be used 1709 OCTAVE_HAVE_FRAMEWORK(OpenGL, [[ 1710 #include <OpenGL/gl.h> 1711 #include <OpenGL/glu.h> 1712 ]], [[ 1713 GLint par; glGetIntegerv (GL_VIEWPORT, &par); 1714 ]], 1715 have_framework_opengl=yes, have_framework_opengl=no) 1716 1717 if test $have_framework_opengl = yes; then 1718 AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, 1719 [Define to 1 if framework OPENGL is available.]) 1720 OPENGL_LIBS="-framework OpenGL" 1721 AC_MSG_NOTICE([adding -framework OpenGL to OPENGL_LIBS]) 1722 OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS 1723 else 1724 case $canonical_host_type in 1725 *-*-mingw32* | *-*-msdosmsvc) 1726 AC_CHECK_HEADERS([windows.h]) 1727 ;; 1728 esac 1729 have_opengl_incs=no 1730 AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h], 1731 [AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h], 1732 [have_opengl_incs=yes; break], [], [ 1733#if defined (HAVE_WINDOWS_H) 1734#include <windows.h> 1735#endif 1736 ]) 1737 break 1738 ], [], [ 1739#if defined (HAVE_WINDOWS_H) 1740# include <windows.h> 1741#endif 1742 ]) 1743 1744 if test $have_opengl_incs = yes; then 1745 AC_CHECK_HEADERS([GL/glext.h OpenGL/glext.h], [], [], [ 1746#if defined (HAVE_WINDOWS_H) 1747# include <windows.h> 1748#endif 1749#if defined (HAVE_GL_GL_H) 1750# include <GL/gl.h> 1751#elif defined (HAVE_OPENGL_GL_H) 1752# include <OpenGL/gl.h> 1753#endif 1754 ]) 1755 case $canonical_host_type in 1756 *-*-mingw32* | *-*-msdosmsvc) 1757 save_LIBS="$LIBS" 1758 LIBS="$LIBS -lopengl32" 1759 AC_MSG_CHECKING([for glEnable in -lopengl32]) 1760 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1761 #if HAVE_WINDOWS_H 1762 # include <windows.h> 1763 #endif 1764 #if defined (HAVE_GL_GL_H) 1765 # include <GL/gl.h> 1766 #elif defined (HAVE_OPENGL_GL_H) 1767 # include <OpenGL/gl.h> 1768 #endif 1769 ]], [[ 1770 glEnable(GL_SMOOTH); 1771 ]])], [OPENGL_LIBS="-lopengl32 -lglu32"]) 1772 1773 LIBS="$save_LIBS" 1774 if test -n "$OPENGL_LIBS"; then 1775 AC_MSG_RESULT([yes]) 1776 else 1777 AC_MSG_RESULT([no]) 1778 fi 1779 ;; 1780 *) 1781 ## Non-Mac, Non-Windows systems use this check 1782 AC_CHECK_LIB([GL], [glEnable], [OPENGL_LIBS="-lGL -lGLU"]) 1783 ;; 1784 esac 1785 fi 1786 fi 1787 AC_SUBST(OPENGL_LIBS) 1788 if test -n "$OPENGL_LIBS"; then 1789 AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.]) 1790 fi 1791]) 1792dnl 1793dnl Check whether Qhull works (does not crash). 1794dnl 1795AC_DEFUN([OCTAVE_CHECK_LIB_QHULL_OK], [ 1796 AC_CACHE_CHECK([whether the qhull library works], 1797 [octave_cv_lib_qhull_ok], 1798 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 1799 #include <stdio.h> 1800 #if defined (HAVE_LIBQHULL_LIBQHULL_H) 1801 # include <libqhull/libqhull.h> 1802 # include <libqhull/qset.h> 1803 # include <libqhull/geom.h> 1804 # include <libqhull/poly.h> 1805 # include <libqhull/io.h> 1806 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) 1807 # if defined (HAVE_QHULL_LIBQHULL_H) 1808 # include <qhull/libqhull.h> 1809 # else 1810 # include <qhull/qhull.h> 1811 # endif 1812 # include <qhull/qset.h> 1813 # include <qhull/geom.h> 1814 # include <qhull/poly.h> 1815 # include <qhull/io.h> 1816 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) 1817 # if defined (HAVE_LIBQHULL_H) 1818 # include <libqhull.h> 1819 # else 1820 # include <qhull.h> 1821 # endif 1822 # include <qset.h> 1823 # include <geom.h> 1824 # include <poly.h> 1825 # include <io.h> 1826 #endif 1827 #if defined (NEED_QHULL_VERSION) 1828 char *qh_version = "version"; 1829 #endif 1830 ]], [[ 1831 int dim = 2; 1832 int n = 4; 1833 coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 }; 1834 boolT ismalloc = 0; 1835 return qh_new_qhull (dim, n, points, ismalloc, "qhull ", 0, stderr); 1836 ]])], 1837 octave_cv_lib_qhull_ok=yes, 1838 octave_cv_lib_qhull_ok=no, 1839 octave_cv_lib_qhull_ok=yes) 1840 ]) 1841 if test $octave_cv_lib_qhull_ok = yes; then 1842 $1 1843 : 1844 else 1845 $2 1846 : 1847 fi 1848]) 1849dnl 1850dnl Check whether PCRE is compiled with --enable-utf. 1851dnl 1852AC_DEFUN([OCTAVE_CHECK_LIB_PCRE_OK], [ 1853 AC_CACHE_CHECK([whether PCRE library was compiled with UTF support], 1854 [octave_cv_lib_pcre_ok], 1855 [AC_LANG_PUSH(C++) 1856 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 1857 #include <stdio.h> 1858 #if defined (HAVE_PCRE_H) 1859 # include <pcre.h> 1860 #elif defined (HAVE_PCRE_PCRE_H) 1861 # include <pcre/pcre.h> 1862 #endif 1863 ]], [[ 1864 const char *pattern = "test"; 1865 const char *err; 1866 int erroffset; 1867 pcre *data = pcre_compile (pattern, PCRE_UTF8, &err, &erroffset, nullptr); 1868 return (! data); 1869 ]])], 1870 octave_cv_lib_pcre_ok=yes, 1871 octave_cv_lib_pcre_ok=no, 1872 octave_cv_lib_pcre_ok=yes) 1873 AC_LANG_POP(C++) 1874 ]) 1875 if test $octave_cv_lib_pcre_ok = yes; then 1876 $1 1877 : 1878 else 1879 $2 1880 : 1881 fi 1882]) 1883dnl 1884dnl Check whether sndfile library is modern enough to include things like Ogg 1885dnl 1886AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [ 1887 AC_CACHE_CHECK([whether sndfile library is modern enough], 1888 [octave_cv_lib_sndfile_ok], 1889 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1890 #include <sndfile.h> 1891 ]], [[ 1892 int x = SF_FORMAT_OGG; 1893 ]])], 1894 octave_cv_lib_sndfile_ok=yes, 1895 octave_cv_lib_sndfile_ok=no) 1896 ]) 1897 if test $octave_cv_lib_sndfile_ok = yes; then 1898 $1 1899 : 1900 else 1901 $2 1902 : 1903 fi 1904]) 1905dnl 1906dnl Find a suitable termlib to use. 1907dnl 1908AC_DEFUN([OCTAVE_CHECK_LIB_TERMLIB], [ 1909 TERM_LIBS= 1910 ac_octave_save_LIBS="$LIBS" 1911 AC_SEARCH_LIBS([tputs], 1912 [ncurses curses termcap terminfo termlib], 1913 [], []) 1914 LIBS="$ac_octave_save_LIBS" 1915 case "$ac_cv_search_tputs" in 1916 -l*) 1917 TERM_LIBS="$ac_cv_search_tputs" 1918 ;; 1919 no) 1920 warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, or -ltermlib!" 1921 AC_MSG_WARN([$warn_termlibs]) 1922 ;; 1923 esac 1924 1925dnl Old code (9/9/2012). Delete when new code is definitely proven. 1926dnl 1927dnl for _termlib in ncurses curses termcap terminfo termlib; do 1928dnl AC_CHECK_LIB([${_termlib}], [tputs], [ 1929dnl TERM_LIBS="-l${termlib}" 1930dnl octave_cv_lib_found_termlib=yes 1931dnl break]) 1932dnl done 1933 1934 AC_SUBST(TERM_LIBS) 1935]) 1936dnl 1937dnl Check whether the Qt class QFont has the ForceIntegerMetrics enumerated 1938dnl type member. This property was introduced in Qt 4.7. 1939dnl 1940dnl FIXME: Delete this entirely when we can safely assume that Qt 4.7 or later 1941dnl is in use everywhere, or when we drop support for Qt 4. 1942dnl 1943AC_DEFUN([OCTAVE_CHECK_MEMBER_QFONT_FORCE_INTEGER_METRICS], [ 1944 AC_CACHE_CHECK([for QFont::ForceIntegerMetrics in <QFont>], 1945 [octave_cv_decl_qfont_force_integer_metrics], 1946 [AC_LANG_PUSH(C++) 1947 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1948 ac_octave_save_CXXFLAGS="$CXXFLAGS" 1949 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 1950 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 1951 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1952 #include <QFont> 1953 ]], [[ 1954 QFont::StyleStrategy strategy = QFont::ForceIntegerMetrics; 1955 ]])], 1956 octave_cv_decl_qfont_force_integer_metrics=yes, 1957 octave_cv_decl_qfont_force_integer_metrics=no) 1958 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1959 CXXFLAGS="$ac_octave_save_CXXFLAGS" 1960 AC_LANG_POP(C++) 1961 ]) 1962 if test $octave_cv_decl_qfont_force_integer_metrics = yes; then 1963 AC_DEFINE(HAVE_QFONT_FORCE_INTEGER_METRICS, 1, 1964 [Define to 1 if `ForceIntegerMetrics' is a member of `QFont'.]) 1965 fi 1966]) 1967dnl 1968dnl Check whether the Qt class QFont has the Monospace enumerated type member. 1969dnl This property was introduced in Qt 4.7. 1970dnl 1971dnl FIXME: Delete this entirely when we can safely assume that Qt 4.7 or later 1972dnl is in use everywhere, or when we drop support for Qt 4. 1973dnl 1974AC_DEFUN([OCTAVE_CHECK_MEMBER_QFONT_MONOSPACE], [ 1975 AC_CACHE_CHECK([for QFont::Monospace in <QFont>], 1976 [octave_cv_decl_qfont_monospace], 1977 [AC_LANG_PUSH(C++) 1978 ac_octave_save_CPPFLAGS="$CPPFLAGS" 1979 ac_octave_save_CXXFLAGS="$CXXFLAGS" 1980 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 1981 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 1982 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1983 #include <QFont> 1984 ]], [[ 1985 QFont::StyleHint hint = QFont::Monospace; 1986 ]])], 1987 octave_cv_decl_qfont_monospace=yes, 1988 octave_cv_decl_qfont_monospace=no) 1989 CPPFLAGS="$ac_octave_save_CPPFLAGS" 1990 CXXFLAGS="$ac_octave_save_CXXFLAGS" 1991 AC_LANG_POP(C++) 1992 ]) 1993 if test $octave_cv_decl_qfont_monospace = yes; then 1994 AC_DEFINE(HAVE_QFONT_MONOSPACE, 1, 1995 [Define to 1 if `Monospace' is a member of `QFont'.]) 1996 fi 1997]) 1998dnl 1999dnl Check whether QVariant::canConvert accepts a QMetaType::Type 2000dnl enumeration value as an argument. 2001dnl 2002AC_DEFUN([OCTAVE_CHECK_QVARIANT_CANCONVERT_ACCEPTS_QMETATYPE_TYPE], [ 2003 AC_CACHE_CHECK([whether QVariant::canConvert accepts QMetaType::Type argument], 2004 [octave_cv_qvariant_canconvert_accepts_qmetatype_type], 2005 [AC_LANG_PUSH(C++) 2006 ac_octave_save_CPPFLAGS="$CPPFLAGS" 2007 ac_octave_save_CXXFLAGS="$CXXFLAGS" 2008 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 2009 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 2010 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2011 #include <QMetaType> 2012 #include <QVariant> 2013 ]], [[ 2014 QVariant var; 2015 QMetaType::Type type = QMetaType::QString; 2016 var.canConvert (type); 2017 ]])], 2018 octave_cv_qvariant_canconvert_accepts_qmetatype_type=yes, 2019 octave_cv_qvariant_canconvert_accepts_qmetatype_type=no) 2020 CPPFLAGS="$ac_octave_save_CPPFLAGS" 2021 CXXFLAGS="$ac_octave_save_CXXFLAGS" 2022 AC_LANG_POP(C++) 2023 ]) 2024 if test $octave_cv_qvariant_canconvert_accepts_qmetatype_type = yes; then 2025 AC_DEFINE(QVARIANT_CANCONVERT_ACCEPTS_QMETATYPE_TYPE, 1, 2026 [Define to 1 if `QVariant::canConvert' accepts `QMetaType::Type' enumeration value as argument.]) 2027 fi 2028]) 2029dnl 2030dnl Check for the Qhull version. 2031dnl 2032AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [ 2033 AC_CACHE_CHECK([for qh_version in $QHULL_LIBS], 2034 [octave_cv_lib_qhull_version], 2035 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 2036 #include <stdio.h> 2037 #if defined (HAVE_LIBQHULL_LIBQHULL_H) 2038 # include <libqhull/libqhull.h> 2039 # include <libqhull/qset.h> 2040 # include <libqhull/geom.h> 2041 # include <libqhull/poly.h> 2042 # include <libqhull/io.h> 2043 #elif defined (HAVE_QHULL_LIBQHULL_H) || defined (HAVE_QHULL_QHULL_H) 2044 # if defined (HAVE_QHULL_LIBQHULL_H) 2045 # include <qhull/libqhull.h> 2046 # else 2047 # include <qhull/qhull.h> 2048 # endif 2049 # include <qhull/qset.h> 2050 # include <qhull/geom.h> 2051 # include <qhull/poly.h> 2052 # include <qhull/io.h> 2053 #elif defined (HAVE_LIBQHULL_H) || defined (HAVE_QHULL_H) 2054 # if defined (HAVE_LIBQHULL_H) 2055 # include <libqhull.h> 2056 # else 2057 # include <qhull.h> 2058 # endif 2059 # include <qset.h> 2060 # include <geom.h> 2061 # include <poly.h> 2062 # include <io.h> 2063 #endif 2064 ]], [[ 2065 const char *tmp = qh_version; 2066 ]])], 2067 octave_cv_lib_qhull_version=yes, octave_cv_lib_qhull_version=no) 2068 ]) 2069 if test $octave_cv_lib_qhull_version = no; then 2070 AC_DEFINE(NEED_QHULL_VERSION, 1, 2071 [Define to 1 if the Qhull library needs a qh_version variable defined.]) 2072 fi 2073]) 2074dnl 2075dnl Check whether we have QScintilla for the given Qt VERSION. 2076dnl 2077AC_DEFUN([OCTAVE_CHECK_QSCINTILLA], [ 2078 qt_version="$1"; 2079 use_qscintilla=no 2080 warn_qscintilla="" 2081 2082 ## Check for Qt libraries 2083 case "$qt_version" in 2084 4) 2085 octave_qscintilla_libnames="qscintilla2-qt4 qscintilla2_qt4 qt4scintilla2 qscintilla2" 2086 ;; 2087 5) 2088 octave_qscintilla_libnames="qscintilla2-qt5 qscintilla2_qt5 qt5scintilla2" 2089 ;; 2090 *) 2091 AC_MSG_ERROR([Unrecognized Qt version $qt_version]) 2092 ;; 2093 esac 2094 2095 if test $build_qt_gui = yes && test $check_qscintilla = yes; then 2096 2097 ## Check for QScintilla library which is used in the Qt GUI editor. 2098 AC_CACHE_CHECK([for the QScintilla library for Qt $qt_version], 2099 [octave_cv_lib_qscintilla], 2100 [save_CPPFLAGS="$CPPFLAGS" 2101 save_CXXFLAGS="$CXXFLAGS" 2102 save_LDFLAGS="$LDFLAGS" 2103 save_LIBS="$LIBS" 2104 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 2105 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 2106 LDFLAGS="$QT_LDFLAGS $LDFLAGS" 2107 AC_LANG_PUSH(C++) 2108 for octave_qscintilla_try in $octave_qscintilla_libnames; do 2109 LIBS="$QT_LIBS -l$octave_qscintilla_try" 2110 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 2111 #include <Qsci/qsciapis.h> 2112 #include <Qsci/qscilexercpp.h> 2113 ]], [[ 2114 QsciLexer *lexer = new QsciLexerCPP (); 2115 QsciAPIs *lexer_apis = new QsciAPIs (lexer); 2116 ]])], 2117 octave_cv_lib_qscintilla="-l$octave_qscintilla_try", 2118 octave_cv_lib_qscintilla=no) 2119 if test $octave_cv_lib_qscintilla != no; then 2120 break 2121 fi 2122 done 2123 CPPFLAGS="$save_CPPFLAGS" 2124 CXXFLAGS="$save_CXXFLAGS" 2125 LDFLAGS="$save_LDFLAGS" 2126 LIBS="$save_LIBS" 2127 AC_LANG_POP([C++]) 2128 ]) 2129 2130 if test $octave_cv_lib_qscintilla = no; then 2131 warn_qscintilla="QScintilla library not found; disabling built-in Qt GUI editor" 2132 else 2133 ## Let's assume QScintilla library is at the same location as 2134 ## other regular Qt libraries. 2135 QT_LIBS="$QT_LIBS $octave_cv_lib_qscintilla" 2136 OCTAVE_CHECK_QSCINTILLA_VERSION 2137 AC_DEFINE(HAVE_QSCINTILLA, 1, 2138 [Define to 1 if the QScintilla library and header files are available.]) 2139 2140 save_CPPFLAGS="$CPPFLAGS" 2141 save_CXXFLAGS="$CXXFLAGS" 2142 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 2143 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 2144 AC_LANG_PUSH(C++) 2145 AC_CHECK_HEADERS([Qsci/qscilexeroctave.h Qsci/qscilexermatlab.h]) 2146 AC_LANG_POP(C++) 2147 CPPFLAGS="$save_CPPFLAGS" 2148 CXXFLAGS="$save_CXXFLAGS" 2149 2150 use_qscintilla=yes 2151 fi 2152 fi 2153]) 2154dnl 2155dnl Check whether QScintilla has version 2.6.0 or later 2156dnl FIXME: This test uses a version number. It potentially could 2157dnl be re-written to actually call the function, but is it worth it? 2158dnl 2159AC_DEFUN([OCTAVE_CHECK_QSCINTILLA_VERSION], [ 2160 AC_CACHE_CHECK([whether QScintilla has version 2.6.0 or later], 2161 [octave_cv_version_2_6_0], 2162 [AC_LANG_PUSH(C++) 2163 ac_octave_save_CPPFLAGS="$CPPFLAGS" 2164 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 2165 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ 2166 #include <Qsci/qsciglobal.h> 2167 ]], [[ 2168 #if QSCINTILLA_VERSION < 0x020600 2169 #error Old FindFirst function found. 2170 #endif 2171 ]])], 2172 octave_cv_version_2_6_0=yes, 2173 octave_cv_version_2_6_0=no) 2174 CPPFLAGS="$ac_octave_save_CPPFLAGS" 2175 AC_LANG_POP(C++) 2176 ]) 2177 if test $octave_cv_version_2_6_0 = yes; then 2178 AC_DEFINE(HAVE_QSCI_VERSION_2_6_0, 1, 2179 [Define to 1 if QScintilla is of Version 2.6.0 or later.]) 2180 fi 2181]) 2182dnl 2183dnl OCTAVE_CHECK_QT 2184dnl 2185AC_DEFUN([OCTAVE_CHECK_QT], [ 2186 octave_qt_versions="$1" 2187 2188 build_qt_gui=no 2189 build_qt_graphics=no 2190 use_qscintilla=no 2191 win32_terminal=no 2192 2193 for ver in $octave_qt_versions; do 2194 OCTAVE_CHECK_QT_VERSION([$ver]) 2195 if test $build_qt_gui = yes; then 2196 have_qt_version=$ver 2197 break 2198 elif test -n "$QT_MODULES_AVAILABLE"; then 2199 ## If some modules were found for $ver, then warn about possible 2200 ## incomplete or broken Qt installation instead of checking for 2201 ## next version in the list. Don't attempt a similar check for 2202 ## tools here because Qt4 and Qt5 tools may be installed with 2203 ## the same name so determining whether there is a mix of versions 2204 ## will require more work than just looking which tools are installed. 2205 warn_qt_modules="Your installation of Qt version $ver appears incomplete or broken in some way. Fix that or use --with-qt=VER to use another version." 2206 break 2207 fi 2208 done 2209 2210 if test $build_qt_gui = yes; then 2211 BUILD_QT_SUMMARY_MSG="yes (version: $have_qt_version)" 2212 if test x"$have_qt_version" = x4; then 2213 AC_DEFINE(HAVE_QT4, 1, [Define to 1 if using Qt version 4.]) 2214 warn_qt_ver="Use of Qt version 4 is deprecated. Support will be removed in Octave version 7." 2215 OCTAVE_CONFIGURE_WARNING([warn_qt_ver]) 2216 fi 2217 if test x"$have_qt_version" = x5; then 2218 AC_DEFINE(HAVE_QT5, 1, [Define to 1 if using Qt version 5.]) 2219 fi 2220 else 2221 if test -n "$QT_MODULES_MISSING" || test -n "$QT_TOOLS_MISSING"; then 2222 qt_missing=`echo $QT_MODULES_MISSING$QT_TOOLS_MISSING | sed 's/ *$//'` 2223 BUILD_QT_SUMMARY_MSG="no (missing:$qt_missing)" 2224 else 2225 BUILD_QT_SUMMARY_MSG="no" 2226 fi 2227 if test -n "$warn_qt_modules"; then 2228 OCTAVE_CONFIGURE_WARNING([warn_qt_modules]) 2229 fi 2230 if test -n "$warn_qt_libraries"; then 2231 OCTAVE_CONFIGURE_WARNING([warn_qt_libraries]) 2232 fi 2233 if test -n "$warn_qt_version"; then 2234 OCTAVE_CONFIGURE_WARNING([warn_qt_version]) 2235 fi 2236 if test -n "$warn_qt_tools"; then 2237 OCTAVE_CONFIGURE_WARNING([warn_qt_tools]) 2238 fi 2239 if test -n "$warn_qt_setvbuf"; then 2240 OCTAVE_CONFIGURE_WARNING([warn_qt_setvbuf]) 2241 fi 2242 if test -n "$warn_qt_lib_fcns"; then 2243 OCTAVE_CONFIGURE_WARNING([warn_qt_lib_fcns]) 2244 fi 2245 if test -n "$warn_qt_abstract_item_model"; then 2246 OCTAVE_CONFIGURE_WARNING([warn_qt_abstract_item_model]) 2247 fi 2248 if test -n "$warn_qt_opengl"; then 2249 OCTAVE_CONFIGURE_WARNING([warn_qt_opengl]) 2250 fi 2251 if test -n "$warn_qscintilla"; then 2252 OCTAVE_CONFIGURE_WARNING([warn_qscintilla]) 2253 fi 2254 fi 2255 2256 AM_CONDITIONAL([AMCOND_BUILD_QT_GUI], [test $build_qt_gui = yes]) 2257 AM_CONDITIONAL([AMCOND_BUILD_QT_GRAPHICS], [test $build_qt_graphics = yes]) 2258 AM_CONDITIONAL([AMCOND_HAVE_QSCINTILLA], [test $use_qscintilla = yes]) 2259 AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes]) 2260]) 2261dnl 2262dnl Check whether QOffscreenSurface is present. 2263dnl 2264AC_DEFUN([OCTAVE_CHECK_QT_OPENGL_OFFSCREEN_OK], [ 2265 dnl Normally the language and compiler flags would be set and restored 2266 dnl inside of the AC_CACHE_CHECK body. Because we also need to check for 2267 dnl Qt header files associated with the compilation test, set and restore 2268 dnl these values outside of the AC_CACHE_CHECK for this macro only. 2269 AC_LANG_PUSH(C++) 2270 ac_octave_save_CPPFLAGS="$CPPFLAGS" 2271 ac_octave_save_CXXFLAGS="$CXXFLAGS" 2272 CPPFLAGS="$QT_OPENGL_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 2273 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 2274 AC_CHECK_HEADERS([QOffscreenSurface]) 2275 AC_CACHE_CHECK([whether Qt supports full offscreen OpenGL rendering], 2276 [octave_cv_qt_opengl_os_ok], 2277 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2278 #if HAVE_WINDOWS_H 2279 # include <windows.h> 2280 #endif 2281 #if defined (HAVE_GL_GL_H) 2282 # include <GL/gl.h> 2283 #elif defined (HAVE_OPENGL_GL_H) 2284 # include <OpenGL/gl.h> 2285 #endif 2286 #if defined (HAVE_GL_GLU_H) 2287 # include <GL/glu.h> 2288 #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL 2289 # include <OpenGL/glu.h> 2290 #endif 2291 #if defined (HAVE_QOPENGLWIDGET) 2292 # include <QOpenGLWidget> 2293 # include <QOpenGLContext> 2294 #endif 2295 #if defined (HAVE_QOFFSCREENSURFACE) 2296 # include <QOffscreenSurface> 2297 #endif 2298 QOpenGLContext ctx; 2299 QOffscreenSurface surf; 2300 ]])], 2301 octave_cv_qt_opengl_os_ok=yes, 2302 octave_cv_qt_opengl_os_ok=no) 2303 ]) 2304 CPPFLAGS="$ac_octave_save_CPPFLAGS" 2305 CXXFLAGS="$ac_octave_save_CXXFLAGS" 2306 AC_LANG_POP(C++) 2307 if test $octave_cv_qt_opengl_os_ok = yes; then 2308 $1 2309 : 2310 else 2311 $2 2312 : 2313 fi 2314]) 2315dnl 2316dnl Check whether Qt works with full OpenGL support 2317dnl 2318AC_DEFUN([OCTAVE_CHECK_QT_OPENGL_OK], [ 2319 dnl Normally the language and compiler flags would be set and restored 2320 dnl inside of the AC_CACHE_CHECK body. Because we also need to check for 2321 dnl Qt header files associated with the compilation test, set and restore 2322 dnl these values outside of the AC_CACHE_CHECK for this macro only. 2323 AC_LANG_PUSH(C++) 2324 ac_octave_save_CPPFLAGS="$CPPFLAGS" 2325 ac_octave_save_CXXFLAGS="$CXXFLAGS" 2326 CPPFLAGS="$QT_OPENGL_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 2327 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 2328 AC_CHECK_HEADERS([QOpenGLWidget QGLWidget QGLFunctions_1_1]) 2329 AC_CACHE_CHECK([whether Qt works with OpenGL and GLU], 2330 [octave_cv_qt_opengl_ok], 2331 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2332 #if HAVE_WINDOWS_H 2333 # include <windows.h> 2334 #endif 2335 #if defined (HAVE_GL_GL_H) 2336 # include <GL/gl.h> 2337 #elif defined (HAVE_OPENGL_GL_H) 2338 # include <OpenGL/gl.h> 2339 #endif 2340 #if defined (HAVE_GL_GLU_H) 2341 # include <GL/glu.h> 2342 #elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL 2343 # include <OpenGL/glu.h> 2344 #endif 2345 #if defined (HAVE_QOPENGLWIDGET) 2346 # include <QOpenGLWidget> 2347 # define OCTAVE_QT_OPENGL_WIDGET QOpenGLWidget 2348 #elif defined (HAVE_QGLWIDGET) 2349 # include <QGLWidget> 2350 # define OCTAVE_QT_OPENGL_WIDGET QGLWidget 2351 #endif 2352 class gl_widget : public OCTAVE_QT_OPENGL_WIDGET 2353 { 2354 public: 2355 gl_widget (QWidget *parent = 0) 2356 : OCTAVE_QT_OPENGL_WIDGET (parent) { } 2357 ~gl_widget () {} 2358 }; 2359 ]], [[ 2360 gl_widget widget; 2361 ]])], 2362 octave_cv_qt_opengl_ok=yes, 2363 octave_cv_qt_opengl_ok=no) 2364 ]) 2365 CPPFLAGS="$ac_octave_save_CPPFLAGS" 2366 CXXFLAGS="$ac_octave_save_CXXFLAGS" 2367 AC_LANG_POP(C++) 2368 if test $octave_cv_qt_opengl_ok = yes; then 2369 $1 2370 : 2371 else 2372 $2 2373 : 2374 fi 2375]) 2376dnl 2377dnl OCTAVE_CHECK_QT_TOOL(TOOL) 2378dnl 2379AC_DEFUN([OCTAVE_CHECK_QT_TOOL], [ 2380 AC_CHECK_TOOLS(m4_toupper([$1])_QTVER, [$1-qt$qt_version]) 2381 if test -z "$m4_toupper([$1])_QTVER"; then 2382 AC_CHECK_TOOLS(m4_toupper([$1]), [$1]) 2383 if test -n "$m4_toupper([$1])"; then 2384 if test -n "$QTCHOOSER"; then 2385 m4_toupper([$1])FLAGS="-qt=$qt_version" 2386 fi 2387 QT_TOOLS_AVAILABLE="$QT_TOOLS_AVAILABLE $1" 2388 else 2389 QT_TOOLS_MISSING="$QT_TOOLS_MISSING $1" 2390 fi 2391 else 2392 m4_toupper([$1])="$m4_toupper([$1])_QTVER" 2393 QT_TOOLS_AVAILABLE="$QT_TOOLS_AVAILABLE $1" 2394 fi 2395]) 2396dnl 2397dnl Check whether Qt VERSION is present, supports QtOpenGL and 2398dnl QScintilla, and will work for Octave. 2399dnl 2400dnl OCTAVE_CHECK_QT_VERSION(VERSION) 2401dnl 2402AC_DEFUN([OCTAVE_CHECK_QT_VERSION], [AC_MSG_CHECKING([Qt version $1]) 2403 QT_CPPFLAGS= 2404 QT_LDFLAGS= 2405 QT_LIBS= 2406 2407 qt_version="$1"; 2408 2409 build_qt_gui=yes 2410 build_qt_graphics=no 2411 have_qt_opengl_offscreen=no 2412 win32_terminal=no 2413 2414 warn_qt_libraries="" 2415 warn_qt_version="" 2416 warn_qt_tools="" 2417 warn_qt_setvbuf="" 2418 warn_qt_lib_fcns="" 2419 warn_qt_abstract_item_model="" 2420 warn_qt_opengl="" 2421 2422 ## Check for Qt libraries 2423 case "$qt_version" in 2424 4) 2425 QT_OPENGL_MODULE="QtOpenGL" 2426 QT_MODULES="QtCore QtGui QtNetwork QtHelp QtXml" 2427 ;; 2428 5) 2429 QT_OPENGL_MODULE="Qt5OpenGL" 2430 QT_MODULES="Qt5Core Qt5Gui Qt5Network Qt5PrintSupport Qt5Help Qt5Xml" 2431 ;; 2432 *) 2433 AC_MSG_ERROR([Unrecognized Qt version $qt_version]) 2434 ;; 2435 esac 2436 2437 ## Use this check to get info in the log file. 2438 PKG_CHECK_MODULES(QT, [$QT_MODULES], 2439 [], 2440 [build_qt_gui=no 2441 warn_qt_libraries="Qt libraries not found; disabling Qt GUI"]) 2442 2443 ## Check the modules again individually to get lists of modules that 2444 ## are available and/or missing 2445 QT_MODULES_AVAILABLE= 2446 QT_MODULES_MISSING= 2447 for qt_mod in $QT_MODULES; do 2448 if $PKG_CONFIG --exists $qt_mod; then 2449 QT_MODULES_AVAILABLE="$QT_MODULES_AVAILABLE $qt_mod" 2450 else 2451 QT_MODULES_MISSING="$QT_MODULES_MISSING $qt_mod" 2452 fi 2453 done 2454 2455 if test $build_qt_gui = yes; then 2456 ## Retrieve Qt compilation and linker flags 2457 QT_CPPFLAGS="$($PKG_CONFIG --cflags-only-I $QT_MODULES | $SED -e 's/^ *$//')" 2458 QT_LDFLAGS="$($PKG_CONFIG --libs-only-L $QT_MODULES | $SED -e 's/^ *$//')" 2459 QT_LIBS="$($PKG_CONFIG --libs-only-l $QT_MODULES | $SED -e 's/^ *$//')" 2460 QT_OPENGL_CPPFLAGS="$($PKG_CONFIG --cflags-only-I $QT_OPENGL_MODULE | $SED -e 's/^ *$//')" 2461 QT_OPENGL_LDFLAGS="$($PKG_CONFIG --libs-only-L $QT_OPENGL_MODULE | $SED -e 's/^ *$//')" 2462 QT_OPENGL_LIBS="$($PKG_CONFIG --libs-only-l $QT_OPENGL_MODULE | $SED -e 's/^ *$//')" 2463 2464 case $host_os in 2465 *darwin*) 2466 ## Qt might be installed in framework 2467 if test -z "$QT_LIBS"; then 2468 QT_LDFLAGS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -e '-F' | uniq | tr '\n' ' '`" 2469 QT_LIBS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -v -e '-F' | uniq | tr '\n' ' '`" 2470 QT_OPENGL_LDFLAGS="`$PKG_CONFIG --libs-only-other $QT_OPENGL_MODULE | tr ' ' '\n' | $GREP -e '-F' | uniq | tr '\n' ' '`" 2471 QT_OPENGL_LIBS="`$PKG_CONFIG --libs-only-other $QT_OPENGL_MODULE | tr ' ' '\n' | $GREP -v -e '-F' | uniq | tr '\n' ' '`" 2472 ## Enabling link_all_deps works around libtool's imperfect handling 2473 ## of the -F flag 2474 AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], 2475 [test $link_all_deps = yes || test -n "$QT_LDFLAGS"]) 2476 fi 2477 ;; 2478 esac 2479 2480 if test $qt_version = 4; then 2481 ## Check for Qt4 2482 if ! `$PKG_CONFIG --atleast-version=4.0.0 QtCore`; then 2483 build_qt_gui=no 2484 warn_qt_version="Qt >= 4.0.0 not found; disabling Qt GUI" 2485 fi 2486 fi 2487 fi 2488 2489 QT_TOOLS_AVAILABLE= 2490 QT_TOOLS_MISSING= 2491 2492 if test $build_qt_gui = yes; then 2493 AC_CHECK_TOOLS(QTCHOOSER, [qtchooser]) 2494 2495 OCTAVE_CHECK_QT_TOOL([moc]) 2496 OCTAVE_CHECK_QT_TOOL([uic]) 2497 OCTAVE_CHECK_QT_TOOL([rcc]) 2498 OCTAVE_CHECK_QT_TOOL([lrelease]) 2499 OCTAVE_CHECK_QT_TOOL([qcollectiongenerator]) 2500 OCTAVE_CHECK_QT_TOOL([qhelpgenerator]) 2501 2502 if test -n "$QT_TOOLS_MISSING"; then 2503 warn_qt_tools="one or more of the Qt utilities moc, uic, rcc, lrelease, qcollectiongenerator, and qhelpgenerator not found; disabling Qt GUI" 2504 build_qt_gui=no 2505 MOC_QTVER= 2506 UIC_QTVER= 2507 RCC_QTVER= 2508 LRELEASE_QTVER= 2509 QCOLLECTIONGENERATOR_QTVER= 2510 QHELPGENERATOR_QTVER= 2511 MOCFLAGS= 2512 UICFLAGS= 2513 RCCFLAGS= 2514 LRELEASEFLAGS= 2515 QCOLLECTIONGENERATORFLAGS= 2516 QHELPGENERATORFLAGS= 2517 $as_unset ac_cv_prog_MOC_QTVER 2518 $as_unset ac_cv_prog_ac_ct_MOC_QTVER 2519 $as_unset ac_cv_prog_UIC_QTVER 2520 $as_unset ac_cv_prog_ac_ct_UIC_QTVER 2521 $as_unset ac_cv_prog_RCC_QTVER 2522 $as_unset ac_cv_prog_ac_ct_RCC_QTVER 2523 $as_unset ac_cv_prog_LRELEASE_QTVER 2524 $as_unset ac_cv_prog_ac_ct_LRELEASE_QTVER 2525 $as_unset ac_cv_prog_QCOLLECTIONGENERATOR_QTVER 2526 $as_unset ac_cv_prog_ac_ct_QCOLLECTIONGENERATOR_QTVER 2527 $as_unset ac_cv_prog_QHELPGENERATOR_QTVER 2528 $as_unset ac_cv_prog_ac_ct_QHELPGENERATOR_QTVER 2529 fi 2530 fi 2531 2532 if test $build_qt_gui = yes; then 2533 case $host_os in 2534 mingw* | msdosmsvc*) 2535 AC_CHECK_FUNCS([setvbuf], [win32_terminal=yes], 2536 [build_qt_gui=no 2537 warn_qt_setvbuf="setvbuf not found; disabling Qt GUI"]) 2538 ;; 2539 *) 2540 AC_CHECK_HEADERS([pty.h libutil.h util.h]) 2541 AC_SEARCH_LIBS([openpty], [util], 2542 [AC_DEFINE(HAVE_OPENPTY, 1, [Define to 1 if openpty exists])]) 2543 AC_CHECK_FUNCS([chmod chown ftruncate mmap munmap], [], 2544 [build_qt_gui=no 2545 warn_qt_lib_fcns="At least one of chmod, chown, ftruncate, mmap, and munmap not found; disabling Qt GUI"]) 2546 ;; 2547 esac 2548 fi 2549 2550 if test $build_qt_gui = yes; then 2551 OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL 2552 2553 if test $octave_cv_func_qabstractitemmodel_beginresetmodel = no; then 2554 build_qt_gui=no 2555 warn_qt_abstract_item_model="QAbstractItemModel::beginResetModel not found; disabling Qt GUI" 2556 ## Invalidate cache so that this test will be done again if we 2557 ## perform the test with a different Qt version. 2558 $as_unset octave_cv_func_qabstractitemmodel_beginresetmodel 2559 fi 2560 fi 2561 2562 if test $build_qt_gui = yes; then 2563 ## We have what we need to build the Qt GUI. The remaining 2564 ## checks below are for optional features related to the Qt GUI. 2565 2566 AC_DEFINE(HAVE_QT, 1, 2567 [Define to 1 if Qt is available, with all required functions, libraries, developer header files, and utilities.]) 2568 2569 AC_LANG_PUSH(C++) 2570 ac_octave_save_CPPFLAGS="$CPPFLAGS" 2571 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 2572 AC_CHECK_HEADERS([QStandardPaths]) 2573 CPPFLAGS="$ac_octave_save_CPPFLAGS" 2574 AC_LANG_POP(C++) 2575 2576 ## We don't need to unset cache variables for any of the remaining 2577 ## tests if they fail because we have already decided that the Qt 2578 ## version that we are testing now will be the one used. 2579 2580 OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT 2581 OCTAVE_CHECK_FUNC_QFONTDATABASE_SYSTEMFONT 2582 OCTAVE_CHECK_FUNC_QFONTMETRICS_HORIZONTAL_ADVANCE 2583 OCTAVE_CHECK_FUNC_QGUIAPPLICATION_SETDESKTOPFILENAME 2584 OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONRESIZEMODE 2585 OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSCLICKABLE 2586 OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSMOVABLE 2587 OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT 2588 OCTAVE_CHECK_NEW_QHELPINDEXWIDGET_API 2589 OCTAVE_CHECK_FUNC_QINSTALLMESSAGEHANDLER 2590 OCTAVE_CHECK_FUNC_QLINEEDIT_SETPLACEHOLDERTEXT 2591 OCTAVE_CHECK_FUNC_QLIST_ITERATOR_CONSTRUCTOR 2592 OCTAVE_CHECK_FUNC_QMOUSEEVENT_LOCALPOS 2593 OCTAVE_CHECK_FUNC_QOBJECT_FINDCHILDREN_ACCEPTS_FINDCHILDOPTIONS 2594 OCTAVE_CHECK_FUNC_QMAINWINDOW_RESIZEDOCKS 2595 OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO 2596 OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE 2597 OCTAVE_CHECK_FUNC_QTMESSAGEHANDLER_ACCEPTS_QMESSAGELOGCONTEXT 2598 OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER 2599 OCTAVE_CHECK_FUNC_QWHEELEVENT_ANGLEDELTA 2600 OCTAVE_CHECK_FUNC_QWHEELEVENT_POSITION 2601 OCTAVE_CHECK_MEMBER_QFONT_FORCE_INTEGER_METRICS 2602 OCTAVE_CHECK_MEMBER_QFONT_MONOSPACE 2603 OCTAVE_CHECK_QVARIANT_CANCONVERT_ACCEPTS_QMETATYPE_TYPE 2604 OCTAVE_HAVE_QGUIAPPLICATION 2605 2606 OCTAVE_CHECK_QREGION_ITERATORS 2607 OCTAVE_CHECK_QT_SPLITBEHAVIOR_ENUM 2608 2609 if test -n "$OPENGL_LIBS"; then 2610 OCTAVE_CHECK_QT_OPENGL_OK([build_qt_graphics=yes], 2611 [warn_qt_opengl="Qt does not work with the OpenGL libs (GL and GLU); disabling OpenGL graphics with Qt GUI"]) 2612 2613 if test $build_qt_graphics = yes; then 2614 AC_DEFINE(HAVE_QT_GRAPHICS, 1, [Define to 1 if Qt works with OpenGL libs (GL and GLU)]) 2615 OCTAVE_CHECK_QT_OPENGL_OFFSCREEN_OK([have_qt_opengl_offscreen=yes]) 2616 if test $have_qt_opengl_offscreen = yes; then 2617 AC_DEFINE(HAVE_QT_OFFSCREEN, 1, [Define to 1 if Qt handles offscreen OpenGL rendering]) 2618 fi 2619 fi 2620 fi 2621 2622 OCTAVE_CHECK_QSCINTILLA([$qt_version]) 2623 2624 fi 2625 AC_SUBST(MOCFLAGS) 2626 AC_SUBST(UICFLAGS) 2627 AC_SUBST(RCCFLAGS) 2628 AC_SUBST(LRELEASEFLAGS) 2629 AC_SUBST(QCOLLECTIONGENERATORFLAGS) 2630 AC_SUBST(QHELPGENERATORFLAGS) 2631 AC_SUBST(QT_CPPFLAGS) 2632 AC_SUBST(QT_LDFLAGS) 2633 AC_SUBST(QT_LIBS) 2634 AC_SUBST(QT_OPENGL_CPPFLAGS) 2635 AC_SUBST(QT_OPENGL_LDFLAGS) 2636 AC_SUBST(QT_OPENGL_LIBS) 2637]) 2638dnl 2639dnl Check if the default Fortran INTEGER is 64 bits wide. 2640dnl If cross-compiling, assume 4 bytes unless the cache value 2641dnl is already set. 2642dnl 2643AC_DEFUN([OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER], [ 2644 AC_CACHE_CHECK([default size of Fortran INTEGER], 2645 [octave_cv_sizeof_fortran_integer], 2646 [ac_octave_save_FFLAGS="$FFLAGS" 2647 FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" 2648 AC_LANG_PUSH(Fortran 77) 2649 AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[ 2650 integer*8 n8 2651 integer n 2652c Generate -2**33 + 1. 2653 n8 = 2 2654 n8 = -4 * (n8 ** 30) 2655 n8 = n8 + 1 2656c Convert to default integer type. If the values are no longer equal, 2657c assume the default integer size is 32-bits. 2658 n = n8 2659 if (n .ne. n8) stop 1 2660 ]])], 2661 octave_cv_sizeof_fortran_integer=8, 2662 octave_cv_sizeof_fortran_integer=4, 2663 octave_cv_sizeof_fortran_integer=4) 2664 AC_LANG_POP(Fortran 77) 2665 FFLAGS="$ac_octave_save_FFLAGS" 2666 ]) 2667]) 2668dnl 2669dnl Check whether SUNDIALS libraries provide a compatible interface. 2670dnl The current recommended interface was introduced in SUNDIALS version 4. 2671dnl The deprecated interface that Octave currently works to be compatible with 2672dnl was introduced in SUNDIALS version 3. 2673dnl 2674AC_DEFUN([OCTAVE_CHECK_SUNDIALS_COMPATIBLE_API], [ 2675 ac_octave_save_LIBS=$LIBS 2676 LIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_NVECSERIAL_LIBS $LIBS" 2677 dnl Current API functions present in SUNDIALS version 4 2678 AC_CHECK_FUNCS([IDASetJacFn IDASetLinearSolver SUNLinSol_Dense]) 2679 dnl FIXME: The purpose of the following tests is to detect the deprecated 2680 dnl API from SUNDIALS version 3, which should only be used if the current 2681 dnl API tests above failed. For now, always test for ida_direct.h. 2682 AC_CHECK_HEADERS([ida/ida_direct.h ida_direct.h]) 2683 dnl Each of these is a deprecated analog to the functions listed above. 2684 AC_CHECK_FUNCS([IDADlsSetJacFn IDADlsSetLinearSolver SUNDenseLinearSolver]) 2685 LIBS=$ac_octave_save_LIBS 2686 AC_MSG_CHECKING([whether SUNDIALS API provides the necessary functions]) 2687 if test "x$ac_cv_func_IDASetJacFn" = xyes \ 2688 && test "x$ac_cv_func_IDASetLinearSolver" = xyes \ 2689 && test "x$ac_cv_func_SUNLinSol_Dense" = xyes; then 2690 octave_have_sundials_compatible_api=yes 2691 elif test "x$ac_cv_func_IDADlsSetJacFn" = xyes \ 2692 && test "x$ac_cv_func_IDADlsSetLinearSolver" = xyes \ 2693 && test "x$ac_cv_func_SUNDenseLinearSolver" = xyes; then 2694 octave_have_sundials_compatible_api=yes 2695 else 2696 octave_have_sundials_compatible_api=no 2697 fi 2698 AC_MSG_RESULT([$octave_have_sundials_compatible_api]) 2699 if test $octave_have_sundials_compatible_api = no; then 2700 warn_sundials_disabled="SUNDIALS libraries do not provide an API that is compatible with Octave. The solvers ode15i and ode15s will be disabled." 2701 OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled]) 2702 fi 2703]) 2704dnl 2705dnl Check whether SUNDIALS IDA library is configured with double 2706dnl precision realtype. 2707dnl 2708AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SIZEOF_REALTYPE], [ 2709 AC_CACHE_CHECK([whether SUNDIALS IDA is configured with double precision realtype], 2710 [octave_cv_sundials_realtype_is_double], 2711 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2712 #if defined (HAVE_IDA_IDA_H) 2713 # include <ida/ida.h> 2714 #endif 2715 #include <assert.h> 2716 ]], [[ 2717 static_assert (sizeof (realtype) == sizeof (double), 2718 "SUNDIALS is not configured for double precision"); 2719 ]])], 2720 octave_cv_sundials_realtype_is_double=yes, 2721 octave_cv_sundials_realtype_is_double=no) 2722 ]) 2723 if test $octave_cv_sundials_realtype_is_double = no; then 2724 warn_sundials_disabled="SUNDIALS IDA library not configured with double precision realtype. The solvers ode15i and ode15s will be disabled." 2725 OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled]) 2726 fi 2727]) 2728dnl 2729dnl Check whether SUNDIALS IDA library is configured with SUNLINSOL_KLU 2730dnl enabled. 2731dnl 2732AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_KLU], [ 2733 ## Including <sunlinsol/sunlinsol_klu.h> may depend on including klu.h 2734 ## first. So perform the check as follows using several different 2735 ## possible locations for klu.h instead of using OCTAVE_CHECK_LIB to 2736 ## check for sunlinsol_klu.h. 2737 AC_CHECK_HEADERS([klu.h klu/klu.h suitesparse/klu.h ufsparse/klu.h]) 2738 AC_CHECK_HEADERS([sunlinsol/sunlinsol_klu.h], [], [], 2739 [#if defined (HAVE_KLU_H) 2740 # include <klu.h> 2741 #elif defined (HAVE_KLU_KLU_H) 2742 # include <klu/klu.h> 2743 #elif defined (HAVE_SUITESPARSE_KLU_H) 2744 # include <suitesparse/klu.h> 2745 #elif defined (HAVE_UFSPARSE_KLU_H) 2746 # include <ufsparse/klu.h> 2747 #endif 2748 ]) 2749 OCTAVE_CHECK_LIB(sundials_sunlinsolklu, SUNLINSOL_KLU, [], 2750 [], [SUNKLU], [], 2751 [don't use SUNDIALS SUNLINSOL_KLU library, disable ode15i and ode15s sparse Jacobian], 2752 [AC_CHECK_FUNCS([SUNLinSol_KLU SUNKLU]) 2753 AC_CACHE_CHECK([whether compiling a program that calls SUNKLU works], 2754 [octave_cv_sundials_sunlinsol_klu], 2755 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2756 #if defined (HAVE_IDA_IDA_H) 2757 #include <ida/ida.h> 2758 #endif 2759 #if defined (HAVE_KLU_H) 2760 #include <klu.h> 2761 #endif 2762 #if defined (HAVE_KLU_KLU_H) 2763 #include <klu/klu.h> 2764 #endif 2765 #if defined (HAVE_SUITESPARSE_KLU_H) 2766 #include <suitesparse/klu.h> 2767 #endif 2768 #if defined (HAVE_UFPARSE_KLU_H) 2769 #include <ufsparse/klu.h> 2770 #endif 2771 #if defined (HAVE_SUNLINSOL_SUNLINSOL_KLU_H) 2772 #include <sunlinsol/sunlinsol_klu.h> 2773 #endif 2774 ]], [[ 2775 SUNKLU (0, 0); 2776 ]])], 2777 octave_cv_sundials_sunlinsol_klu=yes, 2778 octave_cv_sundials_sunlinsol_klu=no) 2779 ])]) 2780 if test "x$ac_cv_header_sunlinsol_sunlinsol_klu_h" = xyes \ 2781 && test "x$octave_cv_sundials_sunlinsol_klu" = xyes; then 2782 AC_DEFINE(HAVE_SUNDIALS_SUNLINSOL_KLU, 1, 2783 [Define to 1 if SUNDIALS IDA is configured with SUNLINSOL_KLU enabled.]) 2784 else 2785 warn_sundials_sunlinsol_klu="SUNDIALS IDA library not configured with SUNLINSOL_KLU or sunlinksol_klu.h is not usable. The solvers ode15i and ode15s will not support the sparse Jacobian feature." 2786 OCTAVE_CONFIGURE_WARNING([warn_sundials_sunlinsol_klu]) 2787 fi 2788]) 2789dnl 2790dnl Check whether SUNDIALS IDA library has the SUNLINSOL_DENSE linear solver. 2791dnl 2792AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_DENSE], [ 2793 AC_CHECK_HEADERS([sunlinsol/sunlinsol_dense.h], 2794 octave_cv_sundials_sunlinsol_dense=yes, 2795 octave_cv_sundials_sunlinsol_dense=no) 2796 ]) 2797 if test $octave_cv_sundials_sunlinsol_dense = yes; then 2798 AC_DEFINE(HAVE_SUNDIALS_SUNLINSOL_DENSE, 1, 2799 [Define to 1 if SUNDIALS IDA includes the SUNLINSOL_DENSE linear solver.]) 2800 else 2801 warn_sundials_disabled="SUNDIALS IDA library does not include the SUNLINSOL_DENSE linear solver. The solvers ode15i and ode15s will be disabled." 2802 OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled]) 2803 fi 2804]) 2805dnl 2806dnl Add warning to final summary. 2807dnl 2808AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [ 2809 AC_MSG_WARN([$][$1]) 2810 m4_set_add([summary_warning_list], [$1]) 2811]) 2812dnl 2813dnl Print final summary. 2814dnl 2815AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [ 2816 m4_set_foreach([summary_warning_list], [elt], [ 2817 if test -n "[$]elt"; then 2818 AC_MSG_WARN([$]elt) 2819 warn_msg_printed=true 2820 fi]) 2821]) 2822dnl 2823dnl Like AC_CONFIG_FILES, but don't touch the output file if it already 2824dnl exists and hasn't changed. 2825dnl 2826AC_DEFUN([OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES], [ 2827 m4_foreach_w([elt], [$1], [ 2828 AC_CONFIG_FILES(elt[-tmp:]patsubst(elt, [.sh$], [.in.sh])) 2829 AC_CONFIG_COMMANDS(elt, 2830 [$SHELL $srcdir/build-aux/move-if-change ]elt[-tmp ]elt)])]) 2831dnl 2832dnl Check if the C++ library has the bit_and, bit_or, and bit_xor 2833dnl templates defined. 2834dnl 2835AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], [ 2836 AC_CACHE_CHECK([whether bit_and, bit_or, bit_xor are defined in the C++ library], 2837 [octave_cv_cxx_bitwise_op_templates], 2838 [AC_LANG_PUSH(C++) 2839 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2840 #include <functional> 2841 ]], [[ 2842 int x = 0; 2843 int y = 1; 2844 int z1 = std::bit_and<int>() (x, y); 2845 int z2 = std::bit_or<int>() (x, y); 2846 int z3 = std::bit_xor<int>() (x, y); 2847 ]])], 2848 octave_cv_cxx_bitwise_op_templates=yes, 2849 octave_cv_cxx_bitwise_op_templates=no) 2850 AC_LANG_POP(C++) 2851 ]) 2852 if test $octave_cv_cxx_bitwise_op_templates = yes; then 2853 AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES, 1, 2854 [Define to 1 if C++ library has templated bitwise operators.]) 2855 fi 2856]) 2857dnl 2858dnl Check if the C++ library has functions to access real and imaginary 2859dnl parts of complex numbers independently via references. 2860dnl 2861AC_DEFUN([OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS], [ 2862 AC_CACHE_CHECK([whether complex class can reference components independently], 2863 [octave_cv_cxx_complex_reference_accessors], 2864 [AC_LANG_PUSH(C++) 2865 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2866 #include <complex> 2867 ]], [[ 2868 std::complex<double> x; 2869 x.real () = 1.0; 2870 x.imag () = 1.0; 2871 ]])], 2872 octave_cv_cxx_complex_reference_accessors=yes, 2873 octave_cv_cxx_complex_reference_accessors=no) 2874 AC_LANG_POP(C++) 2875 ]) 2876 if test $octave_cv_cxx_complex_reference_accessors = yes; then 2877 AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS, 1, 2878 [Define to 1 if C++ complex class has T& real (void) and T& imag (void) methods.]) 2879 fi 2880]) 2881dnl 2882dnl Check if the C++ library has functions to set real and imaginary 2883dnl parts of complex numbers independently. 2884dnl 2885AC_DEFUN([OCTAVE_CXX_COMPLEX_SETTERS], [ 2886 AC_CACHE_CHECK([whether complex class can set components independently], 2887 [octave_cv_cxx_complex_setters], 2888 [AC_LANG_PUSH(C++) 2889 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2890 #include <complex> 2891 ]], [[ 2892 std::complex<double> x; 2893 x.real (1.0); 2894 x.imag (2.0); 2895 ]])], 2896 octave_cv_cxx_complex_setters=yes, octave_cv_cxx_complex_setters=no) 2897 AC_LANG_POP(C++) 2898 ]) 2899 if test $octave_cv_cxx_complex_setters = yes; then 2900 AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS, 1, 2901 [Define to 1 if C++ complex class has void real (T) and void imag (T) methods.]) 2902 fi 2903]) 2904dnl 2905dnl Check if the compiler supports dynamic auto arrays. 2906dnl 2907AC_DEFUN([OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS], [ 2908 AC_CACHE_CHECK([whether C++ supports dynamic auto arrays], 2909 [octave_cv_cxx_dynamic_auto_arrays], 2910 [AC_LANG_PUSH(C++) 2911 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ 2912 void test(char *); 2913 int length(); 2914 char x[length()]; 2915 test(x); 2916 ]])], 2917 octave_cv_cxx_dynamic_auto_arrays=yes, 2918 octave_cv_cxx_dynamic_auto_arrays=no) 2919 AC_LANG_POP(C++) 2920 ]) 2921 if test $octave_cv_cxx_dynamic_auto_arrays = yes; then 2922 AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS, 1, 2923 [Define to 1 if C++ supports dynamic auto arrays.]) 2924 fi 2925]) 2926dnl 2927dnl Check if C++ compiler handles FLAG command line option. If two 2928dnl arguments are specified, execute the second arg as shell commands. 2929dnl Otherwise, add FLAG to CXXFLAGS if the compiler accepts the flag. 2930dnl 2931AC_DEFUN([OCTAVE_CXX_FLAG], [ 2932 ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'` 2933 AC_MSG_CHECKING([whether ${CXX-g++} accepts $1]) 2934 AC_CACHE_VAL([octave_cv_cxx_flag_$ac_safe], 2935 [AC_LANG_PUSH(C++) 2936 ac_octave_save_CXXFLAGS="$CXXFLAGS" 2937 CXXFLAGS="$CXXFLAGS $1" 2938 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 2939 eval "octave_cv_cxx_flag_$ac_safe=yes", 2940 eval "octave_cv_cxx_flag_$ac_safe=no") 2941 CXXFLAGS="$ac_octave_save_CXXFLAGS" 2942 AC_LANG_POP(C++) 2943 ]) 2944 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then 2945 AC_MSG_RESULT([yes]) 2946 ifelse([$2], , 2947 [CXXFLAGS="$CXXFLAGS $1" 2948 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) 2949 else 2950 AC_MSG_RESULT([no]) 2951 ifelse([$3], , , [$3]) 2952 fi 2953]) 2954dnl 2955dnl Allow the user disable support for command line editing using GNU 2956dnl readline. 2957dnl 2958AC_DEFUN([OCTAVE_ENABLE_READLINE], [ 2959 USE_READLINE=yes 2960 READLINE_LIBS= 2961 AC_ARG_ENABLE([readline], 2962 [AS_HELP_STRING([--disable-readline], 2963 [do not use readline library])], 2964 [if test "$enableval" = no; then 2965 USE_READLINE=no 2966 warn_readline="command editing and history features require GNU Readline" 2967 fi]) 2968 if test $USE_READLINE = yes; then 2969 dnl RHEL 5 and older systems require termlib set before enabling readline 2970 AC_REQUIRE([OCTAVE_CHECK_LIB_TERMLIB]) 2971 ac_octave_save_LIBS="$LIBS" 2972 LIBS="$TERM_LIBS" 2973 AC_CHECK_LIB([readline], [rl_set_keyboard_input_timeout], 2974 [READLINE_LIBS="-lreadline" 2975 AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.]) 2976 ], 2977 [AC_MSG_WARN([I need GNU Readline 4.2 or later]) 2978 AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) 2979 ]) 2980 LIBS="$ac_octave_save_LIBS" 2981 fi 2982 AC_SUBST(READLINE_LIBS) 2983]) 2984dnl 2985dnl Check if Fortran compiler handles FLAG command line option. If 2986dnl two arguments are specified, execute the second arg as shell 2987dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts 2988dnl the flag. 2989dnl 2990AC_DEFUN([OCTAVE_F77_FLAG], [ 2991 ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'` 2992 AC_MSG_CHECKING([whether ${F77-g77} accepts $1]) 2993 AC_CACHE_VAL([octave_cv_f77_flag_$ac_safe], [ 2994 AC_LANG_PUSH(Fortran 77) 2995 ac_octave_save_FFLAGS="$FFLAGS" 2996 FFLAGS="$FFLAGS $1" 2997 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 2998 eval "octave_cv_f77_flag_$ac_safe=yes", 2999 eval "octave_cv_f77_flag_$ac_safe=no") 3000 FFLAGS="$ac_octave_save_FFLAGS" 3001 AC_LANG_POP(Fortran 77) 3002 ]) 3003 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then 3004 AC_MSG_RESULT([yes]) 3005 ifelse([$2], , 3006 [FFLAGS="$FFLAGS $1" 3007 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2]) 3008 else 3009 AC_MSG_RESULT([no]) 3010 ifelse([$3], , , [$3]) 3011 fi 3012]) 3013dnl 3014dnl Check to see if the compiler and the linker can handle the flags 3015dnl "-framework $1" for the given prologue $2 and the given body $3 of 3016dnl a source file. Arguments 2 and 3 optionally can also be empty. 3017dnl Add options (lower case letters $1) "--with-framework-$1" and 3018dnl "--without-framework-$1". If this test is successful then perform 3019dnl $4, otherwise do $5. 3020dnl 3021AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [ 3022 AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1]) 3023 AC_CACHE_VAL([octave_cv_framework_$1], 3024 [ac_octave_save_LDFLAGS="$LDFLAGS" 3025 LDFLAGS="$LDFLAGS -framework $1" 3026 AC_LANG_PUSH(C++) 3027 AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])], 3028 eval "octave_cv_framework_$1=yes", 3029 eval "octave_cv_framework_$1=no") 3030 AC_LANG_POP(C++) 3031 LDFLAGS="$ac_octave_save_LDFLAGS" 3032 ]) 3033 if test "$octave_cv_framework_$1" = yes; then 3034 AC_MSG_RESULT([yes]) 3035 AC_ARG_WITH(framework-m4_tolower($1), 3036 [AS_HELP_STRING([--without-framework-m4_tolower($1)], 3037 [don't use framework $1])], 3038 with_have_framework=$withval, with_have_framework=yes) 3039 if test "$with_have_framework" = yes; then 3040 [$4] 3041 : 3042 else 3043 AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)]) 3044 [$5] 3045 fi 3046 else 3047 AC_MSG_RESULT([no]) 3048 [$5] 3049 fi 3050]) 3051dnl 3052dnl Check whether the Qt class QGuiApplication exists. 3053dnl This class was introduced in Qt 5.0. 3054dnl 3055dnl FIXME: Delete this entirely when we drop support for Qt 4. 3056dnl 3057AC_DEFUN([OCTAVE_HAVE_QGUIAPPLICATION], [ 3058 AC_CACHE_CHECK([for QGuiApplication], 3059 [octave_cv_decl_qguiapplication], 3060 [AC_LANG_PUSH(C++) 3061 ac_octave_save_CPPFLAGS="$CPPFLAGS" 3062 ac_octave_save_CXXFLAGS="$CXXFLAGS" 3063 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" 3064 CXXFLAGS="$CXXPICFLAG $CXXFLAGS" 3065 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3066 #include <QGuiApplication> 3067 ]], [[ 3068 QScreen *pscreen = QGuiApplication::primaryScreen (); 3069 ]])], 3070 octave_cv_decl_qguiapplication=yes, 3071 octave_cv_decl_qguiapplication=no) 3072 CPPFLAGS="$ac_octave_save_CPPFLAGS" 3073 CXXFLAGS="$ac_octave_save_CXXFLAGS" 3074 AC_LANG_POP(C++) 3075 ]) 3076 if test $octave_cv_decl_qguiapplication = yes; then 3077 AC_DEFINE(HAVE_QGUIAPPLICATION, 1, 3078 [Define to 1 if `QGuiApplication' class is available.]) 3079 fi 3080]) 3081dnl 3082dnl Check for IEEE 754 data format. 3083dnl 3084AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], [ 3085 AC_MSG_CHECKING([for IEEE 754 data format]) 3086 AC_CACHE_VAL([octave_cv_ieee754_data_format], 3087 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3088 int 3089 main (void) 3090 { 3091 typedef union { unsigned char c[8]; double d; } ieeebytes; 3092 3093 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43}; 3094 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c}; 3095 3096 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0; 3097 } 3098 ]])], 3099 octave_cv_ieee754_data_format=yes, 3100 octave_cv_ieee754_data_format=no, 3101 octave_cv_ieee754_data_format=yes) 3102 ]) 3103 if test "$cross_compiling" = yes; then 3104 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation]) 3105 else 3106 AC_MSG_RESULT([$octave_cv_ieee754_data_format]) 3107 fi 3108 if test $octave_cv_ieee754_data_format = yes; then 3109 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, 3110 [Define to 1 if your system uses IEEE 754 data format.]) 3111 else 3112 ## If the format is unknown, then you will probably not have a 3113 ## useful system, so we will abort here. Anyone wishing to 3114 ## experiment with building Octave on a system without IEEE 3115 ## floating point should be capable of removing this check and 3116 ## the one in the octave_ieee_init function in liboctave/lo-ieee.cc. 3117 AC_MSG_ERROR([IEEE 754 data format required for building Octave]) 3118 fi 3119]) 3120dnl 3121dnl Check for CallInst::addAttribute API 3122dnl 3123AC_DEFUN([OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API], [ 3124 AC_CACHE_CHECK([if llvm::CallInst::addAttribute's arg type is llvm::Attributes], 3125 [octave_cv_callinst_addattribute_arg_is_attributes], 3126 [AC_LANG_PUSH(C++) 3127 AC_COMPILE_IFELSE( 3128 [AC_LANG_PROGRAM([[ 3129#if defined (HAVE_LLVM_IR_FUNCTION_H) 3130 #include <llvm/IR/Instructions.h> 3131 #include <llvm/IR/Attributes.h> 3132#else 3133 #include <llvm/Instructions.h> 3134 #include <llvm/Attributes.h> 3135#endif 3136 ]], [[ 3137 llvm::CallInst *callinst; 3138 llvm::AttrBuilder attr_builder; 3139 attr_builder.addAttribute(llvm::Attributes::StructRet); 3140 llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder); 3141 callinst->addAttribute (1, attrs); 3142 ]])], 3143 octave_cv_callinst_addattribute_arg_is_attributes=yes, 3144 octave_cv_callinst_addattribute_arg_is_attributes=no) 3145 AC_LANG_POP(C++) 3146 ]) 3147 if test $octave_cv_callinst_addattribute_arg_is_attributes = yes; then 3148 AC_DEFINE(CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1, 3149 [Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes.]) 3150 fi 3151]) 3152dnl 3153dnl Check for Function::addAttribute API 3154dnl 3155AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API], [ 3156 AC_CACHE_CHECK([if llvm::Function::addAttribute's arg type is llvm::Attributes], 3157 [octave_cv_function_addattribute_arg_is_attributes], 3158 [AC_LANG_PUSH(C++) 3159 AC_COMPILE_IFELSE( 3160 [AC_LANG_PROGRAM([[ 3161#if defined (HAVE_LLVM_IR_FUNCTION_H) 3162 #include <llvm/IR/Function.h> 3163 #include <llvm/IR/Attributes.h> 3164 #include <llvm/IR/LLVMContext.h> 3165#else 3166 #include <llvm/Function.h> 3167 #include <llvm/Attributes.h> 3168 #include <llvm/LLVMContext.h> 3169#endif 3170 ]], [[ 3171 llvm::Function *llvm_function; 3172 llvm::AttrBuilder attr_builder; 3173 attr_builder.addAttribute(llvm::Attributes::StructRet); 3174 llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder); 3175 llvm_function->addAttribute (1, attrs); 3176 ]])], 3177 octave_cv_function_addattribute_arg_is_attributes=yes, 3178 octave_cv_function_addattribute_arg_is_attributes=no) 3179 AC_LANG_POP(C++) 3180 ]) 3181 if test $octave_cv_function_addattribute_arg_is_attributes = yes; then 3182 AC_DEFINE(FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1, 3183 [Define to 1 if llvm::Function:addAttribute arg type is llvm::Attributes.]) 3184 fi 3185]) 3186dnl 3187dnl Check for Function::addFnAttr API 3188dnl 3189AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDFNATTR_API], [ 3190 AC_CACHE_CHECK([if llvm::Function::addFnAttr's arg type is llvm::Attributes], 3191 [octave_cv_function_addfnattr_arg_is_attributes], 3192 [AC_LANG_PUSH(C++) 3193 AC_COMPILE_IFELSE( 3194 [AC_LANG_PROGRAM([[ 3195#if defined (HAVE_LLVM_IR_FUNCTION_H) 3196 #include <llvm/IR/Function.h> 3197 #include <llvm/IR/Attributes.h> 3198#else 3199 #include <llvm/Function.h> 3200 #include <llvm/Attributes.h> 3201#endif 3202 ]], [[ 3203 llvm::Function *llvm_function; 3204 llvm_function->addFnAttr (llvm::Attributes::AlwaysInline); 3205 ]])], 3206 octave_cv_function_addfnattr_arg_is_attributes=yes, 3207 octave_cv_function_addfnattr_arg_is_attributes=no) 3208 AC_LANG_POP(C++) 3209 ]) 3210 if test $octave_cv_function_addfnattr_arg_is_attributes = yes; then 3211 AC_DEFINE(FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES, 1, 3212 [Define to 1 if llvm::Function:addFnAttr arg type is llvm::Attributes.]) 3213 fi 3214]) 3215dnl 3216dnl Check for legacy::PassManager API 3217dnl 3218AC_DEFUN([OCTAVE_LLVM_LEGACY_PASSMANAGER_API], [ 3219 AC_CACHE_CHECK([if llvm::legacy::PassManager exists], 3220 [octave_cv_legacy_passmanager], 3221 [AC_LANG_PUSH(C++) 3222 save_LIBS="$LIBS" 3223 LIBS="$LLVM_LIBS $LIBS" 3224 AC_LINK_IFELSE( 3225 [AC_LANG_PROGRAM([[ 3226 #include <llvm/IR/LegacyPassManager.h> 3227 ]], [[ 3228 llvm::Module *module; 3229 llvm::legacy::PassManager *module_pass_manager; 3230 llvm::legacy::FunctionPassManager *pass_manager; 3231 module_pass_manager = new llvm::legacy::PassManager (); 3232 pass_manager = new llvm::legacy::FunctionPassManager (module); 3233 ]])], 3234 octave_cv_legacy_passmanager=yes, 3235 octave_cv_legacy_passmanager=no) 3236 LIBS="$save_LIBS" 3237 AC_LANG_POP(C++) 3238 ]) 3239 if test $octave_cv_legacy_passmanager = yes; then 3240 AC_DEFINE(LEGACY_PASSMANAGER, 1, 3241 [Define to 1 if LLVM::legacy::PassManager exists.]) 3242 fi 3243]) 3244dnl 3245dnl Check for raw_fd_ostream API 3246dnl 3247AC_DEFUN([OCTAVE_LLVM_RAW_FD_OSTREAM_API], [ 3248 AC_CACHE_CHECK([if llvm::raw_fd_ostream's arg type is llvm::sys:fs], 3249 [octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs], 3250 [AC_LANG_PUSH(C++) 3251 AC_COMPILE_IFELSE( 3252 [AC_LANG_PROGRAM([[ 3253 #include <llvm/Support/raw_os_ostream.h> 3254 ]], [[ 3255 std::string str; 3256 llvm::raw_fd_ostream fout ("", str, llvm::sys::fs::F_Binary); 3257 ]])], 3258 octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=yes, 3259 octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=no) 3260 AC_LANG_POP(C++) 3261 ]) 3262 if test $octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs = yes; then 3263 AC_DEFINE(RAW_FD_OSTREAM_ARG_IS_LLVM_SYS_FS, 1, 3264 [Define to 1 if LLVM::raw_fd_ostream arg type is llvm::sys:fs.]) 3265 fi 3266]) 3267dnl 3268dnl Check llvm::IRBuilder API 3269dnl 3270AC_DEFUN([OCTAVE_LLVM_IRBUILDER_API], [ 3271 AC_CACHE_CHECK([if llvm::IRBuilder has two template arguments], 3272 [octave_cv_llvm_irbuilder_has_two_template_args], 3273 [AC_LANG_PUSH(C++) 3274 AC_COMPILE_IFELSE( 3275 [AC_LANG_PROGRAM([[ 3276#if defined (HAVE_LLVM_IR_FUNCTION_H) 3277 #include <llvm/IR/LLVMContext.h> 3278#else 3279 #include <llvm/LLVMContext.h> 3280#endif 3281#if defined (HAVE_LLVM_IR_IRBUILDER_H) 3282 #include <llvm/IR/IRBuilder.h> 3283#elif defined (HAVE_LLVM_SUPPORT_IRBUILDER_H) 3284 #include <llvm/Support/IRBuilder.h> 3285#else 3286 #include <llvm/IRBuilder.h> 3287#endif 3288 using namespace llvm; 3289 ]], [[ 3290 LLVMContext c; 3291 IRBuilder<ConstantFolder,IRBuilderDefaultInserter> irb (c); 3292 ]])], 3293 octave_cv_llvm_irbuilder_has_two_template_args=yes, 3294 octave_cv_llvm_irbuilder_has_two_template_args=no) 3295 AC_LANG_POP(C++) 3296 ]) 3297 if test $octave_cv_llvm_irbuilder_has_two_template_args = yes; then 3298 AC_DEFINE(LLVM_IRBUILDER_HAS_TWO_TEMPLATE_ARGS, 1, 3299 [Define to 1 if llvm::IRBuilder has two template arguments.]) 3300 fi 3301]) 3302dnl 3303dnl Check for llvm::createAlwaysInlinerPass 3304dnl 3305AC_DEFUN([OCTAVE_LLVM_HAS_CREATEALWAYSINLINERPASS], [ 3306 AC_CACHE_CHECK([if llvm::createAlwaysInlinerPass exists], 3307 [octave_cv_llvm_has_createalwaysinlinerpass], 3308 [AC_LANG_PUSH(C++) 3309 AC_COMPILE_IFELSE( 3310 [AC_LANG_PROGRAM([[ 3311 #include <llvm/Transforms/IPO.h> 3312 ]], [[ 3313 llvm::Pass *p; 3314 p = llvm::createAlwaysInlinerPass (); 3315 ]])], 3316 octave_cv_llvm_has_createalwaysinlinerpass=yes, 3317 octave_cv_llvm_has_createalwaysinlinerpass=no) 3318 AC_LANG_POP(C++) 3319 ]) 3320 if test $octave_cv_llvm_has_createalwaysinlinerpass = yes; then 3321 AC_DEFINE(LLVM_HAS_CREATEALWAYSINLINERPASS, 1, 3322 [Define to 1 if llvm::createAlwaysInlinerPass exists.]) 3323 fi 3324]) 3325dnl 3326dnl Check llvm::IRBuilder::CreateConstInBoundsGEP1_32 API 3327dbl 3328AC_DEFUN([OCTAVE_LLVM_IRBUILDER_CREATECONSTINBOUNDSGEP1_32_API], [ 3329 AC_CACHE_CHECK([if llvm::IRBuilder::CreateConstInBoundsGEP1_32 requires a type argument], 3330 [octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type], 3331 [AC_LANG_PUSH(C++) 3332 AC_COMPILE_IFELSE( 3333 [AC_LANG_PROGRAM([[ 3334#if defined (HAVE_LLVM_IR_IRBUILDER_H) 3335 #include <llvm/IR/IRBuilder.h> 3336#elif defined (HAVE_LLVM_SUPPORT_IRBUILDER_H) 3337 #include <llvm/Support/IRBuilder.h> 3338#else 3339 #include <llvm/IRBuilder.h> 3340#endif 3341 ]], [[ 3342 llvm::LLVMContext c; 3343 llvm::IRBuilder<> irb (c); 3344 llvm::Value *v; 3345 v = irb.CreateConstInBoundsGEP1_32 ((llvm::Value *) nullptr, 0); 3346 ]])], 3347 octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type=no, 3348 octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type=yes) 3349 AC_LANG_POP(C++) 3350 ]) 3351 if test $octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type = yes; then 3352 AC_DEFINE(LLVM_IRBUILDER_CREATECONSTINBOUNDSGEP1_32_REQUIRES_TYPE, 1, 3353 [Define to 1 if llvm::IRBuilder::CreateConstInBoundsGEP1_32 requires a type argument.]) 3354 fi 3355]) 3356dnl 3357dnl Check if MIPS processor is target and quiet signalling NaN value is 3358dnl opposite of IEEE 754-2008 standard used by all other architectures. 3359dnl 3360AC_DEFUN([OCTAVE_MIPS_NAN], [ 3361 AC_CACHE_CHECK([whether MIPS processor is using non-standard NaN encoding], 3362 [octave_cv_mips_nan], 3363 [AC_LANG_PUSH(C++) 3364 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 3365 #include <cmath> 3366 #include <limits> 3367 ]], [[ 3368 /* FIXME: Only test is that MIPS is the target architecture. 3369 * This should be AND'ed with a test for whether the actual NaN 3370 * value for the high word (LO_IEEE_NA_HW) has the value 3371 * 0x7FF840F4 (normal) or 0x7FF040F4 (non-standard). Template code 3372 * that could work is in liboctave/utils/lo-ieee.cc but it also 3373 * depends on knowing whether the architecture is big-endian or 3374 * little-endian. */ 3375 #if defined (__mips__) 3376 return (0); 3377 #else 3378 return (1); 3379 #endif 3380 ]])], 3381 octave_cv_mips_nan=yes, 3382 octave_cv_mips_nan=no, 3383 octave_cv_mips_nan=no) 3384 AC_LANG_POP(C++) 3385 ]) 3386 if test $octave_cv_mips_nan = yes; then 3387 AC_DEFINE(HAVE_MIPS_NAN, 1, 3388 [Define to 1 if MIPS processor is using non-standard NaN encoding.]) 3389 fi 3390]) 3391dnl 3392dnl OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS 3393dnl 3394dnl Set variables related to Fortran symbol names (append underscore, 3395dnl use uppercase names, etc.) and calling convention (mostly used for 3396dnl determining how character strings are passed). 3397dnl 3398AC_DEFUN([OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS], [ 3399 F77_TOLOWER=yes 3400 F77_APPEND_UNDERSCORE=yes 3401 F77_APPEND_EXTRA_UNDERSCORE=yes 3402 3403 case $ac_cv_f77_mangling in 3404 "upper case") F77_TOLOWER=no ;; 3405 esac 3406 case $ac_cv_f77_mangling in 3407 "no underscore") F77_APPEND_UNDERSCORE=no ;; 3408 esac 3409 case $ac_cv_f77_mangling in 3410 "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;; 3411 esac 3412 3413 case $canonical_host_type in 3414 i[[3456789]]86-*-*) 3415 if test $ac_cv_f77_compiler_gnu = yes; then 3416 OCTAVE_F77_FLAG([-mieee-fp]) 3417 fi 3418 ;; 3419 alpha*-*-*) 3420 if test $ac_cv_f77_compiler_gnu = yes; then 3421 OCTAVE_F77_FLAG([-mieee]) 3422 else 3423 OCTAVE_F77_FLAG([-ieee]) 3424 OCTAVE_F77_FLAG([-fpe1]) 3425 fi 3426 ;; 3427 powerpc-apple-machten*) 3428 FFLAGS= 3429 ;; 3430 esac 3431 3432 if test $ac_cv_f77_compiler_gnu = yes; then 3433 FORTRAN_CALLING_CONVENTION=gfortran 3434 else 3435 FORTRAN_CALLING_CONVENTION=unknown 3436 fi 3437 AC_ARG_ENABLE([fortran-calling-convention], 3438 [AS_HELP_STRING([--enable-fortran-calling-convention=OPTION], 3439 [Select C++ to Fortran calling convention. "gfortran" should be detected automatically. Other options are "cray", "visual-fortran", or "f2c".])], 3440 [FORTRAN_CALLING_CONVENTION="$enableval"], []) 3441 3442 case $FORTRAN_CALLING_CONVENTION in 3443 gfortran) 3444 AC_DEFINE(F77_USES_GFORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the gfortran calling convention.]) 3445 ;; 3446 cray) 3447 AC_DEFINE(F77_USES_CRAY_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Cray Fortran calling convention.]) 3448 ;; 3449 visual-fortran) 3450 AC_DEFINE(F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Visual Fortran calling convention.]) 3451 ;; 3452 f2c) 3453 AC_DEFINE(F77_USES_F2C_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the f2c calling convention.]) 3454 ;; 3455 *) 3456 AC_MSG_ERROR([to build Octave, the C++ to Fortran calling convention must be known.]) 3457 ;; 3458 esac 3459 3460 if test -n "$FFLAGS"; then 3461 AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS]) 3462 fi 3463 3464 AC_SUBST(F77_TOLOWER) 3465 AC_SUBST(F77_APPEND_UNDERSCORE) 3466 AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE) 3467]) 3468dnl 3469dnl OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS 3470dnl 3471dnl Requires the following variables to already be set: 3472dnl 3473dnl AR 3474dnl CFLAGS 3475dnl CXX 3476dnl CXXFLAGS 3477dnl EXEEXT 3478dnl GCC 3479dnl GREP 3480dnl GXX 3481dnl LDFLAGS 3482dnl ac_cv_f77_compiler_gnu 3483dnl ac_top_build_prefix 3484dnl canonical_host_type 3485dnl have_msvc 3486dnl 3487AC_DEFUN_ONCE([OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS], [ 3488 ### Set system-dependent options for building shared libraries. 3489 ### These are used by mkoctfile to create dynamically loadable 3490 ### .oct and .mex files. It would be great if we could somehow 3491 ### use libtool to get this information. 3492 3493 CPICFLAG=-fPIC 3494 CXXPICFLAG=-fPIC 3495 FPICFLAG=-fPIC 3496 SH_LDFLAGS=-shared 3497 DL_LDFLAGS="${SH_LDFLAGS}" 3498 MKOCTFILE_DL_LDFLAGS="${DL_LDFLAGS}" 3499 NO_OCT_FILE_STRIP=false 3500 TEMPLATE_AR="${AR}" 3501 TEMPLATE_ARFLAGS="${ARFLAGS}" 3502 EXTERNAL_DLL_DEFS= 3503 OCTAVE_DLL_DEFS= 3504 OCTINTERP_DLL_DEFS= 3505 OCTGUI_DLL_DEFS= 3506 OCTGRAPHICS_DLL_DEFS= 3507 library_path_var=LD_LIBRARY_PATH 3508 ldpreloadsep=" " 3509 case $canonical_host_type in 3510 *-*-386bsd* | *-*-netbsd*) 3511 SH_LDFLAGS=-Bshareable 3512 ;; 3513 *-*-openbsd*) 3514 SH_LDFLAGS="-shared -fPIC" 3515 ;; 3516 *-*-freebsd*) 3517 SH_LDFLAGS="-shared -Wl,-x" 3518 ;; 3519 alpha*-dec-osf*) 3520 CPICFLAG= 3521 CXXPICFLAG= 3522 FPICFLAG= 3523 SH_LDFLAGS="-shared -Wl,-expect_unresolved -Wl,'*'" 3524 ;; 3525 *-*-darwin*) 3526 DL_LDFLAGS="-bundle -bundle_loader ${ac_top_build_prefix}src/octave${EXEEXT} ${LDFLAGS}" 3527 dnl Contains variables that are defined and undefined at this point, so use 3528 dnl appropriate quoting to defer expansion of ${bindir} and ${version}. 3529 MKOCTFILE_DL_LDFLAGS='-bundle -bundle_loader ${bindir}/octave-${version}'"${EXEEXT}" 3530 SH_LDFLAGS="-dynamiclib -single_module ${LDFLAGS}" 3531 case $canonical_host_type in 3532 powerpc-*) 3533 CXXPICFLAG= 3534 CPICFLAG= 3535 FPICFLAG= 3536 ;; 3537 esac 3538 NO_OCT_FILE_STRIP=true 3539 library_path_var=DYLD_LIBRARY_PATH 3540 ;; 3541 *-*-cygwin*) 3542 CPICFLAG= 3543 CXXPICFLAG= 3544 FPICFLAG= 3545 DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc" 3546 SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" 3547 ldpreloadsep=":" 3548 ;; 3549 *-*-mingw*) 3550 if test $have_msvc = yes; then 3551 DL_LDFLAGS="-shared" 3552 CPICFLAG= 3553 CXXPICFLAG= 3554 FPICFLAG= 3555 SH_LDFLAGS="-shared" 3556 if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then 3557 DL_LDFLAGS="$DL_LDFLAGS -g" 3558 SH_LDFLAGS="$SH_LDFLAGS -g" 3559 fi 3560 NO_OCT_FILE_STRIP=true 3561 library_path_var=PATH 3562 ## Extra compilation flags. 3563 EXTERNAL_DLL_DEFS="-DEXTERNAL_DLL" 3564 OCTAVE_DLL_DEFS="-DOCTAVE_DLL" 3565 OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL" 3566 OCTGUI_DLL_DEFS="-DOCTGUI_DLL" 3567 OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL" 3568 else 3569 CPICFLAG= 3570 CXXPICFLAG= 3571 FPICFLAG= 3572 DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc" 3573 SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" 3574 library_path_var=PATH 3575 fi 3576 ;; 3577 *-*-msdosmsvc) 3578 DL_LDFLAGS="-shared" 3579 CPICFLAG= 3580 CXXPICFLAG= 3581 FPICFLAG= 3582 SH_LDFLAGS="-shared" 3583 if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then 3584 DL_LDFLAGS="$DL_LDFLAGS -g" 3585 SH_LDFLAGS="$SH_LDFLAGS -g" 3586 fi 3587 NO_OCT_FILE_STRIP=true 3588 library_path_var=PATH 3589 ## Extra compilation flags. 3590 EXTERNAL_DLL_DEFS="-DEXTERNAL_DLL" 3591 OCTAVE_DLL_DEFS="-DOCTAVE_DLL" 3592 OCTGUI_DLL_DEFS="-DOCTGUI_DLL" 3593 OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL" 3594 ;; 3595 *-*-linux* | *-*-gnu*) 3596 MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic" 3597 ;; 3598 i[[3456]]86-*-sco3.2v5*) 3599 SH_LDFLAGS=-G 3600 ;; 3601 rs6000-ibm-aix* | powerpc-ibm-aix*) 3602 CPICFLAG= 3603 CXXPICFLAG= 3604 FPICFLAG= 3605 library_path_var=LIBPATH 3606 ;; 3607 hppa*-hp-hpux*) 3608 if test $ac_cv_f77_compiler_gnu = yes; then 3609 FPICFLAG=-fPIC 3610 else 3611 FPICFLAG=+Z 3612 fi 3613 SH_LDFLAGS="-shared -fPIC" 3614 library_path_var=SHLIB_PATH 3615 ;; 3616 ia64*-hp-hpux*) 3617 if test $ac_cv_f77_compiler_gnu = yes; then 3618 FPICFLAG=-fPIC 3619 else 3620 FPICFLAG=+Z 3621 fi 3622 SH_LDFLAGS="-shared -fPIC" 3623 ;; 3624 *-sgi-*) 3625 CPICFLAG= 3626 CXXPICFLAG= 3627 FPICFLAG= 3628 ;; 3629 sparc-sun-sunos4*) 3630 if test $ac_cv_f77_compiler_gnu = yes; then 3631 FPICFLAG=-fPIC 3632 else 3633 FPICFLAG=-PIC 3634 fi 3635 SH_LDFLAGS="-assert nodefinitions" 3636 ;; 3637 sparc-sun-solaris2* | i386-pc-solaris2*) 3638 if test $ac_cv_f77_compiler_gnu = yes; then 3639 FPICFLAG=-fPIC 3640 else 3641 FPICFLAG=-KPIC 3642 fi 3643 if test "$GCC" = yes; then 3644 CPICFLAG=-fPIC 3645 else 3646 CPICFLAG=-KPIC 3647 fi 3648 if test "$GXX" = yes; then 3649 CXXPICFLAG=-fPIC 3650 SH_LDFLAGS=-shared 3651 else 3652 CXXPICFLAG=-KPIC 3653 SH_LDFLAGS=-G 3654 fi 3655 ## Template closures in archive libraries need a different mechanism. 3656 if test "$GXX" != yes; then 3657 TEMPLATE_AR="${CXX}" 3658 TEMPLATE_ARFLAGS="-xar -o" 3659 fi 3660 ;; 3661 esac 3662 3663 AC_MSG_NOTICE([defining FPICFLAG to be $FPICFLAG]) 3664 AC_MSG_NOTICE([defining CPICFLAG to be $CPICFLAG]) 3665 AC_MSG_NOTICE([defining CXXPICFLAG to be $CXXPICFLAG]) 3666 AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS]) 3667 AC_MSG_NOTICE([defining DL_LDFLAGS to be $DL_LDFLAGS]) 3668 AC_MSG_NOTICE([defining MKOCTFILE_DL_LDFLAGS to be $MKOCTFILE_DL_LDFLAGS]) 3669 AC_MSG_NOTICE([defining NO_OCT_FILE_STRIP to be $NO_OCT_FILE_STRIP]) 3670 AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR]) 3671 AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS]) 3672 AC_MSG_NOTICE([defining EXTERNAL_DLL_DEFS to be $EXTERNAL_DLL_DEFS]) 3673 AC_MSG_NOTICE([defining OCTAVE_DLL_DEFS to be $OCTAVE_DLL_DEFS]) 3674 AC_MSG_NOTICE([defining OCTINTERP_DLL_DEFS to be $OCTINTERP_DLL_DEFS]) 3675 AC_MSG_NOTICE([defining OCTGUI_DLL_DEFS to be $OCTGUI_DLL_DEFS]) 3676 AC_MSG_NOTICE([defining OCTGRAPHICS_DLL_DEFS to be $OCTGRAPHICS_DLL_DEFS]) 3677 AC_MSG_NOTICE([defining library_path_var to be $library_path_var]) 3678 AC_SUBST(FPICFLAG) 3679 AC_SUBST(CPICFLAG) 3680 AC_SUBST(CXXPICFLAG) 3681 AC_SUBST(SH_LDFLAGS) 3682 AC_SUBST(DL_LDFLAGS) 3683 AC_SUBST(MKOCTFILE_DL_LDFLAGS) 3684 AC_SUBST(NO_OCT_FILE_STRIP) 3685 AC_SUBST(TEMPLATE_AR) 3686 AC_SUBST(TEMPLATE_ARFLAGS) 3687 AC_SUBST(EXTERNAL_DLL_DEFS) 3688 AC_SUBST(OCTAVE_DLL_DEFS) 3689 AC_SUBST(OCTINTERP_DLL_DEFS) 3690 AC_SUBST(OCTGUI_DLL_DEFS) 3691 AC_SUBST(OCTGRAPHICS_DLL_DEFS) 3692 AC_SUBST(library_path_var) 3693 AC_SUBST(ldpreloadsep) 3694 AM_SUBST_NOTMAKE(ldpreloadsep) 3695]) 3696dnl 3697dnl Check for ar. 3698dnl 3699AC_DEFUN([OCTAVE_PROG_AR], [ 3700 if test -z "$AR"; then 3701 AR=ar 3702 fi 3703 AC_SUBST(AR) 3704 3705 if test -z "$ARFLAGS"; then 3706 ARFLAGS="cr" 3707 fi 3708 AC_SUBST(ARFLAGS) 3709 3710 dnl FIXME: Remove when libtool updated (placed 4/15/2017). 3711 dnl This silences the following unnecessary warning during compile: 3712 dnl ar: `u' modifier ignored since `D' is the default (see `U') 3713 if test -z "$AR_FLAGS"; then 3714 AR_FLAGS="$ARFLAGS" 3715 fi 3716]) 3717dnl 3718dnl Check for bison. 3719dnl 3720AC_DEFUN([OCTAVE_PROG_BISON], [ 3721 AC_PROG_YACC 3722 WARN_YFLAGS= 3723 3724 case "`$YACC --version`" in 3725 *bison*) tmp_have_bison=yes ;; 3726 *) tmp_have_bison=no ;; 3727 esac 3728 3729 if test $tmp_have_bison = yes; then 3730 dnl FIXME: Call GNU bison with the `-Wno-yacc` option, which works with 3731 dnl bison 2.5 and all later versions, as recommended by the bison NEWS. 3732 dnl This is needed as long as Octave supports Autoconf version 2.69 or 3733 dnl older. In Autoconf 2.70, AC_PROG_YACC no longer adds the `-y` 3734 dnl option to emulate POSIX yacc. 3735 WARN_YFLAGS="-Wno-yacc" 3736 3737 AC_CACHE_CHECK([syntax of bison api.prefix (or name-prefix) declaration], 3738 [octave_cv_bison_api_prefix_decl_style], [ 3739 style="api name" 3740 quote="quote brace" 3741 for s in $style; do 3742 for q in $quote; do 3743 if test $s = "api"; then 3744 if test $q = "quote"; then 3745 def='%define api.prefix "foo_"' 3746 else 3747 def='%define api.prefix {foo_}' 3748 fi 3749 else 3750 if test $q = "quote"; then 3751 def='%name-prefix="foo_"' 3752 else 3753 def='%name-prefix {foo_}' 3754 fi 3755 fi 3756 cat << EOF > conftest.yy 3757$def 3758%start input 3759%% 3760input:; 3761%% 3762EOF 3763 ## Older versions of bison only warn and exit with success. 3764 octave_bison_output=`$YACC $WARN_YFLAGS conftest.yy 2>&1` 3765 ac_status=$? 3766 if test $ac_status -eq 0 && test -z "$octave_bison_output"; then 3767 octave_cv_bison_api_prefix_decl_style="$s $q" 3768 break 3769 fi 3770 done 3771 if test -n "$octave_cv_bison_api_prefix_decl_style"; then 3772 break 3773 fi 3774 done 3775 rm -f conftest.yy y.tab.h y.tab.c 3776 ]) 3777 fi 3778 3779 if test -z "$octave_cv_bison_api_prefix_decl_style" \ 3780 || test "$octave_cv_bison_api_prefix_decl_style" != "api brace"; then 3781 tmp_have_bison=no 3782 warn_bison_api_prefix_decl_style=" 3783 3784I wasn't able to find a suitable style for declaring the api prefix 3785in a bison input file so I'm disabling bison. We expect bison to 3786understand the '%define api.prefix { PREFIX }' syntax. 3787" 3788 OCTAVE_CONFIGURE_WARNING([warn_bison_api_prefix_decl_style]) 3789 fi 3790 3791 if test $tmp_have_bison = no; then 3792 YACC='${top_srcdir}/build-aux/missing bison' 3793 warn_bison=" 3794 3795I didn't find bison, or the version of bison that I found does not 3796support all the features that are required, but it's only a problem 3797if you need to reconstruct parse.cc, which is the case if you're 3798building from VCS sources. 3799" 3800 OCTAVE_CONFIGURE_WARNING([warn_bison]) 3801 fi 3802 AC_SUBST(WARN_YFLAGS) 3803]) 3804dnl 3805dnl Find find program. 3806dnl 3807## Prefer GNU find if found. 3808AN_MAKEVAR([FIND], [OCTAVE_PROG_FIND]) 3809AN_PROGRAM([gfind], [OCTAVE_PROG_FIND]) 3810AN_PROGRAM([find], [OCTAVE_PROG_FIND]) 3811AC_DEFUN([OCTAVE_PROG_FIND], [ 3812 AC_CHECK_PROGS(FIND, [gfind find]) 3813]) 3814dnl 3815dnl Check for flex. 3816dnl 3817AC_DEFUN([OCTAVE_PROG_FLEX], [ 3818 ## For now, don't define LEXLIB to be -lfl -- we don't use anything in 3819 ## it, and it might not be installed. 3820 ## 3821 ## Also make sure that we generate an interactive scanner if we are 3822 ## using flex. 3823 AC_PROG_LEX 3824 case "`$LEX --version`" in 3825 *flex*) 3826 LFLAGS="-I" 3827 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) 3828 LEXLIB= 3829 ;; 3830 *) 3831 LEX='${top_srcdir}/build-aux/missing flex' 3832 warn_flex=" 3833 3834I didn't find flex, but it's only a problem if you need to reconstruct 3835lex.cc, which is the case if you're building from VCS sources. 3836" 3837 OCTAVE_CONFIGURE_WARNING([warn_flex]) 3838 ;; 3839 esac 3840 AC_SUBST(LFLAGS) 3841]) 3842dnl 3843dnl Check for ghostscript. 3844dnl 3845AC_DEFUN([OCTAVE_PROG_GHOSTSCRIPT], [ 3846 case "$canonical_host_type" in 3847 *-*-mingw* | *-*-msdosmsvc) 3848 ac_octave_gs_names="gswin32c gs mgs" 3849 ;; 3850 *) 3851 ac_octave_gs_names="gs" 3852 ;; 3853 esac 3854 AC_CHECK_PROGS(GHOSTSCRIPT, [$ac_octave_gs_names]) 3855 if test -z "$GHOSTSCRIPT"; then 3856 GHOSTSCRIPT='${top_srcdir}/build-aux/missing gs' 3857 warn_ghostscript=" 3858 3859I didn't find ghostscript, so reconstructing figures for the manual 3860will fail, and saving graphics in some output formats will fail when 3861using Octave 3862" 3863 OCTAVE_CONFIGURE_WARNING([warn_ghostscript]) 3864 fi 3865 AC_SUBST(GHOSTSCRIPT) 3866]) 3867dnl 3868dnl Check for gnuplot. 3869dnl 3870AC_DEFUN([OCTAVE_PROG_GNUPLOT], [ 3871 ac_octave_gp_names="gnuplot" 3872 ac_octave_gp_default="gnuplot" 3873 if test "$cross_compiling" = yes; then 3874 GNUPLOT="$ac_octave_gp_default" 3875 GNUPLOT_BINARY=$GNUPLOT 3876 AC_MSG_RESULT([assuming $GNUPLOT exists on $canonical_host_type host]) 3877 else 3878 AC_CHECK_PROGS(GNUPLOT, [$ac_octave_gp_names]) 3879 GNUPLOT_BINARY=$GNUPLOT 3880 if test -z "$GNUPLOT"; then 3881 GNUPLOT="$ac_octave_gp_default" 3882 GNUPLOT_BINARY="" 3883 warn_gnuplot=" 3884 3885gnuplot not found. It isn't necessary to have gnuplot installed, but 3886without native graphics or gnuplot you won't be able to use any of 3887Octave's plotting commands. 3888" 3889 OCTAVE_CONFIGURE_WARNING([warn_gnuplot]) 3890 fi 3891 fi 3892 AC_SUBST(GNUPLOT) 3893]) 3894dnl 3895dnl Check for gperf. 3896dnl 3897AC_DEFUN([OCTAVE_PROG_GPERF], [ 3898 AC_CHECK_PROG(GPERF, gperf, gperf, []) 3899 if test -z "$GPERF"; then 3900 GPERF='${top_srcdir}/build-aux/missing gperf' 3901 warn_gperf=" 3902 3903I didn't find gperf, but it's only a problem if you need to 3904reconstruct oct-gperf.h 3905" 3906 OCTAVE_CONFIGURE_WARNING([warn_gperf]) 3907 GPERF='${top_srcdir}/build-aux/missing gperf' 3908 fi 3909 AC_SUBST(GPERF) 3910]) 3911dnl 3912dnl Find icotool program. 3913dnl 3914AC_DEFUN([OCTAVE_PROG_ICOTOOL], [ 3915 AC_CHECK_PROG(ICOTOOL, icotool, icotool, []) 3916 if test -z "$ICOTOOL"; then 3917 ICOTOOL='${top_srcdir}/build-aux/missing icotool' 3918 warn_icotool=" 3919 3920I didn't find icotool, but it's only a problem if you need to 3921reconstruct octave-logo.ico, which is the case if you're building from 3922VCS sources. 3923" 3924 OCTAVE_CONFIGURE_WARNING([warn_icotool]) 3925 fi 3926 AC_SUBST(ICOTOOL) 3927]) 3928dnl 3929dnl Check for makeinfo. 3930dnl 3931AC_DEFUN([OCTAVE_PROG_MAKEINFO], [ 3932 dnl use MKINFO, not MAKEINFO, for variable name because Automake 3933 dnl automatically defines a value for MAKEINFO even when it does not 3934 dnl exist which will then fool the 'test -z' line. 3935 AC_CHECK_PROG(MKINFO, makeinfo, makeinfo, []) 3936 if test -z "$MKINFO"; then 3937 warn_makeinfo=" 3938 3939I didn't find makeinfo, which is required for reading documentation. 3940You may install a copy later for Octave to use. 3941" 3942 OCTAVE_CONFIGURE_WARNING([warn_makeinfo]) 3943 fi 3944 dnl If we have a GNU makeinfo program, see if it supports the @sortas command 3945 dnl for defining a custom sort key for an index entry. 3946 if test -n "$MKINFO"; then 3947 AC_CACHE_CHECK([for makeinfo support for @sortas command], 3948 [octave_cv_makeinfo_sortas_command], 3949 [cat << EOF > conftest.texi 3950\input texinfo 3951@node Top 3952@top Document 3953@menu 3954* Chapter:: 3955* Index:: 3956@end menu 3957@node Chapter 3958@chapter Chapter 3959@cindex @sortas{a} foo 3960@node Index 3961@unnumbered Index 3962@printindex cp 3963@bye 3964EOF 3965 if $MKINFO --no-warn conftest.texi 2>/dev/null; then 3966 octave_cv_makeinfo_sortas_command=yes 3967 else 3968 octave_cv_makeinfo_sortas_command=no 3969 fi 3970 rm -f conftest.info conftest.texi 3971 ]) 3972 if test $octave_cv_makeinfo_sortas_command = no; then 3973 warn_makeinfo=" 3974 3975I wasn't able to find a version of GNU makeinfo that supports the 3976@sortas command, but it's only a problem if you need to build the 3977manual, which is the case if you're building from VCS sources. 3978" 3979 OCTAVE_CONFIGURE_WARNING([warn_makeinfo]) 3980 fi 3981 fi 3982]) 3983dnl 3984dnl What pager should we use? 3985dnl 3986AC_DEFUN([OCTAVE_PROG_PAGER], [ 3987 if test "$cross_compiling" = yes; then 3988 DEFAULT_PAGER=less 3989 AC_MSG_RESULT([assuming $DEFAULT_PAGER exists on $canonical_host_type host]) 3990 AC_SUBST(DEFAULT_PAGER) 3991 else 3992 ac_octave_possible_pagers="less more page pg" 3993 case "$canonical_host_type" in 3994 *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc) 3995 ac_octave_possible_pagers="$ac_octave_possible_pagers more.com" 3996 ;; 3997 esac 3998 3999 AC_CHECK_PROGS(DEFAULT_PAGER, [$ac_octave_possible_pagers], []) 4000 if test -z "$DEFAULT_PAGER"; then 4001 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" 4002 OCTAVE_CONFIGURE_WARNING([warn_less]) 4003 fi 4004 fi 4005]) 4006dnl 4007dnl Find Perl program. 4008dnl 4009AC_DEFUN([OCTAVE_PROG_PERL], [ 4010 AC_CHECK_PROG(PERL, perl, perl, []) 4011 AC_SUBST(PERL) 4012]) 4013dnl 4014dnl Find Python program. 4015dnl 4016AC_DEFUN([OCTAVE_PROG_PYTHON], [ 4017 AC_CHECK_PROG(PYTHON, python, python, []) 4018 AC_SUBST(PYTHON) 4019]) 4020dnl 4021dnl Find rsvg-convert program. 4022dnl 4023AC_DEFUN([OCTAVE_PROG_RSVG_CONVERT], [ 4024 AC_CHECK_PROG(RSVG_CONVERT, rsvg-convert, rsvg-convert, []) 4025 if test -z "$RSVG_CONVERT"; then 4026 RSVG_CONVERT='${top_srcdir}/build-aux/missing rsvg-convert' 4027 warn_rsvg_convert=" 4028 4029I didn't find rsvg-convert, but it's only a problem if you need to 4030reconstruct octave-logo-*.png, which is the case if you're building 4031from VCS sources. 4032" 4033 OCTAVE_CONFIGURE_WARNING([warn_rsvg_convert]) 4034 fi 4035 AC_SUBST(RSVG_CONVERT) 4036]) 4037dnl 4038dnl Find sed program. 4039dnl 4040# Check for a fully-functional sed program, that truncates 4041# as few characters as possible and that supports "\(X\|Y\)" 4042# style regular expression alternation. Prefer GNU sed if found. 4043AC_DEFUN([OCTAVE_PROG_SED], [ 4044 AC_MSG_CHECKING([for a usable sed]) 4045 if test -z "$SED"; then 4046 AC_CACHE_VAL([octave_cv_prog_sed], 4047 [# Loop through the user's path and search for sed and gsed. 4048 # Next, test potential sed programs in list for truncation. 4049 _AS_PATH_WALK([$PATH], 4050 [for ac_prog in sed gsed; do 4051 for ac_exec_ext in '' $ac_executable_extensions; do 4052 if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then 4053 _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" 4054 fi 4055 done 4056 done 4057 ]) 4058 AS_TMPDIR(sed) 4059 _max=0 4060 _count=0 4061 # Add /usr/xpg4/bin/sed as it is typically found on Solaris 4062 # along with /bin/sed that truncates output. 4063 for _sed in $_sed_list /usr/xpg4/bin/sed; do 4064 test ! -f ${_sed} && break 4065 cat /dev/null > "$tmp/sed.in" 4066 _count=0 4067 echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in" 4068 # Check for GNU sed and select it if it is found. 4069 if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then 4070 octave_cv_prog_sed=${_sed} 4071 break; 4072 fi 4073 # Reject if RE alternation is not handled. 4074 if test "`echo 'this and that' | ${_sed} -n 's/\(this\|that\).*$/\1/p'`" != "this"; then 4075 continue; 4076 fi 4077 while true; do 4078 cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" 4079 mv "$tmp/sed.tmp" "$tmp/sed.in" 4080 cp "$tmp/sed.in" "$tmp/sed.nl" 4081 echo >>"$tmp/sed.nl" 4082 ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break 4083 cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break 4084 # 10000 chars as input seems more than enough 4085 test $_count -gt 10 && break 4086 _count=`expr $_count + 1` 4087 if test $_count -gt $_max; then 4088 _max=$_count 4089 octave_cv_prog_sed=$_sed 4090 fi 4091 done 4092 done 4093 rm -rf "$tmp" 4094 ]) 4095 SED=$octave_cv_prog_sed 4096 if test -z "$SED"; then 4097 AC_MSG_ERROR([no usable version of sed found]) 4098 fi 4099 fi 4100 AC_SUBST(SED) 4101 AC_MSG_RESULT([$SED]) 4102]) 4103dnl 4104dnl Check for options that can be passed to tar to make archives reproducible. 4105dnl 4106AC_DEFUN([OCTAVE_PROG_TAR_REPRODUCIBLE], [ 4107 AC_MSG_CHECKING([for options to make reproducible archives with GNU tar]) 4108dnl This uses Automake's logic for finding GNU tar under various names 4109 for octave_tar in tar gnutar gtar :; do 4110 $octave_tar --version >/dev/null 2>&1 && break 4111 done 4112dnl If we have a valid GNU tar program, see if it supports sets of options 4113 if test x"$octave_tar" != x:; then 4114 octave_tar_flags= 4115 echo > conftest.txt 4116 for octave_tar_flag in --owner=0 --group=0 --numeric-owner --sort=name; do 4117 $octave_tar -cf conftest.tar $octave_tar_flags $octave_tar_flag conftest.txt 2>/dev/null 4118 if test $? -eq 0; then 4119 octave_tar_flags="${octave_tar_flags:+$octave_tar_flags }$octave_tar_flag" 4120 fi 4121 done 4122 rm -f conftest.tar conftest.txt 4123 REPRODUCIBLE_TAR_FLAGS="$octave_tar_flags" 4124 fi 4125 AC_SUBST(REPRODUCIBLE_TAR_FLAGS) 4126 AC_MSG_RESULT([$REPRODUCIBLE_TAR_FLAGS]) 4127]) 4128dnl 4129dnl Check for texi2dvi. 4130dnl 4131AC_DEFUN([OCTAVE_PROG_TEXI2DVI], [ 4132 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, []) 4133 if test -z "$TEXI2DVI"; then 4134 TEXI2DVI='${top_srcdir}/build-aux/missing texi2dvi' 4135 warn_texi2dvi=" 4136 4137I didn't find texi2dvi, but it's only a problem if you need to 4138reconstruct the DVI version of the manual 4139" 4140 OCTAVE_CONFIGURE_WARNING([warn_texi2dvi]) 4141 fi 4142 AC_SUBST(TEXI2DVI) 4143]) 4144dnl 4145dnl Check for texi2pdf. 4146dnl 4147AC_DEFUN([OCTAVE_PROG_TEXI2PDF], [ 4148 AC_REQUIRE([OCTAVE_PROG_TEXI2DVI]) 4149 AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, []) 4150 if test -z "$TEXI2PDF"; then 4151 ac_octave_texi2pdf_missing=yes; 4152 if test -n "$TEXI2DVI"; then 4153 TEXI2PDF="$TEXI2DVI --pdf" 4154 ac_octave_texi2pdf_missing=no; 4155 fi 4156 else 4157 ac_octave_texi2pdf_missing=no; 4158 fi 4159 if test $ac_octave_texi2pdf_missing = yes; then 4160 TEXI2PDF='${top_srcdir}/build-aux/missing texi2pdf' 4161 warn_texi2pdf=" 4162 4163I didn't find texi2pdf, but it's only a problem if you need to 4164reconstruct the PDF version of the manual 4165" 4166 OCTAVE_CONFIGURE_WARNING([warn_texi2pdf]) 4167 fi 4168 AC_SUBST(TEXI2PDF) 4169]) 4170dnl 4171dnl Set default value for a variable and substitute it. 4172dnl 4173AC_DEFUN([OCTAVE_SET_DEFAULT], [ 4174 ifelse($#, 2, [: ${$1=$2} 4175])dnl 4176 AC_MSG_RESULT([defining $1 to be $$1]) 4177 AC_SUBST($1) 4178]) 4179dnl 4180dnl Check for UMFPACK separately split complex matrix and RHS. 4181dnl 4182dnl Macro assumes that the check for umfpack has already been performed. 4183dnl 4184AC_DEFUN([OCTAVE_UMFPACK_SEPARATE_SPLIT], [ 4185 AC_MSG_CHECKING([for UMFPACK separate complex matrix and rhs split]) 4186 AC_CACHE_VAL([octave_cv_umfpack_separate_split], 4187 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4188 #include <stdint.h> 4189 #include <stdlib.h> 4190 #include <math.h> 4191 #if defined (HAVE_SUITESPARSE_UMFPACK_H) 4192 # include <suitesparse/umfpack.h> 4193 #elif defined (HAVE_UFSPARSE_UMFPACK_H) 4194 # include <ufsparse/umfpack.h> 4195 #elif defined (HAVE_UMFPACK_UMFPACK_H) 4196 # include <umfpack/umfpack.h> 4197 #elif defined (HAVE_UMFPACK_H) 4198 # include <umfpack.h> 4199 #endif 4200 #if defined (OCTAVE_ENABLE_64) 4201 typedef uint64_t idx_type; 4202 #define UMFPACK_NAME(name) umfpack_zl_ ## name 4203 #else 4204 typedef int idx_type; 4205 #define UMFPACK_NAME(name) umfpack_zi_ ## name 4206 #endif 4207 idx_type n = 5; 4208 idx_type Ap[] = {0, 2, 5, 9, 10, 12}; 4209 idx_type Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4}; 4210 double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0., 4211 -3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.}; 4212 double br[] = {8., 45., -3., 3., 19.}; 4213 double bi[] = {0., 0., 0., 0., 0.}; 4214 int main (void) 4215 { 4216 double *null = (double *) NULL ; 4217 double *x = (double *)malloc (2 * n * sizeof(double)); 4218 idx_type i ; 4219 void *Symbolic, *Numeric ; 4220 (void) UMFPACK_NAME (symbolic) (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ; 4221 (void) UMFPACK_NAME (numeric) (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ; 4222 UMFPACK_NAME (free_symbolic) (&Symbolic) ; 4223 (void) UMFPACK_NAME (solve) (0, Ap, Ai, Ax, null, x, null, br, bi, 4224 Numeric, null, null) ; 4225 UMFPACK_NAME (free_numeric) (&Numeric) ; 4226 for (i = 0; i < n; i++, x+=2) 4227 if (fabs (*x - i - 1.) > 1.e-13) 4228 return (1); 4229 return (0) ; 4230 } 4231 ]])], 4232 octave_cv_umfpack_separate_split=yes, 4233 octave_cv_umfpack_separate_split=no, 4234 octave_cv_umfpack_separate_split=yes) 4235 ]) 4236 if test "$cross_compiling" = yes; then 4237 AC_MSG_RESULT([$octave_cv_umfpack_separate_split assumed for cross compilation]) 4238 else 4239 AC_MSG_RESULT([$octave_cv_umfpack_separate_split]) 4240 fi 4241 if test $octave_cv_umfpack_separate_split = yes; then 4242 AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, 4243 [Define to 1 if the UMFPACK Complex solver allows matrix and RHS to be split independently.]) 4244 fi 4245]) 4246