+/* Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ *
+ * 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 3 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 Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
/**********************************************************************
- use 1 and 0 for public #defines instead of "def and undef",
i.e. use #define SCM_HAVE_FOO rather than just not defining
SCM_HAVE_FOO whenever possible. See GNU Coding Guidelines for
- rationale. The only notable non-deprecated exceptions to this
- rule are GUILE_DEBUG and GUILE_DEBUG_FREELIST which do not follow
- this convention in order to retain backward compatibility.
+ rationale. The only notable non-deprecated exception to this rule
+ is GUILE_DEBUG which does not follow this convention in order to
+ retain backward compatibility.
- in the code below, be *VERY* careful not to use or rely on any
runtime-dynamic information below. For example, you cannot use
type.
- we now use SCM_SIZEOF_FOO != 0 rather than SCM_HAVE_FOO for any
- cases where the size might actually vary. For types where the
- size is fixed, we use SCM_HAVE_FOO, i.e. you can see us define or
- not define SCM_HAVE_T_INT64 below when appropriate.
+ cases where the size might actually vary.
Rationales (not finished):
#include <stdio.h>
#include <string.h>
-#include <uniconv.h>
#define pf printf
pf ("/* limits.h not available */\n");
#endif
-# ifdef TIME_WITH_SYS_TIME
+#if HAVE_SYS_TIME_H
pf ("#include <sys/time.h>\n");
+#else
+ pf ("/* sys/time.h not available */\n");
+#endif
+
+#if HAVE_TIME_H
pf ("#include <time.h>\n");
-# else
-# ifdef HAVE_SYS_TIME_H
- pf ("#include <sys/time.h>\n");
-# else
-# ifdef HAVE_TIME_H
- pf ("#include <time.h>\n");
-# endif
-# endif
-# endif
+#else
+ pf ("/* time.h not available */\n");
+#endif
pf("\n");
#ifdef STDC_HEADERS
pf ("#define SCM_HAVE_STDC_HEADERS 1 /* 0 or 1 */\n");
pf ("#include <stdlib.h>\n");
-# if HAVE_SYS_TYPES_H
+# ifdef HAVE_SYS_TYPES_H
pf ("#include <sys/types.h>\n");
# endif
-# if HAVE_SYS_STDTYPES_H
+# ifdef HAVE_SYS_STDTYPES_H
pf ("#include <sys/stdtypes.h>\n");
# endif
pf ("#include <stddef.h>\n");
pf ("#define SCM_HAVE_SYS_SELECT_H 0 /* 0 or 1 */\n");
#endif
-#ifdef HAVE_FLOATINGPOINT_H
- pf ("#define SCM_HAVE_FLOATINGPOINT_H 1 /* 0 or 1 */\n");
-#else
- pf ("#define SCM_HAVE_FLOATINGPOINT_H 0 /* 0 or 1 */\n");
-#endif
-
-#ifdef HAVE_IEEEFP_H
- pf ("#define SCM_HAVE_IEEEFP_H 1 /* 0 or 1 */\n");
-#else
- pf ("#define SCM_HAVE_IEEEFP_H 0 /* 0 or 1 */\n");
-#endif
-
-#ifdef HAVE_NAN_H
- pf ("#define SCM_HAVE_NAN_H 1 /* 0 or 1 */\n");
-#else
- pf ("#define SCM_HAVE_NAN_H 0 /* 0 or 1 */\n");
-#endif
-
#ifdef HAVE_WINSOCK2_H
pf ("#define SCM_HAVE_WINSOCK2_H 1 /* 0 or 1 */\n");
#else
pf ("#define GUILE_DEBUG 1 /* defined or undefined */\n");
else
pf ("/* #undef GUILE_DEBUG */\n");
-
- /*** GUILE_DEBUG_FREELIST (deined or undefined) ***/
- pf ("\n");
- pf ("/* Define this to debug the free list (helps w/ GC bugs). */\n");
- if (SCM_I_GSC_GUILE_DEBUG_FREELIST)
- pf ("#define GUILE_DEBUG_FREELIST 1 /* defined or undefined */\n");
- else
- pf ("/* #undef GUILE_DEBUG_FREELIST */\n");
- /*** SCM_ENABLE_DISCOURAGED (0 or 1) ***/
- pf ("\n");
- pf ("/* Set to 1 if you want to enable discouraged features. */\n");
- pf ("/* (value will be 0 or 1). */\n");
- pf ("#define SCM_ENABLE_DISCOURAGED %d\n", SCM_I_GSC_ENABLE_DISCOURAGED);
-
/*** SCM_ENABLE_DEPRECATED (0 or 1) ***/
pf ("\n");
pf ("/* Set to 1 if you want to enable deprecated features. */\n");
pf ("/* (value will be 0 or 1). */\n");
pf ("#define SCM_ENABLE_DEPRECATED %d\n", SCM_I_GSC_ENABLE_DEPRECATED);
- /*** SCM_ENABLE_ELISP (0 or 1) ***/
- pf ("\n");
- pf ("/* Set to 1 to add Elisp support (in addition to Scheme). */\n");
- pf ("#define SCM_ENABLE_ELISP %d /* 0 or 1 */\n", SCM_I_GSC_ENABLE_ELISP);
-
/*** SCM_STACK_GROWS_UP (0 or 1) ***/
pf ("\n");
pf ("/* Set to 1 if the stack grows up, 0 otherwise. */\n");
pf ("typedef %s scm_t_uint32;\n", SCM_I_GSC_T_UINT32);
pf ("typedef %s scm_t_intmax;\n", SCM_I_GSC_T_INTMAX);
pf ("typedef %s scm_t_uintmax;\n", SCM_I_GSC_T_UINTMAX);
+ pf ("typedef %s scm_t_intptr;\n", SCM_I_GSC_T_INTPTR);
+ pf ("typedef %s scm_t_uintptr;\n", SCM_I_GSC_T_UINTPTR);
if (0 == strcmp ("intmax_t", SCM_I_GSC_T_INTMAX))
pf ("#define SCM_SIZEOF_INTMAX %d\n", SIZEOF_INTMAX_T);
return 1;
pf ("\n");
- pf ("/* 64-bit integer -- if available SCM_HAVE_T_INT64 will be 1 and\n"
- " scm_t_int64 will be a suitable type, otherwise SCM_HAVE_T_INT64\n"
- " will be 0. */\n");
- if (SCM_I_GSC_T_INT64)
- {
- pf ("#define SCM_HAVE_T_INT64 1 /* 0 or 1 */\n");
- pf ("typedef %s scm_t_int64;\n", SCM_I_GSC_T_INT64);
- }
- else
- pf ("#define SCM_HAVE_T_INT64 0 /* 0 or 1 */\n");
+ pf ("#define SCM_HAVE_T_INT64 1 /* 0 or 1 */\n");
+ pf ("typedef %s scm_t_int64;\n", SCM_I_GSC_T_INT64);
+ pf ("#define SCM_HAVE_T_UINT64 1 /* 0 or 1 */\n");
+ pf ("typedef %s scm_t_uint64;\n", SCM_I_GSC_T_UINT64);
pf ("\n");
- pf ("/* 64-bit unsigned integer -- if available SCM_HAVE_T_UINT64 will\n"
- " be 1 and scm_t_uint64 will be a suitable type, otherwise\n"
- " SCM_HAVE_T_UINT64 will be 0. */\n");
- if (SCM_I_GSC_T_UINT64)
- {
- pf ("#define SCM_HAVE_T_UINT64 1 /* 0 or 1 */\n");
- pf ("typedef %s scm_t_uint64;\n", SCM_I_GSC_T_UINT64);
- }
- else
- pf ("#define SCM_HAVE_T_UINT64 0 /* 0 or 1 */\n");
-
- pf ("\n");
- pf ("/* scm_t_ptrdiff_t and size, always defined -- defined to long if\n"
+ pf ("/* scm_t_ptrdiff and size, always defined -- defined to long if\n"
" platform doesn't have ptrdiff_t. */\n");
pf ("typedef %s scm_t_ptrdiff;\n", SCM_I_GSC_T_PTRDIFF);
if (0 == strcmp ("long", SCM_I_GSC_T_PTRDIFF))
pf ("#define SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER %d /* 0 or 1 */\n",
SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER);
+#ifdef HAVE_GC_PTHREAD_CANCEL
+ pf ("#define SCM_HAVE_GC_PTHREAD_CANCEL 1 /* 0 or 1 */\n");
+#else
+ pf ("#define SCM_HAVE_GC_PTHREAD_CANCEL 0 /* 0 or 1 */\n");
+#endif
+
+#ifdef HAVE_GC_PTHREAD_EXIT
+ pf ("#define SCM_HAVE_GC_PTHREAD_EXIT 1 /* 0 or 1 */\n");
+#else
+ pf ("#define SCM_HAVE_GC_PTHREAD_EXIT 0 /* 0 or 1 */\n");
+#endif
+
+#ifdef HAVE_GC_PTHREAD_SIGMASK
+ pf ("#define SCM_HAVE_GC_PTHREAD_SIGMASK 1 /* 0 or 1 */\n");
+#else
+ pf ("#define SCM_HAVE_GC_PTHREAD_SIGMASK 0 /* 0 or 1 */\n");
+#endif
+
pf ("\n\n/*** File system access ***/\n");
pf ("/* Define to 1 if `struct dirent64' is available. */\n");
else
pf ("/* #undef SCM_HAVE_THREAD_STORAGE_CLASS */\n");
-#if USE_DLL_IMPORT
+#ifdef USE_DLL_IMPORT
pf ("\n");
pf ("/* Define some additional CPP macros on Win32 platforms. */\n");
pf ("# define __REGEX_IMPORT__ 1\n");
#endif
pf ("\n");
- pf ("#if SCM_ENABLE_DEPRECATED == 1\n"
- "# define USE_THREADS 1 /* always true now */\n"
- "# define GUILE_ISELECT 1 /* always true now */\n"
- "# define READER_EXTENSIONS 1 /* always true now */\n"
- "# define DEBUG_EXTENSIONS 1 /* always true now */\n"
- "# define DYNAMIC_LINKING 1 /* always true now */\n"
- "#endif\n");
- printf ("\n");
-
pf ("#define SCM_HAVE_ARRAYS 1 /* always true now */\n");
pf ("\n");
pf ("/* Constants from uniconv.h. */\n");
- pf ("#define SCM_ICONVEH_ERROR %d\n", (int) iconveh_error);
- pf ("#define SCM_ICONVEH_QUESTION_MARK %d\n",
- (int) iconveh_question_mark);
+ pf ("#define SCM_ICONVEH_ERROR %d\n", SCM_I_GSC_ICONVEH_ERROR);
+ pf ("#define SCM_ICONVEH_QUESTION_MARK %d\n",
+ SCM_I_GSC_ICONVEH_QUESTION_MARK);
pf ("#define SCM_ICONVEH_ESCAPE_SEQUENCE %d\n",
- (int) iconveh_escape_sequence);
+ SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE);
printf ("#endif\n");