+void initialize_gc_option(void) {
+ /* GC default */
+ char *def;
+#ifdef WITH_LIBGC
+ gc_option = boehm;
+ def = "boehm";
+#else
+ gc_option = nitgc;
+ def = "nitgc";
+#endif
+
+ /* Process GC runtime selection */
+ if (getenv("NIT_GC_OPTION") != NULL) {
+ char *opt=getenv("NIT_GC_OPTION");
+ if (strcmp(opt, "boehm")==0) {
+#ifdef WITH_LIBGC
+ gc_option = boehm;
+#else
+ fprintf(stderr, "Compiled without Boehm GC support. Using default '%s'.\n", def);
+#endif
+ } else if (strcmp(opt, "nitgc")==0) {
+ gc_option = nitgc;
+ } else if (strcmp(opt, "malloc")==0) {
+ gc_option = gc_opt_malloc;
+ } else if (strcmp(opt, "large")==0) {
+ gc_option = large;
+ } else if (strcmp(opt, "help")==0) {
+ fprintf(stderr, "NIT_GC_OPTION accepts 'nitgc'"
+#ifdef WITH_LIBGC
+ ", 'boehm'"
+#endif
+ ", 'large', 'malloc'. Default is '%s'.\n", def);
+ exit(1);
+ } else {
+ fprintf(stderr, "Invalid GC option in NIT_GC_OPTION environment variable. Using default '%s'.\n", def);
+ }