diff --git a/ChangeLog b/ChangeLog index 34d4429e6c..920291d79c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +1999-12-15 Allan Rae + + * src/stl_string_fwd.h, src/Makefile.am (lyx_SOURCES): added new + header that provides a wrapper around the very annoying SGI STL header + of the same name. + + * src/support/lyxstring.C, src/LString.h: + removed old SGI-STL-compatability attempts. + + * configure.in: Use LYX_STL_STRING_FWD. + + * acinclude.m4 (LYX_STL_STRING_FWD), acconfig.h: Test if + stl_string_fwd.h is around and try to determine it's location. + Major improvement over previous SGI STL 3.2 compatability. + Three small problems remain with this function due to my zero + knowledge of autoconf. JMarc and lgb see the comments in the code. + 1999-12-14 Jean-Marc Lasgouttes * src/broken_const.h, config/hack-gcc, config/README: removed diff --git a/acconfig.h b/acconfig.h index 9a99119de2..f78514cf08 100644 --- a/acconfig.h +++ b/acconfig.h @@ -37,6 +37,12 @@ e.g. */ #undef FORMS_H_LOCATION +/* define this to the location of stl_string_fwd.h to be used with #include, + NOTE: Do not set it to as that will find the LyX + supplied version of the header. + e.g. <../include/stl_string_fwd.h> */ +#undef STL_STRING_FWD_H_LOCATION + /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES diff --git a/acinclude.m4 b/acinclude.m4 index 9d7435fa5b..b3380d31c1 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1067,6 +1067,31 @@ case "$host" in esac ]) +### Check for stl_string_fwd.h existence and location if it exists +### +### Three problems remain: +### 1. I don't check if $lyx_cv_extra_inc has a value before testing it. +### 2. I don't issue a warning/error if AC_CHECK_HEADERS finds it but I +### don't. The warning should only need to be something like: +### "Can't find path to stl_string_fwd.h please define +### STL_STRING_FWD_H_LOCATION in src/config.h or supply the path +### using --with-extra-inc" +### 3. Multiple extra include dirs? and I don't check --with-extra-prefix yet +### +AC_DEFUN(LYX_STL_STRING_FWD, +[AC_CHECK_HEADERS(stl_string_fwd.h,[ + lyx_cv_stl_string_fwd_h_location="<../include/stl_string_fwd.h>" + AC_CHECK_HEADER(../include/stl_string_fwd.h,[ + ac_cv_header_stl_string_fwd_h=yes + lyx_cv_stl_string_fwd_h_location="<../include/stl_string_fwd.h>"],[ + AC_CHECK_HEADER($lyx_cv_extra_inc/stl_string_fwd.h,[ + ac_cv_header_stl_string_fwd_h=yes + lyx_cv_stl_string_fwd_h_location="<$lyx_cv_extra_inc/stl_string_fwd.h>"],[ + ac_cv_header_stl_string_fwd_h=no])]) + AC_DEFINE_UNQUOTED(STL_STRING_FWD_H_LOCATION,$lyx_cv_stl_string_fwd_h_location)]) +]) + + # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library, adds --enable-ltdl-convenience to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor diff --git a/configure.in b/configure.in index 96cc087288..d00c816513 100644 --- a/configure.in +++ b/configure.in @@ -153,7 +153,10 @@ AC_LANG_CPLUSPLUS # some standard header files AC_HEADER_DIRENT AC_HEADER_MAJOR -AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h stl_string_fwd.h) +AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h) + +# some annoying header files +LYX_STL_STRING_FWD # some standard structures AC_HEADER_STAT diff --git a/src/LString.h b/src/LString.h index f98bc7d9b5..46ec80c097 100644 --- a/src/LString.h +++ b/src/LString.h @@ -18,14 +18,5 @@ using std::string; #else #include "support/lyxstring.h" typedef lyxstring string; -#if defined(USING_EXCEPTIONS) && defined(HAVE_STL_STRING_FWD_H) -// Hide the forward declaration of string by SGI's STL > 3.13. But only when -// exceptions are in use. -// Due to a clash with SGI's forward declaration of string we have to provide -// __get_c_string() ourselves since SGI expects it to exist and block -// their string declarations as best we can. ARRae. -# define __SGI_STL_STRING_FWD_H -static char const * __get_c_string(string const &); -#endif // HAVE_STL_STRING_FWD_H #endif #endif diff --git a/src/Makefile.am b/src/Makefile.am index 59f9727827..636f672111 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -148,6 +148,7 @@ lyx_SOURCES = \ sp_form.h \ spellchecker.C \ spellchecker.h \ + stl_string_fwd.h \ table.C \ table.h \ tex-accent.C \ diff --git a/src/stl_string_fwd.h b/src/stl_string_fwd.h new file mode 100644 index 0000000000..5bc011b9be --- /dev/null +++ b/src/stl_string_fwd.h @@ -0,0 +1,33 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-1999 The LyX Team. + * + * ====================================================== */ + +#ifndef LYX_STL_STRING_FWD_H +#define LYX_STL_STRING_FWD_H + + +#if defined(HAVE_STL_STRING_FWD_H) +# ifndef USE_INCLUDED_STRING +// include the real stl_string_fwd.h +# include STL_STRING_FWD_H_LOCATION +# else +// Hide the forward declaration of string by SGI's STL > 3.13. +// We have to provide the declaration of__get_c_string() ourselves +// since SGI expects it to exist and we're blocking their string declarations +// as best we can. +// Note that a declaration for string is still required so we have to +// provide one via LString.h. ARRae. +# include "LString.h" +# define __SGI_STL_STRING_FWD_H + static char const * __get_c_string(string const &); +# endif // USE_INCLUDED_STRING +#endif // HAVE_STL_STRING_FWD_H + +#endif // LYX_STL_STRING_FWD_H diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C index 022e7f58eb..fd22e800c9 100644 --- a/src/support/lyxstring.C +++ b/src/support/lyxstring.C @@ -16,7 +16,6 @@ #pragma implementation "lyxstring.h" #endif -//#include "LString.h" #include "lyxstring.h" #include #include @@ -61,26 +60,6 @@ using std::min; // Lgb. -#if 0 -// I have no clue why this function is needed at all, it is static and -// confined to this filescope. How can any other file/fuction/module -// get access to it at all?? Perhaps the forward declaration in LString.h -// is enough. ARRae, any clues? Lgb. - -#ifdef HAVE_STL_STRING_FWD_H -// SGI's STL > 3.13 expects string to provide __get_c_string. -// Due to a clash with SGI's forward declaration of string we have -// to provide this ourselves and block their string declarations -// as best we can. ARRae. - -static char const * __get_c_string(string const & s) -{ - return s.c_str(); -} -#endif -#endif - - /////////////////////////////////////// // The internal string representation ///////////////////////////////////////