Improve support for NetBSD (#944)

- fix gcc version check for FL_DEPRECATED macro

- fix #include for select() on NetBSD < 3.0 (#944)

For more info please see GitHub Issue #944
This commit is contained in:
Albrecht Schlosser 2024-04-02 15:26:36 +02:00
parent 16cd29fd6d
commit 7a879568b3
2 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/*
* Function attribute declarations for the Fast Light Tool Kit (FLTK).
*
* Copyright 1998-2023 by Bill Spitzak and others.
* Copyright 1998-2024 by Bill Spitzak and others.
*
* This library is free software. Distribution and use rights are outlined in
* the file "COPYING" which should have been included with this file. If this
@ -168,11 +168,11 @@
#endif
#endif /* gcc 4.5.0 */
#if FL_GCC_VERSION > 30100 /* gcc 3.1.0 */
#if FL_GCC_VERSION >= 30400 /* gcc 3.4.0 */
#ifndef FL_DEPRECATED
#define FL_DEPRECATED(msg, func) func __attribute__((deprecated))
#endif
#endif /* gcc 3.1.0 */
#endif /* gcc 3.4.0 */
#endif /* __GNUC__ */

View File

@ -31,6 +31,18 @@ static pollfd *pollfds = 0;
# include <sys/select.h>
# endif /* HAVE_SYS_SELECT_H */
// NetBSD before version 3.0 declares select() in "unistd.h" (#944):
// https://man.netbsd.org/NetBSD-2.1/select.2
# if defined(__NetBSD__)
# include <sys/param.h> // For '__NetBSD_Version__' definition
# if defined(__NetBSD_Version__) && (__NetBSD_Version__ < 300000000)
# include <sys/types.h>
# include <sys/time.h>
# include <unistd.h>
# endif // __NetBSD_Version__
# endif // __NetBSD__
# define POLLIN 1
# define POLLOUT 4
# define POLLERR 8