]> git.lyx.org Git - lyx.git/blobdiff - acinclude.m4
patch from Dekel
[lyx.git] / acinclude.m4
index c45ad717009eb8c01861b0a91b38f3cb698395a4..ac8165def8da673ab01613e99fda1a5e1e0e6dd8 100644 (file)
@@ -176,29 +176,33 @@ dnl normal versions of a library), tasteless as that idea is.
   ac_save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS=
 dnl Check the version of g++
-  gxx_version=`g++ --version`
+  gxx_version=`${CXX} --version`
   
   AC_PROG_CXX_G
   if test "$ac_test_CXXFLAGS" = set; then
     CXXFLAGS="$ac_save_CXXFLAGS"
   elif test $ac_cv_prog_cxx_g = yes; then
     case $gxx_version in
-      2.7*) CXXFLAGS="$lyx_opt";;
-      2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
-      2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti";;
-      *)    CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
+      2.95.1)  CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";;
+      2.95.*)  CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      2.96*)   CXXFLAGS="-g $lyx_opt -fhonor-std";;
+      *2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
+      *)       CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
     esac
   else
     CXXFLAGS="$lyx_opt"
   fi
   if test x$with_warnings = xyes ; then
     case $gxx_version in
-       2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
-       *) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";;
+       2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
+       2.96*)  CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
+       *)      CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
     esac
     if test $lyx_devel_version = yes ; then
        case $gxx_version in
            2.95.*) ;;
+           2.96*) ;;
+           *2.91*) ;;
            *) CXXFLAGS="$CXXFLAGS -pedantic";;
         esac
     fi
@@ -341,8 +345,10 @@ AC_DEFUN(LYX_CXX_STL_STRING,[
            using std::string;
        ],[
            string a("hello there");
-           a.clear();
+           a.erase();
            a = "hey";
+           char s[] = "y";
+           int t = a.compare(a.length() - 1, 1, s);
            a.erase();
        ],[
            with_included_string=no
@@ -425,10 +431,11 @@ dnl   good enough to suit our needs.
 AC_DEFUN(LYX_CXX_NAMESPACES,[
 AC_CACHE_CHECK(for correct namespaces support,lyx_cv_cxx_namespace,
  [AC_TRY_COMPILE([
-  #include <vector>
-  using std::vector;
+  namespace foo {
+    int bar;
+  }
 ],[
-       vector<int> test;
+        foo::bar = 0;
        return 0;
 ],lyx_cv_cxx_namespace=yes,lyx_cv_cxx_namespace=no)
 ])
@@ -540,23 +547,18 @@ lyx_cv_xfversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
   sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'`
 rm -f conftest*])
 case "$lyx_cv_xfversion" in 
-  "(unknown)"|0.82|0.83|0.84|0.85
-     LYX_ERROR(dnl
+  "(unknown)"|0.8[1-7]
+         LYX_ERROR(dnl
 Version $lyx_cv_xfversion of xforms is not compatible with LyX. 
-   This version of LyX works best with version 0.88[,] although it
-   supports also versions 0.81[,] 0.86 and 0.87.) ;;
-  0.81|0.86|0.87) 
-     LYX_WARNING(dnl
-While LyX is compatible with version $lyx_cv_xfversion of xforms[,] 
-   it is recommended that you upgrade to version 0.88.) ;;
-     0.88) ;;
-     0.89) LYX_WARNING(dnl
+   This version of LyX works best with versions 0.88 (recommended) and later.) ;;
+    0.88) ;;
+    0.89) LYX_WARNING(dnl
 LyX should work ok with version $lyx_cv_xfversion of xforms[,] but
 it is an unproven version and might still have some bugs. If you
 have problems[,] please use version 0.88 instead.) ;;
-          *) LYX_WARNING(dnl
+       *) LYX_WARNING(dnl
 Version $lyx_cv_xfversion of xforms might not be compatible with LyX[,] 
  since it is newer than 0.88. You might have slight problems with it.);;
+ since it is newer than 0.88. You might have slight problems with it.);;
 esac
 fi])
 
@@ -616,8 +618,9 @@ AC_DEFUN(LYX_FUNC_PUTENV_ARGTYPE,
 [AC_MSG_CHECKING([type of argument for putenv()])
  AC_CACHE_VAL(lyx_cv_func_putenv_arg,dnl
   [AC_TRY_COMPILE(dnl
-[#include <cstdlib>
-extern int putenv(const char *);],,dnl
+[#include <cstdlib>],
+[char const * foo = "bar";
+ putenv(foo);],dnl
    [lyx_cv_func_putenv_arg='char const *'],[lyx_cv_func_putenv_arg='char *'])])
  AC_MSG_RESULT($lyx_cv_func_putenv_arg)
  AC_DEFINE_UNQUOTED(PUTENV_TYPE_ARG,$lyx_cv_func_putenv_arg,dnl
@@ -784,7 +787,6 @@ extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func
  AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5))
 ])
 
-### BEGIN libtool.m4
 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
@@ -1215,9 +1217,6 @@ AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
 
 dnl This is just to silence aclocal about the macro not being used
 ifelse([AC_DISABLE_FAST_INSTALL])dnl
-
-### END libtool.m4
-
 # Macro to add for using GNU gettext.
 # Ulrich Drepper <drepper@cygnus.com>, 1995.
 #
@@ -1269,7 +1268,11 @@ AC_DEFUN(AM_WITH_NLS,
               [AC_CACHE_CHECK([for gettext in libintl],
                 gt_cv_func_gettext_libintl,
                 [AC_CHECK_LIB(intl, gettext,
-                 gt_cv_func_gettext_libintl=yes,
+dnl ============== A fix is here! ======================
+dnl -lintl was not added to the LIBS variable in this case
+                 [gt_cv_func_gettext_libintl=yes
+                  INTLLIBS="-lintl"],
+dnl ==== end of fix
                  gt_cv_func_gettext_libintl=no)],
                 gt_cv_func_gettext_libintl=no)])
           fi
@@ -1447,11 +1450,12 @@ strdup __argz_count __argz_stringify __argz_next])
      else
        AC_MSG_CHECKING(for catalogs to be installed)
        NEW_LINGUAS=
-dnl ============== Fix is here! =======================
+dnl ============== Fix is here! ======================
 dnl Some sh do not like substitution in bounds of for loops
-dnl       for lang in ${LINGUAS=$ALL_LINGUAS}; do
+dnl    for lang in ${LINGUAS=$ALL_LINGUAS}; do
     tmplinguas=${LINGUAS=$ALL_LINGUAS}
     for lang in ${tmplinguas}; do
+dnl ==== end of fix
          case "$ALL_LINGUAS" in
           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
          esac
@@ -1537,3 +1541,69 @@ dnl       for lang in ${LINGUAS=$ALL_LINGUAS}; do
    sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
        < $srcdir/po/POTFILES.in > po/POTFILES
   ])
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+AC_DEFUN(AM_LC_MESSAGES,
+  [if test $ac_cv_header_locale_h = yes; then
+    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+    if test $am_cv_val_LC_MESSAGES = yes; then
+      AC_DEFINE(HAVE_LC_MESSAGES)
+    fi
+  fi])
+# Search path for a program which passes the given test.
+# Ulrich Drepper <drepper@cygnus.com>, 1996.
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN(AM_PATH_PROG_WITH_TEST,
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+  /*)
+  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in ifelse([$5], , $PATH, [$5]); do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if [$3]; then
+       ac_cv_path_$1="$ac_dir/$ac_word"
+       break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+  ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test -n "[$]$1"; then
+  AC_MSG_RESULT([$]$1)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])