X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=config%2Flyxinclude.m4;h=1d16ed827204294450958c93672edcc1b72506e0;hb=fdb9b989f728626622926f0b770b0f0c96c91cf0;hp=eb2aa64ecccaeaded2df34f38162d29813f5566f;hpb=b5589bf6cf82439dc8dcc6c9465ce3b32dc0f389;p=lyx.git diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index eb2aa64ecc..1d16ed8272 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -7,15 +7,15 @@ 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 +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 @@ -28,21 +28,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[=] 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 - 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]) ]) @@ -169,7 +168,7 @@ AC_ARG_ENABLE(warnings, 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]) @@ -186,7 +185,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; @@ -200,13 +199,22 @@ AC_ARG_ENABLE(concept-checks, 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 @@ -224,26 +232,41 @@ if test x$GXX = xyes; then if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS="$ac_save_CXXFLAGS" else - 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.1*) CXXFLAGS="$lyx_opt -finline-limit=500 -fno-exceptions";; - 3.2*|3.3*) CXXFLAGS="$lyx_opt -fno-exceptions";; - 3.4*|4.0*) - CXXFLAGS="$lyx_opt -fno-exceptions" - test $enable_pch = yes && lyx_pch_comp=yes - ;; - *) CXXFLAGS="$lyx_opt";; - esac + 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 3.4*|4.0*) - lyx_flags="$lyx_flags stdlib-debug" + lyx_flags="stdlib-debug $lyx_flags" AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode]) AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode]) ;; @@ -252,27 +275,17 @@ if test x$GXX = xyes; then if test x$enable_concept_checks = xyes ; then case $gxx_version in 3.3*) - lyx_flags="$lyx_flags concept-checks" + lyx_flags="concept-checks $lyx_flags" AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking]) ;; 3.4*|4.0*) - lyx_flags="$lyx_flags concept-checks" + lyx_flags="concept-checks $lyx_flags" AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking]) ;; esac fi - if test x$enable_warnings = xyes ; then - case $gxx_version in - 2.*|3.1*|3.2*|3.3*) - CPPFLAGS="$CPPFLAGS -W -Wall" - ;; - *) - CPPFLAGS="$CPPFLAGS -Wextra -Wall" - ;; - esac - fi fi -test "$lyx_pch_comp" = yes && lyx_flags="$lyx_flags pch" +test "$lyx_pch_comp" = yes && lyx_flags="pch $lyx_flags" AM_CONDITIONAL(LYX_BUILD_PCH, test "$lyx_pch_comp" = yes) ])dnl @@ -535,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: qt3, qt4, gtk], + [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) @@ -550,8 +567,8 @@ AC_SUBST(FRONTENDS_PROGS) ]) -## Check what kind of packaging should be used at install time. -## The default is autodetected. +## 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, @@ -564,21 +581,32 @@ AC_ARG_WITH(packaging, *) 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]) - default_prefix="/Applications/LyX.app" +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' - mandir='${prefix}/Contents/Resources/man' ;; - 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'" + 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]) + 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) ]) @@ -612,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" ]) @@ -641,3 +669,28 @@ 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?/*$[]??'` +])