Fix putenv() for solaris 7; tweak configure stuff.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@396 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-12-28 14:06:29 +00:00
parent 00c37e19ec
commit 7401c2baaa
6 changed files with 46 additions and 20 deletions

View File

@ -1,3 +1,20 @@
1999-12-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/buffer.C (Dispatch): remove an extraneous break statement.
* acinclude.m4 (STL_STRING_FWD_H_LOCATION): add the comment for
config.h.in to the AC_DEFINE_UNQUOTED() call.
(LYX_FUNC_PUTENV_ARGTYPE): new macro. Checks whether putenv()
needs char * as argument (because Solaris 7 declares it like
that).
* acconfig.h: remove placeholder for STL_STRING_FWD_H_LOCATION;
remove definition of BZERO.
* src/support/filetools.C (QuoteName): change to do simple
'quoting'. More work is necessary. Also changed to do nothing
under emx (needs fix too).
1999-12-24 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/LRegex.C: include <regex.h> if HAVE_REGEX_H is

View File

@ -36,12 +36,6 @@
/* Define as 1 if you have the stpcopy function */
#undef HAVE_STPCPY
/* define this to the location of stl_string_fwd.h to be used with #include,
NOTE: Do not set it to <stl_string_fwd.h> as that will find the LyX
supplied version of the header.
e.g. <../include/stl_string_fwd.h> or better yet use an absolute path */
#undef STL_STRING_FWD_H_LOCATION
/* define this to the location of xpm.h to be used with #include,
e.g. <xpm.h> */
#undef XPM_H_LOCATION
@ -57,12 +51,6 @@
/**/#undef __STRICT_ANSI__
#endif
#ifdef HAVE_MEMSET
#define BZERO(a,b) memset(a,0,b)
#else
#define BZERO(a,b) bzero(a,b)
#endif
#ifndef HAVE_STRCHR
#define strchr(a,b) index(a,b)
#endif

View File

@ -608,6 +608,21 @@ if test "$ac_cv_sco" = yes; then
test "x$GXX" = xyes && lyx_broken_headers=yes
fi])
dnl Usage: LYX_FUNC_PUTENV_ARGTYPE
dnl Checks whether putenv() takes 'char const *' or 'char *' as
dnl argument. This is needed because Solaris 7 (wrongly?) uses 'char *',
dnl while everybody else uses the former...
AC_DEFUN(LYX_FUNC_PUTENV_ARGTYPE,
[AC_MSG_CHECKING([type of argument for putenv()])
AC_CACHE_VAL(lyx_cv_func_putenv_arg,dnl
[AC_TRY_COMPILE(dnl
[#include <cstdlib>
extern int putenv(const char *);],,dnl
[lyx_cv_func_putenv_arg='char const *'],[lyx_cv_func_putenv_arg='char *'])])
AC_MSG_RESULT($lyx_cv_func_putenv_arg)
AC_DEFINE_UNQUOTED(PUTENV_TYPE_ARG,$lyx_cv_func_putenv_arg,dnl
[Define to the type of the argument of putenv(). Needed on Solaris 7.])])
dnl Usage: LYX_WITH_DIR(dir-name,desc,dir-var-name,default-value,
dnl [default-yes-value])
@ -683,7 +698,6 @@ AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
ac_cv_target_system_type="$target"
])
dnl We use this until autoconf fixes its version.
AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for select()])
@ -1138,7 +1152,11 @@ lyx_cv_path_stl_string_fwd_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
grep 'stl_string_fwd.h' 2>/dev/null | \
sed -e 's/.*\(".*stl_string_fwd.h"\).*/\1/' -e "1q"`
rm -f conftest*])
AC_DEFINE_UNQUOTED(STL_STRING_FWD_H_LOCATION,$lyx_cv_path_stl_string_fwd_h)])
AC_DEFINE_UNQUOTED(STL_STRING_FWD_H_LOCATION,$lyx_cv_path_stl_string_fwd_h,
[define this to the location of stl_string_fwd.h to be used with #include,
NOTE: Do not set it to <stl_string_fwd.h> as that will find the LyX
supplied version of the header.
e.g. <../include/stl_string_fwd.h> or better yet use an absolute path])])
])

View File

@ -189,6 +189,9 @@ AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo)
dnl Until this is fixed in autoconf we provide our own version
LYX_FUNC_SELECT_ARGTYPES
dnl check whether we have to work around solaris broken putenv()
LYX_FUNC_PUTENV_ARGTYPE
# SunOS 4.1.3 does not have strerror and atexit
AC_REPLACE_FUNCS(strerror atexit)

View File

@ -4013,7 +4013,6 @@ void Buffer::Dispatch(int action, const string & argument)
case LFUN_EXPORT:
MenuExport(this, argument);
break;
break;
default:
lyxerr << "A truly unknown func!" << endl;

View File

@ -97,10 +97,11 @@ string QuoteName(string const & name)
#ifdef WITH_WARNINGS
#warning Add proper emx support here!
#endif
string qname = name;
while (qname.find("'") != string::npos)
LSubstring(qname, "'") = "\\'";
return '\'' + qname + '\'';
#ifndef __EMX__
return '\'' + name + '\'';
#else
return name;
#endif
}
@ -333,7 +334,7 @@ bool PutEnv(string const & envstr)
// this leaks, but what can we do about it?
// Is doing a getenv() and a free() of the older value
// a good idea? (JMarc)
int retval = putenv((new string(envstr))->c_str());
int retval = putenv(const_cast<PUTENV_TYPE_ARG>((new string(envstr))->c_str()));
#else
#ifdef HAVE_SETENV
string varname;