comparison m4/acinclude.m4 @ 29367:8608b7e50720

maint: sort m4 macros alphabetically in acinclude.m4. * acinclude.m4: Sort AC_DEFUN macros alphabetically.
author Rik <rik@octave.org>
date Sat, 13 Feb 2021 11:48:09 -0800
parents 8224cb664385
children d35ed8538d69
comparison
equal deleted inserted replaced
29366:8224cb664385 29367:8608b7e50720
95 [CFLAGS="$CFLAGS $1" 95 [CFLAGS="$CFLAGS $1"
96 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) 96 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2])
97 else 97 else
98 AC_MSG_RESULT([no]) 98 AC_MSG_RESULT([no])
99 ifelse([$3], , , [$3]) 99 ifelse([$3], , , [$3])
100 fi
101 ])
102 dnl
103 dnl Check if pthread stack size accounts for thread-local storage.
104 dnl
105 dnl This program should succeed if the pthread library allocates memory
106 dnl for thread-local (__thread) variables independently of the
107 dnl requested thread stack size.
108 dnl
109 dnl It will fail if (as in the current version of glibc) the storage
110 dnl for thread-local variables is subtracted from the memory allocated
111 dnl for the thread stack. (This can cause problems for Java and for
112 dnl other libraries.)
113 dnl
114 dnl This bug is tracked in glibc at:
115 dnl https://sourceware.org/bugzilla/show_bug.cgi?id=11787
116 dnl
117 AC_DEFUN([OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE], [
118 AC_CACHE_CHECK([whether pthread stack size does not account for thread-local storage],
119 [octave_cv_broken_pthread_stacksize],
120 [AC_LANG_PUSH(C)
121 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
122 #include <stdio.h>
123 #include <string.h>
124 #include <pthread.h>
125
126 static char __thread data[100 * 1024];
127
128 static void * threadfunc(void *arg)
129 {
130 return data;
131 }
132 ]], [[
133 pthread_attr_t attr;
134 pthread_t thread;
135 int errnum;
136
137 pthread_attr_init (&attr);
138 errnum = pthread_attr_setstacksize (&attr, 64 * 1024);
139 if (errnum != 0)
140 {
141 fprintf (stderr, "pthread_attr_setstacksize: %s\n", strerror(errnum));
142 return 1;
143 }
144 errnum = pthread_create (&thread, &attr, &threadfunc, NULL);
145 if (errnum != 0)
146 {
147 fprintf (stderr, "pthread_create: %s\n", strerror(errnum));
148 return 1;
149 }
150 errnum = pthread_join (thread, NULL);
151 if (errnum != 0)
152 {
153 fprintf (stderr, "pthread_join: %s\n", strerror(errnum));
154 return 1;
155 }
156
157 pthread_attr_destroy (&attr);
158 return 0;
159 ]])],
160 octave_cv_broken_pthread_stacksize=no,
161 octave_cv_broken_pthread_stacksize=yes,
162 octave_cv_broken_pthread_stacksize=no)
163 AC_LANG_POP(C)
164 ])
165 if test $octave_cv_broken_pthread_stacksize = yes; then
166 AC_DEFINE(HAVE_BROKEN_PTHREAD_STACKSIZE, 1,
167 [Define to 1 if pthread stack size does not account for thread-local storage.])
100 fi 168 fi
101 ]) 169 ])
102 dnl 170 dnl
103 dnl Check for broken stl_algo.h header file in gcc versions 4.8.0, 4.8.1, 4.8.2 171 dnl Check for broken stl_algo.h header file in gcc versions 4.8.0, 4.8.1, 4.8.2
104 dnl which leads to failures in nth_element. 172 dnl which leads to failures in nth_element.
182 fi 250 fi
183 else 251 else
184 octave_cv_broken_stl_algo_h=no 252 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." 253 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]) 254 OCTAVE_CONFIGURE_WARNING([warn_stl_algo_h])
187 fi
188 ])
189 dnl
190 dnl Check if pthread stack size accounts for thread-local storage.
191 dnl
192 dnl This program should succeed if the pthread library allocates memory
193 dnl for thread-local (__thread) variables independently of the
194 dnl requested thread stack size.
195 dnl
196 dnl It will fail if (as in the current version of glibc) the storage
197 dnl for thread-local variables is subtracted from the memory allocated
198 dnl for the thread stack. (This can cause problems for Java and for
199 dnl other libraries.)
200 dnl
201 dnl This bug is tracked in glibc at:
202 dnl https://sourceware.org/bugzilla/show_bug.cgi?id=11787
203 dnl
204 AC_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
213 static char __thread data[100 * 1024];
214
215 static 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 255 fi
256 ]) 256 ])
257 dnl 257 dnl
258 dnl Check whether CXSparse is version 2.2 or later 258 dnl Check whether CXSparse is version 2.2 or later
259 dnl FIXME: This test uses a version number. It potentially could 259 dnl FIXME: This test uses a version number. It potentially could
341 CPPFLAGS="$ac_octave_save_CPPFLAGS" 341 CPPFLAGS="$ac_octave_save_CPPFLAGS"
342 LDFLAGS="$ac_octave_save_LDFLAGS" 342 LDFLAGS="$ac_octave_save_LDFLAGS"
343 LIBS="$ac_octave_save_LIBS" 343 LIBS="$ac_octave_save_LIBS"
344 ]) 344 ])
345 dnl 345 dnl
346 dnl OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS
347 dnl
348 dnl Set variables related to Fortran symbol names (append underscore,
349 dnl use uppercase names, etc.) and calling convention (mostly used for
350 dnl determining how character strings are passed).
351 dnl
352 AC_DEFUN([OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS], [
353 F77_TOLOWER=yes
354 F77_APPEND_UNDERSCORE=yes
355 F77_APPEND_EXTRA_UNDERSCORE=yes
356
357 case $ac_cv_f77_mangling in
358 "upper case") F77_TOLOWER=no ;;
359 esac
360 case $ac_cv_f77_mangling in
361 "no underscore") F77_APPEND_UNDERSCORE=no ;;
362 esac
363 case $ac_cv_f77_mangling in
364 "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;;
365 esac
366
367 case $canonical_host_type in
368 i[[3456789]]86-*-*)
369 if test $ac_cv_f77_compiler_gnu = yes; then
370 OCTAVE_F77_FLAG([-mieee-fp])
371 fi
372 ;;
373 alpha*-*-*)
374 if test $ac_cv_f77_compiler_gnu = yes; then
375 OCTAVE_F77_FLAG([-mieee])
376 else
377 OCTAVE_F77_FLAG([-ieee])
378 OCTAVE_F77_FLAG([-fpe1])
379 fi
380 ;;
381 powerpc-apple-machten*)
382 FFLAGS=
383 ;;
384 esac
385
386 if test $ac_cv_f77_compiler_gnu = yes; then
387 FORTRAN_CALLING_CONVENTION=gfortran
388 else
389 FORTRAN_CALLING_CONVENTION=unknown
390 fi
391 AC_ARG_ENABLE([fortran-calling-convention],
392 [AS_HELP_STRING([--enable-fortran-calling-convention=OPTION],
393 [Select C++ to Fortran calling convention. "gfortran" should be detected automatically. Other options are "cray", "visual-fortran", or "f2c".])],
394 [FORTRAN_CALLING_CONVENTION="$enableval"], [])
395
396 case $FORTRAN_CALLING_CONVENTION in
397 gfortran)
398 AC_DEFINE(F77_USES_GFORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the gfortran calling convention.])
399 ;;
400 cray)
401 AC_DEFINE(F77_USES_CRAY_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Cray Fortran calling convention.])
402 ;;
403 visual-fortran)
404 AC_DEFINE(F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Visual Fortran calling convention.])
405 ;;
406 f2c)
407 AC_DEFINE(F77_USES_F2C_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the f2c calling convention.])
408 ;;
409 *)
410 AC_MSG_ERROR([to build Octave, the C++ to Fortran calling convention must be known.])
411 ;;
412 esac
413
414 if test -n "$FFLAGS"; then
415 AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
416 fi
417
418 AC_SUBST(F77_TOLOWER)
419 AC_SUBST(F77_APPEND_UNDERSCORE)
420 AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE)
421 ])
422 dnl
346 dnl Check if function gluTessCallback is called with "(...)". 423 dnl Check if function gluTessCallback is called with "(...)".
347 dnl 424 dnl
348 AC_DEFUN([OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS], [ 425 AC_DEFUN([OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS], [
349 AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"], 426 AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"],
350 [octave_cv_func_glutesscallback_threedots], 427 [octave_cv_func_glutesscallback_threedots],
364 AC_LANG_POP(C++) 441 AC_LANG_POP(C++)
365 ]) 442 ])
366 if test $octave_cv_func_glutesscallback_threedots = yes; then 443 if test $octave_cv_func_glutesscallback_threedots = yes; then
367 AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1, 444 AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1,
368 [Define to 1 if gluTessCallback is called with (...).]) 445 [Define to 1 if gluTessCallback is called with (...).])
446 fi
447 ])
448 dnl
449 dnl Check whether the Qt class QList has a constructor that accepts
450 dnl a pair of iterators. This constructor was introduced in Qt 5.14.
451 dnl
452 AC_DEFUN([OCTAVE_CHECK_FUNC_QFONTMETRICS_HORIZONTAL_ADVANCE], [
453 AC_CACHE_CHECK([for QFontMetrics::horizontalAdvance function],
454 [octave_cv_func_qfontmetrics_horizontal_advance],
455 [AC_LANG_PUSH(C++)
456 ac_octave_save_CPPFLAGS="$CPPFLAGS"
457 ac_octave_save_CXXFLAGS="$CXXFLAGS"
458 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
459 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
460 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
461 #include <QFont>
462 #include <QFontMetrics>
463 #include <QString>
464 ]], [[
465 QFont font;
466 QFontMetrics fm (font);
467 fm.horizontalAdvance ('x');
468 fm.horizontalAdvance (QString ("string"));
469 ]])],
470 octave_cv_func_qfontmetrics_horizontal_advance=yes,
471 octave_cv_func_qfontmetrics_horizontal_advance=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_qfontmetrics_horizontal_advance = yes; then
477 AC_DEFINE(HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE, 1,
478 [Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.])
369 fi 479 fi
370 ]) 480 ])
371 dnl 481 dnl
372 dnl Check whether the Qt QGuiApplication class has the setDesktopFileName 482 dnl Check whether the Qt QGuiApplication class has the setDesktopFileName
373 dnl static member function. This function was introduced in Qt 5.7. 483 dnl static member function. This function was introduced in Qt 5.7.
394 AC_LANG_POP(C++) 504 AC_LANG_POP(C++)
395 ]) 505 ])
396 if test $octave_cv_func_qguiapplication_setdesktopfilename = yes; then 506 if test $octave_cv_func_qguiapplication_setdesktopfilename = yes; then
397 AC_DEFINE(HAVE_QGUIAPPLICATION_SETDESKTOPFILENAME, 1, 507 AC_DEFINE(HAVE_QGUIAPPLICATION_SETDESKTOPFILENAME, 1,
398 [Define to 1 if you have the `QGuiApplication::setDesktopFileName' member function.]) 508 [Define to 1 if you have the `QGuiApplication::setDesktopFileName' member function.])
399 fi
400 ])
401 dnl
402 dnl Check whether the Qt QHelpSearchQueryWidget class has the searchInput
403 dnl member function. This function was introduced in Qt 5.9.
404 dnl
405 dnl FIXME: Delete this entirely when we drop support for Qt 5.8 or older.
406 dnl
407 AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT], [
408 AC_CACHE_CHECK([for QHelpSearchQueryWidget::searchInput],
409 [octave_cv_func_qhelpsearchquerywidget_searchinput],
410 [AC_LANG_PUSH(C++)
411 ac_octave_save_CPPFLAGS="$CPPFLAGS"
412 ac_octave_save_CXXFLAGS="$CXXFLAGS"
413 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
414 CXXFLAGS="$CXXPICFLAG $CPPFLAGS"
415 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
416 #include <QHelpSearchQueryWidget>
417 #include <QString>
418 ]], [[
419 QHelpSearchQueryWidget *query_widget = new QHelpSearchQueryWidget ();
420 QString search_input = query_widget->searchInput ();
421 ]])],
422 octave_cv_func_qhelpsearchquerywidget_searchinput=yes,
423 octave_cv_func_qhelpsearchquerywidget_searchinput=no)
424 CPPFLAGS="$ac_octave_save_CPPFLAGS"
425 CXXFLAGS="$ac_octave_save_CXXFLAGS"
426 AC_LANG_POP(C++)
427 ])
428 if test $octave_cv_func_qhelpsearchquerywidget_searchinput = yes; then
429 AC_DEFINE(HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT, 1,
430 [Define to 1 if you have the `QHelpSearchQueryWidget::searchInput' member function.])
431 fi
432 ])
433 dnl
434 dnl Check whether new API is used with QHelpIndexWidget.
435 dnl Under new API, QHelpIndexWidget emits documentActivates.
436 dnl Under old API, QHelpIndexWidget emits linkActivated.
437 dnl New structure/signal API was introduced in Qt 5.15.
438 dnl
439 dnl FIXME: Delete this entirely when we drop support for Qt 5.14 or older.
440 dnl
441 AC_DEFUN([OCTAVE_CHECK_NEW_QHELPINDEXWIDGET_API], [
442 AC_CACHE_CHECK([for new QHelpIndexWidget API],
443 [octave_cv_new_qhelpindexwidget_api],
444 [AC_LANG_PUSH(C++)
445 ac_octave_save_CPPFLAGS="$CPPFLAGS"
446 ac_octave_save_CXXFLAGS="$CXXFLAGS"
447 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
448 CXXFLAGS="$CXXPICFLAG $CPPFLAGS"
449 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
450 #include <QHelpLink>
451 ]], [[
452 QHelpLink link;
453 ]])],
454 octave_cv_new_qhelpindexwidget_api=yes,
455 octave_cv_new_qhelpindexwidget_api=no)
456 CPPFLAGS="$ac_octave_save_CPPFLAGS"
457 CXXFLAGS="$ac_octave_save_CXXFLAGS"
458 AC_LANG_POP(C++)
459 ])
460 if test $octave_cv_new_qhelpindexwidget_api = yes; then
461 AC_DEFINE(HAVE_NEW_QHELPINDEXWIDGET_API, 1,
462 [Define to 1 if using new QHelpIndexWidget API.])
463 fi
464 ])
465 dnl
466 dnl Check whether the Qt class QMainWindow has the resizeDocks member function.
467 dnl This member function was introduced in Qt 5.6.
468 dnl
469 dnl FIXME: remove this test when we drop support for Qt older than 5.6
470 dnl
471 AC_DEFUN([OCTAVE_CHECK_FUNC_QMAINWINDOW_RESIZEDOCKS], [
472 AC_CACHE_CHECK([for QMainWindow::resizeDocks in <QMainWindow>],
473 [octave_cv_func_mainwindow_resizedocks],
474 [AC_LANG_PUSH(C++)
475 ac_octave_save_CPPFLAGS="$CPPFLAGS"
476 ac_octave_save_CXXFLAGS="$CXXFLAGS"
477 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
478 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
480 #include <QMainWindow>
481 #include <QDockWidget>
482 ]], [[
483 QMainWindow *mw = new QMainWindow ();
484 QDockWidget *dw = new QDockWidget (mw);
485 mw->addDockWidget (Qt::LeftDockWidgetArea, dw);
486 mw->resizeDocks ({dw},{20},Qt::Horizontal);
487 ]])],
488 octave_cv_func_mainwindow_resizedocks=yes,
489 octave_cv_func_mainwindow_resizedocks=no)
490 CPPFLAGS="$ac_octave_save_CPPFLAGS"
491 CXXFLAGS="$ac_octave_save_CXXFLAGS"
492 AC_LANG_POP(C++)
493 ])
494 if test $octave_cv_func_mainwindow_resizedocks = yes; then
495 AC_DEFINE(HAVE_QMAINWINDOW_RESIZEDOCKS, 1,
496 [Define to 1 if you have the 'QMainWindow::resizeDocks' member function.])
497 fi
498 ])
499 dnl
500 dnl Check whether the Qt class QScreen has the devicePixelRatio member function.
501 dnl This member function was introduced in Qt 5.5.
502 dnl
503 AC_DEFUN([OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO], [
504 AC_CACHE_CHECK([for QScreen::devicePixelRatio in <QScreen>],
505 [octave_cv_func_qscreen_devicepixelratio],
506 [AC_LANG_PUSH(C++)
507 ac_octave_save_CPPFLAGS="$CPPFLAGS"
508 ac_octave_save_CXXFLAGS="$CXXFLAGS"
509 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
510 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
511 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
512 #include <QApplication>
513 #include <QScreen>
514 ]], [[
515 QScreen *screen = QApplication::primaryScreen ();
516 qreal ratio = screen->devicePixelRatio ();
517 ]])],
518 octave_cv_func_qscreen_devicepixelratio=yes,
519 octave_cv_func_qscreen_devicepixelratio=no)
520 CPPFLAGS="$ac_octave_save_CPPFLAGS"
521 CXXFLAGS="$ac_octave_save_CXXFLAGS"
522 AC_LANG_POP(C++)
523 ])
524 if test $octave_cv_func_qscreen_devicepixelratio = yes; then
525 AC_DEFINE(HAVE_QSCREEN_DEVICEPIXELRATIO, 1,
526 [Define to 1 if you have the `QScreen::devicePixelRatio' member function.])
527 fi 509 fi
528 ]) 510 ])
529 dnl 511 dnl
530 dnl Check whether the Qt class QHelpEngine has the documentsForIdentifier 512 dnl Check whether the Qt class QHelpEngine has the documentsForIdentifier
531 dnl function. dnl This member function was introduced in Qt 5.15. 513 dnl function. dnl This member function was introduced in Qt 5.15.
560 AC_DEFINE(HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER, 1, 542 AC_DEFINE(HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER, 1,
561 [Define to 1 if you have the `QHelpEngine::documentsForIdentifier' member function.]) 543 [Define to 1 if you have the `QHelpEngine::documentsForIdentifier' member function.])
562 fi 544 fi
563 ]) 545 ])
564 dnl 546 dnl
547 dnl Check whether the Qt QHelpSearchQueryWidget class has the searchInput
548 dnl member function. This function was introduced in Qt 5.9.
549 dnl
550 dnl FIXME: Delete this entirely when we drop support for Qt 5.8 or older.
551 dnl
552 AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT], [
553 AC_CACHE_CHECK([for QHelpSearchQueryWidget::searchInput],
554 [octave_cv_func_qhelpsearchquerywidget_searchinput],
555 [AC_LANG_PUSH(C++)
556 ac_octave_save_CPPFLAGS="$CPPFLAGS"
557 ac_octave_save_CXXFLAGS="$CXXFLAGS"
558 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
559 CXXFLAGS="$CXXPICFLAG $CPPFLAGS"
560 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
561 #include <QHelpSearchQueryWidget>
562 #include <QString>
563 ]], [[
564 QHelpSearchQueryWidget *query_widget = new QHelpSearchQueryWidget ();
565 QString search_input = query_widget->searchInput ();
566 ]])],
567 octave_cv_func_qhelpsearchquerywidget_searchinput=yes,
568 octave_cv_func_qhelpsearchquerywidget_searchinput=no)
569 CPPFLAGS="$ac_octave_save_CPPFLAGS"
570 CXXFLAGS="$ac_octave_save_CXXFLAGS"
571 AC_LANG_POP(C++)
572 ])
573 if test $octave_cv_func_qhelpsearchquerywidget_searchinput = yes; then
574 AC_DEFINE(HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT, 1,
575 [Define to 1 if you have the `QHelpSearchQueryWidget::searchInput' member function.])
576 fi
577 ])
578 dnl
579 dnl Check whether the Qt class QList has a constructor that accepts
580 dnl a pair of iterators. This constructor was introduced in Qt 5.14.
581 dnl
582 AC_DEFUN([OCTAVE_CHECK_FUNC_QLIST_ITERATOR_CONSTRUCTOR], [
583 AC_CACHE_CHECK([for QList<T>::QList (iterator, iterator) constructor],
584 [octave_cv_func_qlist_iterator_constructor],
585 [AC_LANG_PUSH(C++)
586 ac_octave_save_CPPFLAGS="$CPPFLAGS"
587 ac_octave_save_CXXFLAGS="$CXXFLAGS"
588 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
589 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
591 #include <QList>
592 ]], [[
593 QList<int> lst_one;
594 QList<int> lst_two (lst_one.begin (), lst_one.end ());
595 ]])],
596 octave_cv_func_qlist_iterator_constructor=yes,
597 octave_cv_func_qlist_iterator_constructor=no)
598 CPPFLAGS="$ac_octave_save_CPPFLAGS"
599 CXXFLAGS="$ac_octave_save_CXXFLAGS"
600 AC_LANG_POP(C++)
601 ])
602 if test $octave_cv_func_qlist_iterator_constructor = yes; then
603 AC_DEFINE(HAVE_QLIST_ITERATOR_CONSTRUCTOR, 1,
604 [Define to 1 if you have the `QList<T>::QList (iterator, iterator)' constructor.])
605 fi
606 ])
607 dnl
608 dnl Check whether the Qt class QMainWindow has the resizeDocks member function.
609 dnl This member function was introduced in Qt 5.6.
610 dnl
611 dnl FIXME: remove this test when we drop support for Qt older than 5.6
612 dnl
613 AC_DEFUN([OCTAVE_CHECK_FUNC_QMAINWINDOW_RESIZEDOCKS], [
614 AC_CACHE_CHECK([for QMainWindow::resizeDocks in <QMainWindow>],
615 [octave_cv_func_mainwindow_resizedocks],
616 [AC_LANG_PUSH(C++)
617 ac_octave_save_CPPFLAGS="$CPPFLAGS"
618 ac_octave_save_CXXFLAGS="$CXXFLAGS"
619 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
620 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
621 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
622 #include <QMainWindow>
623 #include <QDockWidget>
624 ]], [[
625 QMainWindow *mw = new QMainWindow ();
626 QDockWidget *dw = new QDockWidget (mw);
627 mw->addDockWidget (Qt::LeftDockWidgetArea, dw);
628 mw->resizeDocks ({dw},{20},Qt::Horizontal);
629 ]])],
630 octave_cv_func_mainwindow_resizedocks=yes,
631 octave_cv_func_mainwindow_resizedocks=no)
632 CPPFLAGS="$ac_octave_save_CPPFLAGS"
633 CXXFLAGS="$ac_octave_save_CXXFLAGS"
634 AC_LANG_POP(C++)
635 ])
636 if test $octave_cv_func_mainwindow_resizedocks = yes; then
637 AC_DEFINE(HAVE_QMAINWINDOW_RESIZEDOCKS, 1,
638 [Define to 1 if you have the 'QMainWindow::resizeDocks' member function.])
639 fi
640 ])
641 dnl
642 dnl Check whether the Qt class QScreen has the devicePixelRatio member function.
643 dnl This member function was introduced in Qt 5.5.
644 dnl
645 AC_DEFUN([OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO], [
646 AC_CACHE_CHECK([for QScreen::devicePixelRatio in <QScreen>],
647 [octave_cv_func_qscreen_devicepixelratio],
648 [AC_LANG_PUSH(C++)
649 ac_octave_save_CPPFLAGS="$CPPFLAGS"
650 ac_octave_save_CXXFLAGS="$CXXFLAGS"
651 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
652 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
653 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
654 #include <QApplication>
655 #include <QScreen>
656 ]], [[
657 QScreen *screen = QApplication::primaryScreen ();
658 qreal ratio = screen->devicePixelRatio ();
659 ]])],
660 octave_cv_func_qscreen_devicepixelratio=yes,
661 octave_cv_func_qscreen_devicepixelratio=no)
662 CPPFLAGS="$ac_octave_save_CPPFLAGS"
663 CXXFLAGS="$ac_octave_save_CXXFLAGS"
664 AC_LANG_POP(C++)
665 ])
666 if test $octave_cv_func_qscreen_devicepixelratio = yes; then
667 AC_DEFINE(HAVE_QSCREEN_DEVICEPIXELRATIO, 1,
668 [Define to 1 if you have the `QScreen::devicePixelRatio' member function.])
669 fi
670 ])
671 dnl
565 dnl Check whether the Qt class QWheelEvent has the angleDelta member function. 672 dnl Check whether the Qt class QWheelEvent has the angleDelta member function.
566 dnl This member function was introduced in Qt 5. 673 dnl This member function was introduced in Qt 5.
567 dnl 674 dnl
568 dnl FIXME: Delete this entirely when we drop support for Qt 4. 675 dnl FIXME: Delete this entirely when we drop support for Qt 4.
569 dnl 676 dnl
619 AC_LANG_POP(C++) 726 AC_LANG_POP(C++)
620 ]) 727 ])
621 if test $octave_cv_func_qwheelevent_position = yes; then 728 if test $octave_cv_func_qwheelevent_position = yes; then
622 AC_DEFINE(HAVE_QWHEELEVENT_POSITION, 1, 729 AC_DEFINE(HAVE_QWHEELEVENT_POSITION, 1,
623 [Define to 1 if you have the `QWheelEvent::position' member function.]) 730 [Define to 1 if you have the `QWheelEvent::position' member function.])
624 fi
625 ])
626 dnl
627 dnl Check whether the Qt class QList has a constructor that accepts
628 dnl a pair of iterators. This constructor was introduced in Qt 5.14.
629 dnl
630 AC_DEFUN([OCTAVE_CHECK_FUNC_QLIST_ITERATOR_CONSTRUCTOR], [
631 AC_CACHE_CHECK([for QList<T>::QList (iterator, iterator) constructor],
632 [octave_cv_func_qlist_iterator_constructor],
633 [AC_LANG_PUSH(C++)
634 ac_octave_save_CPPFLAGS="$CPPFLAGS"
635 ac_octave_save_CXXFLAGS="$CXXFLAGS"
636 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
637 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
638 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
639 #include <QList>
640 ]], [[
641 QList<int> lst_one;
642 QList<int> lst_two (lst_one.begin (), lst_one.end ());
643 ]])],
644 octave_cv_func_qlist_iterator_constructor=yes,
645 octave_cv_func_qlist_iterator_constructor=no)
646 CPPFLAGS="$ac_octave_save_CPPFLAGS"
647 CXXFLAGS="$ac_octave_save_CXXFLAGS"
648 AC_LANG_POP(C++)
649 ])
650 if test $octave_cv_func_qlist_iterator_constructor = yes; then
651 AC_DEFINE(HAVE_QLIST_ITERATOR_CONSTRUCTOR, 1,
652 [Define to 1 if you have the `QList<T>::QList (iterator, iterator)' constructor.])
653 fi
654 ])
655 dnl
656 dnl Check whether the Qt class QList has a constructor that accepts
657 dnl a pair of iterators. This constructor was introduced in Qt 5.14.
658 dnl
659 AC_DEFUN([OCTAVE_CHECK_FUNC_QFONTMETRICS_HORIZONTAL_ADVANCE], [
660 AC_CACHE_CHECK([for QFontMetrics::horizontalAdvance function],
661 [octave_cv_func_qfontmetrics_horizontal_advance],
662 [AC_LANG_PUSH(C++)
663 ac_octave_save_CPPFLAGS="$CPPFLAGS"
664 ac_octave_save_CXXFLAGS="$CXXFLAGS"
665 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
666 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
667 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
668 #include <QFont>
669 #include <QFontMetrics>
670 #include <QString>
671 ]], [[
672 QFont font;
673 QFontMetrics fm (font);
674 fm.horizontalAdvance ('x');
675 fm.horizontalAdvance (QString ("string"));
676 ]])],
677 octave_cv_func_qfontmetrics_horizontal_advance=yes,
678 octave_cv_func_qfontmetrics_horizontal_advance=no)
679 CPPFLAGS="$ac_octave_save_CPPFLAGS"
680 CXXFLAGS="$ac_octave_save_CXXFLAGS"
681 AC_LANG_POP(C++)
682 ])
683 if test $octave_cv_func_qfontmetrics_horizontal_advance = yes; then
684 AC_DEFINE(HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE, 1,
685 [Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.])
686 fi
687 ])
688 dnl
689 dnl Check whether the Qt class QRegion has the iterators and related
690 dnl functions introduced in Qt 5.8.
691 dnl
692 AC_DEFUN([OCTAVE_CHECK_QREGION_ITERATORS], [
693 AC_CACHE_CHECK([for QRegion iterators and related functions],
694 [octave_cv_qregion_iterators],
695 [AC_LANG_PUSH(C++)
696 ac_octave_save_CPPFLAGS="$CPPFLAGS"
697 ac_octave_save_CXXFLAGS="$CXXFLAGS"
698 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
699 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
700 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
701 #include <QRegion>
702 ]], [[
703 QRegion region;
704 QRegion::const_iterator it;
705 it = region.begin ();
706 it = region.end ();
707 it = region.cbegin ();
708 it = region.cend ();
709 QRegion::const_reverse_iterator rit;
710 rit = region.rbegin ();
711 rit = region.rend ();
712 rit = region.crbegin ();
713 rit = region.crend ();
714 ]])],
715 octave_cv_qregion_iterators=yes,
716 octave_cv_qregion_iterators=no)
717 CPPFLAGS="$ac_octave_save_CPPFLAGS"
718 CXXFLAGS="$ac_octave_save_CXXFLAGS"
719 AC_LANG_POP(C++)
720 ])
721 if test $octave_cv_qregion_iterators = yes; then
722 AC_DEFINE(HAVE_QREGION_ITERATORS, 1,
723 [Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.])
724 fi
725 ])
726 dnl
727 dnl Check whether the Qt::SplitBehavior enum exists and has
728 dnl Qt::KeepEmptyParts and Qt::SkipEmptyParts members. This enum
729 dnl was introduced or modified in Qt 5.14.
730 dnl
731 AC_DEFUN([OCTAVE_CHECK_QT_SPLITBEHAVIOR_ENUM], [
732 AC_CACHE_CHECK([for Qt::SplitBehavior enum],
733 [octave_cv_qt_splitbehavior_enum],
734 [AC_LANG_PUSH(C++)
735 ac_octave_save_CPPFLAGS="$CPPFLAGS"
736 ac_octave_save_CXXFLAGS="$CXXFLAGS"
737 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
738 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
739 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
740 #include <Qt>
741 ]], [[
742 Qt::SplitBehavior sb_keep = Qt::KeepEmptyParts;
743 Qt::SplitBehavior sb_skip = Qt::SkipEmptyParts;
744 ]])],
745 octave_cv_qt_splitbehavior_enum=yes,
746 octave_cv_qt_splitbehavior_enum=no)
747 CPPFLAGS="$ac_octave_save_CPPFLAGS"
748 CXXFLAGS="$ac_octave_save_CXXFLAGS"
749 AC_LANG_POP(C++)
750 ])
751 if test $octave_cv_qt_splitbehavior_enum = yes; then
752 AC_DEFINE(HAVE_QT_SPLITBEHAVIOR_ENUM, 1,
753 [Define to 1 if you have the `Qt::SplitBehavior' enum.])
754 fi 731 fi
755 ]) 732 ])
756 dnl 733 dnl
757 dnl Check whether HDF5 library has version 1.6 API functions. 734 dnl Check whether HDF5 library has version 1.6 API functions.
758 dnl 735 dnl
1389 if test -n "$OPENGL_LIBS"; then 1366 if test -n "$OPENGL_LIBS"; then
1390 AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.]) 1367 AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.])
1391 fi 1368 fi
1392 ]) 1369 ])
1393 dnl 1370 dnl
1371 dnl Check whether PCRE is compiled with --enable-utf.
1372 dnl
1373 AC_DEFUN([OCTAVE_CHECK_LIB_PCRE_OK], [
1374 AC_CACHE_CHECK([whether PCRE library was compiled with UTF support],
1375 [octave_cv_lib_pcre_ok],
1376 [AC_LANG_PUSH(C++)
1377 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1378 #include <stdio.h>
1379 #if defined (HAVE_PCRE_H)
1380 # include <pcre.h>
1381 #elif defined (HAVE_PCRE_PCRE_H)
1382 # include <pcre/pcre.h>
1383 #endif
1384 ]], [[
1385 const char *pattern = "test";
1386 const char *err;
1387 int erroffset;
1388 pcre *data = pcre_compile (pattern, PCRE_UTF8, &err, &erroffset, nullptr);
1389 return (! data);
1390 ]])],
1391 octave_cv_lib_pcre_ok=yes,
1392 octave_cv_lib_pcre_ok=no,
1393 octave_cv_lib_pcre_ok=yes)
1394 AC_LANG_POP(C++)
1395 ])
1396 if test $octave_cv_lib_pcre_ok = yes; then
1397 $1
1398 :
1399 else
1400 $2
1401 :
1402 fi
1403 ])
1404 dnl
1394 dnl Check whether Qhull works (does not crash). 1405 dnl Check whether Qhull works (does not crash).
1395 dnl 1406 dnl
1396 AC_DEFUN([OCTAVE_CHECK_LIB_QHULL_OK], [ 1407 AC_DEFUN([OCTAVE_CHECK_LIB_QHULL_OK], [
1397 AC_CACHE_CHECK([whether the qhull library works], 1408 AC_CACHE_CHECK([whether the qhull library works],
1398 [octave_cv_lib_qhull_ok], 1409 [octave_cv_lib_qhull_ok],
1446 $2 1457 $2
1447 : 1458 :
1448 fi 1459 fi
1449 ]) 1460 ])
1450 dnl 1461 dnl
1451 dnl Check whether PCRE is compiled with --enable-utf.
1452 dnl
1453 AC_DEFUN([OCTAVE_CHECK_LIB_PCRE_OK], [
1454 AC_CACHE_CHECK([whether PCRE library was compiled with UTF support],
1455 [octave_cv_lib_pcre_ok],
1456 [AC_LANG_PUSH(C++)
1457 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1458 #include <stdio.h>
1459 #if defined (HAVE_PCRE_H)
1460 # include <pcre.h>
1461 #elif defined (HAVE_PCRE_PCRE_H)
1462 # include <pcre/pcre.h>
1463 #endif
1464 ]], [[
1465 const char *pattern = "test";
1466 const char *err;
1467 int erroffset;
1468 pcre *data = pcre_compile (pattern, PCRE_UTF8, &err, &erroffset, nullptr);
1469 return (! data);
1470 ]])],
1471 octave_cv_lib_pcre_ok=yes,
1472 octave_cv_lib_pcre_ok=no,
1473 octave_cv_lib_pcre_ok=yes)
1474 AC_LANG_POP(C++)
1475 ])
1476 if test $octave_cv_lib_pcre_ok = yes; then
1477 $1
1478 :
1479 else
1480 $2
1481 :
1482 fi
1483 ])
1484 dnl
1485 dnl Check whether sndfile library is modern enough to include things like Ogg 1462 dnl Check whether sndfile library is modern enough to include things like Ogg
1486 dnl 1463 dnl
1487 AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [ 1464 AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [
1488 AC_CACHE_CHECK([whether sndfile library is modern enough], 1465 AC_CACHE_CHECK([whether sndfile library is modern enough],
1489 [octave_cv_lib_sndfile_ok], 1466 [octave_cv_lib_sndfile_ok],
1531 dnl octave_cv_lib_found_termlib=yes 1508 dnl octave_cv_lib_found_termlib=yes
1532 dnl break]) 1509 dnl break])
1533 dnl done 1510 dnl done
1534 1511
1535 AC_SUBST(TERM_LIBS) 1512 AC_SUBST(TERM_LIBS)
1513 ])
1514 dnl
1515 dnl Check whether new API is used with QHelpIndexWidget.
1516 dnl Under new API, QHelpIndexWidget emits documentActivates.
1517 dnl Under old API, QHelpIndexWidget emits linkActivated.
1518 dnl New structure/signal API was introduced in Qt 5.15.
1519 dnl
1520 dnl FIXME: Delete this entirely when we drop support for Qt 5.14 or older.
1521 dnl
1522 AC_DEFUN([OCTAVE_CHECK_NEW_QHELPINDEXWIDGET_API], [
1523 AC_CACHE_CHECK([for new QHelpIndexWidget API],
1524 [octave_cv_new_qhelpindexwidget_api],
1525 [AC_LANG_PUSH(C++)
1526 ac_octave_save_CPPFLAGS="$CPPFLAGS"
1527 ac_octave_save_CXXFLAGS="$CXXFLAGS"
1528 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
1529 CXXFLAGS="$CXXPICFLAG $CPPFLAGS"
1530 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1531 #include <QHelpLink>
1532 ]], [[
1533 QHelpLink link;
1534 ]])],
1535 octave_cv_new_qhelpindexwidget_api=yes,
1536 octave_cv_new_qhelpindexwidget_api=no)
1537 CPPFLAGS="$ac_octave_save_CPPFLAGS"
1538 CXXFLAGS="$ac_octave_save_CXXFLAGS"
1539 AC_LANG_POP(C++)
1540 ])
1541 if test $octave_cv_new_qhelpindexwidget_api = yes; then
1542 AC_DEFINE(HAVE_NEW_QHELPINDEXWIDGET_API, 1,
1543 [Define to 1 if using new QHelpIndexWidget API.])
1544 fi
1536 ]) 1545 ])
1537 dnl 1546 dnl
1538 dnl Check for the Qhull version. 1547 dnl Check for the Qhull version.
1539 dnl 1548 dnl
1540 AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [ 1549 AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [
1575 octave_cv_lib_qhull_version=yes, octave_cv_lib_qhull_version=no) 1584 octave_cv_lib_qhull_version=yes, octave_cv_lib_qhull_version=no)
1576 ]) 1585 ])
1577 if test $octave_cv_lib_qhull_version = no; then 1586 if test $octave_cv_lib_qhull_version = no; then
1578 AC_DEFINE(NEED_QHULL_VERSION, 1, 1587 AC_DEFINE(NEED_QHULL_VERSION, 1,
1579 [Define to 1 if the Qhull library needs a qh_version variable defined.]) 1588 [Define to 1 if the Qhull library needs a qh_version variable defined.])
1589 fi
1590 ])
1591 dnl
1592 dnl Check whether the Qt class QRegion has the iterators and related
1593 dnl functions introduced in Qt 5.8.
1594 dnl
1595 AC_DEFUN([OCTAVE_CHECK_QREGION_ITERATORS], [
1596 AC_CACHE_CHECK([for QRegion iterators and related functions],
1597 [octave_cv_qregion_iterators],
1598 [AC_LANG_PUSH(C++)
1599 ac_octave_save_CPPFLAGS="$CPPFLAGS"
1600 ac_octave_save_CXXFLAGS="$CXXFLAGS"
1601 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
1602 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
1603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1604 #include <QRegion>
1605 ]], [[
1606 QRegion region;
1607 QRegion::const_iterator it;
1608 it = region.begin ();
1609 it = region.end ();
1610 it = region.cbegin ();
1611 it = region.cend ();
1612 QRegion::const_reverse_iterator rit;
1613 rit = region.rbegin ();
1614 rit = region.rend ();
1615 rit = region.crbegin ();
1616 rit = region.crend ();
1617 ]])],
1618 octave_cv_qregion_iterators=yes,
1619 octave_cv_qregion_iterators=no)
1620 CPPFLAGS="$ac_octave_save_CPPFLAGS"
1621 CXXFLAGS="$ac_octave_save_CXXFLAGS"
1622 AC_LANG_POP(C++)
1623 ])
1624 if test $octave_cv_qregion_iterators = yes; then
1625 AC_DEFINE(HAVE_QREGION_ITERATORS, 1,
1626 [Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.])
1580 fi 1627 fi
1581 ]) 1628 ])
1582 dnl 1629 dnl
1583 dnl Check whether we have QScintilla for the given Qt VERSION. 1630 dnl Check whether we have QScintilla for the given Qt VERSION.
1584 dnl 1631 dnl
1872 $2 1919 $2
1873 : 1920 :
1874 fi 1921 fi
1875 ]) 1922 ])
1876 dnl 1923 dnl
1924 dnl Check whether the Qt::SplitBehavior enum exists and has
1925 dnl Qt::KeepEmptyParts and Qt::SkipEmptyParts members. This enum
1926 dnl was introduced or modified in Qt 5.14.
1927 dnl
1928 AC_DEFUN([OCTAVE_CHECK_QT_SPLITBEHAVIOR_ENUM], [
1929 AC_CACHE_CHECK([for Qt::SplitBehavior enum],
1930 [octave_cv_qt_splitbehavior_enum],
1931 [AC_LANG_PUSH(C++)
1932 ac_octave_save_CPPFLAGS="$CPPFLAGS"
1933 ac_octave_save_CXXFLAGS="$CXXFLAGS"
1934 CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
1935 CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
1936 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1937 #include <Qt>
1938 ]], [[
1939 Qt::SplitBehavior sb_keep = Qt::KeepEmptyParts;
1940 Qt::SplitBehavior sb_skip = Qt::SkipEmptyParts;
1941 ]])],
1942 octave_cv_qt_splitbehavior_enum=yes,
1943 octave_cv_qt_splitbehavior_enum=no)
1944 CPPFLAGS="$ac_octave_save_CPPFLAGS"
1945 CXXFLAGS="$ac_octave_save_CXXFLAGS"
1946 AC_LANG_POP(C++)
1947 ])
1948 if test $octave_cv_qt_splitbehavior_enum = yes; then
1949 AC_DEFINE(HAVE_QT_SPLITBEHAVIOR_ENUM, 1,
1950 [Define to 1 if you have the `Qt::SplitBehavior' enum.])
1951 fi
1952 ])
1953 dnl
1877 dnl OCTAVE_CHECK_QT_TOOL(TOOL) 1954 dnl OCTAVE_CHECK_QT_TOOL(TOOL)
1878 dnl 1955 dnl
1879 AC_DEFUN([OCTAVE_CHECK_QT_TOOL], [ 1956 AC_DEFUN([OCTAVE_CHECK_QT_TOOL], [
1880 AC_CHECK_TOOLS(m4_toupper([$1])_QTVER, [$1-qt$qt_version]) 1957 AC_CHECK_TOOLS(m4_toupper([$1])_QTVER, [$1-qt$qt_version])
1881 if test -z "$m4_toupper([$1])_QTVER"; then 1958 if test -z "$m4_toupper([$1])_QTVER"; then
2181 octave_cv_sundials_realtype_is_double=yes, 2258 octave_cv_sundials_realtype_is_double=yes,
2182 octave_cv_sundials_realtype_is_double=no) 2259 octave_cv_sundials_realtype_is_double=no)
2183 ]) 2260 ])
2184 if test $octave_cv_sundials_realtype_is_double = no; then 2261 if test $octave_cv_sundials_realtype_is_double = no; then
2185 warn_sundials_disabled="SUNDIALS IDA library not configured with double precision realtype. The solvers ode15i and ode15s will be disabled." 2262 warn_sundials_disabled="SUNDIALS IDA library not configured with double precision realtype. The solvers ode15i and ode15s will be disabled."
2263 OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled])
2264 fi
2265 ])
2266 dnl
2267 dnl Check whether SUNDIALS IDA library has the SUNLINSOL_DENSE linear solver.
2268 dnl
2269 AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_DENSE], [
2270 AC_CHECK_HEADERS([sunlinsol/sunlinsol_dense.h],
2271 octave_cv_sundials_sunlinsol_dense=yes,
2272 octave_cv_sundials_sunlinsol_dense=no)
2273 ])
2274 if test $octave_cv_sundials_sunlinsol_dense = yes; then
2275 AC_DEFINE(HAVE_SUNDIALS_SUNLINSOL_DENSE, 1,
2276 [Define to 1 if SUNDIALS IDA includes the SUNLINSOL_DENSE linear solver.])
2277 else
2278 warn_sundials_disabled="SUNDIALS IDA library does not include the SUNLINSOL_DENSE linear solver. The solvers ode15i and ode15s will be disabled."
2186 OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled]) 2279 OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled])
2187 fi 2280 fi
2188 ]) 2281 ])
2189 dnl 2282 dnl
2190 dnl Check whether SUNDIALS IDA library is configured with SUNLINSOL_KLU 2283 dnl Check whether SUNDIALS IDA library is configured with SUNLINSOL_KLU
2246 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." 2339 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."
2247 OCTAVE_CONFIGURE_WARNING([warn_sundials_sunlinsol_klu]) 2340 OCTAVE_CONFIGURE_WARNING([warn_sundials_sunlinsol_klu])
2248 fi 2341 fi
2249 ]) 2342 ])
2250 dnl 2343 dnl
2251 dnl Check whether SUNDIALS IDA library has the SUNLINSOL_DENSE linear solver. 2344 dnl Like AC_CONFIG_FILES, but don't touch the output file if it already
2252 dnl 2345 dnl exists and hasn't changed.
2253 AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_DENSE], [ 2346 dnl
2254 AC_CHECK_HEADERS([sunlinsol/sunlinsol_dense.h], 2347 AC_DEFUN([OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES], [
2255 octave_cv_sundials_sunlinsol_dense=yes, 2348 m4_foreach_w([elt], [$1], [
2256 octave_cv_sundials_sunlinsol_dense=no) 2349 AC_CONFIG_FILES(elt[-tmp:]patsubst(elt, [.sh$], [.in.sh]))
2257 ]) 2350 AC_CONFIG_COMMANDS(elt,
2258 if test $octave_cv_sundials_sunlinsol_dense = yes; then 2351 [$SHELL $srcdir/build-aux/move-if-change ]elt[-tmp ]elt)])])
2259 AC_DEFINE(HAVE_SUNDIALS_SUNLINSOL_DENSE, 1,
2260 [Define to 1 if SUNDIALS IDA includes the SUNLINSOL_DENSE linear solver.])
2261 else
2262 warn_sundials_disabled="SUNDIALS IDA library does not include the SUNLINSOL_DENSE linear solver. The solvers ode15i and ode15s will be disabled."
2263 OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled])
2264 fi
2265 ])
2266 dnl 2352 dnl
2267 dnl Add warning to final summary. 2353 dnl Add warning to final summary.
2268 dnl 2354 dnl
2269 AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [ 2355 AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [
2270 AC_MSG_WARN([$][$1]) 2356 AC_MSG_WARN([$][$1])
2278 if test -n "[$]elt"; then 2364 if test -n "[$]elt"; then
2279 AC_MSG_WARN([$]elt) 2365 AC_MSG_WARN([$]elt)
2280 warn_msg_printed=true 2366 warn_msg_printed=true
2281 fi]) 2367 fi])
2282 ]) 2368 ])
2283 dnl
2284 dnl Like AC_CONFIG_FILES, but don't touch the output file if it already
2285 dnl exists and hasn't changed.
2286 dnl
2287 AC_DEFUN([OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES], [
2288 m4_foreach_w([elt], [$1], [
2289 AC_CONFIG_FILES(elt[-tmp:]patsubst(elt, [.sh$], [.in.sh]))
2290 AC_CONFIG_COMMANDS(elt,
2291 [$SHELL $srcdir/build-aux/move-if-change ]elt[-tmp ]elt)])])
2292 dnl 2369 dnl
2293 dnl Check if the C++ library has the bit_and, bit_or, and bit_xor 2370 dnl Check if the C++ library has the bit_and, bit_or, and bit_xor
2294 dnl templates defined. 2371 dnl templates defined.
2295 dnl 2372 dnl
2296 AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], [ 2373 AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], [
2409 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) 2486 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2])
2410 else 2487 else
2411 AC_MSG_RESULT([no]) 2488 AC_MSG_RESULT([no])
2412 ifelse([$3], , , [$3]) 2489 ifelse([$3], , , [$3])
2413 fi 2490 fi
2414 ])
2415 dnl
2416 dnl Allow the user disable support for command line editing using GNU
2417 dnl readline.
2418 dnl
2419 AC_DEFUN([OCTAVE_ENABLE_READLINE], [
2420 USE_READLINE=yes
2421 READLINE_LIBS=
2422 AC_ARG_ENABLE([readline],
2423 [AS_HELP_STRING([--disable-readline],
2424 [do not use readline library])],
2425 [if test "$enableval" = no; then
2426 USE_READLINE=no
2427 warn_readline="command editing and history features require GNU Readline"
2428 fi])
2429 if test $USE_READLINE = yes; then
2430 dnl RHEL 5 and older systems require termlib set before enabling readline
2431 AC_REQUIRE([OCTAVE_CHECK_LIB_TERMLIB])
2432 ac_octave_save_LIBS="$LIBS"
2433 LIBS="$TERM_LIBS"
2434 AC_CHECK_LIB([readline], [rl_set_keyboard_input_timeout],
2435 [READLINE_LIBS="-lreadline"
2436 AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.])
2437 ],
2438 [AC_MSG_WARN([I need GNU Readline 4.2 or later])
2439 AC_MSG_ERROR([this is fatal unless you specify --disable-readline])
2440 ])
2441 LIBS="$ac_octave_save_LIBS"
2442 fi
2443 AC_SUBST(READLINE_LIBS)
2444 ])
2445 dnl
2446 dnl Check if Fortran compiler handles FLAG command line option. If
2447 dnl two arguments are specified, execute the second arg as shell
2448 dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts
2449 dnl the flag.
2450 dnl
2451 AC_DEFUN([OCTAVE_F77_FLAG], [
2452 ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
2453 AC_MSG_CHECKING([whether ${F77-g77} accepts $1])
2454 AC_CACHE_VAL([octave_cv_f77_flag_$ac_safe], [
2455 AC_LANG_PUSH(Fortran 77)
2456 ac_octave_save_FFLAGS="$FFLAGS"
2457 FFLAGS="$FFLAGS $1"
2458 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
2459 eval "octave_cv_f77_flag_$ac_safe=yes",
2460 eval "octave_cv_f77_flag_$ac_safe=no")
2461 FFLAGS="$ac_octave_save_FFLAGS"
2462 AC_LANG_POP(Fortran 77)
2463 ])
2464 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then
2465 AC_MSG_RESULT([yes])
2466 ifelse([$2], ,
2467 [FFLAGS="$FFLAGS $1"
2468 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2])
2469 else
2470 AC_MSG_RESULT([no])
2471 ifelse([$3], , , [$3])
2472 fi
2473 ])
2474 dnl
2475 dnl Check to see if the compiler and the linker can handle the flags
2476 dnl "-framework $1" for the given prologue $2 and the given body $3 of
2477 dnl a source file. Arguments 2 and 3 optionally can also be empty.
2478 dnl Add options (lower case letters $1) "--with-framework-$1" and
2479 dnl "--without-framework-$1". If this test is successful then perform
2480 dnl $4, otherwise do $5.
2481 dnl
2482 AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [
2483 AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1])
2484 AC_CACHE_VAL([octave_cv_framework_$1],
2485 [ac_octave_save_LDFLAGS="$LDFLAGS"
2486 LDFLAGS="$LDFLAGS -framework $1"
2487 AC_LANG_PUSH(C++)
2488 AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
2489 eval "octave_cv_framework_$1=yes",
2490 eval "octave_cv_framework_$1=no")
2491 AC_LANG_POP(C++)
2492 LDFLAGS="$ac_octave_save_LDFLAGS"
2493 ])
2494 if test "$octave_cv_framework_$1" = yes; then
2495 AC_MSG_RESULT([yes])
2496 AC_ARG_WITH(framework-m4_tolower($1),
2497 [AS_HELP_STRING([--without-framework-m4_tolower($1)],
2498 [don't use framework $1])],
2499 with_have_framework=$withval, with_have_framework=yes)
2500 if test "$with_have_framework" = yes; then
2501 [$4]
2502 :
2503 else
2504 AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)])
2505 [$5]
2506 fi
2507 else
2508 AC_MSG_RESULT([no])
2509 [$5]
2510 fi
2511 ])
2512 dnl
2513 dnl Check for IEEE 754 data format.
2514 dnl
2515 AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], [
2516 AC_MSG_CHECKING([for IEEE 754 data format])
2517 AC_CACHE_VAL([octave_cv_ieee754_data_format],
2518 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2519 int
2520 main (void)
2521 {
2522 typedef union { unsigned char c[8]; double d; } ieeebytes;
2523
2524 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43};
2525 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c};
2526
2527 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0;
2528 }
2529 ]])],
2530 octave_cv_ieee754_data_format=yes,
2531 octave_cv_ieee754_data_format=no,
2532 octave_cv_ieee754_data_format=yes)
2533 ])
2534 if test "$cross_compiling" = yes; then
2535 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation])
2536 else
2537 AC_MSG_RESULT([$octave_cv_ieee754_data_format])
2538 fi
2539 if test $octave_cv_ieee754_data_format = yes; then
2540 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1,
2541 [Define to 1 if your system uses IEEE 754 data format.])
2542 else
2543 ## If the format is unknown, then you will probably not have a
2544 ## useful system, so we will abort here. Anyone wishing to
2545 ## experiment with building Octave on a system without IEEE
2546 ## floating point should be capable of removing this check and
2547 ## the one in the octave_ieee_init function in liboctave/lo-ieee.cc.
2548 AC_MSG_ERROR([IEEE 754 data format required for building Octave])
2549 fi
2550 ])
2551 dnl
2552 dnl Check for CallInst::addAttribute API
2553 dnl
2554 AC_DEFUN([OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API], [
2555 AC_CACHE_CHECK([if llvm::CallInst::addAttribute's arg type is llvm::Attributes],
2556 [octave_cv_callinst_addattribute_arg_is_attributes],
2557 [AC_LANG_PUSH(C++)
2558 AC_COMPILE_IFELSE(
2559 [AC_LANG_PROGRAM([[
2560 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2561 #include <llvm/IR/Instructions.h>
2562 #include <llvm/IR/Attributes.h>
2563 #else
2564 #include <llvm/Instructions.h>
2565 #include <llvm/Attributes.h>
2566 #endif
2567 ]], [[
2568 llvm::CallInst *callinst;
2569 llvm::AttrBuilder attr_builder;
2570 attr_builder.addAttribute(llvm::Attributes::StructRet);
2571 llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
2572 callinst->addAttribute (1, attrs);
2573 ]])],
2574 octave_cv_callinst_addattribute_arg_is_attributes=yes,
2575 octave_cv_callinst_addattribute_arg_is_attributes=no)
2576 AC_LANG_POP(C++)
2577 ])
2578 if test $octave_cv_callinst_addattribute_arg_is_attributes = yes; then
2579 AC_DEFINE(CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
2580 [Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes.])
2581 fi
2582 ])
2583 dnl
2584 dnl Check for Function::addAttribute API
2585 dnl
2586 AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API], [
2587 AC_CACHE_CHECK([if llvm::Function::addAttribute's arg type is llvm::Attributes],
2588 [octave_cv_function_addattribute_arg_is_attributes],
2589 [AC_LANG_PUSH(C++)
2590 AC_COMPILE_IFELSE(
2591 [AC_LANG_PROGRAM([[
2592 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2593 #include <llvm/IR/Function.h>
2594 #include <llvm/IR/Attributes.h>
2595 #include <llvm/IR/LLVMContext.h>
2596 #else
2597 #include <llvm/Function.h>
2598 #include <llvm/Attributes.h>
2599 #include <llvm/LLVMContext.h>
2600 #endif
2601 ]], [[
2602 llvm::Function *llvm_function;
2603 llvm::AttrBuilder attr_builder;
2604 attr_builder.addAttribute(llvm::Attributes::StructRet);
2605 llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
2606 llvm_function->addAttribute (1, attrs);
2607 ]])],
2608 octave_cv_function_addattribute_arg_is_attributes=yes,
2609 octave_cv_function_addattribute_arg_is_attributes=no)
2610 AC_LANG_POP(C++)
2611 ])
2612 if test $octave_cv_function_addattribute_arg_is_attributes = yes; then
2613 AC_DEFINE(FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
2614 [Define to 1 if llvm::Function:addAttribute arg type is llvm::Attributes.])
2615 fi
2616 ])
2617 dnl
2618 dnl Check for Function::addFnAttr API
2619 dnl
2620 AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDFNATTR_API], [
2621 AC_CACHE_CHECK([if llvm::Function::addFnAttr's arg type is llvm::Attributes],
2622 [octave_cv_function_addfnattr_arg_is_attributes],
2623 [AC_LANG_PUSH(C++)
2624 AC_COMPILE_IFELSE(
2625 [AC_LANG_PROGRAM([[
2626 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2627 #include <llvm/IR/Function.h>
2628 #include <llvm/IR/Attributes.h>
2629 #else
2630 #include <llvm/Function.h>
2631 #include <llvm/Attributes.h>
2632 #endif
2633 ]], [[
2634 llvm::Function *llvm_function;
2635 llvm_function->addFnAttr (llvm::Attributes::AlwaysInline);
2636 ]])],
2637 octave_cv_function_addfnattr_arg_is_attributes=yes,
2638 octave_cv_function_addfnattr_arg_is_attributes=no)
2639 AC_LANG_POP(C++)
2640 ])
2641 if test $octave_cv_function_addfnattr_arg_is_attributes = yes; then
2642 AC_DEFINE(FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES, 1,
2643 [Define to 1 if llvm::Function:addFnAttr arg type is llvm::Attributes.])
2644 fi
2645 ])
2646 dnl
2647 dnl Check for legacy::PassManager API
2648 dnl
2649 AC_DEFUN([OCTAVE_LLVM_LEGACY_PASSMANAGER_API], [
2650 AC_CACHE_CHECK([if llvm::legacy::PassManager exists],
2651 [octave_cv_legacy_passmanager],
2652 [AC_LANG_PUSH(C++)
2653 save_LIBS="$LIBS"
2654 LIBS="$LLVM_LIBS $LIBS"
2655 AC_LINK_IFELSE(
2656 [AC_LANG_PROGRAM([[
2657 #include <llvm/IR/LegacyPassManager.h>
2658 ]], [[
2659 llvm::Module *module;
2660 llvm::legacy::PassManager *module_pass_manager;
2661 llvm::legacy::FunctionPassManager *pass_manager;
2662 module_pass_manager = new llvm::legacy::PassManager ();
2663 pass_manager = new llvm::legacy::FunctionPassManager (module);
2664 ]])],
2665 octave_cv_legacy_passmanager=yes,
2666 octave_cv_legacy_passmanager=no)
2667 LIBS="$save_LIBS"
2668 AC_LANG_POP(C++)
2669 ])
2670 if test $octave_cv_legacy_passmanager = yes; then
2671 AC_DEFINE(LEGACY_PASSMANAGER, 1,
2672 [Define to 1 if LLVM::legacy::PassManager exists.])
2673 fi
2674 ])
2675 dnl
2676 dnl Check for raw_fd_ostream API
2677 dnl
2678 AC_DEFUN([OCTAVE_LLVM_RAW_FD_OSTREAM_API], [
2679 AC_CACHE_CHECK([if llvm::raw_fd_ostream's arg type is llvm::sys:fs],
2680 [octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs],
2681 [AC_LANG_PUSH(C++)
2682 AC_COMPILE_IFELSE(
2683 [AC_LANG_PROGRAM([[
2684 #include <llvm/Support/raw_os_ostream.h>
2685 ]], [[
2686 std::string str;
2687 llvm::raw_fd_ostream fout ("", str, llvm::sys::fs::F_Binary);
2688 ]])],
2689 octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=yes,
2690 octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=no)
2691 AC_LANG_POP(C++)
2692 ])
2693 if test $octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs = yes; then
2694 AC_DEFINE(RAW_FD_OSTREAM_ARG_IS_LLVM_SYS_FS, 1,
2695 [Define to 1 if LLVM::raw_fd_ostream arg type is llvm::sys:fs.])
2696 fi
2697 ])
2698 dnl
2699 dnl Check llvm::IRBuilder API
2700 dnl
2701 AC_DEFUN([OCTAVE_LLVM_IRBUILDER_API], [
2702 AC_CACHE_CHECK([if llvm::IRBuilder has two template arguments],
2703 [octave_cv_llvm_irbuilder_has_two_template_args],
2704 [AC_LANG_PUSH(C++)
2705 AC_COMPILE_IFELSE(
2706 [AC_LANG_PROGRAM([[
2707 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2708 #include <llvm/IR/LLVMContext.h>
2709 #else
2710 #include <llvm/LLVMContext.h>
2711 #endif
2712 #if defined (HAVE_LLVM_IR_IRBUILDER_H)
2713 #include <llvm/IR/IRBuilder.h>
2714 #elif defined (HAVE_LLVM_SUPPORT_IRBUILDER_H)
2715 #include <llvm/Support/IRBuilder.h>
2716 #else
2717 #include <llvm/IRBuilder.h>
2718 #endif
2719 using namespace llvm;
2720 ]], [[
2721 LLVMContext c;
2722 IRBuilder<ConstantFolder,IRBuilderDefaultInserter> irb (c);
2723 ]])],
2724 octave_cv_llvm_irbuilder_has_two_template_args=yes,
2725 octave_cv_llvm_irbuilder_has_two_template_args=no)
2726 AC_LANG_POP(C++)
2727 ])
2728 if test $octave_cv_llvm_irbuilder_has_two_template_args = yes; then
2729 AC_DEFINE(LLVM_IRBUILDER_HAS_TWO_TEMPLATE_ARGS, 1,
2730 [Define to 1 if llvm::IRBuilder has two template arguments.])
2731 fi
2732 ])
2733 dnl
2734 dnl Check for llvm::createAlwaysInlinerPass
2735 dnl
2736 AC_DEFUN([OCTAVE_LLVM_HAS_CREATEALWAYSINLINERPASS], [
2737 AC_CACHE_CHECK([if llvm::createAlwaysInlinerPass exists],
2738 [octave_cv_llvm_has_createalwaysinlinerpass],
2739 [AC_LANG_PUSH(C++)
2740 AC_COMPILE_IFELSE(
2741 [AC_LANG_PROGRAM([[
2742 #include <llvm/Transforms/IPO.h>
2743 ]], [[
2744 llvm::Pass *p;
2745 p = llvm::createAlwaysInlinerPass ();
2746 ]])],
2747 octave_cv_llvm_has_createalwaysinlinerpass=yes,
2748 octave_cv_llvm_has_createalwaysinlinerpass=no)
2749 AC_LANG_POP(C++)
2750 ])
2751 if test $octave_cv_llvm_has_createalwaysinlinerpass = yes; then
2752 AC_DEFINE(LLVM_HAS_CREATEALWAYSINLINERPASS, 1,
2753 [Define to 1 if llvm::createAlwaysInlinerPass exists.])
2754 fi
2755 ])
2756 dnl
2757 dnl Check llvm::IRBuilder::CreateConstInBoundsGEP1_32 API
2758 dbl
2759 AC_DEFUN([OCTAVE_LLVM_IRBUILDER_CREATECONSTINBOUNDSGEP1_32_API], [
2760 AC_CACHE_CHECK([if llvm::IRBuilder::CreateConstInBoundsGEP1_32 requires a type argument],
2761 [octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type],
2762 [AC_LANG_PUSH(C++)
2763 AC_COMPILE_IFELSE(
2764 [AC_LANG_PROGRAM([[
2765 #if defined (HAVE_LLVM_IR_IRBUILDER_H)
2766 #include <llvm/IR/IRBuilder.h>
2767 #elif defined (HAVE_LLVM_SUPPORT_IRBUILDER_H)
2768 #include <llvm/Support/IRBuilder.h>
2769 #else
2770 #include <llvm/IRBuilder.h>
2771 #endif
2772 ]], [[
2773 llvm::LLVMContext c;
2774 llvm::IRBuilder<> irb (c);
2775 llvm::Value *v;
2776 v = irb.CreateConstInBoundsGEP1_32 ((llvm::Value *) nullptr, 0);
2777 ]])],
2778 octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type=no,
2779 octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type=yes)
2780 AC_LANG_POP(C++)
2781 ])
2782 if test $octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type = yes; then
2783 AC_DEFINE(LLVM_IRBUILDER_CREATECONSTINBOUNDSGEP1_32_REQUIRES_TYPE, 1,
2784 [Define to 1 if llvm::IRBuilder::CreateConstInBoundsGEP1_32 requires a type argument.])
2785 fi
2786 ])
2787 dnl
2788 dnl Check if MIPS processor is target and quiet signalling NaN value is
2789 dnl opposite of IEEE 754-2008 standard used by all other architectures.
2790 dnl
2791 AC_DEFUN([OCTAVE_MIPS_NAN], [
2792 AC_CACHE_CHECK([whether MIPS processor is using non-standard NaN encoding],
2793 [octave_cv_mips_nan],
2794 [AC_LANG_PUSH(C++)
2795 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
2796 #include <cmath>
2797 #include <limits>
2798 ]], [[
2799 /* FIXME: Only test is that MIPS is the target architecture.
2800 * This should be AND'ed with a test for whether the actual NaN
2801 * value for the high word (LO_IEEE_NA_HW) has the value
2802 * 0x7FF840F4 (normal) or 0x7FF040F4 (non-standard). Template code
2803 * that could work is in liboctave/utils/lo-ieee.cc but it also
2804 * depends on knowing whether the architecture is big-endian or
2805 * little-endian. */
2806 #if defined (__mips__)
2807 return (0);
2808 #else
2809 return (1);
2810 #endif
2811 ]])],
2812 octave_cv_mips_nan=yes,
2813 octave_cv_mips_nan=no)
2814 AC_LANG_POP(C++)
2815 ])
2816 if test $octave_cv_mips_nan = yes; then
2817 AC_DEFINE(HAVE_MIPS_NAN, 1,
2818 [Define to 1 if MIPS processor is using non-standard NaN encoding.])
2819 fi
2820 ])
2821 dnl
2822 dnl OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS
2823 dnl
2824 dnl Set variables related to Fortran symbol names (append underscore,
2825 dnl use uppercase names, etc.) and calling convention (mostly used for
2826 dnl determining how character strings are passed).
2827 dnl
2828 AC_DEFUN([OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS], [
2829 F77_TOLOWER=yes
2830 F77_APPEND_UNDERSCORE=yes
2831 F77_APPEND_EXTRA_UNDERSCORE=yes
2832
2833 case $ac_cv_f77_mangling in
2834 "upper case") F77_TOLOWER=no ;;
2835 esac
2836 case $ac_cv_f77_mangling in
2837 "no underscore") F77_APPEND_UNDERSCORE=no ;;
2838 esac
2839 case $ac_cv_f77_mangling in
2840 "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;;
2841 esac
2842
2843 case $canonical_host_type in
2844 i[[3456789]]86-*-*)
2845 if test $ac_cv_f77_compiler_gnu = yes; then
2846 OCTAVE_F77_FLAG([-mieee-fp])
2847 fi
2848 ;;
2849 alpha*-*-*)
2850 if test $ac_cv_f77_compiler_gnu = yes; then
2851 OCTAVE_F77_FLAG([-mieee])
2852 else
2853 OCTAVE_F77_FLAG([-ieee])
2854 OCTAVE_F77_FLAG([-fpe1])
2855 fi
2856 ;;
2857 powerpc-apple-machten*)
2858 FFLAGS=
2859 ;;
2860 esac
2861
2862 if test $ac_cv_f77_compiler_gnu = yes; then
2863 FORTRAN_CALLING_CONVENTION=gfortran
2864 else
2865 FORTRAN_CALLING_CONVENTION=unknown
2866 fi
2867 AC_ARG_ENABLE([fortran-calling-convention],
2868 [AS_HELP_STRING([--enable-fortran-calling-convention=OPTION],
2869 [Select C++ to Fortran calling convention. "gfortran" should be detected automatically. Other options are "cray", "visual-fortran", or "f2c".])],
2870 [FORTRAN_CALLING_CONVENTION="$enableval"], [])
2871
2872 case $FORTRAN_CALLING_CONVENTION in
2873 gfortran)
2874 AC_DEFINE(F77_USES_GFORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the gfortran calling convention.])
2875 ;;
2876 cray)
2877 AC_DEFINE(F77_USES_CRAY_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Cray Fortran calling convention.])
2878 ;;
2879 visual-fortran)
2880 AC_DEFINE(F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Visual Fortran calling convention.])
2881 ;;
2882 f2c)
2883 AC_DEFINE(F77_USES_F2C_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the f2c calling convention.])
2884 ;;
2885 *)
2886 AC_MSG_ERROR([to build Octave, the C++ to Fortran calling convention must be known.])
2887 ;;
2888 esac
2889
2890 if test -n "$FFLAGS"; then
2891 AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
2892 fi
2893
2894 AC_SUBST(F77_TOLOWER)
2895 AC_SUBST(F77_APPEND_UNDERSCORE)
2896 AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE)
2897 ]) 2491 ])
2898 dnl 2492 dnl
2899 dnl OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS 2493 dnl OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS
2900 dnl 2494 dnl
2901 dnl Requires the following variables to already be set: 2495 dnl Requires the following variables to already be set:
3125 AC_SUBST(OCTGUI_DLL_DEFS) 2719 AC_SUBST(OCTGUI_DLL_DEFS)
3126 AC_SUBST(OCTGRAPHICS_DLL_DEFS) 2720 AC_SUBST(OCTGRAPHICS_DLL_DEFS)
3127 AC_SUBST(library_path_var) 2721 AC_SUBST(library_path_var)
3128 AC_SUBST(ldpreloadsep) 2722 AC_SUBST(ldpreloadsep)
3129 AM_SUBST_NOTMAKE(ldpreloadsep) 2723 AM_SUBST_NOTMAKE(ldpreloadsep)
2724 ])
2725 dnl
2726 dnl Allow the user disable support for command line editing using GNU
2727 dnl readline.
2728 dnl
2729 AC_DEFUN([OCTAVE_ENABLE_READLINE], [
2730 USE_READLINE=yes
2731 READLINE_LIBS=
2732 AC_ARG_ENABLE([readline],
2733 [AS_HELP_STRING([--disable-readline],
2734 [do not use readline library])],
2735 [if test "$enableval" = no; then
2736 USE_READLINE=no
2737 warn_readline="command editing and history features require GNU Readline"
2738 fi])
2739 if test $USE_READLINE = yes; then
2740 dnl RHEL 5 and older systems require termlib set before enabling readline
2741 AC_REQUIRE([OCTAVE_CHECK_LIB_TERMLIB])
2742 ac_octave_save_LIBS="$LIBS"
2743 LIBS="$TERM_LIBS"
2744 AC_CHECK_LIB([readline], [rl_set_keyboard_input_timeout],
2745 [READLINE_LIBS="-lreadline"
2746 AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.])
2747 ],
2748 [AC_MSG_WARN([I need GNU Readline 4.2 or later])
2749 AC_MSG_ERROR([this is fatal unless you specify --disable-readline])
2750 ])
2751 LIBS="$ac_octave_save_LIBS"
2752 fi
2753 AC_SUBST(READLINE_LIBS)
2754 ])
2755 dnl
2756 dnl Check if Fortran compiler handles FLAG command line option. If
2757 dnl two arguments are specified, execute the second arg as shell
2758 dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts
2759 dnl the flag.
2760 dnl
2761 AC_DEFUN([OCTAVE_F77_FLAG], [
2762 ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
2763 AC_MSG_CHECKING([whether ${F77-g77} accepts $1])
2764 AC_CACHE_VAL([octave_cv_f77_flag_$ac_safe], [
2765 AC_LANG_PUSH(Fortran 77)
2766 ac_octave_save_FFLAGS="$FFLAGS"
2767 FFLAGS="$FFLAGS $1"
2768 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
2769 eval "octave_cv_f77_flag_$ac_safe=yes",
2770 eval "octave_cv_f77_flag_$ac_safe=no")
2771 FFLAGS="$ac_octave_save_FFLAGS"
2772 AC_LANG_POP(Fortran 77)
2773 ])
2774 if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then
2775 AC_MSG_RESULT([yes])
2776 ifelse([$2], ,
2777 [FFLAGS="$FFLAGS $1"
2778 AC_MSG_RESULT([adding $1 to FFLAGS])], [$2])
2779 else
2780 AC_MSG_RESULT([no])
2781 ifelse([$3], , , [$3])
2782 fi
2783 ])
2784 dnl
2785 dnl Check to see if the compiler and the linker can handle the flags
2786 dnl "-framework $1" for the given prologue $2 and the given body $3 of
2787 dnl a source file. Arguments 2 and 3 optionally can also be empty.
2788 dnl Add options (lower case letters $1) "--with-framework-$1" and
2789 dnl "--without-framework-$1". If this test is successful then perform
2790 dnl $4, otherwise do $5.
2791 dnl
2792 AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [
2793 AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1])
2794 AC_CACHE_VAL([octave_cv_framework_$1],
2795 [ac_octave_save_LDFLAGS="$LDFLAGS"
2796 LDFLAGS="$LDFLAGS -framework $1"
2797 AC_LANG_PUSH(C++)
2798 AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
2799 eval "octave_cv_framework_$1=yes",
2800 eval "octave_cv_framework_$1=no")
2801 AC_LANG_POP(C++)
2802 LDFLAGS="$ac_octave_save_LDFLAGS"
2803 ])
2804 if test "$octave_cv_framework_$1" = yes; then
2805 AC_MSG_RESULT([yes])
2806 AC_ARG_WITH(framework-m4_tolower($1),
2807 [AS_HELP_STRING([--without-framework-m4_tolower($1)],
2808 [don't use framework $1])],
2809 with_have_framework=$withval, with_have_framework=yes)
2810 if test "$with_have_framework" = yes; then
2811 [$4]
2812 :
2813 else
2814 AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)])
2815 [$5]
2816 fi
2817 else
2818 AC_MSG_RESULT([no])
2819 [$5]
2820 fi
2821 ])
2822 dnl
2823 dnl Check for IEEE 754 data format.
2824 dnl
2825 AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], [
2826 AC_MSG_CHECKING([for IEEE 754 data format])
2827 AC_CACHE_VAL([octave_cv_ieee754_data_format],
2828 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2829 int
2830 main (void)
2831 {
2832 typedef union { unsigned char c[8]; double d; } ieeebytes;
2833
2834 ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43};
2835 ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c};
2836
2837 return l.d != 1234567891234567.0 && b.d != 1234567891234567.0;
2838 }
2839 ]])],
2840 octave_cv_ieee754_data_format=yes,
2841 octave_cv_ieee754_data_format=no,
2842 octave_cv_ieee754_data_format=yes)
2843 ])
2844 if test "$cross_compiling" = yes; then
2845 AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation])
2846 else
2847 AC_MSG_RESULT([$octave_cv_ieee754_data_format])
2848 fi
2849 if test $octave_cv_ieee754_data_format = yes; then
2850 AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1,
2851 [Define to 1 if your system uses IEEE 754 data format.])
2852 else
2853 ## If the format is unknown, then you will probably not have a
2854 ## useful system, so we will abort here. Anyone wishing to
2855 ## experiment with building Octave on a system without IEEE
2856 ## floating point should be capable of removing this check and
2857 ## the one in the octave_ieee_init function in liboctave/lo-ieee.cc.
2858 AC_MSG_ERROR([IEEE 754 data format required for building Octave])
2859 fi
2860 ])
2861 dnl
2862 dnl Check for CallInst::addAttribute API
2863 dnl
2864 AC_DEFUN([OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API], [
2865 AC_CACHE_CHECK([if llvm::CallInst::addAttribute's arg type is llvm::Attributes],
2866 [octave_cv_callinst_addattribute_arg_is_attributes],
2867 [AC_LANG_PUSH(C++)
2868 AC_COMPILE_IFELSE(
2869 [AC_LANG_PROGRAM([[
2870 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2871 #include <llvm/IR/Instructions.h>
2872 #include <llvm/IR/Attributes.h>
2873 #else
2874 #include <llvm/Instructions.h>
2875 #include <llvm/Attributes.h>
2876 #endif
2877 ]], [[
2878 llvm::CallInst *callinst;
2879 llvm::AttrBuilder attr_builder;
2880 attr_builder.addAttribute(llvm::Attributes::StructRet);
2881 llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
2882 callinst->addAttribute (1, attrs);
2883 ]])],
2884 octave_cv_callinst_addattribute_arg_is_attributes=yes,
2885 octave_cv_callinst_addattribute_arg_is_attributes=no)
2886 AC_LANG_POP(C++)
2887 ])
2888 if test $octave_cv_callinst_addattribute_arg_is_attributes = yes; then
2889 AC_DEFINE(CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
2890 [Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes.])
2891 fi
2892 ])
2893 dnl
2894 dnl Check for Function::addAttribute API
2895 dnl
2896 AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API], [
2897 AC_CACHE_CHECK([if llvm::Function::addAttribute's arg type is llvm::Attributes],
2898 [octave_cv_function_addattribute_arg_is_attributes],
2899 [AC_LANG_PUSH(C++)
2900 AC_COMPILE_IFELSE(
2901 [AC_LANG_PROGRAM([[
2902 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2903 #include <llvm/IR/Function.h>
2904 #include <llvm/IR/Attributes.h>
2905 #include <llvm/IR/LLVMContext.h>
2906 #else
2907 #include <llvm/Function.h>
2908 #include <llvm/Attributes.h>
2909 #include <llvm/LLVMContext.h>
2910 #endif
2911 ]], [[
2912 llvm::Function *llvm_function;
2913 llvm::AttrBuilder attr_builder;
2914 attr_builder.addAttribute(llvm::Attributes::StructRet);
2915 llvm::Attributes attrs = llvm::Attributes::get(llvm::getGlobalContext(), attr_builder);
2916 llvm_function->addAttribute (1, attrs);
2917 ]])],
2918 octave_cv_function_addattribute_arg_is_attributes=yes,
2919 octave_cv_function_addattribute_arg_is_attributes=no)
2920 AC_LANG_POP(C++)
2921 ])
2922 if test $octave_cv_function_addattribute_arg_is_attributes = yes; then
2923 AC_DEFINE(FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES, 1,
2924 [Define to 1 if llvm::Function:addAttribute arg type is llvm::Attributes.])
2925 fi
2926 ])
2927 dnl
2928 dnl Check for Function::addFnAttr API
2929 dnl
2930 AC_DEFUN([OCTAVE_LLVM_FUNCTION_ADDFNATTR_API], [
2931 AC_CACHE_CHECK([if llvm::Function::addFnAttr's arg type is llvm::Attributes],
2932 [octave_cv_function_addfnattr_arg_is_attributes],
2933 [AC_LANG_PUSH(C++)
2934 AC_COMPILE_IFELSE(
2935 [AC_LANG_PROGRAM([[
2936 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2937 #include <llvm/IR/Function.h>
2938 #include <llvm/IR/Attributes.h>
2939 #else
2940 #include <llvm/Function.h>
2941 #include <llvm/Attributes.h>
2942 #endif
2943 ]], [[
2944 llvm::Function *llvm_function;
2945 llvm_function->addFnAttr (llvm::Attributes::AlwaysInline);
2946 ]])],
2947 octave_cv_function_addfnattr_arg_is_attributes=yes,
2948 octave_cv_function_addfnattr_arg_is_attributes=no)
2949 AC_LANG_POP(C++)
2950 ])
2951 if test $octave_cv_function_addfnattr_arg_is_attributes = yes; then
2952 AC_DEFINE(FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES, 1,
2953 [Define to 1 if llvm::Function:addFnAttr arg type is llvm::Attributes.])
2954 fi
2955 ])
2956 dnl
2957 dnl Check for llvm::createAlwaysInlinerPass
2958 dnl
2959 AC_DEFUN([OCTAVE_LLVM_HAS_CREATEALWAYSINLINERPASS], [
2960 AC_CACHE_CHECK([if llvm::createAlwaysInlinerPass exists],
2961 [octave_cv_llvm_has_createalwaysinlinerpass],
2962 [AC_LANG_PUSH(C++)
2963 AC_COMPILE_IFELSE(
2964 [AC_LANG_PROGRAM([[
2965 #include <llvm/Transforms/IPO.h>
2966 ]], [[
2967 llvm::Pass *p;
2968 p = llvm::createAlwaysInlinerPass ();
2969 ]])],
2970 octave_cv_llvm_has_createalwaysinlinerpass=yes,
2971 octave_cv_llvm_has_createalwaysinlinerpass=no)
2972 AC_LANG_POP(C++)
2973 ])
2974 if test $octave_cv_llvm_has_createalwaysinlinerpass = yes; then
2975 AC_DEFINE(LLVM_HAS_CREATEALWAYSINLINERPASS, 1,
2976 [Define to 1 if llvm::createAlwaysInlinerPass exists.])
2977 fi
2978 ])
2979 dnl
2980 dnl Check llvm::IRBuilder API
2981 dnl
2982 AC_DEFUN([OCTAVE_LLVM_IRBUILDER_API], [
2983 AC_CACHE_CHECK([if llvm::IRBuilder has two template arguments],
2984 [octave_cv_llvm_irbuilder_has_two_template_args],
2985 [AC_LANG_PUSH(C++)
2986 AC_COMPILE_IFELSE(
2987 [AC_LANG_PROGRAM([[
2988 #if defined (HAVE_LLVM_IR_FUNCTION_H)
2989 #include <llvm/IR/LLVMContext.h>
2990 #else
2991 #include <llvm/LLVMContext.h>
2992 #endif
2993 #if defined (HAVE_LLVM_IR_IRBUILDER_H)
2994 #include <llvm/IR/IRBuilder.h>
2995 #elif defined (HAVE_LLVM_SUPPORT_IRBUILDER_H)
2996 #include <llvm/Support/IRBuilder.h>
2997 #else
2998 #include <llvm/IRBuilder.h>
2999 #endif
3000 using namespace llvm;
3001 ]], [[
3002 LLVMContext c;
3003 IRBuilder<ConstantFolder,IRBuilderDefaultInserter> irb (c);
3004 ]])],
3005 octave_cv_llvm_irbuilder_has_two_template_args=yes,
3006 octave_cv_llvm_irbuilder_has_two_template_args=no)
3007 AC_LANG_POP(C++)
3008 ])
3009 if test $octave_cv_llvm_irbuilder_has_two_template_args = yes; then
3010 AC_DEFINE(LLVM_IRBUILDER_HAS_TWO_TEMPLATE_ARGS, 1,
3011 [Define to 1 if llvm::IRBuilder has two template arguments.])
3012 fi
3013 ])
3014 dnl
3015 dnl Check llvm::IRBuilder::CreateConstInBoundsGEP1_32 API
3016 dbl
3017 AC_DEFUN([OCTAVE_LLVM_IRBUILDER_CREATECONSTINBOUNDSGEP1_32_API], [
3018 AC_CACHE_CHECK([if llvm::IRBuilder::CreateConstInBoundsGEP1_32 requires a type argument],
3019 [octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type],
3020 [AC_LANG_PUSH(C++)
3021 AC_COMPILE_IFELSE(
3022 [AC_LANG_PROGRAM([[
3023 #if defined (HAVE_LLVM_IR_IRBUILDER_H)
3024 #include <llvm/IR/IRBuilder.h>
3025 #elif defined (HAVE_LLVM_SUPPORT_IRBUILDER_H)
3026 #include <llvm/Support/IRBuilder.h>
3027 #else
3028 #include <llvm/IRBuilder.h>
3029 #endif
3030 ]], [[
3031 llvm::LLVMContext c;
3032 llvm::IRBuilder<> irb (c);
3033 llvm::Value *v;
3034 v = irb.CreateConstInBoundsGEP1_32 ((llvm::Value *) nullptr, 0);
3035 ]])],
3036 octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type=no,
3037 octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type=yes)
3038 AC_LANG_POP(C++)
3039 ])
3040 if test $octave_cv_llvm_irbuilder_createconstinboundsgep1_32_requires_type = yes; then
3041 AC_DEFINE(LLVM_IRBUILDER_CREATECONSTINBOUNDSGEP1_32_REQUIRES_TYPE, 1,
3042 [Define to 1 if llvm::IRBuilder::CreateConstInBoundsGEP1_32 requires a type argument.])
3043 fi
3044 ])
3045 dnl
3046 dnl Check for legacy::PassManager API
3047 dnl
3048 AC_DEFUN([OCTAVE_LLVM_LEGACY_PASSMANAGER_API], [
3049 AC_CACHE_CHECK([if llvm::legacy::PassManager exists],
3050 [octave_cv_legacy_passmanager],
3051 [AC_LANG_PUSH(C++)
3052 save_LIBS="$LIBS"
3053 LIBS="$LLVM_LIBS $LIBS"
3054 AC_LINK_IFELSE(
3055 [AC_LANG_PROGRAM([[
3056 #include <llvm/IR/LegacyPassManager.h>
3057 ]], [[
3058 llvm::Module *module;
3059 llvm::legacy::PassManager *module_pass_manager;
3060 llvm::legacy::FunctionPassManager *pass_manager;
3061 module_pass_manager = new llvm::legacy::PassManager ();
3062 pass_manager = new llvm::legacy::FunctionPassManager (module);
3063 ]])],
3064 octave_cv_legacy_passmanager=yes,
3065 octave_cv_legacy_passmanager=no)
3066 LIBS="$save_LIBS"
3067 AC_LANG_POP(C++)
3068 ])
3069 if test $octave_cv_legacy_passmanager = yes; then
3070 AC_DEFINE(LEGACY_PASSMANAGER, 1,
3071 [Define to 1 if LLVM::legacy::PassManager exists.])
3072 fi
3073 ])
3074 dnl
3075 dnl Check for raw_fd_ostream API
3076 dnl
3077 AC_DEFUN([OCTAVE_LLVM_RAW_FD_OSTREAM_API], [
3078 AC_CACHE_CHECK([if llvm::raw_fd_ostream's arg type is llvm::sys:fs],
3079 [octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs],
3080 [AC_LANG_PUSH(C++)
3081 AC_COMPILE_IFELSE(
3082 [AC_LANG_PROGRAM([[
3083 #include <llvm/Support/raw_os_ostream.h>
3084 ]], [[
3085 std::string str;
3086 llvm::raw_fd_ostream fout ("", str, llvm::sys::fs::F_Binary);
3087 ]])],
3088 octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=yes,
3089 octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=no)
3090 AC_LANG_POP(C++)
3091 ])
3092 if test $octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs = yes; then
3093 AC_DEFINE(RAW_FD_OSTREAM_ARG_IS_LLVM_SYS_FS, 1,
3094 [Define to 1 if LLVM::raw_fd_ostream arg type is llvm::sys:fs.])
3095 fi
3096 ])
3097 dnl
3098 dnl Check if MIPS processor is target and quiet signalling NaN value is
3099 dnl opposite of IEEE 754-2008 standard used by all other architectures.
3100 dnl
3101 AC_DEFUN([OCTAVE_MIPS_NAN], [
3102 AC_CACHE_CHECK([whether MIPS processor is using non-standard NaN encoding],
3103 [octave_cv_mips_nan],
3104 [AC_LANG_PUSH(C++)
3105 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
3106 #include <cmath>
3107 #include <limits>
3108 ]], [[
3109 /* FIXME: Only test is that MIPS is the target architecture.
3110 * This should be AND'ed with a test for whether the actual NaN
3111 * value for the high word (LO_IEEE_NA_HW) has the value
3112 * 0x7FF840F4 (normal) or 0x7FF040F4 (non-standard). Template code
3113 * that could work is in liboctave/utils/lo-ieee.cc but it also
3114 * depends on knowing whether the architecture is big-endian or
3115 * little-endian. */
3116 #if defined (__mips__)
3117 return (0);
3118 #else
3119 return (1);
3120 #endif
3121 ]])],
3122 octave_cv_mips_nan=yes,
3123 octave_cv_mips_nan=no)
3124 AC_LANG_POP(C++)
3125 ])
3126 if test $octave_cv_mips_nan = yes; then
3127 AC_DEFINE(HAVE_MIPS_NAN, 1,
3128 [Define to 1 if MIPS processor is using non-standard NaN encoding.])
3129 fi
3130 ]) 3130 ])
3131 dnl 3131 dnl
3132 dnl Check for ar. 3132 dnl Check for ar.
3133 dnl 3133 dnl
3134 AC_DEFUN([OCTAVE_PROG_AR], [ 3134 AC_DEFUN([OCTAVE_PROG_AR], [