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
+echo "configuring LyX version" AC_PACKAGE_VERSION
+if echo AC_PACKAGE_VERSION | grep 'svn' >/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
+if echo AC_PACKAGE_VERSION | grep 'pre' > /dev/null ; then
lyx_prerelease=yes
echo "WARNING: This is a prerelease. Be careful and backup your documents."
else
dnl
dnl
AC_DEFUN([LYX_VERSION_SUFFIX],[
-AC_MSG_CHECKING([for install target ... ])
+AC_MSG_CHECKING([for version suffix])
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])
+ version_suffix=$withval
+ RPM_VERSION_SUFFIX="--with-version-suffix=$withval"])
AC_SUBST(RPM_VERSION_SUFFIX)
-AC_MSG_RESULT([$lyxname])
+AC_MSG_RESULT([$withval])
])
enable_warnings=no;
fi;])
if test x$enable_warnings = xyes ; then
- lyx_flags="$lyx_flags warnings"
+ 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])
### We might want to disable debug
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debug information]),,
- [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes && test $ac_cv_prog_gxx = yes ; then
+ [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
enable_debug=yes;
else
enable_debug=no;
fi;])
+AC_ARG_ENABLE(stdlib-debug,
+ AC_HELP_STRING([--enable-stdlib-debug],[enable debug mode in the standard library]),,
+ [ if test $lyx_devel_version = yes ; then
+ enable_stdlib_debug=yes;
+ else
+ enable_stdlib_debug=no;
+ fi;])
+
+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
+ enable_concept_checks=yes;
+ else
+ enable_concept_checks=no;
+ fi;])
+
+AC_ARG_ENABLE(profiling,
+ AC_HELP_STRING([--enable-profiling],[enable profiling]),,
+ enable_profiling=no;)
+
### set up optimization
AC_ARG_ENABLE(optimization,
- AC_HELP_STRING([--enable-optimization[=value]],[enable compiler optimisation]),,
- enable_optimization=yes;)
+ AC_HELP_STRING([--enable-optimization[=value]],[enable compiler optimisation]),,
+ enable_optimization=yes;)
case $enable_optimization in
- yes) lyx_opt=-O;;
- no) lyx_opt=;;
+ yes)
+ if test $lyx_devel_version = yes ; then
+ lyx_opt=-O
+ else
+ lyx_opt=-O2
+ fi;;
+ no) lyx_opt=;;
*) lyx_opt=${enable_optimization};;
esac
+AC_ARG_ENABLE(pch,
+ AC_HELP_STRING([--enable-pch],[enable precompiled headers]),,
+ enable_pch=yes;)
lyx_pch_comp=no
-# set the debug flags correctly.
+# set the compiler options correctly.
if test x$GXX = xyes; then
dnl Useful for global version info
gxx_version=`${CXX} -dumpversion`
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
else
+ CFLAGS="$lyx_opt"
+ CXXFLAGS="$lyx_opt"
+ if test x$enable_debug = xyes ; then
+ CFLAGS="-g $CFLAGS"
+ CXXFLAGS="-g $CXXFLAGS"
+ fi
+ if test x$enable_profiling = xyes ; then
+ CFLAGS="-pg $CFLAGS"
+ CXXFLAGS="-pg $CXXFLAGS"
+ LDFLAGS="-pg $LDFLAGS"
+ fi
+ if test x$enable_warnings = xyes ; then
+ case $gxx_version in
+ 3.1*|3.2*|3.3*)
+ CPPFLAGS="-W -Wall $CPPFLAGS"
+ ;;
+ *)
+ CPPFLAGS="-Wextra -Wall $CPPFLAGS "
+ ;;
+ esac
+ fi
+ fi
+ case $gxx_version in
+ 3.1*) AM_CXXFLAGS="-finline-limit=500 ";;
+ 3.2*|3.3*) AM_CXXFLAGS="";;
+ 3.4*|4.0*)
+ 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
- 2.95.1) CXXFLAGS="$lyx_opt -fpermissive -ftemplate-depth-30";;
- 2.95.*) CXXFLAGS="$lyx_opt -Wno-non-template-friend -ftemplate-depth-30";;
- 2.96*) CXXFLAGS="$lyx_opt -fno-exceptions -ftemplate-depth-30 -Wno-non-template-friend";;
- 3.0*) CXXFLAGS="$lyx_opt";;
- 3.1*) CXXFLAGS="$lyx_opt -finline-limit=500 -fno-exceptions";;
- 3.2*) CXXFLAGS="$lyx_opt -fno-exceptions";;
- 3.3*) CXXFLAGS="$lyx_opt -fno-exceptions";;
3.4*|4.0*)
- CXXFLAGS="$lyx_opt -fno-exceptions"
- lyx_pch_comp=yes;;
- *) CXXFLAGS="$lyx_opt";;
+ lyx_flags="stdlib-debug $lyx_flags"
+ AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode])
+ AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode])
+ ;;
esac
- if test x$enable_debug = xyes ; then
- case $gxx_version in
- 3.3*) CXXFLAGS="-g $CXXFLAGS"
- AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
- ;;
- 3.4*|4.0*) CXXFLAGS="-g $CXXFLAGS"
- AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
- AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode])
- AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode])
- ;;
- *) CXXFLAGS="-g $CXXFLAGS";;
- esac
- fi
fi
- if test x$enable_warnings = xyes ; then
+ if test x$enable_concept_checks = xyes ; then
case $gxx_version in
- 2.95.*) CPPFLAGS="$CPPFLAGS -W -Wall";;
- 2.96*) CPPFLAGS="$CPPFLAGS -W -Wall";;
- 3.1*) CPPFLAGS="$CPPFLAGS -W -Wall";;
- 3.2*) CPPFLAGS="$CPPFLAGS -W -Wall";;
- 3.3*) CPPFLAGS="$CPPFLAGS -W -Wall";;
- *) CPPFLAGS="$CPPFLAGS -Wextra -Wall";;
+ 3.3*)
+ lyx_flags="concept-checks $lyx_flags"
+ AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
+ ;;
+ 3.4*|4.0*)
+ lyx_flags="concept-checks $lyx_flags"
+ AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
+ ;;
esac
fi
fi
+test "$lyx_pch_comp" = yes && lyx_flags="pch $lyx_flags"
AM_CONDITIONAL(LYX_BUILD_PCH, test "$lyx_pch_comp" = yes)
])dnl
])
-dnl Usage: LYX_CXX_CHEADERS : checks whether the C++ compiler
-dnl provides wrappers for C headers and use our alternate version otherwise.
-AC_DEFUN([LYX_CXX_CHEADERS],[
-AC_CACHE_CHECK(for C headers wrappers,lyx_cv_cxx_cheaders,
- [AC_TRY_CPP([
-#include <clocale>
-#include <cctype>
-#include <cerrno>
-#include <cmath>
-#include <csignal>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>],[lyx_cv_cxx_cheaders=yes],[lyx_cv_cxx_cheaders=no])])
-if test $lyx_cv_cxx_cheaders = no ; then
- LYX_ADD_INC_DIR(lyx_cppflags,\$(top_srcdir)/src/cheaders)
-fi])
-
-
dnl Usage: LYX_CXX_GLOBAL_CSTD: checks whether C library functions
dnl are already in the global namespace
AC_DEFUN([LYX_CXX_GLOBAL_CSTD],[
AC_ARG_WITH(frontend,
[ --with-frontend=THIS Use THIS frontend as main GUI:
Possible values: xforms, qt, gtk(EXPERIMENTAL)],
- [FRONTENDS="$withval"], [FRONTENDS="xforms"])
+ [FRONTENDS="$withval"])
+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)
])
+## Check what kind of packaging should be used at install time.
+## The default is autodetected.
+AC_DEFUN([LYX_USE_PACKAGING],
+[AC_MSG_CHECKING([what packaging should be used])
+AC_ARG_WITH(packaging,
+ [ --with-packaging=THIS Use THIS packaging for installation:
+ Possible values: posix, windows, macosx],
+ [lyx_use_packaging="$withval"], [
+ case $host in
+ *-apple-darwin*) lyx_use_packaging=macosx ;;
+ *-pc-mingw32*) lyx_use_packaging=windows;;
+ *) lyx_use_packaging=posix;;
+ esac])
+AC_MSG_RESULT($lyx_use_packaging)
+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])
+ PACKAGE=LyX${version_suffix}
+ default_prefix="/Applications/${PACKAGE}.app"
+ bindir='${prefix}/Contents/MacOS'
+ libdir='${prefix}/Contents/Resources'
+ datadir='${prefix}/Contents/Resources'
+ pkgdatadir='${datadir}'
+ mandir='${datadir}/man' ;;
+ windows) AC_DEFINE(USE_WINDOWS_PACKAGING, 1, [Define to 1 if LyX should use a Windows-style file layout])
+ PACKAGE=LyX${version_suffix}
+ program_suffix=$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
+AC_SUBST(pkgdatadir)
+])
+
## ------------------------------------------------------------------------
## Find a file (or one of more files in a list of dirs)
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"
])
+
+
+## ------------------------------------------------------------------------
+## Check whether mkdir() is mkdir or _mkdir, and whether it takes
+## one or two arguments.
+##
+## http://ac-archive.sourceforge.net/C_Support/ac_func_mkdir.html
+## ------------------------------------------------------------------------
+##
+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([
+#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])])
+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.])
+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?/*$[]??'`
+])