This is the mail archive of the gsl-discuss@sourceware.cygnus.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Jan Kasprzak <kas@informatics.muni.cz>] [patch] gsl-0.4 and Linux/glibc2.1



[a note of appreciation; I'll apply the patch]

------- Start of forwarded message -------
Date: Tue, 1 Jun 1999 14:17:39 +0200
From: Jan Kasprzak <kas@informatics.muni.cz>
To: rosalia@cygnus.com
Cc: mejzlik@fi.muni.cz
Subject: [patch] gsl-0.4 and Linux/glibc2.1
Message-ID: <19990601141739.B667@informatics.muni.cz>

	Hello Mark,

	I have tried to compile gsl-0.4 on Linux with glibc2.1. It seems
that in this version of glibc the "stderr" is not a constant expression,
which makes the compilation of err/stream.c fail. I suggest to initialize
the gsl_stream to NULL and set it to stderr at run-time, for example in the
first call of gsl_stream_printf(). The quick fix is attached. I have not
tried to study the code, it just allows the gsl to compile and it seems
it may work :-)

	I use parts of gsl in Opal, my software for computation chemistry
(http://www.fi.muni.cz/~kas/opal/). So thanks for developing it and keep up
a good work.

	Sincerely,

-Yenya

P.S.: Are you an author of the dominion game? We have played it here some
	six or seven years ago ...

--- err/stream.c.orig	Tue Jun  1 13:53:27 1999
+++ err/stream.c	Tue Jun  1 13:55:59 1999
@@ -6,7 +6,11 @@
 #include <gsl_errno.h>
 #include <gsl_message.h>
 
-FILE * gsl_stream = stderr ;
+/*
+ * gsl_stream should not be initialized to stderr as stderr need not to be
+ * constant (e.g. Linux/glibc2.1). -Jan "Yenya" Kasprzak
+ */
+FILE * gsl_stream = NULL;
 gsl_stream_handler_t * gsl_stream_handler = NULL;
 
 void
@@ -18,6 +22,8 @@
       (*gsl_stream_handler) (label, file, line, reason);
       return;
     }
+  if (gsl_stream == NULL)
+      gsl_stream = stderr;
   fprintf (gsl_stream, "gsl: %s:%d: %s: %s\n", file, line, label, reason);
 
 }
@@ -35,5 +41,5 @@
 {
   FILE * previous_stream = gsl_stream;
   gsl_stream = new_stream;
-  return previous_stream;
+  return (previous_stream == NULL)?stderr:previous_stream;
 }

-- 
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz>       http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz   0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\             Czech Linux Homepage:  http://www.linux.cz/              ///
||||   > Where do the -- MARK --s  come from ?                          ||||
||||   It is the sound of Tux the penguin chewing on your system logs.  ||||

------- End of forwarded message -------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]