all: fix __FILE_NAME__ workaround

Do not apply offset for __FILE__ in non-VPATH build,
since the path is not prefixed with `${srcdir}/` in that case.
This commit is contained in:
CismonX 2025-02-02 17:48:42 +08:00
parent c17d6ebadf
commit 54c81c43bb
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
2 changed files with 10 additions and 3 deletions

View file

@ -198,11 +198,13 @@ AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[char const *name = __FILE_NAME__;]])
], [
AC_MSG_RESULT([yes])
AS_VAR_SET([no_file_name], [no])
], [
AC_MSG_RESULT([no])
AS_IF([test . -ef "${srcdir}"], , [
AS_VAR_SET([no_file_name], [yes])
])
])
AM_CONDITIONAL([NO_FILE_NAME], [test x${no_file_name} != xno])
AM_CONDITIONAL([NO_FILE_NAME], [test x${no_file_name} = xyes])
AC_SYS_LARGEFILE
AS_VAR_IF([ac_have_largefile], [no], [

View file

@ -114,7 +114,12 @@
#ifdef __FILE_NAME__
# define FILE_NAME_ __FILE_NAME__
#else
# define FILE_NAME_ ( __FILE__ + sizeof(BOOKMARKFS_SRCDIR) )
# ifdef BOOKMARKFS_SRCDIR
# define FILE_NAME_OFFSET_ sizeof(BOOKMARKFS_SRCDIR)
# else
# define FILE_NAME_OFFSET_ 0
# endif
# define FILE_NAME_ ( __FILE__ + FILE_NAME_OFFSET_ )
#endif
#define BOOKMARKFS_HOMEPAGE_URL "https://nongnu.org/bookmarkfs"