123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include "png.h"
- #ifndef MAXLINE
- # define MAXLINE 1024
- #endif
- static int
- png_have_vsx(png_structp png_ptr)
- {
- FILE *f;
- const char *string = "altivec supported";
- char input[MAXLINE];
- char *token = NULL;
- PNG_UNUSED(png_ptr)
- f = fopen("/proc/cpuinfo", "r");
- if (f != NULL)
- {
- memset(input,0,MAXLINE);
- while(fgets(input,MAXLINE,f) != NULL)
- {
- token = strstr(input,string);
- if(token != NULL)
- return 1;
- }
- }
- #ifdef PNG_WARNINGS_SUPPORTED
- else
- png_warning(png_ptr, "/proc/cpuinfo open failed");
- #endif
- return 0;
- }
|