Skip to content
Permalink
Browse files

Configure dynamically generates SDL_config.h

I'm still wrestling with autoheader, but this should work for now...
Fixed lots of build problems with C library support disabled
  • Loading branch information
slouken committed Feb 7, 2006
1 parent 249b20c commit bc0d1253796490dc6c7c86d00c98f71a0ac3b523
@@ -6,6 +6,7 @@ echo "This may take a while ..."
# Touch the timestamps on all the files since CVS messes them up
directory=`dirname $0`
touch $directory/configure.in
touch $directory/include/SDL_config.h.in

# Regenerate configuration files
aclocal || exit 1
@@ -1,5 +1,42 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(README)
AH_TOP([/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Sam Lantinga
slouken@libsdl.org
*/

#ifndef _SDL_config_h
#define _SDL_config_h

/* This is a set of defines to configure the SDL features */

/* Comment this if you want to build without any libc requirements */
#undef HAVE_LIBC
#ifdef HAVE_LIBC
])
AC_CONFIG_HEADER(include/SDL_config.h)
AH_BOTTOM([
#endif /* HAVE_LIBC */

#endif /* _SDL_config_h */
])

dnl Set various version strings - taken gratefully from the GTk sources
#
@@ -113,6 +150,40 @@ if test x$ac_cv_prog_gcc = xyes; then
fi
fi

dnl See whether we are allowed to use the system C library
AC_ARG_ENABLE(libc,
[ --enable-libc Use the system C library [default=yes]],
, AC_DEFINE(HAVE_LIBC))

dnl Checks for header files.
AC_CHECK_HEADERS(alloca.h stdint.h stdlib.h stdarg.h malloc.h)
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(stdio.h)
AC_CHECK_HEADERS(signal.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(malloc calloc realloc free)
AC_CHECK_FUNCS(getenv putenv qsort abs)
AC_CHECK_FUNCS(memset memcpy memmove memcmp)
AC_CHECK_FUNCS(strlen strcpy strncpy strcat strncat strdup)
AC_CHECK_FUNCS(_strrev _strupr _strlwr)
AC_CHECK_FUNCS(strchr strrchr strstr)
AC_CHECK_FUNCS(itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof)
AC_CHECK_FUNCS(strcmp strncmp stricmp strcasecmp)
AC_CHECK_FUNCS(sscanf snprintf vsnprintf)

dnl Initialize the compiler and linker flags for SDL applications

SDL_CFLAGS=""
@@ -41,3 +41,7 @@ libSDLinclude_HEADERS = \
SDL_windows.h \
begin_code.h \
close_code.h

EXTRA_DIST = \
SDL_config.h.in \
SDL_config.h.minimal
@@ -23,81 +23,8 @@
#ifndef _SDL_config_h
#define _SDL_config_h

/* This is a set of defines to configure the SDL features */
/* This is the minimal configuration that can be used to build SDL */

#define HAVE_STDARG_H

/* Comment this if you want to build without any libc requirements */
#define HAVE_LIBC
#ifdef HAVE_LIBC

/* Various C library headers */
#ifndef HAVE_CTYPE_H
#define HAVE_CTYPE_H
#endif
#ifndef HAVE_STDIO_H
#define HAVE_STDIO_H
#endif
#ifndef HAVE_STDLIB_H
#define HAVE_STDLIB_H
#endif
#ifndef HAVE_MALLOC_H
#define HAVE_MALLOC_H
#endif
#ifndef HAVE_STRING_H
#define HAVE_STRING_H
#endif
#if !defined(_WIN32_WCE)
#ifndef HAVE_SIGNAL_H
#define HAVE_SIGNAL_H
#endif
#endif /* !_WIN32_WCE */

/* Features provided by SDL_stdlib.h */
#define HAVE_MALLOC
#define HAVE_REALLOC
#define HAVE_FREE
#ifndef HAVE_ALLOCA
#define HAVE_ALLOCA
#endif
#if !defined(_WIN32) /* Don't use C runtime versions of these on Windows */
#define HAVE_GETENV
#define HAVE_PUTENV
#endif
/*#define HAVE_QSORT*/

/* Features provided by SDL_string.h */
#define HAVE_MEMSET
#define HAVE_MEMCPY
#define HAVE_MEMMOVE
#define HAVE_MEMCMP
#define HAVE_STRLEN
#define HAVE_STRCPY
#define HAVE_STRNCPY
#define HAVE_STRCAT
#define HAVE_STRNCAT
/*#define HAVE__STRREV*/
/*#define HAVE__STRUPR*/
/*#define HAVE__STRLWR*/
#define HAVE_STRCHR
#define HAVE_STRRCHR
#define HAVE_STRSTR
/*#define HAVE_ITOA*/
/*#define HAVE__LTOA*/
/*#define HAVE__UITOA*/
/*#define HAVE__ULTOA*/
/*#define HAVE_STRTOL*/
/*#define HAVE__I64TOA*/
/*#define HAVE__UI64TOA*/
/*#define HAVE_STRTOLL*/
#define HAVE_STRCMP
#define HAVE_STRNCMP
/*#define HAVE_STRICMP*/
/*#define HAVE_STRCASECMP*/
#define HAVE_SSCANF
/*#define HAVE_SNPRINTF*/
/*#define HAVE_VSNPRINTF*/

#endif /* HAVE_LIBC */
#define HAVE_STDARG_H 1

#endif /* _SDL_config_h */

0 comments on commit bc0d125

Please sign in to comment.