]> git.lyx.org Git - lyx.git/blobdiff - config/lyxinclude.m4
Fixed some lines that were too long. It compiled afterwards.
[lyx.git] / config / lyxinclude.m4
index 274a738bad4bbe455f04f24e17a9b419b1a409da..4eb93d755b4b0a6095fc36f5cf10406265494660 100644 (file)
@@ -7,20 +7,17 @@ dnl         Allan Rae (rae@lyx.org)
 dnl Usage LYX_CHECK_VERSION   Displays version of LyX being built and
 dnl sets variables "lyx_devel_version" and "lyx_prerelease"
 AC_DEFUN([LYX_CHECK_VERSION],[
-echo "configuring LyX version $VERSION"
-if echo "$VERSION" | grep 'cvs' >/dev/null ; then
-  lyx_devel_version=yes
-  AC_DEFINE(DEVEL_VERSION, 1, [Define if you are building a development version of LyX])
-  echo "WARNING: This is a development version. Expect bugs."
-else
-  lyx_devel_version=no
-fi
-if echo "$VERSION" | grep 'pre' > /dev/null ; then
-    lyx_prerelease=yes
-    echo "WARNING: This is a prerelease. Be careful and backup your documents."
-else
-    lyx_prerelease=no
-fi
+echo "configuring LyX version" AC_PACKAGE_VERSION
+lyx_devel_version=no
+lyx_prerelease=no
+case AC_PACKAGE_VERSION in
+  *svn*) lyx_devel_version=yes
+         AC_DEFINE(DEVEL_VERSION, 1, [Define if you are building a development version of LyX])
+         LYX_DATE="not released yet"
+         echo "WARNING: This is a development version. Expect bugs.";;
+  *pre*|*alpha*|*beta*|*rc*) lyx_prerelease=yes
+        echo "WARNING: This is a prerelease. Be careful and backup your documents.";;
+esac
 AC_SUBST(lyx_devel_version)])
 
 
@@ -28,21 +25,20 @@ dnl Define the option to set a LyX version on installed executables and director
 dnl
 dnl
 AC_DEFUN([LYX_VERSION_SUFFIX],[
-AC_MSG_CHECKING([for install target ... ])
+AC_MSG_CHECKING([for version suffix])
+dnl We need the literal double quotes in the rpm spec file
 RPM_VERSION_SUFFIX='""'
 AC_ARG_WITH(version-suffix,
   [  --with-version-suffix[=<version>]  install lyx files as lyx<version>],
   [if test "x$withval" = "xyes";
    then
-     withval="-$VERSION"
+     withval="-"AC_PACKAGE_VERSION
      ac_configure_args=`echo $ac_configure_args | sed "s,--with-version-suffix,--with-version-suffix=$withval,"`
    fi
-   lyxname="lyx$withval"
-   program_suffix=$withval
-   RPM_VERSION_SUFFIX="--with-version-suffix=$withval"],
-  [lyxname=lyx])
+   AC_SUBST(version_suffix,$withval)
+   RPM_VERSION_SUFFIX="--with-version-suffix=$withval"])
 AC_SUBST(RPM_VERSION_SUFFIX)
-AC_MSG_RESULT([$lyxname])
+AC_MSG_RESULT([$withval])
 ])
 
 
@@ -74,6 +70,14 @@ LYX_ERROR([Cannot find $1. Please check that the $2 library
 dnl Usage: LYX_CHECK_ERRORS  Displays a warning message if a LYX_ERROR
 dnl   has occured previously.
 AC_DEFUN([LYX_CHECK_ERRORS],[
+if test x$lyx_warning = xyes; then
+cat <<EOF
+=== The following minor problems have been detected by configure.
+=== Please check the messages below before running 'make'.
+=== (see the section 'Problems' in the INSTALL file)
+$lyx_warning_txt
+EOF
+fi
 if test x$lyx_error = xyes; then
 cat <<EOF
 **** The following problems have been detected by configure.
@@ -82,16 +86,9 @@ cat <<EOF
 $lyx_error_txt
 $lyx_warning_txt
 EOF
+exit 1
 else
 
-if test x$lyx_warning = xyes; then
-cat <<EOF
-=== The following minor problems have been detected by configure.
-=== Please check the messages below before running 'make'.
-=== (see the section 'Problems' in the INSTALL file)
-$lyx_warning_txt
-EOF
-fi
 cat <<EOF
 Configuration of LyX was successful.
 Type 'make' to compile the program,
@@ -170,9 +167,6 @@ AC_ARG_ENABLE(warnings,
     fi;])
 if test x$enable_warnings = xyes ; then
   lyx_flags="warnings $lyx_flags"
-  AC_DEFINE(WITH_WARNINGS, 1,
-  [Define this if you want to see the warning directives put here and
-   there by the developpers to get attention])
 fi
 
 ### We might want to disable debug
@@ -186,7 +180,7 @@ AC_ARG_ENABLE(debug,
 
 AC_ARG_ENABLE(stdlib-debug,
   AC_HELP_STRING([--enable-stdlib-debug],[enable debug mode in the standard library]),,
-  [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
+  [ if test $lyx_devel_version = yes ; then
       enable_stdlib_debug=yes;
     else
       enable_stdlib_debug=no;
@@ -194,7 +188,7 @@ AC_ARG_ENABLE(stdlib-debug,
 
 AC_ARG_ENABLE(concept-checks,
   AC_HELP_STRING([--enable-concept-checks],[enable concept checks]),,
-  [ if test $lyx_devel_version = yes -o $lyx-prerelease = yes ; then
+  [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
        enable_concept_checks=yes;
     else
         enable_concept_checks=no;
@@ -244,9 +238,11 @@ if test x$GXX = xyes; then
         CXXFLAGS="-pg $CXXFLAGS"
         LDFLAGS="-pg $LDFLAGS"
     fi
+  fi
+  if test "$ac_env_CPPFLAGS_set" != set; then
     if test x$enable_warnings = xyes ; then
         case $gxx_version in
-            2.*|3.1*|3.2*|3.3*)
+            3.1*|3.2*|3.3*)
                 CPPFLAGS="-W -Wall $CPPFLAGS"
                 ;;
             *)
@@ -256,20 +252,17 @@ if test x$GXX = xyes; then
     fi
   fi
   case $gxx_version in
-      2.95.1)  AM_CXXFLAGS="-fpermissive -ftemplate-depth-30";;
-      2.95.*)  AM_CXXFLAGS="-Wno-non-template-friend -ftemplate-depth-30";;
-      2.96*)  AM_CXXFLAGS="-fno-exceptions -ftemplate-depth-30 -Wno-non-template-friend";;
-      3.1*)    AM_CXXFLAGS="-finline-limit=500 -fno-exceptions";;
-      3.2*|3.3*)    AM_CXXFLAGS="-fno-exceptions";;
-      3.4*|4.0*)
-          AM_CXXFLAGS="-fno-exceptions"
+      3.1*)    AM_CXXFLAGS="-finline-limit=500 ";;
+      3.2*|3.3*)    AM_CXXFLAGS="";;
+      3.4*|4.*)
+          AM_CXXFLAGS=""
           test $enable_pch = yes && lyx_pch_comp=yes
           ;;
       *)       AM_CXXFLAGS="";;
   esac
   if test x$enable_stdlib_debug = xyes ; then
     case $gxx_version in
-      3.4*|4.0*)
+      3.4*|4.*)
         lyx_flags="stdlib-debug $lyx_flags"
        AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode])
        AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode])
@@ -282,7 +275,7 @@ if test x$GXX = xyes; then
         lyx_flags="concept-checks $lyx_flags"
         AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
        ;;
-      3.4*|4.0*)
+      3.4*|4.*)
         lyx_flags="concept-checks $lyx_flags"
        AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
        ;;
@@ -415,7 +408,7 @@ dnl Usage: LYX_USE_INCLUDED_BOOST : select if the included boost should
 dnl        be used.
 AC_DEFUN([LYX_USE_INCLUDED_BOOST],[
        AC_ARG_WITH(included-boost,
-           [  --with-included-boost  use the boost lib supplied with LyX],
+           [  --without-included-boost  do not use the boost lib supplied with LyX, try to find one in the system directories - compilation will abort if nothing suitable is found],
            [lyx_cv_with_included_boost=$withval
                AC_MSG_RESULT([$with_included_boost])],
            [lyx_cv_with_included_boost=yes])
@@ -475,7 +468,7 @@ dnl                       [default-yes-value])
 dnl  Adds a --with-'dir-name' option (described by 'desc') and puts the
 dnl  resulting directory name in 'dir-var-name'.
 AC_DEFUN([LYX_WITH_DIR],[
-  AC_ARG_WITH($1,[  --with-$1        specify $2])
+  AC_ARG_WITH($1,[AC_HELP_STRING([--with-$1],[specify $2])])
   AC_MSG_CHECKING([for $2])
   if test -z "$with_$3"; then
      AC_CACHE_VAL(lyx_cv_$3, lyx_cv_$3=$4)
@@ -552,14 +545,18 @@ rm -f conftest*])
 ])
 ### end of LYX_PATH_HEADER
 
-### Check which frontends we want to use. The default is XForms only
+### Check which frontends we want to use.
 ###
 AC_DEFUN([LYX_USE_FRONTENDS],
 [AC_MSG_CHECKING([what frontend should be used for the GUI])
 AC_ARG_WITH(frontend,
   [  --with-frontend=THIS    Use THIS frontend as main GUI:
-                           Possible values: xforms, qt, gtk(EXPERIMENTAL)],
-  [FRONTENDS="$withval"], [FRONTENDS="xforms"])
+                           Possible values: qt4],
+  [FRONTENDS="$withval"],[FRONTENDS="qt4"])
+if test "x$FRONTENDS" = x ; then
+  AC_MSG_RESULT(none)
+  AC_ERROR("Please select a frontend using --with-frontend")
+fi
 AC_MSG_RESULT($FRONTENDS)
 AC_SUBST(FRONTENDS)
 AC_SUBST(FRONTENDS_SUBDIRS)
@@ -581,23 +578,35 @@ AC_ARG_WITH(packaging,
                   *) lyx_use_packaging=posix;;
   esac])
 AC_MSG_RESULT($lyx_use_packaging)
+lyx_install_macosx=false
 case $lyx_use_packaging in
    macosx) AC_DEFINE(USE_MACOSX_PACKAGING, 1, [Define to 1 if LyX should use a MacOS X application bundle file layout])
-           default_prefix="/Applications/LyX.app"
+          PACKAGE=LyX${version_suffix}
+          default_prefix="/Applications/${PACKAGE}.app"
           bindir='${prefix}/Contents/MacOS'
           libdir='${prefix}/Contents/Resources'
           datadir='${prefix}/Contents/Resources'
-          mandir='${prefix}/Contents/Resources/man' ;;
+          pkgdatadir='${datadir}'
+          mandir='${datadir}/man' 
+          lyx_install_macosx=true ;;
   windows) AC_DEFINE(USE_WINDOWS_PACKAGING, 1, [Define to 1 if LyX should use a Windows-style file layout])
-           default_prefix="C:/Program Files/LyX"
+          PACKAGE=LyX${version_suffix}
+          default_prefix="C:/Program Files/${PACKAGE}"
           bindir='${prefix}/bin'
           libdir='${prefix}/Resources'
           datadir='${prefix}/Resources'
+          pkgdatadir='${datadir}'
           mandir='${prefix}/Resources/man' ;;
     posix) AC_DEFINE(USE_POSIX_PACKAGING, 1, [Define to 1 if LyX should use a POSIX-style file layout])
+          PACKAGE=lyx${version_suffix}
+          program_suffix=$version_suffix
+          pkgdatadir='${datadir}/${PACKAGE}'
           default_prefix=$ac_default_prefix ;;
     *) LYX_ERROR([Unknown packaging type $lyx_use_packaging]) ;;
 esac
+AM_CONDITIONAL(INSTALL_MACOSX, $lyx_install_macosx)
+AC_SUBST(pkgdatadir)
+AC_SUBST(program_suffix)
 ])
 
 
@@ -631,7 +640,7 @@ ac_save_cc=$CC
 ac_save_cflags="$CFLAGS"
 CC=$CXX
 CFLAGS="$CXXFLAGS"
-AM_PROG_LIBTOOL dnl for libraries
+AC_PROG_LIBTOOL dnl for libraries
 CC=$ac_save_cc
 CFLAGS="$ac_save_cflags"
 ])
@@ -660,3 +669,48 @@ if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
             [Define if mkdir takes only one argument.])
 fi
 ])
+
+
+dnl Set VAR to the canonically resolved absolute equivalent of PATHNAME,
+dnl (which may be a relative path, and need not refer to any existing 
+dnl entity).
+
+dnl On Win32-MSYS build hosts, the returned path is resolved to its true
+dnl native Win32 path name, (but with slashes, not backslashes).
+
+dnl On any other system, it is simply the result which would be obtained
+dnl if PATHNAME represented an existing directory, and the pwd command was
+dnl executed in that directory.
+AC_DEFUN([MSYS_AC_CANONICAL_PATH],
+[ac_dir="$2"
+ ( exec 2>/dev/null; cd / && pwd -W ) | grep ':' >/dev/null &&
+    ac_pwd_w="pwd -W" || ac_pwd_w=pwd
+ until ac_val=`exec 2>/dev/null; cd "$ac_dir" && $ac_pwd_w`
+ do
+   ac_dir=`AS_DIRNAME(["$ac_dir"])`
+ done
+ ac_dir=`echo "$ac_dir" | sed 's?^[[./]]*??'`
+ ac_val=`echo "$ac_val" | sed 's?/*$[]??'`
+ $1=`echo "$2" | sed "s?^[[./]]*$ac_dir/*?$ac_val/?"'
+   s?/*$[]??'`
+])
+
+dnl this is used by the macro blow to general a proper config.h.in entry
+m4_define([LYX_AH_CHECK_DECL],
+[AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_$1),
+  [Define if you have the prototype for function `$1'])])
+
+dnl Check things are declared in headers to avoid errors or warnings.
+dnl Called like LYX_CHECK_DECL(function, header1 header2...)
+dnl Defines HAVE_DECL_{FUNCTION}
+AC_DEFUN([LYX_CHECK_DECL],
+[LYX_AH_CHECK_DECL($1)
+for ac_header in $2
+do
+  AC_MSG_CHECKING([if $1 is declared by header $ac_header])
+  AC_EGREP_HEADER($1, $ac_header,
+      [AC_MSG_RESULT(yes)
+       AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_DECL_$1))
+       break],
+      [AC_MSG_RESULT(no)])
+done])