]> git.lyx.org Git - lyx.git/commitdiff
Use autoupdate to convert some obsolete calls
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 12 Jun 2019 16:10:13 +0000 (18:10 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 12 Jun 2019 16:10:13 +0000 (18:10 +0200)
AC_TRY_COMPILE and AC_TRY_LINK have been obsolete for some time.

Now most autoconf warnings are gone.

config/lyxinclude.m4
config/qt4.m4
config/spell.m4
configure.ac

index 47a1997ff012f51bafd14fa222956936e85193ab..a6298accf0e1d19f583893fe260198312e5e4b8e 100644 (file)
@@ -142,12 +142,11 @@ dnl Usage: LYX_PROG_CLANG: set CLANG to yes if the compiler is clang.
 AC_DEFUN([LYX_PROG_CLANG],
 [AC_CACHE_CHECK([whether the compiler is clang],
                [lyx_cv_prog_clang],
-[AC_TRY_COMPILE([], [
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
 #ifndef __clang__
            this is not clang
 #endif
-],
-[lyx_cv_prog_clang=yes ; CLANG=yes], [lyx_cv_prog_clang=no ; CLANG=no])])
+]])],[lyx_cv_prog_clang=yes ; CLANG=yes],[lyx_cv_prog_clang=no ; CLANG=no])])
 if test $CLANG = yes ; then
   AC_CACHE_CHECK([for clang version],
     [lyx_cv_clang_version],
@@ -176,7 +175,7 @@ AC_DEFUN([LYX_CXX_CXX11_FLAGS],
     save_CXXFLAGS=$CXXFLAGS
     CXXFLAGS="$flag $AM_CXXFLAGS $CXXFLAGS"
     dnl sample openmp source code to test
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
        template <typename T>
        struct check
        {
@@ -199,8 +198,7 @@ AC_DEFUN([LYX_CXX_CXX11_FLAGS],
        check_type c;
        check_type&& cr = static_cast<check_type&&>(c);
 
-       auto d = a;], [],
-    [lyx_cv_cxx11_flags=$flag; break])
+       auto d = a;]], [[]])],[lyx_cv_cxx11_flags=$flag; break],[])
    CXXFLAGS=$save_CXXFLAGS
    CPPFLAGS=$save_CPPFLAGS
   done])
@@ -225,20 +223,19 @@ AC_DEFUN([LYX_CXX_USE_REGEX],
    CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
    # The following code snippet has been taken taken from example in
    #   http://stackoverflow.com/questions/8561850/compile-stdregex-iterator-with-gcc
-   AC_TRY_LINK(
-     [
+   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <regex>
        #include <iostream>
 
        #include <string.h>
 
        typedef std::regex_iterator<const char *> Myiter;
-     ][
+     ]], [[
        const char *pat = "axayaz";
        Myiter::regex_type rx("a");
        Myiter next(pat, pat + strlen(pat), rx);
        Myiter end;
-   ], [lyx_std_regex=yes], [lyx_std_regex=no])
+   ]])],[lyx_std_regex=yes],[lyx_std_regex=no])
    CXXFLAGS=$save_CXXFLAGS
    CPPFLAGS=$save_CPPFLAGS
    AC_MSG_RESULT([$lyx_std_regex])
@@ -261,13 +258,12 @@ AC_DEFUN([LYX_CXX_USE_CALL_ONCE],
    CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
    save_CXXFLAGS=$CXXFLAGS
    CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
-   AC_TRY_LINK(
-     [
+   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <mutex>
        static std::once_flag flag;
-     ][
+     ]], [[
        std::call_once(flag, [](){ return; });
-   ], [lyx_std_call_once=yes], [lyx_std_call_once=no])
+   ]])],[lyx_std_call_once=yes],[lyx_std_call_once=no])
    CXXFLAGS=$save_CXXFLAGS
    CPPFLAGS=$save_CPPFLAGS
    AC_MSG_RESULT([$lyx_std_call_once])
@@ -283,12 +279,11 @@ dnl Usage: LYX_LIB_STDCXX: set lyx_cv_lib_stdcxx to yes if the STL library is li
 AC_DEFUN([LYX_LIB_STDCXX],
 [AC_CACHE_CHECK([whether STL is libstdc++],
                [lyx_cv_lib_stdcxx],
-[AC_TRY_COMPILE([#include<vector>], [
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include<vector>]], [[
 #if ! defined(__GLIBCXX__) && ! defined(__GLIBCPP__)
            this is not libstdc++
 #endif
-],
-[lyx_cv_lib_stdcxx=yes], [lyx_cv_lib_stdcxx=no])])
+]])],[lyx_cv_lib_stdcxx=yes],[lyx_cv_lib_stdcxx=no])])
 ])
 
 
@@ -297,12 +292,11 @@ dnl        if the STL library is GNU libstdc++ and the C++11 ABI is used.
 AC_DEFUN([LYX_LIB_STDCXX_CXX11_ABI],
 [AC_CACHE_CHECK([whether STL is libstdc++ using the C++11 ABI],
                [lyx_cv_lib_stdcxx_cxx11_abi],
-[AC_TRY_COMPILE([#include<vector>], [
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include<vector>]], [[
 #if ! defined(_GLIBCXX_USE_CXX11_ABI) || ! _GLIBCXX_USE_CXX11_ABI
            this is not libstdc++ using the C++11 ABI
 #endif
-],
-[lyx_cv_lib_stdcxx_cxx11_abi=yes], [lyx_cv_lib_stdcxx_cxx11_abi=no])])
+]])],[lyx_cv_lib_stdcxx_cxx11_abi=yes],[lyx_cv_lib_stdcxx_cxx11_abi=no])])
 ])
 
 
@@ -615,16 +609,16 @@ AC_DEFUN([LYX_CHECK_CALLSTACK_PRINTING],
 if test x"$lyx_cv_callstack_printing" = xyes; then
   AC_CACHE_CHECK([whether printing callstack is possible],
                 [lyx_cv_callstack_printing],
-  [AC_TRY_COMPILE([
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
   #include <execinfo.h>
   #include <cxxabi.h>
-  ][
+  ]], [[
          void* array[200];
          size_t size = backtrace(array, 200);
          backtrace_symbols(array, size);
          int status = 0;
          abi::__cxa_demangle("abcd", 0, 0, &status);
-  ],, [lyx_cv_callstack_printing=no])])
+  ]])],[],[lyx_cv_callstack_printing=no])])
 fi
 if test x"$lyx_cv_callstack_printing" = xyes; then
   AC_DEFINE([LYX_CALLSTACK_PRINTING], 1,
@@ -840,13 +834,12 @@ AC_DEFUN([AC_FUNC_MKDIR],
 [AC_CHECK_FUNCS([mkdir _mkdir])
 AC_CACHE_CHECK([whether mkdir takes one argument],
                [ac_cv_mkdir_takes_one_arg],
-[AC_TRY_COMPILE([
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/stat.h>
 #if HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
-], [mkdir (".");],
-[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
+]], [[mkdir (".");]])],[ac_cv_mkdir_takes_one_arg=yes],[ac_cv_mkdir_takes_one_arg=no])])
 if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
   AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
             [Define if mkdir takes only one argument.])
@@ -914,9 +907,7 @@ AC_DEFUN([LYX_CHECK_DEF],
  save_CXXFLAGS=$CXXFLAGS
  CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
  AC_LANG_PUSH(C++)
- AC_TRY_COMPILE([#include <$2>], [$3],
-     lyx_have_def_name=yes,
-     lyx_have_def_name=no)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$2>]], [[$3]])],[lyx_have_def_name=yes],[lyx_have_def_name=no])
  AC_LANG_POP(C++)
  CXXFLAGS=$save_CXXFLAGS
  CPPFLAGS=$save_CPPFLAGS
index a737015916ea0616cbd5764f4cd5a7ea6d394868..6e2d6bcd3fcf762b6cb21544078a3c4d05ee4625 100644 (file)
@@ -3,18 +3,15 @@ AC_DEFUN([QT_TRY_LINK],
 [
        SAVE_LIBS="$LIBS"
        LIBS="$LIBS $1"
-       AC_TRY_LINK([
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <qglobal.h>
        #include <qstring.h>
-               ],
-       [
+               ]], [[
        QString s("mangle_failure");
        #if (QT_VERSION < 400)
        break_me_(\\\);
        #endif
-       ],
-       qt_cv_libname=$1,
-       )
+       ]])],[qt_cv_libname=$1],[])
        LIBS="$SAVE_LIBS"
 ])
 
index 3cefc82ee697587f3c122381be12fc2495f18b9d..ad8fe4332bcb2912a274b33336e6106bcd36e6c3 100644 (file)
@@ -29,12 +29,9 @@ AC_DEFUN([LYX_HAVE_ENCHANT2],
   save_CXXFLAGS=$CXXFLAGS
   CXXFLAGS="$ENCHANT_CFLAGS $AM_CXXFLAGS $CXXFLAGS"
 
-  AC_TRY_COMPILE([#include <enchant++.h>],
-      [enchant::Broker broker;],
-      [AC_MSG_RESULT(yes)
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <enchant++.h>]], [[enchant::Broker broker;]])],[AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_ENCHANT2, 1, [Define to 1 if enchant 2.x is detected])
-      ],
-      [AC_MSG_RESULT(no)])
+      ],[AC_MSG_RESULT(no)])
   CXXFLAGS=$save_CXXFLAGS
 ])
 
@@ -67,14 +64,11 @@ AC_DEFUN([LYX_HAVE_HUNSPELL_CXXABI],
   CXXFLAGS="$ENCHANT_CFLAGS $AM_CXXFLAGS $CXXFLAGS"
 
 # in the C++ ABI, stem() returns a vector, in the C ABI, it returns an int
-  AC_TRY_COMPILE([#include <hunspell/hunspell.hxx>],
-      [Hunspell sp("foo", "bar");
-       int i = sp.stem("test").size();],
-      [AC_MSG_RESULT(yes)
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hunspell/hunspell.hxx>]], [[Hunspell sp("foo", "bar");
+       int i = sp.stem("test").size();]])],[AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_HUNSPELL_CXXABI, 1, [Define to 1 if hunspell C++ (rather than C) ABI is detected])
        have_hunspell_cxx_abi=yes
-      ],
-      [AC_MSG_RESULT(no)])
+      ],[AC_MSG_RESULT(no)])
   CXXFLAGS=$save_CXXFLAGS
 ])
 
index b0f8d25851fa040d4084a6e17c2d5bee56419892..7bf598db44eb85c51b6f39aa636cc6c18e63a9bb 100644 (file)
@@ -1,10 +1,10 @@
 dnl Process with autoconf to generate configure script   -*- sh -*-
 
-AC_INIT(LyX,2.4.0dev,[lyx-devel@lists.lyx.org],[lyx])
+AC_INIT([LyX],[2.4.0dev],[lyx-devel@lists.lyx.org],[lyx])
 AC_PRESERVE_HELP_ORDER
 # Use ISO format only. The frontend needs to parse this
 AC_SUBST(LYX_DATE, ["2018-02-24"])
-AC_PREREQ(2.65)
+AC_PREREQ([2.65])
 AC_CONFIG_SRCDIR(src/main.cpp)
 AC_CONFIG_HEADERS([config.h])
 
@@ -110,9 +110,8 @@ AC_CHECK_SIZEOF(wchar_t)
 
 # Taken from gettext, needed for libiconv
 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
-   [AC_TRY_COMPILE([#include <stddef.h>
-      wchar_t foo = (wchar_t)'\0';], ,
-      [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
+   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
+      wchar_t foo = (wchar_t)'\0';]], [[]])],[gt_cv_c_wchar_t=yes],[gt_cv_c_wchar_t=no])])
 if test $gt_cv_c_wchar_t = yes; then
   AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
   HAVE_WCHAR_T=1