-
-
Notifications
You must be signed in to change notification settings - Fork 368
build: define more typical HAVE_PTHREAD if pthreads library can be used #6479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
||
/* | ||
* configuration information solely dependent on the above | ||
* nothing below this point should need changing | ||
*/ | ||
|
||
#if defined(HAVE_VALUES_H) && !defined(HAVE_LIMITS_H) | ||
#define INT_MIN -MAXINT | ||
#endif | ||
|
||
|
||
|
||
/* | ||
* Defines needed to get large file support - from cdrtools-2.01 | ||
*/ | ||
|
||
/* MINGW32 LFS */ | ||
|
||
/* define if we have LFS */ | ||
#undef HAVE_LARGEFILES | ||
|
||
#ifdef HAVE_LARGEFILES /* If we have working largefiles at all */ | ||
/* This is not defined with glibc-2.1.3 */ | ||
|
||
#if 0 | ||
|
||
/* what to do with these four? configure comments these out */ | ||
|
||
#undef _LARGEFILE_SOURCE /* To make ftello() visible (HP-UX 10.20). */ | ||
#undef _LARGE_FILES /* Large file defined on AIX-style hosts. */ | ||
#undef _XOPEN_SOURCE /* To make ftello() visible (glibc 2.1.3). */ | ||
#undef _XOPEN_SOURCE_EXTENDED | ||
/* XXX We don't use this because glibc2.1.3*/ | ||
/* XXX is bad anyway. If we define */ | ||
/* XXX _XOPEN_SOURCE we will loose caddr_t */ | ||
|
||
#endif | ||
|
||
#if defined(__MINGW32__) && (!defined(_FILE_OFFSET_BITS) || (_FILE_OFFSET_BITS != 64)) | ||
|
||
/* add/remove as needed */ | ||
/* redefine off_t */ | ||
#include <sys/types.h> | ||
#define off_t off64_t | ||
/* fseeko and ftello are safe because not defined by MINGW */ | ||
#define HAVE_FSEEKO | ||
#define fseeko fseeko64 | ||
#define ftello ftello64 | ||
/* redefine lseek */ | ||
#include <unistd.h> | ||
#define lseek lseek64 | ||
/* redefine stat and fstat */ | ||
/* use _stati64 compatible with MSVCRT < 6.1 */ | ||
#include <sys/stat.h> | ||
#define stat _stati64 | ||
#define fstat _fstati64 | ||
|
||
#endif /* MINGW32 LFS */ | ||
|
||
#endif /* HAVE_LARGEFILES */ | ||
|
||
|
||
/* define if langinfo.h exists */ | ||
#undef HAVE_LANGINFO_H | ||
|
||
/* Use framebuffer objects for off-screen OpenGL rendering */ | ||
#define OPENGL_FBO 1 | ||
|
||
#endif /* _config_h */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is any of this supposed to be kept? I see some mingw stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea. But having custom code in files that are generated/re-generated is not the correct way to go. Anyone running autoreconf
would then nuke them. Thus – if it is necessary, then this is a wrong place to have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial periodic update script was running that each time, and got trimmed down to only keep the guess file and another because of this. It would have kept it in sync and prevented the deviation from arriving
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to configure.ac
thus making autotools friendly (survive autoreconfigure
).
#ifndef _config_h | ||
#define _config_h | ||
|
||
#define GDEBUG 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one of our overrides on the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. If we have overrides, we should implement them in a robust way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to configure.ac thus making autotools friendly (survive autoreconfigure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now we see the results after autoreconf?
For original history, see config.h.in before this commit.
/* MINGW32 LFS */ | ||
|
||
/* define if we have LFS */ | ||
#undef HAVE_LARGEFILES | ||
|
||
#ifdef HAVE_LARGEFILES /* If we have working largefiles at all */ | ||
/* This is not defined with glibc-2.1.3 */ | ||
|
||
#if defined(__MINGW32__) && (!defined(_FILE_OFFSET_BITS) || (_FILE_OFFSET_BITS != 64)) | ||
|
||
/* add/remove as needed */ | ||
/* redefine off_t */ | ||
#include <sys/types.h> | ||
#define off_t off64_t | ||
/* fseeko and ftello are safe because not defined by MINGW */ | ||
#define HAVE_FSEEKO | ||
#define fseeko fseeko64 | ||
#define ftello ftello64 | ||
/* redefine lseek */ | ||
#include <unistd.h> | ||
#define lseek lseek64 | ||
/* redefine stat and fstat */ | ||
/* use _stati64 compatible with MSVCRT < 6.1 */ | ||
#include <sys/stat.h> | ||
#define stat _stati64 | ||
#define fstat _fstati64 | ||
|
||
#endif /* MINGW32 LFS */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it matter if it isn't guarded by the #ifndef _config_h anymore? And does the order matter too? (I couldn't determine easily on my phone if the variables/defines used there were already set at the time of use)
AC_CANONICAL_HOST | ||
AC_PROG_CC | ||
|
||
# Start some config.h customizations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like comment on other file, is it possible to have it at the end, where the HAVE defines are already defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe that's because I'm viewing this on my phone, but does the PR description capture what is in the changes? I can't match one to the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as the content goes, this is fine with me, except two three things:
- Description of the minGW and OpenGL changes should be included somewhere.
- Why this does not include CMake change? (Included in #6480)
- OpenGL needs fixes for macOS which now fails in
/Users/runner/work/grass/grass/lib/ogsf
Since I already tested the follow-up PR #6480, I see that this is valuable and generally functional.
Correction of my comment: The macOS build fails on the follow-up PR #6480 (I suppose because the OpenGL fixes are only here). |
Yes, because three lines of code revealed a problem in our build system. I'll create a separate PR with build system fixes to be merged first and then reference it here. Thus there will be a chain of PRs to be merged to get #6480 in. CMake experts can comment more on this, but as I understood, modern CMake practice is to not pollute global space with local defines. |
At the moment we usually just check for presence of pthread headers and then assume pthread library is also fine. This PR introduces more common
HAVE_PTHREAD
that generally should be used instead ofHAVE_PTHREAD_H
in most of our cases.Actual change is only in
configure.ac
, the rest is just a side effect of runningautoreconf