Skip to content

Commit

Permalink
Added -fno-gnu-unique
Browse files Browse the repository at this point in the history
This option should solve once for all the problem with gnu unique symbols.
I am not 100% this option will not introduce troubles linking other C++
libraries, and thus I leave the possibility to remove it with
./configure --disable-no-gnu-unique

However, problems are very unlikely considering that this is the
same behavior of icpc and clang.

See plumed#549
  • Loading branch information
GiovanniBussi committed Apr 27, 2023
1 parent ae6cc8f commit 25bd964
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
69 changes: 69 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ enable_fussy
enable_debug_glibcxx
enable_shared
enable_dependency_tracking
enable_no_gnu_unique
enable_rpath
enable_absolute_soname
enable_absolute_install_name
Expand Down Expand Up @@ -1401,6 +1402,8 @@ Optional Features:
--enable-shared enable shared libs, default: yes
--enable-dependency-tracking
enable dependency tracking, default: yes
--enable-no-gnu-unique enable a flag to avoid gnu unique symbols, default:
yes
--enable-rpath enable store rpath, default: no
--enable-absolute-soname
enable store absolute soname (Linux only - this is
Expand Down Expand Up @@ -2725,6 +2728,24 @@ fi



no_gnu_unique=
# Check whether --enable-no-gnu-unique was given.
if test "${enable_no_gnu_unique+set}" = set; then :
enableval=$enable_no_gnu_unique; case "${enableval}" in
(yes) no_gnu_unique=true ;;
(no) no_gnu_unique=false ;;
(*) as_fn_error $? "wrong argument to --enable-no-gnu-unique" "$LINENO" 5 ;;
esac
else
case "yes" in
(yes) no_gnu_unique=true ;;
(no) no_gnu_unique=false ;;
esac

fi



rpath=
# Check whether --enable-rpath was given.
if test "${enable_rpath+set}" = set; then :
Expand Down Expand Up @@ -5398,7 +5419,55 @@ $as_echo "$as_me: dependency tracking enabled" >&6;}
fi


if test "$no_gnu_unique" = true
then

save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fno-gnu-unique"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -fno-gnu-unique" >&5
$as_echo_n "checking whether $CXX accepts -fno-gnu-unique... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not linking" >&5
$as_echo "not linking" >&6; }; CXXFLAGS="$save_CXXFLAGS"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext

else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }; CXXFLAGS="$save_CXXFLAGS"

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi

#### Compulsory libraries ####
# some of them might be made optional if we find that are not available in some system
Expand Down
6 changes: 5 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ PLUMED_CONFIG_ENABLE([fussy],[fussy warnings],[no])
PLUMED_CONFIG_ENABLE([debug-glibcxx],[enable boundary check],[no])
PLUMED_CONFIG_ENABLE([shared],[shared libs],[yes])
PLUMED_CONFIG_ENABLE([dependency-tracking],[dependency tracking],[yes])
PLUMED_CONFIG_ENABLE([no-gnu-unique],[a flag to avoid gnu unique symbols],[yes])
PLUMED_CONFIG_ENABLE([rpath],[store rpath],[no])
PLUMED_CONFIG_ENABLE([absolute-soname],[store absolute soname (Linux only - this is the default behavior on OSX). Only enable for testing!],[no])
PLUMED_CONFIG_ENABLE([absolute-install-name],[store absolute relative (OSX only - disable to have a behavior similar to Linux). Only disable for testing!],[yes])
Expand Down Expand Up @@ -523,7 +524,10 @@ else
fi



if test "$no_gnu_unique" = true
then
PLUMED_CHECK_CXXFLAG([-fno-gnu-unique])
fi

#### Compulsory libraries ####
# some of them might be made optional if we find that are not available in some system
Expand Down

0 comments on commit 25bd964

Please sign in to comment.