1 /* contrib/powerpc-vsx/linux.c
3 * Copyright (c) 2017 Glenn Randers-Pehrson
4 * Written by Vadim Barkov, 2017.
6 * This code is released under the libpng license.
7 * For conditions of distribution and use, see the disclaimer
11 * BUG REPORTS: png-mng-implement@sourceforge.net
13 * png_have_vsx implemented for Linux by reading the widely available
14 * pseudo-file /proc/cpuinfo.
16 * This code is strict ANSI-C and is probably moderately portable; it does
17 * however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
30 png_have_vsx(png_structp png_ptr)
34 const char *string = "altivec supported";
40 f = fopen("/proc/cpuinfo", "r");
43 memset(input,0,MAXLINE);
44 while(fgets(input,MAXLINE,f) != NULL)
46 token = strstr(input,string);
51 #ifdef PNG_WARNINGS_SUPPORTED
53 png_warning(png_ptr, "/proc/cpuinfo open failed");