mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:37:12 +00:00
getopt varies too much between platforms, and we already use compat/getopt.c
for Linux so just use it everywhere.
This commit is contained in:
2
compat.h
2
compat.h
@ -370,7 +370,6 @@ int utf8proc_mbtowc(wchar_t *, const char *, size_t);
|
|||||||
int utf8proc_wctomb(char *, wchar_t);
|
int utf8proc_wctomb(char *, wchar_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_GETOPT
|
|
||||||
/* getopt.c */
|
/* getopt.c */
|
||||||
extern int BSDopterr;
|
extern int BSDopterr;
|
||||||
extern int BSDoptind;
|
extern int BSDoptind;
|
||||||
@ -384,6 +383,5 @@ int BSDgetopt(int, char *const *, const char *);
|
|||||||
#define optopt BSDoptopt
|
#define optopt BSDoptopt
|
||||||
#define optreset BSDoptreset
|
#define optreset BSDoptreset
|
||||||
#define optarg BSDoptarg
|
#define optarg BSDoptarg
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* COMPAT_H */
|
#endif /* COMPAT_H */
|
||||||
|
40
configure.ac
40
configure.ac
@ -128,6 +128,12 @@ AC_FUNC_STRNLEN
|
|||||||
# Look for clock_gettime. Must come before event_init.
|
# Look for clock_gettime. Must come before event_init.
|
||||||
AC_SEARCH_LIBS(clock_gettime, rt)
|
AC_SEARCH_LIBS(clock_gettime, rt)
|
||||||
|
|
||||||
|
# Always use our getopt because 1) glibc's doesn't enforce argument order 2)
|
||||||
|
# musl does not set optarg to NULL for flags without arguments (although it is
|
||||||
|
# not required to, but it is helpful) 3) there are probably other weird
|
||||||
|
# implementations.
|
||||||
|
AC_LIBOBJ(getopt)
|
||||||
|
|
||||||
# Look for libevent.
|
# Look for libevent.
|
||||||
PKG_CHECK_MODULES(
|
PKG_CHECK_MODULES(
|
||||||
LIBEVENT,
|
LIBEVENT,
|
||||||
@ -427,40 +433,6 @@ else
|
|||||||
AC_LIBOBJ(unvis)
|
AC_LIBOBJ(unvis)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Look for getopt. glibc's getopt does not enforce argument order and the ways
|
|
||||||
# of making it do so are stupid, so just use our own instead.
|
|
||||||
AC_CHECK_FUNC(getopt, found_getopt=yes, found_getopt=no)
|
|
||||||
if test "x$found_getopt" != xno; then
|
|
||||||
AC_MSG_CHECKING(if getopt is suitable)
|
|
||||||
AC_EGREP_CPP(
|
|
||||||
yes,
|
|
||||||
[
|
|
||||||
#include <features.h>
|
|
||||||
#ifdef __GLIBC__
|
|
||||||
yes
|
|
||||||
#endif
|
|
||||||
],
|
|
||||||
[
|
|
||||||
found_getopt=no
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
],
|
|
||||||
AC_MSG_RESULT(yes))
|
|
||||||
fi
|
|
||||||
if test "x$found_getopt" != xno; then
|
|
||||||
AC_CHECK_DECLS(
|
|
||||||
[optarg, optind, optreset],
|
|
||||||
,
|
|
||||||
found_getopt=no,
|
|
||||||
[
|
|
||||||
#include <unistd.h>
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
if test "x$found_getopt" != xno; then
|
|
||||||
AC_DEFINE(HAVE_GETOPT)
|
|
||||||
else
|
|
||||||
AC_LIBOBJ(getopt)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Look for fdforkpty and forkpty in libutil.
|
# Look for fdforkpty and forkpty in libutil.
|
||||||
AC_SEARCH_LIBS(fdforkpty, util, found_fdforkpty=yes, found_fdforkpty=no)
|
AC_SEARCH_LIBS(fdforkpty, util, found_fdforkpty=yes, found_fdforkpty=no)
|
||||||
if test "x$found_fdforkpty" = xyes; then
|
if test "x$found_fdforkpty" = xyes; then
|
||||||
|
Reference in New Issue
Block a user