mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Instead of specifically addressing glibc, use NULL as second argument
of realpath() when PATH_MAX is not defined in limits.h. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35466 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
90e1f226b8
commit
4a2243135c
@ -571,6 +571,26 @@ do
|
||||
[AC_MSG_RESULT(no)])
|
||||
done])
|
||||
|
||||
dnl this is used by the macro below to generate a proper config.h.in entry
|
||||
m4_define([LYX_AH_CHECK_DEF],
|
||||
[AH_TEMPLATE(AS_TR_CPP(HAVE_DEF_$1),
|
||||
[Define to 1 if `$1' is defined in `$2'])])
|
||||
|
||||
dnl Check whether name is defined in header by using it in codesnippet.
|
||||
dnl Called like LYX_CHECK_DEF(name, header, codesnippet)
|
||||
dnl Defines HAVE_DEF_{NAME}
|
||||
AC_DEFUN([LYX_CHECK_DEF],
|
||||
[LYX_AH_CHECK_DEF($1, $2)
|
||||
AC_MSG_CHECKING([if $1 is defined by header $2])
|
||||
AC_TRY_COMPILE([#include <$2>], [$3],
|
||||
lyx_have_def_name=yes,
|
||||
lyx_have_def_name=no)
|
||||
AC_MSG_RESULT($lyx_have_def_name)
|
||||
if test "x$lyx_have_def_name" = xyes; then
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_DEF_$1))
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Extract the single digits from PACKAGE_VERSION and make them available.
|
||||
dnl Defines LYX_MAJOR_VERSION, LYX_MINOR_VERSION, LYX_RELEASE_LEVEL,
|
||||
dnl LYX_RELEASE_PATCH (possibly equal to 0), LYX_DIR_VER, and LYX_USERDIR_VER.
|
||||
|
@ -183,6 +183,8 @@ AC_TYPE_SIGNAL
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UID_T
|
||||
|
||||
LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
|
||||
|
||||
AC_CHECK_FUNCS(chmod close _close fork getpid _getpid lstat mkfifo open _open pclose _pclose popen _popen readlink strerror)
|
||||
# Check the form of mkdir()
|
||||
AC_FUNC_MKDIR
|
||||
|
@ -297,15 +297,15 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode)
|
||||
|
||||
string real_path(string const & path)
|
||||
{
|
||||
#ifdef __GLIBC__
|
||||
#ifdef HAVE_DEF_PATH_MAX
|
||||
char rpath[PATH_MAX + 1];
|
||||
char * result = realpath(path.c_str(), rpath);
|
||||
return FileName::fromFilesystemEncoding(result ? rpath : path).absFileName();
|
||||
#else
|
||||
char * result = realpath(path.c_str(), NULL);
|
||||
string ret = FileName::fromFilesystemEncoding(result ? result : path).absFileName();
|
||||
free(result);
|
||||
return ret;
|
||||
#else
|
||||
char rpath[PATH_MAX + 1];
|
||||
char * result = realpath(path.c_str(), rpath);
|
||||
return FileName::fromFilesystemEncoding(result ? rpath : path).absFileName();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user