sdl2.m4 updates:

- remove HP/UX 9 (%@#!) support
- change fopen() mode from "a" to "w" in test code.
- bump its serial num to 2.
- test/acinclude.m4: same sdl2.m4 updates.
This commit is contained in:
Ozkan Sezer 2020-12-22 17:00:11 +03:00
parent 087de97b56
commit f117db5186
2 changed files with 11 additions and 54 deletions

33
sdl2.m4
View File

@ -7,14 +7,15 @@
# #
# Changelog: # Changelog:
# * also look for SDL2.framework under Mac OS X # * also look for SDL2.framework under Mac OS X
# * removed HP/UX 9 support.
# serial 1 # serial 2
dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl dnl
AC_DEFUN([AM_PATH_SDL2], AC_DEFUN([AM_PATH_SDL2],
[dnl [dnl
dnl Get the cflags and libraries from the sdl2-config script dnl Get the cflags and libraries from the sdl2-config script
dnl dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
@ -112,38 +113,16 @@ dnl
AC_TRY_RUN([ AC_TRY_RUN([
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "SDL.h" #include "SDL.h"
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int major, minor, micro; int major, minor, micro;
char *tmp_version; FILE *fp = fopen("conf.sdltest", "w");
/* This hangs on some systems (?) if (fp) fclose(fp);
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */ if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_sdl_version"); printf("%s, bad version string\n", "$min_sdl_version");
exit(1); exit(1);
} }

View File

@ -5,13 +5,13 @@
# stolen from Manish Singh # stolen from Manish Singh
# Shamelessly stolen from Owen Taylor # Shamelessly stolen from Owen Taylor
# serial 1 # serial 2
dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl dnl
AC_DEFUN([AM_PATH_SDL2], AC_DEFUN([AM_PATH_SDL2],
[dnl [dnl
dnl Get the cflags and libraries from the sdl2-config script dnl Get the cflags and libraries from the sdl2-config script
dnl dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
@ -83,38 +83,16 @@ dnl
AC_TRY_RUN([ AC_TRY_RUN([
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "SDL.h" #include "SDL.h"
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int major, minor, micro; int major, minor, micro;
char *tmp_version; FILE *fp = fopen("conf.sdltest", "w");
/* This hangs on some systems (?) if (fp) fclose(fp);
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */ if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_sdl_version"); printf("%s, bad version string\n", "$min_sdl_version");
exit(1); exit(1);
} }