mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Check for functions in std namespace
On Solaris, some standard wide character functions are only contained in the std:: namespace. The configure script now checks for these, enabling the appropriate `uses` statements in src/common.h. The checks are handwritten, because Autoconf's AC_CHECK_FUNC macro always uses C linkage, but the problem only appears under C++ linkage. Work on #3340.
This commit is contained in:
parent
417255fc55
commit
1293cd8b6a
2 changed files with 68 additions and 0 deletions
56
configure.ac
56
configure.ac
|
@ -314,6 +314,62 @@ AC_CHECK_FUNCS( getpwent )
|
|||
|
||||
AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )
|
||||
|
||||
dnl AC_CHECK_FUNCS uses C linkage, but sometimes (Solaris!) the behaviour is
|
||||
dnl different with C++.
|
||||
AC_MSG_CHECKING([for wcsdup])
|
||||
AC_TRY_LINK( [ #include <wchar.h> ],
|
||||
[ wchar_t* foo = wcsdup(L""); ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WCSDUP, 1, Define to 1 if you have the `wcsdup' function.)
|
||||
],
|
||||
[AC_MSG_RESULT(no)],
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for std::wcsdup])
|
||||
AC_TRY_LINK( [ #include <wchar.h> ],
|
||||
[ wchar_t* foo = std::wcsdup(L""); ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_STD__WCSDUP, 1, Define to 1 if you have the `std::wcsdup' function.)
|
||||
],
|
||||
[AC_MSG_RESULT(no)],
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for wcscasecmp])
|
||||
AC_TRY_LINK( [ #include <wchar.h> ],
|
||||
[ int foo = wcscasecmp(L"", L""); ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WCSCASECMP, 1, Define to 1 if you have the `wcscasecmp' function.)
|
||||
],
|
||||
[AC_MSG_RESULT(no)],
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for std::wcscasecmp])
|
||||
AC_TRY_LINK( [ #include <wchar.h> ],
|
||||
[ int foo = std::wcscasecmp(L"", L""); ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_STD__WCSCASECMP, 1, Define to 1 if you have the `std::wcscasecmp' function.)
|
||||
],
|
||||
[AC_MSG_RESULT(no)],
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for wcsncasecmp])
|
||||
AC_TRY_LINK( [ #include <wchar.h> ],
|
||||
[ int foo = wcsncasecmp(L"", L"", 0); ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WCSNCASECMP, 1, Define to 1 if you have the `wcsncasecmp' function.)
|
||||
],
|
||||
[AC_MSG_RESULT(no)],
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for std::wcsncasecmp])
|
||||
AC_TRY_LINK( [ #include <wchar.h> ],
|
||||
[ int foo = std::wcsncasecmp(L"", L"", 0); ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_STD__WCSNCASECMP, 1, Define to 1 if you have the `std::wcsncasecmp' function.)
|
||||
],
|
||||
[AC_MSG_RESULT(no)],
|
||||
)
|
||||
|
||||
if test x$local_gettext != xno; then
|
||||
AC_CHECK_FUNCS( gettext )
|
||||
|
||||
|
|
12
src/common.h
12
src/common.h
|
@ -825,4 +825,16 @@ static const wchar_t *enum_to_str(T enum_val, const enum_map<T> map[]) {
|
|||
return NULL;
|
||||
};
|
||||
|
||||
#if !defined(HAVE_WCSDUP) && defined(HAVE_STD__WCSDUP)
|
||||
using std::wcsdup;
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_WCSCASECMP) && defined(HAVE_STD__WCSCASECMP)
|
||||
using std::wcscasecmp;
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_WCSNCASECMP) && defined(HAVE_STD__WCSNCASECMP)
|
||||
using std::wcsncasecmp;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue