- Files for Windows MSVC compilation added

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9525 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Asger Ottar Alstrup 2005-01-22 15:36:47 +00:00
parent 2b2c27a700
commit 868e520da7
6 changed files with 12169 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Release
Debug
lyx.ncb
lyx.suo

596
development/Win32/config.h Normal file
View File

@ -0,0 +1,596 @@
/* src/config.h. Generated by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* -*- C++ -*- */
/*
* \file config.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* This is the compilation configuration file for LyX.
* It was generated by autoconfs configure.
* You might want to change some of the defaults if something goes wrong
* during the compilation.
*/
#ifndef _CONFIG_H
#define _CONFIG_H
#pragma warning(disable:4127 4244 4258 4355 4267 4503 4786 4800)
// Enable a bunch of useful warnings
#pragma warning(3:4019 4032 4057 4125 4130 4152 4189 4201 4706)
#pragma warning(2:4032) // function arg has different type from declaration
#pragma warning(2:4092) // 'sizeof' value too big
#pragma warning(2:4132 4268)// const object not initialized
#pragma warning(2:4152) // pointer conversion between function and data
#pragma warning(2:4239) // standard doesn't allow this conversion
#pragma warning(2:4701) // local variable used without being initialized
#pragma warning(2:4706) // if (a=b) instead of (if a==b)
#pragma warning(2:4709) // comma in array subscript
//#pragma warning(3:4061) // not all enum values tested in switch statement ( works in vc7, and gives alot of warnings )
//#pragma warning(3:4505) // unreferenced local function removed
#pragma warning(3:4121) // space added for structure alignment
#pragma warning(3:4019) // empty statement at global scope
#pragma warning(3:4057) // pointers refer to different base types
#pragma warning(3:4125) // decimal digit terminates octal escape
#pragma warning(2:4131) // old-style function declarator
#pragma warning(3:4211) // extern redefined as static
#pragma warning(3:4213) // cast on left side of = is non-standard
#pragma warning(3:4222) // member function at file scope shouldn't be static
#pragma warning(3:4234 4235)// keyword not supported or reserved for future
#pragma warning(3:4504) // type ambiguous; simplify code
#pragma warning(3:4507) // explicit linkage specified after default linkage
#pragma warning(3:4515) // namespace uses itself
#pragma warning(3:4516 4517)// access declarations are deprecated
#pragma warning(3:4670) // base class of thrown object is inaccessible
#pragma warning(3:4671) // copy ctor of thrown object is inaccessible
#pragma warning(3:4673) // thrown object cannot be handled in catch block
#pragma warning(3:4674) // dtor of thrown object is inaccessible
#pragma warning(3:4705) // statement has no effect (example: a+1;)
/* Location of Aiksaurus.h */
#define AIKSAURUS_H_LOCATION <Aiksaurus/Aiksaurus.h>
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* #undef CRAY_STACKSEG_END */
/* Define if your C++ compiler puts C library functions in the global
namespace */
/* #undef CXX_GLOBAL_CSTD */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
/* Define if you are building a development version of LyX */
#define DEVEL_VERSION 1
/* Define if you want assertions to be enabled in the code */
#define ENABLE_ASSERTIONS 1
/* Define to 1 if translation of program messages to the user's native
language is requested. */
/* #undef ENABLE_NLS */
/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the <argz.h> header file. */
/* #undef HAVE_ARGZ_H */
/* Define to 1 if you have the <aspell/aspell.h> header file. */
/* #undef HAVE_ASPELL_ASPELL_H */
/* Define to 1 if you have the <aspell.h> header file. */
/* #undef HAVE_ASPELL_H */
/* Define to 1 if you have the `asprintf' function. */
/* #undef HAVE_ASPRINTF */
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
/* #undef HAVE_DCGETTEXT */
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
don't. */
#define HAVE_DECL_FEOF_UNLOCKED 0
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
you don't. */
#define HAVE_DECL_FGETS_UNLOCKED 0
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
don't. */
#define HAVE_DECL_GETC_UNLOCKED 0
/* Define if you have the prototype for function `istreambuf_iterator' */
#define HAVE_DECL_ISTREAMBUF_ITERATOR 1
/* Define if you have the prototype for function `mkstemp' */
/* #undef HAVE_DECL_MKSTEMP */
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
don't. */
#define HAVE_DECL__SNPRINTF 1
/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
don't. */
#define HAVE_DECL__SNWPRINTF 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_DIRENT_H 1 */
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the <flimage.h> header file. */
/* #undef HAVE_FLIMAGE_H */
/* Define to 1 if you have the `fwprintf' function. */
#define HAVE_FWPRINTF 1
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define to 1 if you have the `getegid' function. */
#define HAVE_GETEGID 1
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1
/* Define to 1 if you have the `getgid' function. */
#define HAVE_GETGID 1
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define if the GNU gettext() function is already present or preinstalled. */
/* #undef HAVE_GETTEXT */
/* Define to 1 if you have the `getuid' function. */
#define HAVE_GETUID 1
/* Define if you have the iconv() function. */
#define HAVE_ICONV 1
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
#define HAVE_INTMAX_T 1
/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
#define HAVE_INTTYPES_H 1
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
declares uintmax_t. */
#define HAVE_INTTYPES_H_WITH_UINTMAX 1
/* Define to 1 if you have the <ios> header file. */
#define HAVE_IOS 1
/* Define to 1 if you have the <istream> header file. */
#define HAVE_ISTREAM 1
/* Define this if you have the kpsewhich program working on your system. */
#define HAVE_KPSEWHICH 1
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#define HAVE_LANGINFO_CODESET 1
/* Define if your <locale.h> file defines LC_MESSAGES. */
/* #undef HAVE_LC_MESSAGES */
/* Define this if you have the AikSaurus library */
/* #undef HAVE_LIBAIKSAURUS */
/* Define to 1 if you have the `c' library (-lc). */
#define HAVE_LIBC 1
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the <limits> header file. */
#define HAVE_LIMITS 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <locale> header file. */
#define HAVE_LOCALE 1
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define if you have the 'long double' type. */
#define HAVE_LONG_DOUBLE 1
/* Define if you have the 'long long' type. */
#define HAVE_LONG_LONG 1
/* Define to 1 if you have the `lstat' function. */
/* #undef HAVE_LSTAT */
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mempcpy' function. */
#define HAVE_MEMPCPY 1
/* Define to 1 if you have the `mkdir' function. */
#define HAVE_MKDIR 1
/* Define to 1 if you have the `mkfifo' function. */
#define HAVE_MKFIFO 1
/* Define to 1 if you have the `mkstemp' function. */
/* #undef HAVE_MKSTEMP */
/* Define to 1 if you have the `mktemp' function. */
#define HAVE_MKTEMP 1
/* Define to 1 if you have a working `mmap' system call. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `munmap' function. */
#define HAVE_MUNMAP 1
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <nl_types.h> header file. */
#define HAVE_NL_TYPES_H 1
/* Define to 1 if you have the <ostream> header file. */
#define HAVE_OSTREAM 1
/* Define if your printf() function supports format strings with positions. */
#define HAVE_POSIX_PRINTF 1
/* Define to 1 if you have the <pspell/pspell.h> header file. */
/* #undef HAVE_PSPELL_PSPELL_H */
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
/* Define to 1 if you have the `readlink' function. */
/* #undef HAVE_READLINK */
/* Define to 1 if you have the `setenv' function. */
/* #undef HAVE_SETENV 1 */
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the <sstream> header file. */
#define HAVE_SSTREAM 1
/* Define to 1 if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
uintmax_t. */
#define HAVE_STDINT_H_WITH_UINTMAX 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have a conforming std::count template, otherwise HP version
of count template is assumed. */
#define HAVE_STD_COUNT 1
/* Define to 1 if you have the `stpcpy' function. */
#define HAVE_STPCPY 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the `tsearch' function. */
#define HAVE_TSEARCH 1
/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
#define HAVE_UINTMAX_T 1
/* Define to 1 if you have the <unistd.h> header file. */
/*#undef HAVE_UNISTD_H 1*/
/* Define if you have the 'unsigned long long' type. */
#define HAVE_UNSIGNED_LONG_LONG 1
/* Define if you have the 'wchar_t' type. */
#define HAVE_WCHAR_T 1
/* Define to 1 if you have the `wcslen' function. */
#define HAVE_WCSLEN 1
/* Define if you have the 'wint_t' type. */
#define HAVE_WINT_T 1
/* Define to 1 if you have the <X11/flimage.h> header file. */
/* #undef HAVE_X11_FLIMAGE_H */
/* Define to 1 if you have the <zlib.h> header file. */
#define HAVE_ZLIB_H 1
/* Define to 1 if you have the `_mkdir' function. */
/* #undef HAVE__MKDIR */
/* Define to 1 if you have the `__argz_count' function. */
/* #undef HAVE___ARGZ_COUNT */
/* Define to 1 if you have the `__argz_next' function. */
/* #undef HAVE___ARGZ_NEXT */
/* Define to 1 if you have the `__argz_stringify' function. */
/* #undef HAVE___ARGZ_STRINGIFY */
/* Define to 1 if you have the `__fsetlocking' function. */
/* #undef HAVE___FSETLOCKING */
/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST
/* Define if integer division by zero raises signal SIGFPE. */
#define INTDIV0_RAISES_SIGFPE 1
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
*/
/* #undef MAJOR_IN_MKDEV */
/* Define to 1 if `major', `minor', and `makedev' are declared in
<sysmacros.h>. */
/* #undef MAJOR_IN_SYSMACROS */
/* Define if mkdir takes only one argument. */
/* #undef MKDIR_TAKES_ONE_ARG */
/* Define if you have modern standard-compliant STL streams */
#define MODERN_STL_STREAMS 1
/* Name of package */
#define PACKAGE "lyx-1.4.0cvs"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "lyx-devel@lists.lyx.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "lyx"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "lyx 1.4.0cvs"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "lyx"
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.4.0cvs"
/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
/* #undef PRI_MACROS_BROKEN */
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to the type of arg 1 for `select'. */
#define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for `select'. */
#define SELECT_TYPE_ARG234 (fd_set *)
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
/* Define as the maximum value of type 'size_t', if the system doesn't define
it. */
/* #undef SIZE_MAX */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
/* #undef STACK_DIRECTION */
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define as 1 to use the aspell library */
/* #undef USE_ASPELL */
/* Define as 1 if you want to support compressed files. */
/* #undef USE_COMRESSION */
/* Define if you want to be able to load jpeg images natively */
#define USE_JPEG_IMAGE_LOADER 1
/* Define to 1 if LyX should use a MacOS X application bundle file layout */
/* #undef USE_MACOSX_PACKAGING */
/* Define to 1 if LyX should use a POSIX-style file layout */
/* #undef USE_POSIX_PACKAGING */
/* Define as 1 to use the pspell library */
/* #undef USE_PSPELL */
/* Define to 1 if LyX should use a Windows-style file layout */
#define USE_WINDOWS_PACKAGING 1
/* Version number of package */
#define VERSION "1.4.0cvs"
/* Define this if you want to see the warning directives put here and there by
the developpers to get attention */
/* #undef WITH_WARNINGS */
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* # undef _ALL_SOURCE */
#endif
/* libstdc++ concept checking */
/* #undef _GLIBCPP_CONCEPT_CHECKS */
/* libstdc++ concept checking */
/* #undef _GLIBCXX_CONCEPT_CHECKS */
/* libstdc++ debug mode */
/* #undef _GLIBCXX_DEBUG */
/* libstdc++ pedantic debug mode */
/* #undef _GLIBCXX_DEBUG_PEDANTIC */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to nothing if your compiler does not understand the 'explicit'
directive */
/* #undef explicit */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `int' if <sys/types.h> does not define. */
/* #undef mode_t */
/* Define to `long' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define as the type of the result of subtracting two pointers, if the system
doesn't define it. */
/* #undef ptrdiff_t */
/* Define to empty if the C compiler doesn't support this keyword. */
/* #undef signed */
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define to unsigned long or unsigned long long if <stdint.h> and
<inttypes.h> don't define. */
/* #undef uintmax_t */
/************************************************************
** You should not need to change anything beyond this point */
#ifndef HAVE_STRERROR
#if defined(__cplusplus)
extern "C"
#endif
char * strerror(int n);
#endif
#ifdef HAVE_MKSTEMP
#ifndef HAVE_DECL_MKSTEMP
#if defined(__cplusplus)
extern "C"
#endif
int mkstemp(char*);
#endif
#endif
#ifdef __EMX__
#include "support/os2_defines.h"
#endif
#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
#define USE_BOOST_FORMAT 1
#else
#define USE_BOOST_FORMAT 0
#endif
#define BOOST_USER_CONFIG <config.h>
#if defined(ENABLE_ASSERTIONS)
#define BOOST_ENABLE_ASSERT_HANDLER 1
#else
#define BOOST_DISABLE_ASSERTS 1
#endif
#define BOOST_DISABLE_THREADS 1
#define BOOST_NO_WREGEX 1
#define BOOST_NO_WSTRING 1
#endif

42
development/Win32/lyx.sln Normal file
View File

@ -0,0 +1,42 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lyx", "lyx.vcproj", "{967779B1-EB60-49DD-BDA7-8F4C15790778}"
ProjectSection(ProjectDependencies) = postProject
{FDBBC827-4BD2-4E7D-B050-0967A0B6C754} = {FDBBC827-4BD2-4E7D-B050-0967A0B6C754}
{3BF0EC29-8B64-460F-AE0A-96794D38088D} = {3BF0EC29-8B64-460F-AE0A-96794D38088D}
{3BF0EC29-8B64-460F-AE0A-96794D38088D} = {3BF0EC29-8B64-460F-AE0A-96794D38088D}
{3BF0EC29-8B64-460F-AE0A-96794D38088D} = {3BF0EC29-8B64-460F-AE0A-96794D38088D}
{3BF0EC29-8B64-460F-AE0A-96794D38088D} = {3BF0EC29-8B64-460F-AE0A-96794D38088D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libboost_regex", "..\..\boost\libs\regex\regex.vcproj", "{FDBBC827-4BD2-4E7D-B050-0967A0B6C754}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libboost_signals", "..\..\boost\libs\signals\signals.vcproj", "{3BF0EC29-8B64-460F-AE0A-96794D38088D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{967779B1-EB60-49DD-BDA7-8F4C15790778}.Debug.ActiveCfg = Debug|Win32
{967779B1-EB60-49DD-BDA7-8F4C15790778}.Debug.Build.0 = Debug|Win32
{967779B1-EB60-49DD-BDA7-8F4C15790778}.Release.ActiveCfg = Release|Win32
{967779B1-EB60-49DD-BDA7-8F4C15790778}.Release.Build.0 = Release|Win32
{FDBBC827-4BD2-4E7D-B050-0967A0B6C754}.Debug.ActiveCfg = Debug|Win32
{FDBBC827-4BD2-4E7D-B050-0967A0B6C754}.Debug.Build.0 = Debug|Win32
{FDBBC827-4BD2-4E7D-B050-0967A0B6C754}.Release.ActiveCfg = Release|Win32
{FDBBC827-4BD2-4E7D-B050-0967A0B6C754}.Release.Build.0 = Release|Win32
{3BF0EC29-8B64-460F-AE0A-96794D38088D}.Debug.ActiveCfg = Debug|Win32
{3BF0EC29-8B64-460F-AE0A-96794D38088D}.Debug.Build.0 = Debug|Win32
{3BF0EC29-8B64-460F-AE0A-96794D38088D}.Release.ActiveCfg = Release|Win32
{3BF0EC29-8B64-460F-AE0A-96794D38088D}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

10803
development/Win32/lyx.vcproj Normal file

File diff suppressed because it is too large Load Diff

703
development/Win32/package.C Normal file
View File

@ -0,0 +1,703 @@
// -*- C++ -*-
/**
* \file package.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
*
* Warning! This file is autogenerated from package.C.in.
* All changes to this file will be lost.
*/
#include <config.h>
#include "support/package.h"
#include "debug.h"
#include "gettext.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/os.h"
#include <boost/assert.hpp>
#include <boost/tuple/tuple.hpp>
#include <list>
#include <utility>
#if !defined (USE_WINDOWS_PACKAGING) && \
!defined (USE_MACOSX_PACKAGING) && \
!defined (USE_POSIX_PACKAGING)
#error USE_FOO_PACKAGING must be defined for FOO = WINDOWS, MACOSX or POSIX.
#endif
#if defined (USE_WINDOWS_PACKAGING)
# include <windows.h>
# include <shlobj.h> // SHGetFolderPath
// Needed for MinGW:
# ifndef SHGFP_TYPE_CURRENT
# define SHGFP_TYPE_CURRENT 0
# endif
#elif defined (USE_MACOSX_PACKAGING)
# include <CoreServices/CoreServices.h> // FSFindFolder, FSRefMakePath
#endif
using std::string;
namespace lyx {
namespace support {
namespace {
Package package_;
bool initialised_ = false;
} // namespace anon
void init_package(string const & command_line_arg0,
string const & command_line_system_support_dir,
string const & command_line_user_support_dir)
{
// Can do so only once.
if (initialised_)
return;
package_ = Package(command_line_arg0,
command_line_system_support_dir,
command_line_user_support_dir);
initialised_ = true;
}
Package const & package()
{
// Commented out because package().locale_dir() can be called
// from the message translation code in messages.C before
// init_package() is called. Lars is on the case...
// BOOST_ASSERT(initialised_);
return package_;
}
namespace {
string const abs_path_from_binary_name(string const & exe);
std::pair<string, string> const get_build_dirs(string const & abs_binary);
string const get_document_dir(string const & home_dir);
string const get_home_dir();
string const get_locale_dir(string const & system_support_dir);
string const get_system_support_dir(string const & abs_binary,
string const & command_line_system_support_dir);
string const get_temp_dir();
string const get_default_user_support_dir(string const & home_dir);
std::pair<string, bool> const
get_user_support_dir(string const & default_user_support_dir,
string const & command_line_user_support_dir);
} // namespace anon
Package::Package(string const & command_line_arg0,
string const & command_line_system_support_dir,
string const & command_line_user_support_dir)
: explicit_user_support_dir_(false)
{
home_dir_ = get_home_dir();
temp_dir_ = get_temp_dir();
document_dir_ = get_document_dir(home_dir_);
string const abs_binary = abs_path_from_binary_name(command_line_arg0);
binary_dir_ = OnlyPath(abs_binary);
// Is LyX being run in-place from the build tree?
boost::tie(build_support_dir_, system_support_dir_) =
get_build_dirs(abs_binary);
if (build_support_dir_.empty())
system_support_dir_ =
get_system_support_dir(abs_binary,
command_line_system_support_dir);
locale_dir_ = get_locale_dir(system_support_dir_);
string const default_user_support_dir =
get_default_user_support_dir(home_dir_);
boost::tie(user_support_dir_, explicit_user_support_dir_) =
get_user_support_dir(default_user_support_dir,
command_line_user_support_dir);
lyxerr[Debug::INIT]
<< "<package>\n"
<< "\tbinary_dir " << binary_dir() << '\n'
<< "\tsystem_support " << system_support() << '\n'
<< "\tbuild_support " << build_support() << '\n'
<< "\tuser_support " << user_support() << '\n'
<< "\tlocale_dir " << locale_dir() << '\n'
<< "\tdocument_dir " << document_dir() << '\n'
<< "\ttemp_dir " << temp_dir() << '\n'
<< "\thome_dir " << home_dir() << '\n'
<< "</package>\n" << std::endl;
}
namespace {
// These next three functions contain the stuff that is substituted at
// configuration-time.
string const top_srcdir()
{
static string const dir("c:\\lyx\\lyx-devel");
return dir;
}
string const hardcoded_localedir()
{
return string("c:\\lyx\\lyx-devel\\share\\locale");
}
string const hardcoded_system_support_dir()
{
return string("c:\\lyx\\lyx-devel\\share");
}
} // namespace anon
string const & Package::top_srcdir() const
{
static string const dir("c:\\lyx\\lyx-devel");
return dir;
}
namespace {
bool check_command_line_dir(string const & dir,
string const & file,
string const & command_line_switch);
string const extract_env_var_dir(string const & env_var);
bool check_env_var_dir(string const & dir,
string const & env_var);
bool check_env_var_dir(string const & dir,
string const & file,
string const & env_var);
string const relative_locale_dir();
string const relative_system_support_dir();
#if defined (USE_WINDOWS_PACKAGING)
// Given a folder ID, returns the folder name (in unix-style format).
// Eg CSIDL_PERSONAL -> "C:/Documents and Settings/USERNAME/My Documents"
string const win32_folder_path(int folder_id)
{
char folder_path[MAX_PATH + 1];
if (SUCCEEDED(SHGetFolderPath(0, folder_id, 0,
SHGFP_TYPE_CURRENT, folder_path)))
return os::internal_path(folder_path);
return string();
}
#endif
std::pair<string, string> const get_build_dirs(string const & abs_binary)
{
string const check_text = "Checking whether LyX is run in place...";
// We're looking for "lyxrc.defaults" in a directory
// binary_dir/../lib
// We're also looking for "chkconfig.ltx" in a directory
// binary_dir/top_srcdir()/lib
// If both are found, then we're running LyX in-place.
// Note that the name of the lyx binary may be a symbolic link.
// If that is the case, then we follow the links too.
string binary = abs_binary;
while (true) {
// Try and find "lyxrc.defaults".
string const binary_dir = OnlyPath(binary);
string const build_support_dir =
NormalizePath(AddPath(binary_dir, "../lib"));
if (!FileSearch(build_support_dir, "lyxrc.defaults").empty()) {
// Try and find "chkconfig.ltx".
string const system_support_dir =
MakeAbsPath(AddPath(top_srcdir(), "lib"),
AddPath(binary_dir, "support"));
if (!FileSearch(system_support_dir, "chkconfig.ltx").empty()) {
lyxerr[Debug::INIT] << check_text << " yes"
<< std::endl;
return std::make_pair(build_support_dir, system_support_dir);
}
}
// Check whether binary is a symbolic link.
// If so, resolve it and repeat the exercise.
FileInfo const file(binary, true);
if (!file.isOK() || !file.isLink())
break;
string link;
if (LyXReadLink(binary, link, true)) {
binary = link;
} else {
// Unable to resolve the link.
break;
}
}
lyxerr[Debug::INIT] << check_text << " no" << std::endl;
return std::make_pair(string(), string());
}
// Specification of document_dir_ may be reset by LyXRC,
// but the default is fixed for a given OS.
string const get_document_dir(string const & home_dir)
{
#if defined (USE_WINDOWS_PACKAGING)
(void)home_dir; // Silence warning about unused variable.
return win32_folder_path(CSIDL_PERSONAL);
#else // Posix-like.
return home_dir;
#endif
}
// The specification of home_dir_ is fixed for a given OS.
// A typical example on Windows: "C:/Documents and Settings/USERNAME"
// and on a Posix-like machine: "/home/USERNAME".
string const get_home_dir()
{
#if defined (USE_WINDOWS_PACKAGING)
string const home_dir = GetEnv("USERPROFILE");
#else // Posix-like.
string const home_dir = GetEnv("HOME");
#endif
return os::internal_path(home_dir);
}
// Several sources are probed to ascertain the locale directory.
// The only requirement is that the result is indeed a directory.
string const get_locale_dir(string const & system_support_dir)
{
// 1. Use the "LYX_LOCALEDIR" environment variable.
string path = extract_env_var_dir("LYX_LOCALEDIR");
if (!path.empty() && check_env_var_dir(path, "LYX_LOCALEDIR"))
return path;
// 2. Search for system_support_dir / <relative locale dir>
// The <relative locale dir> is OS-dependent. (On Unix, it will
// be "../locale/".)
path = NormalizePath(AddPath(system_support_dir, relative_locale_dir()));
FileInfo fi(path);
if (fi.isOK() && fi.isDir())
return path;
// 3. Fall back to the hard-coded LOCALEDIR.
path = hardcoded_localedir();
FileInfo fi2(path);
if (fi2.isOK() && fi2.isDir())
return path;
return string();
}
// Specification of temp_dir_ may be reset by LyXRC,
// but the default is fixed for a given OS.
string const get_temp_dir()
{
#if defined (USE_WINDOWS_PACKAGING)
// Typical example: C:/TEMP/.
char path[MAX_PATH + 1];
GetTempPath(MAX_PATH, path);
return os::internal_path(path);
#else // Posix-like.
return "/tmp";
#endif
}
// If we use a 'lazy' lyxerr in the hope of setting the locale before
// printing any messages, then we should ensure that it is flushed first.
void bail_out()
{
#ifndef CXX_GLOBAL_CSTD
using std::exit;
#endif
exit(1);
}
// Extracts the absolute path from the foo of "-sysdir foo" or "-userdir foo"
string const abs_path_from_command_line(string const & command_line)
{
if (command_line.empty())
return string();
string const path = os::internal_path(command_line);
return os::is_absolute_path(path) ? path : MakeAbsPath(path);
}
// Does the grunt work for abs_path_from_binary_name()
string const get_binary_path(string const & exe)
{
string const exe_path = os::internal_path(exe);
if (os::is_absolute_path(exe_path))
return exe_path;
// Two possibilities present themselves.
// 1. The binary is relative to the CWD.
string const abs_exe_path = MakeAbsPath(exe_path);
if (FileInfo(abs_exe_path, true).isOK())
return abs_exe_path;
// 2. exe must be the name of the binary only and it
// can be found on the PATH.
string const exe_name = OnlyFilename(exe_path);
if (exe_name != exe_path)
return string();
std::vector<string> const path = getEnvPath("PATH");
std::vector<string>::const_iterator it = path.begin();
std::vector<string>::const_iterator const end = path.end();
for (; it != end; ++it) {
// This will do nothing if *it is already absolute.
string const exe_dir = MakeAbsPath(*it);
string const exe_path = AddName(exe_dir, exe_name);
if (FileInfo(exe_path, true).isOK())
return exe_path;
}
// Didn't find anything.
return string();
}
// Extracts the absolute path to the binary name received as argv[0].
string const abs_path_from_binary_name(string const & exe)
{
string const abs_binary = get_binary_path(exe);
if (abs_binary.empty()) {
lyxerr << bformat(_("Unable to determine the path to the "
"LyX binary from the command line %1$s"),
exe)
<< std::endl;
bail_out();
}
return abs_binary;
}
// A plethora of directories is searched to ascertain the system
// lyxdir which is defined as the first directory to contain
// "chkconfig.ltx".
string const
get_system_support_dir(string const & abs_binary,
string const & command_line_system_support_dir)
{
string const chkconfig_ltx = "chkconfig.ltx";
// searched_dirs is used for diagnostic purposes only in the case
// that "chkconfig.ltx" is not found.
std::list<string> searched_dirs;
// 1. Use the -sysdir command line parameter.
string path = abs_path_from_command_line(command_line_system_support_dir);
if (!path.empty()) {
searched_dirs.push_back(path);
if (check_command_line_dir(path, chkconfig_ltx, "-sysdir"))
return path;
}
// 2. Use the "LYX_DIR_13x" environment variable.
path = extract_env_var_dir("LYX_DIR_13x");
if (!path.empty()) {
searched_dirs.push_back(path);
if (check_env_var_dir(path, chkconfig_ltx, "LYX_DIR_13x"))
return path;
}
// 3. Search relative to the lyx binary.
// We're looking for "chkconfig.ltx" in a directory
// OnlyPath(abs_binary) / <relative dir> / PACKAGE /
// PACKAGE is hardcoded in config.h. Eg "lyx" or "lyx-1.3.6cvs".
// <relative dir> is OS-dependent; on Unix, it will be "../share/".
string const relative_lyxdir = relative_system_support_dir();
// One subtlety to be aware of. The name of the lyx binary may be
// a symbolic link. If that is the case, then we follow the links too.
string binary = abs_binary;
while (true) {
// Try and find "chkconfig.ltx".
string const binary_dir = OnlyPath(binary);
string const lyxdir =
NormalizePath(AddPath(binary_dir, relative_lyxdir));
searched_dirs.push_back(lyxdir);
if (!FileSearch(lyxdir, chkconfig_ltx).empty()) {
// Success! "chkconfig.ltx" has been found.
return lyxdir;
}
// Check whether binary is a symbolic link.
// If so, resolve it and repeat the exercise.
FileInfo const file(binary, true);
if (!file.isOK() || !file.isLink())
break;
string link;
if (LyXReadLink(binary, link, true)) {
binary = link;
} else {
// Unable to resolve the link.
break;
}
}
// 4. Repeat the exercise on the directory itself.
string binary_dir = OnlyPath(abs_binary);
while (true) {
// This time test whether the directory is a symbolic link
// *before* looking for "chkconfig.ltx".
// (We've looked relative to the original already.)
FileInfo const file(binary_dir, true);
if (!file.isOK() || !file.isLink())
break;
string link;
if (LyXReadLink(binary_dir, link, true)) {
binary_dir = link;
} else {
// Unable to resolve the link.
break;
}
// Try and find "chkconfig.ltx".
string const lyxdir =
NormalizePath(AddPath(binary_dir, relative_lyxdir));
searched_dirs.push_back(lyxdir);
if (!FileSearch(lyxdir, chkconfig_ltx).empty()) {
// Success! "chkconfig.ltx" has been found.
return lyxdir;
}
}
// 5. In desparation, try the hard-coded system support dir.
path = hardcoded_system_support_dir();
if (!FileSearch(path, chkconfig_ltx).empty())
return path;
// Everything has failed :-(
// So inform the user and exit.
string searched_dirs_str;
typedef std::list<string>::const_iterator iterator;
iterator const begin = searched_dirs.begin();
iterator const end = searched_dirs.end();
for (iterator it = begin; it != end; ++it) {
if (it != begin)
searched_dirs_str += "\n\t";
searched_dirs_str += *it;
}
lyxerr << bformat(_("Unable to determine the system directory "
"having searched\n"
"\t%1$s\n"
"Try the '-sysdir' command line parameter or "
"set the environment variable LYX_DIR_13x to "
"the LyX system directory containing the file "
"`chkconfig.ltx'."),
searched_dirs_str)
<< std::endl;
bail_out();
// Keep the compiler happy.
return string();
}
// Returns the absolute path to the user lyxdir, together with a flag
// indicating whether this directory was specified explicitly (as -userdir
// or through an environment variable) or whether it was deduced.
std::pair<string, bool> const
get_user_support_dir(string const & default_user_support_dir,
string const & command_line_user_support_dir)
{
bool explicit_userdir = true;
// 1. Use the -userdir command line parameter.
string path =
abs_path_from_command_line(command_line_user_support_dir);
if (!path.empty())
return std::make_pair(path, explicit_userdir);
// 2. Use the LYX_USERDIR_13x environment variable.
path = extract_env_var_dir("LYX_USERDIR_13x");
if (!path.empty())
return std::make_pair(path, explicit_userdir);
// 3. Use the OS-dependent default_user_support_dir
explicit_userdir = false;
return std::make_pair(default_user_support_dir, explicit_userdir);
}
// $HOME/.lyx on all platforms but Win32 where it will be something like
// "C:/Documents and Settings/USERNAME/Application Data/lyx"
string const get_default_user_support_dir(string const & home_dir)
{
#if defined (USE_WINDOWS_PACKAGING)
(void)home_dir; // Silence warning about unused variable.
return AddPath(win32_folder_path(CSIDL_APPDATA), PACKAGE);
#elif defined (USE_MACOSX_PACKAGING)
(void)home_dir; // Silence warning about unused variable.
FSRef fsref;
OSErr const error_code =
FSFindFolder(kUserDomain, kApplicationSupportFolderType,
kDontCreateFolder, &fsref);
if (error_code != 0)
return string();
char store[PATH_MAX + 1];
OSStatus const status_code =
FSRefMakePath(&fsref,
reinterpret_cast<UInt8*>(store), PATH_MAX);
if (status_code != 0)
return string();
return AddPath(reinterpret_cast<char const *>(store), PACKAGE);
#else // USE_POSIX_PACKAGING
return AddPath(home_dir, string(".") + PACKAGE);
#endif
}
// Check that directory @c dir contains @c file.
// Else emit a warning about an invalid @c command_line_switch.
bool check_command_line_dir(string const & dir,
string const & file,
string const & command_line_switch)
{
string const abs_path = FileSearch(dir, file);
if (abs_path.empty()) {
lyxerr << bformat(_("Invalid %1$s switch.\n"
"Directory %2$s does not contain %3$s."),
command_line_switch, dir, file)
<< std::endl;
}
return !abs_path.empty();
}
// The environment variable @c env_var expands to a (single) file path.
string const extract_env_var_dir(string const & env_var)
{
string const dir = os::internal_path(GetEnv(env_var));
return dir.empty() ? dir : MakeAbsPath(dir);
}
// Check that directory @c dir contains @c file.
// Else emit a warning about an invalid @c env_var.
bool check_env_var_dir(string const & dir,
string const & file,
string const & env_var)
{
string const abs_path = FileSearch(dir, file);
if (abs_path.empty()) {
lyxerr << bformat(_("Invalid %1$s environment variable.\n"
"Directory %2$s does not contain %3$s."),
env_var, dir, file)
<< std::endl;
}
return !abs_path.empty();
}
// Check that directory @c dir is indeed a directory.
// Else emit a warning about an invalid @c env_var.
bool check_env_var_dir(string const & dir,
string const & env_var)
{
FileInfo fi(dir);
bool const success = (fi.isOK() && fi.isDir());
if (!success) {
// Put this string on a single line so that the gettext
// search mechanism in po/Makefile.in.in will register
// package.C.in as a file containing strings that need
// translation.
string const fmt =
_("Invalid %1$s environment variable.\n%2$s is not a directory.");
lyxerr << bformat(fmt, env_var, dir)
<< std::endl;
}
return success;
}
// The locale directory relative to the LyX system directory.
string const relative_locale_dir()
{
return "../locale/";
}
// The system lyxdir is relative to the directory containing the LyX binary.
string const relative_system_support_dir()
{
string result;
#if defined (USE_WINDOWS_PACKAGING) || defined (USE_MACOSX_PACKAGING)
result = AddPath("../Resources/", PACKAGE);
#else // Posix-like.
result = AddPath("../share/", PACKAGE);
#endif
return result;
}
} // namespace anon
} // namespace support
} // namespace lyx

View File

@ -0,0 +1,21 @@
/* -*- C++ -*- */
/**
* \file version.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jean-Marc Lasgouttes
*
* Full author contact details are available in file CREDITS.
*
* Warning! This file is autogenerated from version.C.in.
* All changes to this file will be lost.
*/
///
char const * lyx_version = "1.4.0cvs";
///
char const * lyx_release_date = "Thu, Jan 30, 2003";
/// This is the version information shown by 'lyx -version'
char const * lyx_version_info = "@VERSION_INFO@";