Allocate foreign pointer objects in GC-scanned memory.
[bpt/guile.git] / libguile / gen-scmconfig.c
index 5f13513..c1d6aad 100644 (file)
 
  **********************************************************************/
 
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
 
-#include "gen-scmconfig.h"
+#include <libguile/gen-scmconfig.h>
 
 #include <stdio.h>
 #include <string.h>
+#include <uniconv.h>
 
 #define pf printf
 
@@ -168,10 +169,10 @@ main (int argc, char *argv[])
 #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");
@@ -218,14 +219,6 @@ main (int argc, char *argv[])
     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");
@@ -244,11 +237,6 @@ main (int argc, char *argv[])
   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_HAVE_ARRAYS (0 or 1) ***/
-  pf ("\n");
-  pf ("/* Set to 1 to add support for arrays and uniform arrays. */\n");
-  pf ("#define SCM_HAVE_ARRAYS %d /* 0 or 1 */\n", SCM_I_GSC_HAVE_ARRAYS);
-
   /*** SCM_STACK_GROWS_UP (0 or 1) ***/
   pf ("\n");
   pf ("/* Set to 1 if the stack grows up, 0 otherwise. */\n");
@@ -284,21 +272,6 @@ main (int argc, char *argv[])
   pf ("#define SCM_SIZEOF_LONG_LONG %d\n", SIZEOF_LONG_LONG);
   pf ("#define SCM_SIZEOF_UNSIGNED_LONG_LONG %d\n", SIZEOF_UNSIGNED_LONG_LONG);
 
-  pf("\n");
-  pf("/* handling for the deprecated long_long and ulong_long types */\n");  
-  pf("/* If anything suitable is available, it'll be defined here.  */\n");  
-  pf("#if (SCM_ENABLE_DEPRECATED == 1)\n");
-  if (SIZEOF_LONG_LONG != 0)
-    pf ("typedef long long long_long;\n");
-  else if (SIZEOF___INT64 != 0)
-    pf ("typedef __int64 long_long;\n");
-  
-  if (SIZEOF_UNSIGNED_LONG_LONG != 0)
-    pf ("typedef unsigned long long ulong_long;\n");
-  else if (SIZEOF_UNSIGNED___INT64 != 0)
-    pf ("typedef unsigned __int64 ulong_long;\n");
-  pf("#endif /* SCM_ENABLE_DEPRECATED == 1 */\n");
-
   pf ("\n");
   pf ("/* These are always defined. */\n");
   pf ("typedef %s scm_t_int8;\n", SCM_I_GSC_T_INT8);
@@ -309,6 +282,8 @@ main (int argc, char *argv[])
   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);
@@ -383,11 +358,54 @@ main (int argc, char *argv[])
   pf ("#define SCM_USE_NULL_THREADS %d /* 0 or 1 */\n",
       SCM_I_GSC_USE_NULL_THREADS);
 
-  pf ("/* FIXME: what is this used for now? */\n");
-  pf ("#define SCM_USE_COOP_THREADS %d /* 0 or 1 */\n",
-      SCM_I_GSC_USE_COOP_THREADS);
+  pf ("/* Define to 1 if need braces around PTHREAD_ONCE_INIT (for Solaris). */\n");
+  pf ("#define SCM_NEED_BRACES_ON_PTHREAD_ONCE_INIT %d /* 0 or 1 */\n",
+      SCM_I_GSC_NEED_BRACES_ON_PTHREAD_ONCE_INIT);
+
+  pf ("/* Define to 1 if need braces around PTHREAD_MUTEX_INITIALIZER\n"
+      "   (for IRIX with GCC)  */\n");
+  pf ("#define SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER %d /* 0 or 1 */\n",
+      SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER);
+
+  pf ("\n\n/*** File system access ***/\n");
+
+  pf ("/* Define to 1 if `struct dirent64' is available.  */\n");
+  pf ("#define SCM_HAVE_STRUCT_DIRENT64 %d /* 0 or 1 */\n",
+      SCM_I_GSC_HAVE_STRUCT_DIRENT64);
+
+  pf ("/* Define to 1 if `readdir64_r ()' is available.  */\n");
+#ifdef HAVE_READDIR64_R
+  pf ("#define SCM_HAVE_READDIR64_R 1 /* 0 or 1 */\n");
+#else
+  pf ("#define SCM_HAVE_READDIR64_R 0 /* 0 or 1 */\n");
+#endif
+
+  /* Arrange so that we have a file offset type that reflects the one
+     used when compiling Guile, regardless of what the application's
+     `_FILE_OFFSET_BITS' says.  See
+     http://lists.gnu.org/archive/html/bug-guile/2009-06/msg00018.html
+     for the original bug report.
+
+     Note that we can't define `scm_t_off' in terms of `off_t' or
+     `off64_t' because they may or may not be available depending on
+     how the application that uses Guile is compiled.  */
+
+#if defined GUILE_USE_64_CALLS && defined HAVE_STAT64
+  pf ("typedef scm_t_int64 scm_t_off;\n");
+#elif SIZEOF_OFF_T == SIZEOF_INT
+  pf ("typedef int scm_t_off;\n");
+#else
+  pf ("typedef long int scm_t_off;\n");
+#endif
+
+  pf ("/* Define to 1 if the compiler supports the "
+      "`__thread' storage class.  */\n");
+  if (SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS)
+    pf ("#define SCM_HAVE_THREAD_STORAGE_CLASS\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");
@@ -406,6 +424,16 @@ main (int argc, char *argv[])
       "#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_ESCAPE_SEQUENCE %d\n",
+      (int) iconveh_escape_sequence);  
+
   printf ("#endif\n");
 
   return 0;