-
Notifications
You must be signed in to change notification settings - Fork 629
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
buildsys: add check for asprintf to enable alt implementation #1561
Conversation
main/options.c
Outdated
@@ -597,7 +597,7 @@ static vString* getHome (void) | |||
} | |||
} | |||
|
|||
#if defined(_WIN32) && !(defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR)) | |||
#if defined(_WIN32) && !(defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR)) || !defined(HAVE_ASPRINTF) |
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.
I don't know what the Mingw stuff is there, but it seems to me this whole thing could be replaced with:
#ifndef HAVE_ASPRINTF
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.
I assumed that at least windows is compiled without running configure, but I haven't deeply explored the buildsystem for that.
I decided to take a safe route here, as I'm not knowledgable enough to make a decision about the existing conditions.
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.
I haven't tested but this might be useful when mk_mingw.mak
is used with MinGW-w64.
MinGW-w64 has asprintf
, but mk_mingw.mak
(and main/e_msoft.h
) doesn't define HAVE_ASPRINTF
.
(Moving the condition into e_msoft.h
might be another option.)
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.
I mean, for example:
--- a/main/e_msoft.h
+++ b/main/e_msoft.h
@@ -66,6 +66,10 @@ typedef enum { false, true } bool;
# define FA_DIREC _A_SUBDIR
# define ff_name name
+# if defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR)
+# define HAVE_ASPRINTF 1
+# endif
+
#endif
#endif
(Not tested)
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.
O.k. I will make a pull request based on @grobian with the comment of @codebrainz and @k-takata.
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.
(After fixing the trouble about CI I'm working for).
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.
Do you want me to try and put both suggestions in this PR and see if all tests turn green?
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.
@grobian, YES!
Could you rebase the lastest code? I've fixed bugs running test cases on CI environements.
main/options.c
Outdated
@@ -597,7 +597,7 @@ static vString* getHome (void) | |||
} | |||
} | |||
|
|||
#if defined(_WIN32) && !(defined(__USE_MINGW_ANSI_STDIO) && defined(__MINGW64_VERSION_MAJOR)) | |||
#if defined(_WIN32) || !defined(HAVE_ASPRINTF) |
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.
This line can be now just #ifndef HAVE_ASPRINTF
.
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.
I will take your word for it.
Some platforms (like Solaris 10) lack asprintf. The implementation made for Windows works fine there, so use autoconf to determine whether asprintf exists, and if not, enable compiling the replacement implementation. To further simplify the guard logic, define HAVE_ASPRINTF for MinGW when appropriate in e_msoft.h.
LGTM. |
Some platforms (like Solaris 10) lack asprintf. The implementation made
for Windows works fine there, so use autoconf to determine whether
asprintf exists, and if not, enable compiling the replacement
implementation.
These are the relevant build messages: