HAVE_ALLOCA in config

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

HAVE_ALLOCA in config

Message par jocaps » jeu. août 03, 2017 1:42 am

Hi,

Before I start asking.. let me write that I get the source from here:
https://www-fourier.ujf-grenoble.fr/~pa ... stable.tgz

This will be the latest stable with bugfixes I hope.

I have asked before how to compile with cygwin and I was greatly helped by Bernard. I am not sure if everything will work, but so far I could link to giac dll. Now, though, I want to move one step ahead and try to get independent of cygwin. So I tried using codeblocks with gcc. In windows alloca or alloca.h does not exist (I believe _alloca is defined but not recommended). Now, in the config there is an option called HAVE_ALLOCA and HAVE_ALLOCA_H. These two do not seem to affect the code. Thus, compiling (without cygwin) in windows will give the first error (after tweaking the config.h file)

Code : Tout sélectionner

modpoly.cc||In function 'void giac::DivRem(const std::vector<int>&, const std::vector<int>&, int, std::vector<int>&, std::vector<int>&)':|
modpoly.cc|2252|error: 'alloca' was not declared in this scope|
Was there any purpose of having HAVE_ALLOCA in the config options? Is there a way to cleanly resolve this? Is this because I have an old version of the source code?

Jose

PS: Aside from the proper configuration for cygwin (see my last post here). To compile without cygwin I did the following additional changes to config.h:
- removed HAVE_LIBPNG, HAVE_SYS_TIMES_H, HAVE_LIBRT, HAVE_ALLOCA, HAVE_ALLOCA_H

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: HAVE_ALLOCA in config

Message par parisse » jeu. août 03, 2017 9:13 am

alloca is not checked explicitely in configure.in, I guess it is automatically checked by the gnu configure tools.
Replacing alloca by malloc is not straightforward because it requires adding free. It's also slower. Perhaps the best is to #define alloca _alloca for your target, something like

Code : Tout sélectionner

#ifndef HAVE_ALLOCA_H
#define alloca _alloca
#endif
in first.h.
By the way, giac_stable.tgz links to the latest source used for the debian packages on my site. It is not fully up to date, but almost.

Répondre