www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Really need help configuring config.h

Hi, I'm trying to compile gnu scientific library (gsl) v.1.7 with dcm++, and
after a lot of work I'm near the end of this task. This is a part of a  project
that aim to compile with dmc++ the following libraries: atlas (cblas), clapack,
and gsl.
In fact, I think that dmc++ is well suited for numerical computating, but it
still misses the ports for this famous libraries.
I have spent a lot of hours on this project, and i will write a tutorial and
upload the relevant files when the project will be finished.
I still have some problem compiling gsl:
1) I need to configure by hand config.h. I examined the headers in dm\include,
and i ended up with this config.h file:
*******************************************
/* config.h  Generated from configure.ac by autoheader.  
02.03.06: Edited by hand for DMC/WinXP 
*/

/* Define to 1 if you have the declaration of `acosh', and to 0 if you don't.
*/
#define HAVE_DECL_ACOSH 1

/* Define to 1 if you have the declaration of `asinh', and to 0 if you don't.
*/
#define HAVE_DECL_ASINH 1

/* Define to 1 if you have the declaration of `atanh', and to 0 if you don't.
*/
#define HAVE_DECL_ATANH 1

/* Define to 1 if you have the declaration of `expm1', and to 0 if you don't.
*/
#define HAVE_DECL_EXPM1 1

/* Define to 1 if you have the declaration of `feenableexcept', and to 0 if
you don't. */
#define HAVE_DECL_FEENABLEEXCEPT 0

/* Define to 1 if you have the declaration of `fesettrapenable', and to 0 if
you don't. */
#define HAVE_DECL_FESETTRAPENABLE 0

/* Define to 1 if you have the declaration of `finite', and to 0 if you don't.
*/
#define HAVE_DECL_FINITE 0

/* Define to 1 if you have the declaration of `frexp', and to 0 if you don't.
*/
#define HAVE_DECL_FREXP 1

/* Define to 1 if you have the declaration of `hypot', and to 0 if you don't.
*/
#define HAVE_DECL_HYPOT 1

/* Define to 1 if you have the declaration of `isfinite', and to 0 if you
don't. */
#define HAVE_DECL_ISFINITE 1

/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.
*/
#define HAVE_DECL_ISINF 1

/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
*/
#define HAVE_DECL_ISNAN 1

/* Define to 1 if you have the declaration of `ldexp', and to 0 if you don't.
*/
#define HAVE_DECL_LDEXP 1

/* Define to 1 if you have the declaration of `log1p', and to 0 if you don't.
*/
#define HAVE_DECL_LOG1P 1

/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H

/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM

/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1

/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1

/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1

/* Name of package */
#define PACKAGE		"Win-32 DMC++"

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 0			//§§§

/* Version number of package */
#define VERSION 1

/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
//#undef inline 
#define inline __inline

/* Define to `unsigned' if <sys/types.h> does not define. */
//#undef size_t

/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
//#undef volatile

/* Defined if this is an official release */
#undef RELEASED

/* Define if you have inline */
#define HAVE_INLINE 1
//#undef HAVE_INLINE

/* Define if you need to hide the static definitions of inline functions */
#undef HIDE_INLINE_STATIC
//#define HIDE_INLINE_STATIC

/* Defined if you have ansi EXIT_SUCCESS and EXIT_FAILURE in stdlib.h */
#define HAVE_EXIT_SUCCESS_AND_FAILURE 1

/* Use 0 and 1 for EXIT_SUCCESS and EXIT_FAILURE if we don't have them */
#if !HAVE_EXIT_SUCCESS_AND_FAILURE
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#endif

/* Define this if printf can handle %Lf for long double */
#define HAVE_PRINTF_LONGDOUBLE 1

/* Define one of these if you have a known IEEE arithmetic interface */
#undef HAVE_GNUSPARC_IEEE_INTERFACE
#undef HAVE_GNUM68K_IEEE_INTERFACE
#undef HAVE_GNUPPC_IEEE_INTERFACE
#undef HAVE_GNUX86_IEEE_INTERFACE
#undef HAVE_SUNOS4_IEEE_INTERFACE
#undef HAVE_SOLARIS_IEEE_INTERFACE
#undef HAVE_HPUX11_IEEE_INTERFACE
#undef HAVE_HPUX_IEEE_INTERFACE
#undef HAVE_TRU64_IEEE_INTERFACE
#undef HAVE_IRIX_IEEE_INTERFACE
#undef HAVE_AIX_IEEE_INTERFACE
#undef HAVE_FREEBSD_IEEE_INTERFACE
#undef HAVE_OS2EMX_IEEE_INTERFACE
#undef HAVE_NETBSD_IEEE_INTERFACE
#undef HAVE_OPENBSD_IEEE_INTERFACE
#undef HAVE_DARWIN_IEEE_INTERFACE

/* Define this is IEEE comparisons work correctly (e.g. NaN != NaN) */
#define HAVE_IEEE_COMPARISONS 1

/* Define this is IEEE denormalized numbers are available */
#undef HAVE_IEEE_DENORMALS

/* Define a rounding function which moves extended precision values
out of registers and rounds them to double-precision. This should
be used *sparingly*, in places where it is necessary to keep
double-precision rounding for critical expressions while running in
extended precision. For example, the following code should ensure
exact equality, even when extended precision registers are in use,

double q = GSL_COERCE_DBL(3.0/7.0) ;
if (q == GSL_COERCE_DBL(3.0/7.0)) { ... } ;

It carries a penalty even when the program is running in double
precision mode unless you compile a separate version of the
library with HAVE_EXTENDED_PRECISION_REGISTERS turned off. */

#undef HAVE_EXTENDED_PRECISION_REGISTERS

#if HAVE_EXTENDED_PRECISION_REGISTERS
#define GSL_COERCE_DBL(x) (gsl_coerce_double(x))
#else
#define GSL_COERCE_DBL(x) (x)
#endif

/* Substitute gsl functions for missing system functions */

#if !HAVE_DECL_HYPOT
#define hypot gsl_hypot
//#define hypot _hypot
#endif

#if !HAVE_DECL_LOG1P
#define log1p gsl_log1p
#endif

#if !HAVE_DECL_EXPM1
#define expm1 gsl_expm1
#endif

#if !HAVE_DECL_ACOSH
#define acosh gsl_acosh
#endif

#if !HAVE_DECL_ASINH
#define asinh gsl_asinh
#endif

#if !HAVE_DECL_ATANH
#define atanh gsl_atanh
#endif

#if !HAVE_DECL_LDEXP
#define ldexp gsl_ldexp
#endif

#if !HAVE_DECL_FREXP
#define frexp gsl_frexp
#endif

#if !HAVE_DECL_ISINF
#define isinf gsl_isinf
#endif

#if !HAVE_DECL_FINITE
#if HAVE_DECL_ISFINITE
#define finite isfinite
#else
//§ #define finite gsl_finite
#define finite _finite
#endif
#endif

#if !HAVE_DECL_ISNAN
//§ #define isnan gsl_isnan
#define isnan _isnan
#endif

#ifdef __GNUC__
#define DISCARD_POINTER(p) do { ; } while(p ? 0 : 0);
#else
#define DISCARD_POINTER(p) /* ignoring discarded pointer */
#endif

#if defined(GSL_RANGE_CHECK_OFF) || !defined(GSL_RANGE_CHECK)
#define GSL_RANGE_CHECK 0  /* turn off range checking by default */
#endif

#pragma warning( disable : 4244)
****************************
First of all, someone that is more expert than myself should check if eveything
is correct.
I have two problems:
First, if i set #define HAVE_DECL_ACOSH 1, #define HAVE_DECL_ASINH 1, #define
HAVE_DECL_ATANH 1 (as i should, i see this functions are definied in the headers
in dm\include) i get the following error:
out\libgsl.lib(math)
Error 42: Symbol undefined _atanh 
I dont' understand why is it searching for _atnah and not atanh
Second, if i set the inlining as indicated (see the 3 inline macros, nothing
changes if i change HIDE_INLINE_STATIC value), i get the following error:
extern inline double gls_pow_2(const double x);
error: storage class is illgal in this contex
here is header file:
***************************
#ifndef __GSL_POW_INT_H__
#define __GSL_POW_INT_H__

#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif

__BEGIN_DECLS

#ifdef HAVE_INLINE
extern inline double gsl_pow_2(const double x);
extern inline double gsl_pow_3(const double x);
extern inline double gsl_pow_4(const double x);
extern inline double gsl_pow_5(const double x);
extern inline double gsl_pow_6(const double x);
extern inline double gsl_pow_7(const double x);
extern inline double gsl_pow_8(const double x);
extern inline double gsl_pow_9(const double x);

extern inline double gsl_pow_2(const double x) { return x*x;   }
extern inline double gsl_pow_3(const double x) { return x*x*x; }
extern inline double gsl_pow_4(const double x) { double x2 = x*x;   return
x2*x2;    }
extern inline double gsl_pow_5(const double x) { double x2 = x*x;   return
x2*x2*x;  }
extern inline double gsl_pow_6(const double x) { double x2 = x*x;   return
x2*x2*x2; }
extern inline double gsl_pow_7(const double x) { double x3 = x*x*x; return
x3*x3*x;  }
extern inline double gsl_pow_8(const double x) { double x2 = x*x;   double x4 =
x2*x2; return x4*x4; }
extern inline double gsl_pow_9(const double x) { double x3 = x*x*x; return
x3*x3*x3; }
#else
double gsl_pow_2(const double x);
double gsl_pow_3(const double x);
double gsl_pow_4(const double x);
double gsl_pow_5(const double x);
double gsl_pow_6(const double x);
double gsl_pow_7(const double x);
double gsl_pow_8(const double x);
double gsl_pow_9(const double x);
#endif

double gsl_pow_int(double x, int n);

__END_DECLS

#endif /* __GSL_POW_INT_H__ */
*****************
The other problem is concerning the function randomize in test_heapsort.c:
Error: 'randomize' was previosuly declared as something else
It was declared as: void C func(void)
It is now declared as: void C func (double*,unsigned )
I think the problem is that this function is defined in the dm\include heareds.
Is there an easy way to solve this out? Maybe using undef in config.h?

I know that checking the config.h file is a long task, but if somone could help
me out with this, i will be very near to the end of this work.
Only 3 of all the tests of the gsl still fails: fft, rng, and sort.
Thank you in advance for any help!

Best Regards
Stefano
Mar 04 2006