the toolchain-funcs.eclass: * tc-has-openmp will die if the selected compiler is not gcc (-fopenmp is gcc only) * does not support fortran openmp patch follows
Created attachment 257435 [details] toolchain-funcs.diff
assuming file names are *gcc* isnt an improvement. also, i'm not entirely sure you've tested this. `$($(tc-getCC) "$@")` makes no sense.
Created attachment 257441 [details] toolchain-funcs.diff here is the proper patch. *gcc* is an improvement. only gcc compiles/links with option -fopenmp. checking every compiler openmp option is out of question, so at least dont do it if the user does not set CC/FC not as gcc/gfortran.
How about not only reducing to gcc, but at least supporting icc/ifort? So if icc or ifort is detected just returning true? This would reduce the checks in the ebuilds for only testing for openmp support if gcc/gfortran is used. And intel compilers are provided as an ebuild in the tree, so we should support them rudimentary.
these issues were raised in the original bug 320215 already. i'm not entirely sold that this code even existing is the right thing as it means people try to get us to start merging/maintaining a whole lot of compiler-specific crap. which is exactly what you guys are trying to do right now. then it gets worse ... once we start making these functions available, ebuild authors thinks its ok to use this crap instead of fixing the packages themselves to do the detection. the only valid reason for this code to be merged in the first place was to give the user a nice message about trying to wrongly enable USE=openmp when they first havent set up their toolchain correctly. which means the only logic i can think of that should be added is to have tc-has-openmp see if the compiler is gcc and if it isnt, just lie and say "openmp support exists".
(In reply to comment #5) > which means the only logic i can think of that should be added is to have > tc-has-openmp see if the compiler is gcc and if it isnt, just lie and say > "openmp support exists". > this would perfectly fit to what I want. Probably we should warn the user, that he/she should take care of the openmp support and that there is no support other then for gcc.
Perhaps you want to add what Sébastien suggested earlier http://bugs.gentoo.org/show_bug.cgi?id=320215#c11
no, i dont, as i said in comment #2. we should not make filename assumptions. those would break if the string is anywhere in $CHOST. or if someone is using `cc` rather than `gcc`.
Created attachment 257649 [details] toolchain-funcs.diff would something in the lines of this patch work? what are the tests one could use to check the compiler is actually gcc? i also dont particularly like the fact we are actually doing what the package should be doing, but we do have the openmp use flag enabled by default for a lot of profiles. in any case the current tc-has-openmp is only useful in a few cases and should be changed or ditched
having USE=openmp on by default isnt a reason for expanding toolchain coverage. if anything, it's a reason to drop these completely and rely only on USE=openmp. do you actually need to test different frontends ? isnt one "tc-has-openmp" sufficient ? to prevent proliferation of these functions into packages, for now i'd inline the gcc test in tc-has-openmp. you dont need the awk since the bash operator supports globbing: [[ $(...) == gcc* ]] although, to support pretty much all frontends, perhaps we grep for the FSF copyright line: ... --version 2>&1 | grep -qs 'Copyright .* Free Software Foundation, Inc' hopefully no other toolchain is assigning its copyright to the FSF ...
(In reply to comment #10) > having USE=openmp on by default isnt a reason for expanding toolchain coverage. > if anything, it's a reason to drop these completely and rely only on > USE=openmp. there are many science users using intel crap, external fortran compilers, or g77 while having gcc-4.4 selected. mostly for compatibility for other distros . > do you actually need to test different frontends ? isnt one "tc-has-openmp" > sufficient ? one frontend would be perfect if you find a way to make sure fortran and C do have enabled openmp. we would have to get rid of the small compilation tests and rely on a unique gcc version test? > you dont need the awk since the bash operator supports globbing: > [[ $(...) == gcc* ]] you need either awk or something else as tail or grep. this is gcc -v, not gcc --version.
Obsolete, now included in fortran-2.eclass