add initial CMake and Visual Studio build support
This moves the compatibility include files from include to include/compat so we can use the awful MS C compiler <../include/> trick to emulate the GNU #include_next extension. This also removes a few old compat files we do not need anymore.
This commit is contained in:
39
include/compat/stdio.h
Normal file
39
include/compat/stdio.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Public domain
|
||||
* stdio.h compatibility shim
|
||||
*/
|
||||
|
||||
#ifndef LIBCRYPTOCOMPAT_STDIO_H
|
||||
#define LIBCRYPTOCOMPAT_STDIO_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <../include/stdio.h>
|
||||
#else
|
||||
#include_next <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
#include <stdarg.h>
|
||||
int vasprintf(char **str, const char *fmt, va_list ap);
|
||||
int asprintf(char **str, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
void posix_perror(const char *s);
|
||||
FILE * posix_fopen(const char *path, const char *mode);
|
||||
int posix_rename(const char *oldpath, const char *newpath);
|
||||
|
||||
#ifndef NO_REDEF_POSIX_FUNCTIONS
|
||||
#define perror(errnum) posix_perror(errnum)
|
||||
#define fopen(path, mode) posix_fopen(path, mode)
|
||||
#define rename(oldpath, newpath) posix_rename(oldpath, newpath)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user