"Fossies" - the Fresh Open Source Software Archive

Member "gretl-2020b/configure.ac" (5 Mar 2020, 27822 Bytes) of package /linux/misc/gretl-2020b.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "configure.ac": 2020a_vs_2020b.

    1 dnl
    2 dnl Process this file with autoconf to produce a configure script.
    3 dnl
    4 
    5 AC_INIT(lib/src/version.h)
    6 AC_PREREQ(2.12)
    7 AC_CONFIG_HEADER(config.h)
    8 AC_CONFIG_AUX_DIR($srcdir/tools)
    9 
   10 PACKAGE=gretl
   11 
   12 VERSION=`grep GRETL_VERSION $srcdir/lib/src/version.h | awk '{ print $NF }' | sed -e 's/\"//g'`
   13 LIBGRETL_CURRENT=`grep LIBGRETL_CURRENT $srcdir/lib/src/version.h | awk '{ print $NF }'`
   14 LIBGRETL_REVISION=`grep LIBGRETL_REVISION $srcdir/lib/src/version.h | awk '{ print $NF }'`
   15 LIBGRETL_AGE=`grep LIBGRETL_AGE $srcdir/lib/src/version.h | awk '{ print $NF }'`
   16 LIBVERSION="$LIBGRETL_CURRENT.$LIBGRETL_AGE.$LIBGRETL_REVISION"
   17 
   18 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
   19 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
   20 AC_DEFINE_UNQUOTED(LIBVERSION, "$LIBVERSION")
   21 AC_SUBST(PACKAGE)
   22 AC_SUBST(VERSION)
   23 AC_SUBST(LIBVERSION)
   24 
   25 AC_SUBST(LIBGRETL_CURRENT)
   26 AC_SUBST(LIBGRETL_REVISION)
   27 AC_SUBST(LIBGRETL_AGE)
   28 
   29 echo "configuring for $PACKAGE $VERSION (library version $LIBVERSION)"
   30 
   31 dnl
   32 dnl Variables controlling the gretl build
   33 dnl
   34 build_gui="yes"
   35 prefer_gtk2="no"
   36 build_docs="no"
   37 build_addons="no"
   38 use_lucida="no"
   39 build_po="no"
   40 have_readline="no"
   41 new_readline="no"
   42 have_zlib="no"
   43 gtk_version="none"
   44 use_xdg="yes"
   45 use_xdg_utils="no"
   46 try_xdg_utils="yes"
   47 use_gsf="no"
   48 try_gmp="yes"
   49 have_gmp="no"
   50 have_mpfr="no"
   51 gmp_fail="no"
   52 mpfr_fail="no"
   53 have_lapack="no"
   54 have_fftw3="no"
   55 seek_inet_addr="no"
   56 have_tramo="yes"
   57 have_x12a="yes"
   58 have_sourceview="no"
   59 fake_gtkspinner="yes"
   60 fake_mono_time="no"
   61 have_gnu_regex="no"
   62 have_libxml2="no"
   63 have_xslt="no"
   64 try_json_glib="yes"
   65 have_json_glib="no"
   66 try_odbc="no"
   67 have_odbc="no"
   68 try_mpi="yes"
   69 have_mpi="no"
   70 try_libR="yes"
   71 have_libR="no"
   72 try_bc="no"
   73 check_gnuplot="yes"
   74 use_curl="yes"
   75 darwin_build="no"
   76 win32_build="no"
   77 win32pkg="no"
   78 quiet_build="no"
   79 swap_ends="no"
   80 pkg_build="no"
   81 mac_native="no"
   82 have_mac_integration="no"
   83 gui_disabled="no"
   84 gp_3d="yes"
   85 MAKE="make"
   86 XML_LIBS=
   87 FONTREQ="\\RequirePackage{ae}"
   88 RT_LIB=
   89 
   90 AC_CHECK_HEADERS(libintl.h,
   91 	try_nls="yes",
   92 	try_nls="no"
   93 )
   94 
   95 if test [ "$try_nls" = "yes" ]
   96 then
   97    AM_GNU_GETTEXT([external],,)
   98 fi
   99 
  100 dnl
  101 dnl Process options supplied to the configure script
  102 dnl
  103 AC_ARG_ENABLE(gui,
  104 [  --enable-gui            Enable gui [[default=yes]]],
  105 [if test "$enableval" = "yes"
  106 then
  107   build_gui=yes
  108 else
  109   build_gui=no
  110   gui_disabled=yes
  111 fi])
  112 
  113 AC_ARG_ENABLE(gtk2,
  114 [  --enable-gtk2           Use GTK 2.0 in preference to GTK 3.0 [[default=no]]],
  115 [if test "$enableval" = "yes"
  116 then
  117   prefer_gtk2=yes
  118 else
  119   prefer_gtk2=no
  120 fi])
  121 
  122 AC_ARG_ENABLE(build-doc,
  123 [  --enable-build-doc      Enable building of gretl docs [[git only]]],
  124 [if test "$enableval" = "yes"
  125 then
  126   if ! test -d $srcdir/.git ; then
  127     echo "The --enable-build-doc option is valid only when building from git"
  128     exit 1
  129   else
  130     build_docs=yes
  131   fi
  132 else
  133   build_docs=no
  134 fi])
  135 
  136 AC_ARG_ENABLE(build-addons,
  137 [  --enable-build-addons   Enable building of gretl addons [[default=no]]],
  138 [if test "$enableval" = "yes"
  139 then
  140   build_addons=yes
  141 else
  142   build_addons=no
  143 fi])
  144 
  145 AC_ARG_ENABLE(quiet-build,
  146 [  --enable-quiet-build    Enable quiet building],
  147 [if test "$enableval" = "yes"
  148 then
  149   quiet_build=yes
  150 fi])
  151 
  152 AC_ARG_ENABLE(swap-ends,
  153 [  --enable-swap-ends      Build FRED database with swapped endianness ],
  154 [if test "$enableval" = "yes"
  155 then
  156   swap_ends=yes
  157 fi])
  158 
  159 AC_ARG_ENABLE(xdg,
  160 [  --disable-xdg           Don't Install XDG files],
  161 [if test "$enableval" = "no"
  162 then
  163   use_xdg=no
  164   try_xdg_utils=no
  165 fi])
  166 
  167 AC_ARG_ENABLE(json,
  168 [  --disable-json          Don't try to include JSON support],
  169 [if test "$enableval" = "no"
  170 then
  171   try_json_glib=no
  172 fi])
  173 
  174 AC_ARG_ENABLE(gmp,
  175 [  --disable-gmp           Don't try to include GMP support],
  176 [if test "$enableval" = "no"
  177 then
  178   try_gmp=no
  179 fi])
  180 
  181 AC_ARG_ENABLE(xdg-utils,
  182 [  --enable-xdg-utils      Use xdg-utils for installing XDG files [[default=auto]]],
  183 [if test "$enableval" = "no"
  184 then
  185   try_xdg_utils=no
  186 fi])
  187 
  188 AC_ARG_ENABLE(pkgbuild,
  189 [  --enable-pkgbuild       For building relocatable package (e.g. OS X) ],
  190 [if test "$enableval" = "yes"
  191 then
  192   AC_DEFINE(PKGBUILD)
  193   pkg_build="yes"
  194 fi])
  195 
  196 AC_ARG_ENABLE(gnuplot-checks,
  197 [  --disable-gnuplot-checks do not run checks for gnuplot],
  198 [if test "$enableval" = "yes"
  199 then
  200   check_gnuplot=yes
  201   echo "check_gnuplot = yes"
  202 else
  203   check_gnuplot=no
  204   echo "check_gnuplot = no"
  205 fi])
  206 
  207 AC_ARG_ENABLE(gnuplot-3d,
  208 [  --disable-gnuplot-3d     assume gnuplot can't do interactive 3D plots],
  209 [if test "$enableval" = "yes"
  210 then
  211   gp_3d=yes
  212   echo "test gp3d = yes"
  213 else
  214   gp_3d=no
  215   echo "test gp3d = no"
  216 fi])
  217 
  218 AC_ARG_ENABLE(www,
  219 [  --disable-www           do not link to libcurl for http],
  220 [if test "$enableval" = "yes"
  221 then
  222   use_curl=yes
  223 else
  224   if test "$gui_disabled" = "no" ; then
  225     echo ""
  226     echo "The --disable-www option is available only if you also"
  227     echo "give the option --disable-gui"
  228     exit 1
  229   else
  230     use_curl=no
  231   fi
  232 fi])
  233 
  234 AC_ARG_WITH(lucida,
  235 [  --with-lucida           Use Lucida fonts for manual [[git only]]],
  236 [ case "$withval" in
  237   yes)
  238         FONTREQ="\\RequirePackage[[T1]]{fontenc,lucidabr}"
  239 	use_lucida=yes
  240         ;;
  241   *)
  242         ;;
  243   esac ],
  244 )
  245 AC_SUBST(FONTREQ)
  246 
  247 AC_ARG_WITH(gmake,
  248 [  --with-gmake            Use GNU make explicitly [[default=no]]],
  249 [ case "$withval" in
  250   yes)
  251         MAKE="gmake"
  252         ;;
  253   *)
  254         ;;
  255   esac ],
  256 )
  257 AC_SUBST(MAKE)
  258 
  259 AC_ARG_WITH(readline,
  260 [  --with-readline        Use readline library [[default=auto]]],
  261 if test "x${withval}" = "xno"
  262 then
  263   try_readline=no
  264 else
  265   try_readline=yes
  266 fi,
  267 try_readline=yes)
  268 
  269 AC_ARG_WITH(gsf,
  270 [  --with-gsf             Use libgsf [[default=auto]]],
  271 if test "x${withval}" = "xno"
  272 then
  273   try_gsf=no
  274 fi,
  275 try_gsf=yes)
  276 
  277 AC_ARG_WITH(x-12-arima,
  278 [  --with-x-12-arima      include X-12-ARIMA support [[default=yes]]],
  279 if test "x${withval}" = "xno"
  280 then
  281   have_x12a="no"
  282 else
  283   AC_DEFINE(HAVE_X12A)
  284   HAVE_X12A=1
  285 fi,
  286 AC_DEFINE(HAVE_X12A)
  287 HAVE_X12A=1)
  288 AC_SUBST(HAVE_X12A)
  289 
  290 AC_ARG_WITH(tramo-seats,
  291 [  --with-tramo-seats     include TRAMO/SEATS support [[default=yes]]],
  292 if test "$withval" = "no"
  293 then
  294   have_tramo="no"
  295 else
  296   AC_DEFINE(HAVE_TRAMO)
  297   HAVE_TRAMO=1
  298 fi,
  299 AC_DEFINE(HAVE_TRAMO)
  300 HAVE_TRAMO=1)
  301 AC_SUBST(HAVE_TRAMO)
  302 
  303 AC_ARG_WITH(libR,
  304 [  --with-libR            include libR support [[default=auto]]],
  305 if test "$withval" = "no"
  306 then
  307   try_libR=no
  308 fi,
  309 try_libR=yes)
  310 
  311 AC_ARG_WITH(mpi,
  312 [  --with-mpi             include MPI support [[default=auto]]],
  313 if test "$withval" = "no"
  314 then
  315   try_mpi=no
  316 fi,
  317 try_mpi=yes)
  318 
  319 AC_ARG_WITH(odbc,
  320 [  --with-odbc            include ODBC support],
  321 if test "$withval" = "yes"
  322 then
  323   try_odbc=yes
  324 fi,
  325 try_odbc=no)
  326 
  327 AC_PROG_CC
  328 
  329 AC_CANONICAL_HOST
  330 AC_PROG_INSTALL
  331 
  332 dnl check for Windows build
  333 case $host_os in
  334   mingw*)
  335     win32_build=yes
  336     if test $pkg_build = yes ; then
  337       win32pkg=yes
  338     fi
  339     if test "x$WINDRES" = x ; then
  340       WINDRES=windres
  341     fi
  342     AC_SUBST(WINDRES)
  343   ;;
  344 esac
  345 
  346 AC_DISABLE_STATIC
  347 AC_LIBTOOL_DLOPEN
  348 AC_PROG_LIBTOOL
  349 AC_PROG_LN_S
  350 AC_PROG_GREP
  351 
  352 AC_CHECK_LIB(m, sin)
  353 AC_CHECK_LIB(c, fopen)
  354 
  355 dnl Checks for header files, etc.
  356 AC_HEADER_STDC
  357 AC_HEADER_SYS_WAIT
  358 AC_CHECK_HEADERS(stdint.h unistd.h dirent.h fnmatch.h fenv.h byteswap.h sys/times.h)
  359 AC_CHECK_HEADERS(libproc.h sys/proc_info.h)
  360 AC_C_CONST
  361 AC_C_LONG_DOUBLE
  362 AC_CHECK_FUNCS(vasprintf)
  363 AC_CHECK_FUNCS(posix_memalign)
  364 AC_CHECK_SIZEOF(int)
  365 AC_TYPE_SIGNAL
  366 AC_C_BIGENDIAN
  367 
  368 AC_ARG_VAR(HOSTCC, host compiler (for cross-build))
  369 AC_ARG_VAR(MKLANG, builder for gtksourceview files (cross-build))
  370 AC_ARG_VAR(MKNEWS, builder for NEWS file (cross-build))
  371 AC_ARG_VAR(MPICC, path to MPI compiler wrapper)
  372 AC_ARG_VAR(MPILINK, linker commands for MPI (cross-build))
  373 
  374 AC_C_SSE2
  375 AC_C_AVX
  376 AC_C_OPENMP
  377 
  378 dnl check for SIMD intrinsics headers
  379 if test "x$sse2_result" = "xyes" || test "x$avx_result" = "xyes" ; then
  380   AC_CHECK_HEADERS(immintrin.h)
  381 fi
  382 
  383 dnl ensure that the source will get rebuilt if openmp
  384 dnl is turned on or off, by flagging this in config.h
  385 if test "$ac_openmp_result" = "yes" ; then
  386   AC_DEFINE(OPENMP_BUILD)
  387 fi
  388 
  389 dnl Check for MPI apparatus?
  390 if test "$try_mpi" = "yes" ; then
  391   if test "x${MPICC}" = x ; then
  392     AC_DEFUN([AC_PROG_MPICC],
  393     [AC_CHECK_PROG(HAVE_MPICC,mpicc,yes)])
  394 
  395     AC_PROG_MPICC
  396   else
  397     HAVE_MPICC="yes"
  398   fi
  399   if test "x${HAVE_MPICC}" = "xyes" ; then
  400     if test $win32_build = "yes" ; then
  401       MPI_LIBS="-lmsmpi"
  402       have_mpi="yes"
  403       AC_DEFINE(HAVE_MPI)
  404     else
  405       AC_C_MPI
  406     fi
  407   fi
  408 fi
  409 
  410 dnl
  411 dnl Check for libreadline for use with gretlcli
  412 dnl
  413 if test "x$CROSS_READLINE_LIBS" != x ; then
  414    READLINE_LIBS="$CROSS_READLINE_LIBS"
  415    have_readline=yes
  416    AC_DEFINE(HAVE_READLINE)
  417    AC_DEFINE(NEW_READLINE)
  418    AC_SUBST(READLINE_CFLAGS)
  419    AC_SUBST(READLINE_LIBS)
  420 elif test "$try_readline" = "yes" ; then
  421    AM_PATH_READLINE(have_readline="yes", have_readline="no")
  422    if test "$have_readline" = "no" ; then
  423      READLINE_LIBS=""
  424      READLINE_CFLAGS=""
  425    fi
  426 fi
  427 
  428 dnl
  429 dnl Check for C++ compiler (for svm plugin)
  430 dnl
  431 AC_PROG_CXX
  432 
  433 dnl
  434 dnl Check for XDG for handling of gretl mime-types
  435 dnl
  436 if test "$try_xdg_utils" = "yes" ; then
  437   AC_DEFUN([AC_PROG_XDG_MIME],
  438   [AC_CHECK_PROG(XDG_MIME,xdg-mime,yes)])
  439 
  440   AC_PROG_XDG_MIME
  441   if test x"${XDG_MIME}" = xyes ; then
  442     use_xdg_utils=yes
  443   fi
  444 fi
  445 
  446 dnl
  447 dnl Check for zlib
  448 dnl
  449 AC_CHECK_LIB(z, gzopen,have_zlib="yes" ; \
  450   ZLIB="-lz" ; AC_DEFINE(HAVE_ZLIB),,)
  451 AC_SUBST(have_zlib)
  452 
  453 dnl
  454 dnl Check for GMP and MPFR
  455 dnl
  456 if test "$try_gmp" = "yes" ; then
  457   AM_PATH_GMP(4.0.1, have_gmp="yes", gmp_fail="yes")
  458   AM_PATH_MPFR(2.2.0, have_mpfr="yes", gmp_fail="yes")
  459   if test "$have_gmp" = "yes" -a "$have_mpfr" = "yes" ; then
  460     AC_DEFINE(HAVE_GMP)
  461   fi
  462 fi
  463 
  464 dnl
  465 dnl Check for LAPACK
  466 dnl
  467 case $host_os in
  468   *arwin*)
  469     LAPACK_LIBS="-Wl,-framework -Wl,Accelerate"
  470     have_lapack="yes"
  471     darwin_build="yes"
  472     AC_DEFINE(OS_OSX)
  473   ;;
  474   *mingw*)
  475     have_lapack="yes"
  476   ;;
  477   *cygwin*)
  478     AM_PATH_LAPACK(, have_lapack="yes")
  479     if test "$have_lapack" = "yes" ; then
  480       LAPACK_LIBS="${LAPACK_LIBS} -XCClinker,-lgfortran"
  481     fi
  482   ;;
  483   *)
  484     AM_PATH_LAPACK(, have_lapack="yes")
  485   ;;
  486 esac
  487 
  488 dnl And while we're at it...
  489 if test "$darwin_build" = "yes" ; then
  490   CARBONLIB="-Wl,-framework -Wl,Carbon"
  491   AC_SUBST(CARBONLIB)
  492   if test "$pkg_build" = "yes" ; then
  493     DARWIN_RPATH="@executable_path/../lib"
  494     AC_SUBST(DARWIN_RPATH)
  495   fi
  496 fi
  497 
  498 dnl
  499 dnl Is MMAP available?
  500 dnl
  501 AC_MSG_CHECKING([for mmap])
  502 AC_CACHE_VAL(ac_cv_func_mmap_ok,
  503  [AC_TRY_LINK(
  504  changequote(<<, >>)dnl
  505  <<
  506 #include <unistd.h>
  507 #include <sys/mman.h>
  508 #include <sys/stat.h>
  509 #include <fcntl.h>
  510  >>,
  511  changequote([, ])dnl
  512  [mmap((void *)0, 0, PROT_READ, 0, 0, 0);],
  513  ac_cv_func_mmap_ok=yes,
  514  ac_cv_func_mmap_ok=no)] )
  515 AC_MSG_RESULT($ac_cv_func_mmap_ok)
  516 if test $ac_cv_func_mmap_ok = yes
  517 then
  518   AC_DEFINE(HAVE_MMAP)
  519   if test $darwin_build = no ; then
  520     RT_LIB="-lrt"
  521   fi
  522 fi
  523 
  524 dnl
  525 dnl Check for unixODBC?
  526 dnl
  527 if test "$try_odbc" = "yes" ; then
  528   case $host_os in
  529     *arwin*)
  530       ODBC_LIBS="-liodbc"
  531       have_odbc="yes"
  532     ;;
  533     mingw*)
  534       ODBC_LIBS="-lodbc32"
  535       have_odbc="yes"
  536     ;;
  537     *)
  538       AM_PATH_ODBC(,
  539         have_odbc="yes",
  540         have_odbc="no"
  541       )
  542     ;;
  543   esac
  544 fi
  545 
  546 dnl
  547 dnl Check for gnuplot and its PNG capacity, unless the
  548 dnl user has said not to
  549 dnl
  550 if test "$check_gnuplot" = "no" ; then
  551   have_gnuplot=yes
  552 else
  553   AC_DEFUN([AC_PROG_GNUPLOT],
  554   [AC_CHECK_PROG(GNUPLOT,gnuplot,yes)])
  555 
  556   AC_PROG_GNUPLOT
  557   if test x"${GNUPLOT}" = xyes ; then
  558     have_gnuplot=yes
  559   fi
  560 
  561   if test "$build_gui" = "yes" ; then
  562     have_gnuplot=no
  563     AC_MSG_CHECKING(for gnuplot >= 5.0 with cairo support)
  564     echo "set term pngcairo" | GNUTERM=dumb gnuplot 2>/dev/null && have_gnuplot=yes
  565     if test "$have_gnuplot" = yes ; then
  566       GPVERSION=`gnuplot --version | awk '{print $2}'`
  567       if test "x$GPVERSION" = x ; then
  568         have_gnuplot=no
  569       else
  570         GPMAJOR=`echo $GPVERSION | cut -c1 2>/dev/null`
  571         if test $GPMAJOR -gt 4 ; then
  572           AC_MSG_RESULT(yes)
  573         else
  574           have_gnuplot=no
  575         fi
  576       fi
  577     fi
  578     if test "$have_gnuplot" = no ; then
  579       AC_MSG_RESULT(no)
  580       echo
  581       echo "* gretl needs gnuplot >= 5.0, with cairo support."
  582       echo "* The current version of gnuplot is available from www.gnuplot.info"
  583       exit 1
  584     fi
  585   fi
  586 fi
  587 
  588 dnl
  589 dnl Check for pdflatex executable
  590 dnl
  591 AC_DEFUN([AC_PROG_LATEX],
  592 [AC_CHECK_PROG(LATEX,pdflatex,yes)])
  593 
  594 AC_PROG_LATEX
  595 test x"${LATEX}" = xyes && AC_DEFINE(HAVE_LATEX)
  596 if test x"${LATEX}" = xyes ; then
  597   have_latex="yes"
  598 else
  599   have_latex="no"
  600 fi
  601 
  602 dnl
  603 dnl Preliminary check for pkg-config
  604 dnl
  605 if test -z "$PKG_CONFIG"; then
  606    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  607 fi
  608 if test "$PKG_CONFIG" = "no" ; then
  609    echo "
  610 Please install pkg-config and then reconfigure gretl.
  611 pkg-config is available from http://www.freedesktop.org/
  612 "
  613    exit 1
  614 fi
  615 
  616 orig_CFLAGS=$CFLAGS
  617 
  618 dnl
  619 dnl fftw3
  620 dnl
  621 PKG_CHECK_MODULES(FFTW, fftw3, have_fftw3="yes", have_fftw3="no")
  622 
  623 dnl
  624 dnl libcurl
  625 dnl
  626 if test "$use_curl" = "yes" ; then
  627   if test "x$CURL_CFLAGS" != "x" || test "x$CURL_LIBS" != "x" ; then
  628     have_curl="yes"
  629   else
  630     PKG_CHECK_MODULES(CURL, libcurl >= 7.13.0, have_curl="yes", have_curl="no")
  631   fi
  632   if test "$have_curl" = "yes" ; then
  633     AC_DEFINE(USE_CURL)
  634   fi
  635 fi
  636 
  637 dnl
  638 dnl glib 2.0 (needed even if not building GUI; we need 2.14 for regexp functions)
  639 dnl
  640 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14.0, have_glib2="yes", have_glib2="no")
  641 if test "${have_glib2}" = "no" ; then
  642    echo "
  643 Please install glib-2.0 >= 2.14.0 and then reconfigure gretl.
  644 glib-2.0 is available from http://www.gtk.org/
  645 "
  646    exit 1
  647 fi
  648 
  649 dnl
  650 dnl check for glib prior to 2.26 (re. deprecation warnings)
  651 dnl
  652 PKG_CHECK_MODULES(GLIB226, glib-2.0 >= 2.26.0,,
  653   AC_DEFINE(GLIB_LT_2_26)
  654 )
  655 
  656 dnl
  657 dnl Do we need to "fake" g_get_monotonic_time() on Linux?
  658 dnl
  659 if test "$darwin_build" = "no" ; then
  660   PKG_CHECK_MODULES(GLIB228, glib-2.0 >= 2.28.0,
  661      fake_mono_time="no",
  662      fake_mono_time="yes",
  663   )
  664 fi
  665 if test "$fake_mono_time" = "yes" ; then
  666    have_clock_gettime="no"
  667    AC_CHECK_LIB(c, clock_gettime, have_clock_gettime="yes",,)
  668    if test "$have_clock_gettime" = "no" ; then
  669       AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime="yes"; \
  670        RT_LIB="-lrt",,)
  671    fi
  672    if test "$have_clock_gettime" = "yes" ; then
  673       AC_DEFINE(HAVE_CLOCK_GETTIME)
  674    fi
  675 fi
  676 
  677 dnl
  678 dnl see if we have json-glib-1.0 (not a hard dependency, yet)
  679 dnl
  680 if test "$try_json_glib" = "yes" ; then
  681    PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0 >= 0.14,
  682    have_json_glib="yes",
  683    have_json_glib="no")
  684    if test $have_json_glib = "no" ; then
  685 echo "
  686 The json-glib-1.0 library was not found, or the version found
  687 was not new enough. While we recommend including JSON support
  688 you can disable this by using the option --disable-json when
  689 running configure.
  690 "
  691       exit 1
  692    fi
  693 fi
  694 
  695 dnl
  696 dnl Initial check for GTK availability
  697 dnl
  698 if test "$prefer_gtk2" = "yes" ; then
  699     PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.14.0,
  700       GTK_CFLAGS=$GTK2_CFLAGS
  701       GTK_LIBS=$GTK2_LIBS
  702       CFLAGS="$CFLAGS $GTK_CFLAGS"
  703       LIBS="$LIBS $GTK_LIBS"
  704       gtk_version="2.0",
  705       echo "GTK 2 >= 2.14.0 not found"
  706     )
  707 elif test "$build_gui" = "yes" ; then
  708     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2.0,
  709       GTK_CFLAGS=$GTK3_CFLAGS
  710       GTK_LIBS=$GTK3_LIBS
  711       CFLAGS="$CFLAGS $GTK_CFLAGS"
  712       LIBS="$LIBS $GTK_LIBS"
  713       AC_DEFINE(USE_GTK3)
  714       gtk_version="3.0"
  715       fake_gtkspinner="no",
  716       echo "GTK 3 >= 3.0.1 not found"
  717     )
  718 fi
  719 
  720 dnl GTK 2.0 fallback in case preference not given
  721 if test "$prefer_gtk2" = "no" && test "$gtk_version" = "none" ; then
  722    if test "$build_gui" = "yes" ; then
  723       PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.14.0,
  724         GTK_CFLAGS=$GTK2_CFLAGS
  725         GTK_LIBS=$GTK2_LIBS
  726         CFLAGS="$CFLAGS $GTK_CFLAGS"
  727         LIBS="$LIBS $GTK_LIBS"
  728         gtk_version="2.0",
  729         build_gui="no"
  730         echo "GTK 2 >= 2.14.0 not found"
  731     )
  732    fi
  733 fi
  734 
  735 dnl
  736 dnl Mac: check for Quartz version of GTK
  737 dnl
  738 if test "$darwin_build" = "yes" ; then
  739   if test "$gtk_version" = "3.0" ; then
  740     PKG_CHECK_EXISTS(gtk+-quartz-3.0,
  741      echo "Found quartz-based GTK"
  742      AC_DEFINE(MAC_NATIVE)
  743      mac_native="yes",
  744      mac_native="no")
  745   elif test "$gtk_version" = "2.0" ; then
  746     PKG_CHECK_EXISTS(gtk+-quartz-2.0,
  747      echo "Found quartz-based GTK"
  748      AC_DEFINE(MAC_NATIVE)
  749      mac_native="yes",
  750      mac_native="no")
  751      PKG_CHECK_EXISTS(gretl-mac-themes,
  752      AC_DEFINE(HAVE_MAC_THEMES),)
  753   fi
  754   if test "$mac_native" = "yes" ; then
  755      GRETLMAC="gretl"
  756   else
  757      GRETLMAC="Gretl"
  758   fi
  759   AC_SUBST(GRETLMAC)
  760 fi
  761 
  762 dnl
  763 dnl Mac: if using Quartz GTK, require mac-integration
  764 dnl
  765 if test "$mac_native" = "yes" ; then
  766     PKG_CHECK_MODULES(GTKMAC, gtk-mac-integration >= 2.0.1,
  767       have_mac_integration="no",
  768       have_mac_integration="yes",
  769     )
  770 fi
  771 
  772 dnl
  773 dnl For native gtkspinner: check for GTK 2.20 or higher,
  774 dnl and while we're at it grab the gtk prefix
  775 dnl
  776 if test "$gtk_version" = "2.0" ; then
  777     PKG_CHECK_MODULES(GTKSPINNER, gtk+-2.0 >= 2.20.0,
  778       fake_gtkspinner="no",
  779       fake_gtkspinner="yes",
  780     )
  781     GTK_PREFIX=`$PKG_CONFIG --variable=prefix gtk+-2.0`
  782 else
  783     GTK_PREFIX=`$PKG_CONFIG --variable=prefix gtk+-3.0`
  784 fi
  785 
  786 dnl
  787 dnl Check for installed gtksourceview (GTK 2 variant)
  788 dnl
  789 if test "$gtk_version" = "2.0" ; then
  790     PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-2.0 >= 2.2.2,
  791       AC_DEFINE(USE_GTKSOURCEVIEW_2)
  792       GTKSOURCEVIEW_PREFIX=`$PKG_CONFIG --variable=prefix gtksourceview-2.0`
  793       have_sourceview="2.0",
  794       echo "version 2.0 >= 2.2.2 not found"
  795     )
  796     if test "$have_sourceview" = "2.0" ; then
  797       PKG_CHECK_MODULES(GSVWORDS, gtksourceview-2.0 >= 2.10.5,
  798         AC_DEFINE(HAVE_GTKSOURCEVIEW_210),
  799 	echo "gtksourceview: word completion not supported"
  800       )
  801     fi
  802 fi
  803 
  804 dnl
  805 dnl Check for installed gtksourceview (GTK 3 variant)
  806 dnl
  807 if test "$gtk_version" = "3.0" ; then
  808     PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-3.0,
  809       AC_DEFINE(USE_GTKSOURCEVIEW_3)
  810       GTKSOURCEVIEW_PREFIX=`$PKG_CONFIG --variable=prefix gtksourceview-3.0`
  811       have_sourceview="3.0",
  812       echo "version 3.0 not found"
  813     )
  814 fi
  815 
  816 if test x"${MSGFMT}" != x ; then
  817    build_po="yes"
  818 else
  819    echo "*** msgfmt not found, can't build message catalogs"
  820 fi
  821 
  822 dnl countermand any positive results for xdg if we're not
  823 dnl building the gretl GUI
  824 if test "$gui_disabled" = "yes" ; then
  825   use_xdg=no
  826   use_xdg_utils=no
  827 fi
  828 
  829 dnl record the results of the above tests
  830 AC_SUBST(build_gui)
  831 AC_SUBST(gtk_version)
  832 AC_SUBST(mac_native)
  833 AC_SUBST(win32_build)
  834 AC_SUBST(win32pkg)
  835 AC_SUBST(have_sourceview)
  836 AC_SUBST(fake_gtkspinner)
  837 AC_SUBST(have_gnu_regex)
  838 AC_SUBST(have_odbc)
  839 AC_SUBST(have_mpi)
  840 AC_SUBST(build_po)
  841 AC_SUBST(use_curl)
  842 AC_SUBST(use_xdg)
  843 AC_SUBST(use_xdg_utils)
  844 AC_SUBST(GLIB_CFLAGS)
  845 AC_SUBST(GLIB_LIBS)
  846 AC_SUBST(GTK_CFLAGS)
  847 AC_SUBST(GTK_LIBS)
  848 AC_SUBST(CURL_CFLAGS)
  849 AC_SUBST(CURL_LIBS)
  850 AC_SUBST(GTKSOURCEVIEW_PREFIX)
  851 AC_SUBST(GTK_PREFIX)
  852 AC_SUBST(RT_LIB)
  853 
  854 dnl Check for gdk-pixbuf support
  855 if test ${build_gui} = "yes" ; then
  856     PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= 0.7.0,
  857         pixbuf_failed="no",
  858 	pixbuf_failed="yes"
  859    )
  860 fi
  861 if test "${pixbuf_failed}" = "yes" ; then
  862     echo "* gretl needs but did not find the gdk-pixbuf library."
  863     exit 1
  864 fi
  865 
  866 dnl Check for libxml2
  867 PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.5.0)
  868 
  869 dnl Check for libxslt (for the helpfiles)
  870 if test "${build_docs}" = "yes" ; then
  871   PKG_CHECK_MODULES(XSLT, libxslt >= 1.0.15,
  872     have_xslt="yes",
  873     have_xslt="no"
  874   )
  875 fi
  876 
  877 dnl Check for libR (optional)
  878 if test "$try_libR" = "yes" ; then
  879   if test $win32_build = "yes" ; then
  880      have_libR="yes"
  881      AC_DEFINE(USE_RLIB)
  882   else
  883     PKG_CHECK_MODULES(RLIB, libR,
  884       AC_DEFINE(USE_RLIB)
  885       if echo "$RLIB_LIBS" | grep ^-L > /dev/null ; then
  886         RLIBDIR=`echo $RLIB_LIBS | cut -b 3- | awk '{ print $1 }'`
  887       else
  888         RLIBDIR="/usr/lib"
  889       fi
  890       if test "$darwin_build" = "yes" ; then
  891         RLIBNAME="libR.dylib"
  892       else
  893         RLIBNAME="libR.so"
  894       fi
  895       RLIB="${RLIBDIR}/${RLIBNAME}"
  896       AC_DEFINE_UNQUOTED(RLIBPATH, "$RLIB")
  897       have_libR="yes",
  898       have_libR="no"
  899     )
  900   fi
  901 fi
  902 
  903 dnl
  904 dnl Check for libgsf-1, if requested
  905 dnl
  906 if test "$try_gsf" = "yes" ; then
  907     PKG_CHECK_MODULES(GSF, libgsf-1 >= 1.14.31,
  908       CFLAGS="$CFLAGS $GSF_CFLAGS"
  909       LIBS="$LIBS $GSF_LIBS"
  910       AC_DEFINE(USE_GSF)
  911       use_gsf="yes",
  912       echo "libgsf >= 1.14.31 not found"
  913     )
  914 fi
  915 
  916 dnl If building docs was requested, see if we can do it
  917 if test "${build_docs}" = "yes" ; then
  918    if test "$have_xslt" = "no" || test "$have_latex" = "no" ; then
  919       build_docs="no"
  920       echo "*** Can't build gretl docs: XSLT and/or pdflatex not found"
  921    fi
  922 fi
  923 
  924 dnl If building addons was requested, see if we can do it
  925 if test "${build_addons}" = "yes" ; then
  926    if test "$have_latex" = "no" ; then
  927       build_addons="no"
  928       echo "*** Can't build gretl addons: pdflatex not found"
  929    fi
  930 fi
  931 
  932 AC_SUBST(build_docs)
  933 AC_SUBST(build_addons)
  934 AC_SUBST(quiet_build)
  935 AC_SUBST(pkg_build)
  936 AC_SUBST(swap_ends)
  937 AC_SUBST(use_gsf)
  938 
  939 GTK_HUSH=""
  940 CFLAGS=-Wno-deprecated-declarations
  941 AC_MSG_CHECKING([whether CC supports -Wno-deprecated-declarations])
  942 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
  943    [AC_MSG_RESULT([yes])]
  944    [GTK_HUSH=-Wno-deprecated-declarations],
  945    [AC_MSG_RESULT([no])]
  946 )
  947 AC_SUBST(GTK_HUSH)
  948 
  949 if test "$gtk_version" = "3.0" ; then
  950    plugsub="gretl-gtk3"
  951 else
  952    plugsub="gretl-gtk2"
  953 fi
  954 AC_SUBST(plugsub)
  955 
  956 dnl record results on various libraries
  957 AC_SUBST(XML_CFLAGS)
  958 AC_SUBST(XML_LIBS)
  959 AC_SUBST(XSLT_CFLAGS)
  960 AC_SUBST(XSLT_LIBS)
  961 AC_SUBST(GDK_PIXBUF_CFLAGS)
  962 AC_SUBST(GDK_PIXBUF_LIBS)
  963 AC_SUBST(RLIB_CFLAGS)
  964 AC_SUBST(RLIB_LIBS)
  965 AC_SUBST(RLIB)
  966 AC_SUBST(USE_SSE2)
  967 AC_SUBST(USE_AVX)
  968 
  969 dnl Determine installation prefix
  970 if test "${prefix}" = "NONE" ; then
  971    prefix="/usr/local"
  972 fi
  973 AC_DEFINE_UNQUOTED(GRETL_PREFIX, "${prefix}")
  974 
  975 if test "${gp_3d}" = "yes" ; then
  976   AC_DEFINE(GNUPLOT3D)
  977 fi
  978 
  979 CFLAGS="$orig_CFLAGS"
  980 
  981 AC_CONFIG_FILES([
  982 Makefile
  983 gretl_sh
  984 gretl.pc
  985 gui/Makefile
  986 gui/debug
  987 xdg/gretl.desktop
  988 xdg/Makefile
  989 cli/Makefile
  990 cli/debug
  991 lib/Makefile
  992 plugin/Makefile
  993 po/Makefile.in
  994 share/Makefile
  995 share/bcih/Makefile
  996 tests/Makefile
  997 extra/Makefile
  998 redhat/gretl.spec
  999 utils/emacs/Makefile
 1000 doc/gretl.sty
 1001 doc/gretl-lite.sty
 1002 ])
 1003 
 1004 if test "${darwin_build}" = "yes" ; then
 1005   AC_CONFIG_FILES([
 1006     osx/Makefile
 1007     osx/gretl.sh
 1008     osx/fixlinks.sh
 1009     osx/Info.plist
 1010   ])
 1011 fi
 1012 
 1013 if test "${win32_build}" = "yes" ; then
 1014   if test "${pkg_build}" = "yes" ; then
 1015     mingw_prefix="$MINGW_PREFIX"
 1016     AC_SUBST(prefix)
 1017     AC_SUBST(mingw_prefix)
 1018     AC_CONFIG_FILES([
 1019       win32/windist/mkiss.sh
 1020       win32/windist/post-install.sh
 1021       win32/windist/install-runtime.sh
 1022       win32/windist/install-runtime-gtk3.sh
 1023     ])
 1024   else
 1025     GHOME="${prefix}/share/gretl"
 1026     GEXEPATH="${prefix}/bin"
 1027     GEXE="${prefix}/bin/gretl.exe"
 1028     MINGWBIN="$MINGW_PREFIX/bin"
 1029     MSYSBIN="/bin"
 1030     AC_PROG_SED
 1031     AC_CHECK_PROG(CYGPATH_CHECK,cygpath,yes)
 1032     if test x"$CYGPATH_CHECK" = x"yes" ; then
 1033       GHOME=`cygpath -w $GHOME | $SED 's+\\\\+\\\\\\\\+g'`
 1034       GEXEPATH=`cygpath -w $GEXEPATH | $SED 's+\\\\+\\\\\\\\+g'`
 1035       GEXE=`cygpath -m $GEXE`
 1036       MINGWBIN=`cygpath -m $MINGWBIN`
 1037       MSYSBIN=`cygpath -m $MSYSBIN`
 1038     fi
 1039     AC_SUBST(GHOME)
 1040     AC_SUBST(GEXE)
 1041     AC_SUBST(GEXEPATH)
 1042     AC_SUBST(MINGWBIN)
 1043     AC_SUBST(MSYSBIN)
 1044     AC_CONFIG_FILES([
 1045       win32/gretlrun.cmd
 1046       win32/gretlmime.reg
 1047       win32/mkshortcut.sh
 1048     ])
 1049   fi
 1050 fi
 1051 
 1052 if test "${build_docs}" = "yes" ; then
 1053   AC_CONFIG_FILES([
 1054     doc/Makefile
 1055     doc/commands/Makefile
 1056     doc/tex/Makefile
 1057     doc/tex_it/Makefile
 1058     doc/tex_es/Makefile
 1059     doc/tex_pt/Makefile
 1060     doc/tex_gl/Makefile
 1061     doc/reference/Makefile
 1062   ])
 1063 fi
 1064 
 1065 if test "${build_addons}" = "yes" ; then
 1066   AC_CONFIG_FILES([
 1067     addons/Makefile
 1068     addons/gig/Makefile
 1069     addons/gig/pkg.inp
 1070     addons/gig/doc/Makefile
 1071     addons/HIP/Makefile
 1072     addons/HIP/pkg.inp
 1073     addons/HIP/doc/Makefile
 1074     addons/ivpanel/Makefile
 1075     addons/ivpanel/pkg.inp
 1076     addons/ivpanel/doc/Makefile
 1077     addons/SVAR/Makefile
 1078     addons/SVAR/pkg.inp
 1079     addons/SVAR/doc/Makefile
 1080     addons/dbnomics/Makefile
 1081     addons/dbnomics/pkg.inp
 1082     addons/dbnomics/doc/Makefile
 1083     addons/extra/pkg.inp
 1084     addons/extra/Makefile
 1085     addons/extra/doc/Makefile
 1086   ])
 1087 fi
 1088 
 1089 AC_OUTPUT
 1090 
 1091 if test "${have_zlib}" = "no" ; then
 1092 echo "
 1093 Please install zlib (compression library) and then reconfigure gretl.
 1094 zlib is available via http://www.info-zip.org/pub/infozip/zlib/
 1095 "
 1096 
 1097 elif test x"${XML_LIBS}" = x ; then
 1098 echo "
 1099 Please install libxml2 and then reconfigure gretl.
 1100 libxml2 is available from http://xmlsoft.org/
 1101 "
 1102 
 1103 elif test "${have_lapack}" = "no" ; then
 1104 echo "
 1105 Please install lapack and then reconfigure gretl.
 1106 Lapack is available from http://www.netlib.org/lapack/
 1107 "
 1108 
 1109 elif test "${have_fftw3}" = "no" ; then
 1110 echo "
 1111 Please install fftw3 and then reconfigure gretl.
 1112 fftw3 is available from http://www.fftw.org/
 1113 "
 1114 
 1115 elif test "${gmp_fail}" = "yes" ; then
 1116 echo "
 1117 Please install GMP and then reconfigure gretl.
 1118 GMP is available from http://gmplib.org/
 1119 "
 1120 
 1121 elif test "${mpfr_fail}" = "yes" ; then
 1122 echo "
 1123 Please install MPFR and then reconfigure gretl.
 1124 MPFR is available from http://www.mpfr.org/
 1125 "
 1126 
 1127 elif test "${have_curl}" = "no" ; then
 1128 echo "
 1129 Please install libcurl and then reconfigure gretl.
 1130 libcurl is available from http://curl.haxx.se/libcurl/
 1131 "
 1132 
 1133 elif test "${have_glib2}" = "no" ; then
 1134 echo "
 1135 Please install glib-2.0 >= 2.14.0 and then reconfigure gretl.
 1136 glib-2.0 is available from http://www.gtk.org/
 1137 "
 1138 
 1139 elif test "${gtk_version}" = "2.0" && test "${have_sourceview}" != "2.0" ; then
 1140 echo "
 1141 Please install gtksourceview-2.0 and then reconfigure gretl.
 1142 gtksourceview-2.0 is available from http://www.gnome.org/
 1143 "
 1144 
 1145 elif test "${gtk_version}" = "3.0" && test "${have_sourceview}" != "3.0" ; then
 1146 echo "
 1147 Please install gtksourceview-3.0 and then reconfigure gretl.
 1148 gtksourceview-3.0 is available from http://www.gnome.org/
 1149 "
 1150 
 1151 else
 1152   if test "${use_xdg_utils}" = "yes" ; then
 1153     xdg_utils_msg="if DESTDIR not set"
 1154   else
 1155     xdg_utils_msg="no"
 1156   fi
 1157 echo "
 1158 Configuration:
 1159 
 1160   Installation path:                      ${prefix}
 1161   Use readline library:                   ${have_readline}
 1162   Use gnuplot for graphs:                 ${have_gnuplot}
 1163   Use pdflatex for typesetting:           ${have_latex}
 1164   Use libgsf for zip/unzip:               ${use_gsf}
 1165   sse2 support for RNG:                   ${sse2_result}
 1166   OpenMP support:                         ${ac_openmp_result}
 1167   MPI support:                            ${have_mpi}
 1168   AVX support for arithmetic:             ${avx_result}
 1169   Build with GTK version:                 ${gtk_version}
 1170   Build gretl documentation:              ${build_docs}
 1171   Use Lucida fonts:                       ${use_lucida}
 1172   Build message catalogs:                 ${build_po}
 1173   Build gretl addons:                     ${build_addons}
 1174   X-12-ARIMA support:                     ${have_x12a}
 1175   TRAMO/SEATS support:                    ${have_tramo}
 1176   libR support:                           ${have_libR}
 1177   ODBC support:                           ${have_odbc}
 1178   GMP support:                            ${have_gmp}
 1179   JSON parsing support:                   ${have_json_glib}
 1180   Use xdg-utils in installation:          ${xdg_utils_msg}
 1181 
 1182   LAPACK libraries:
 1183     ${LAPACK_LIBS}
 1184 
 1185 Now type '$MAKE' to build gretl."
 1186 
 1187   if test "${build_docs}" = "yes" ; then
 1188     echo "You can also do 'make pdfdocs' to build the PDF documentation."
 1189   fi
 1190   echo
 1191 
 1192   if test "${gui_disabled}" = "no" && test "${gtk_version}" = "none" ; then
 1193     echo "*** Warning: since GTK is not available the gretl GUI will"
 1194     echo "*** not be built, only the library and command-line program."
 1195     echo
 1196   fi
 1197 
 1198   if test "$ac_openmp_result" = "yes" && test "x${blas_pthreads}" != "x"; then
 1199     echo "*** Warning: you are building gretl with OpenMP, but linking"
 1200     echo "*** against an OpenBLAS library that uses pthreads. This mixture"
 1201     echo "*** is not recommended. Ideally, OpenBLAS should use OpenMP."
 1202     echo
 1203   fi
 1204 fi