X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=config%2Flyxinclude.m4;h=e022616aeb810a18e71f69b286497704b7031e85;hb=2de99bed22564af4d535bdfb61b07a0745e71d76;hp=519e512674b13b47e9d2fe3affe50d1a9f4e7e5a;hpb=1ec862e251d924f939068012077c48e91b78e320;p=lyx.git diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 519e512674..e022616aeb 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -7,43 +7,38 @@ 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],[ -changequote(, ) dnl -echo "configuring LyX version $VERSION" -if echo "$VERSION" | grep 'cvs' >/dev/null ; then - lyx_devel_version=yes - 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 -changequote([, ]) dnl -AC_SUBST(lyx_devel_version) -if test $lyx_devel_version = yes ; then - AC_DEFINE(DEVEL_VERSION, 1, [Define if you are building a development version of LyX]) -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*)lyx_prerelease=yes + echo "WARNING: This is a prerelease. Be careful and backup your documents.";; +esac +AC_SUBST(lyx_devel_version)]) dnl Define the option to set a LyX version on installed executables and directories 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[=] install lyx files as lyx], [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], - [lyxname=lyx]) -AC_MSG_RESULT([$lyxname]) + version_suffix=$withval + RPM_VERSION_SUFFIX="--with-version-suffix=$withval"]) +AC_SUBST(RPM_VERSION_SUFFIX) +AC_MSG_RESULT([$withval]) ]) @@ -75,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 < -#include -#include -#include -#include -#include -#include -#include -#include ],[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],[ @@ -521,14 +548,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) @@ -536,6 +567,48 @@ AC_SUBST(FRONTENDS_PROGS) ]) +## 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} + 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) +AC_SUBST(program_suffix) +]) + ## ------------------------------------------------------------------------ ## Find a file (or one of more files in a list of dirs) @@ -567,7 +640,57 @@ 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" ]) + + +## ------------------------------------------------------------------------ +## 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 +#if HAVE_UNISTD_H +# include +#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?/*$[]??'` +])