mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Added in code to automatically add -lm and -lstdc++ to the link line
when they are present on the system.
This commit is contained in:
172
configure
vendored
172
configure
vendored
@@ -1738,9 +1738,7 @@ fi
|
||||
|
||||
#----------------------------------------
|
||||
|
||||
|
||||
|
||||
#########################################################
|
||||
########################################################
|
||||
# User Code
|
||||
#########################################################
|
||||
USERDIR=""
|
||||
@@ -9740,11 +9738,161 @@ if test "$BUILD_WITH_F2C"="n"; then
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Ending Libs for compiling static applications and
|
||||
# dynamically loaded libraries
|
||||
# (sunpro solaris needs a few for dynamic linking)
|
||||
#
|
||||
#
|
||||
# Check to see if we have a -lm line
|
||||
#
|
||||
echo "$as_me:$LINENO: checking for printf in -lm" >&5
|
||||
echo $ECHO_N "checking for printf in -lm... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_m_printf+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lm $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char printf ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
printf ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_cxx_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_m_printf=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_m_printf=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_m_printf" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_m_printf" >&6
|
||||
if test $ac_cv_lib_m_printf = yes; then
|
||||
add_stm=1
|
||||
else
|
||||
add_stm=0
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Check to see if we have a -lstdc++ line
|
||||
#
|
||||
echo "$as_me:$LINENO: checking for printf in -lstdc++" >&5
|
||||
echo $ECHO_N "checking for printf in -lstdc++... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_stdcpp_printf+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lstdc++ $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char printf ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
printf ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_cxx_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_stdcpp_printf=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_stdcpp_printf=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_stdcpp_printf" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_stdcpp_printf" >&6
|
||||
if test $ac_cv_lib_stdcpp_printf = yes; then
|
||||
add_stdc=1
|
||||
else
|
||||
add_stdc=0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test -n "$NEED_F2C" ; then
|
||||
LCXX_END_LIBS="-lctf2c ""$LCXX_END_LIBS"
|
||||
fi
|
||||
@@ -9755,6 +9903,18 @@ case $ac_sys_system in
|
||||
LCXX_END_LIBS="$LCXX_END_LIBS"" -lCrun -lCstd -lfsu" ;;
|
||||
esac ;;
|
||||
esac
|
||||
if test $add_stm = 1 ; then
|
||||
echo 'Adding -lm to the end of the LCXX_END_LIBS variable'
|
||||
LCXX_END_LIBS="$LCXX_END_LIBS"" -lm"
|
||||
echo 'LCXX_END_LIBS = ' $LCXX_END_LIBS
|
||||
fi
|
||||
if test $add_stdc = 1 ; then
|
||||
echo 'Adding -lstdc++ to the end of the LCXX_END_LIBS variable'
|
||||
LCXX_END_LIBS="$LCXX_END_LIBS"" -lstdc++ "
|
||||
echo 'LCXX_END_LIBS = ' $LCXX_END_LIBS
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9888,7 +10048,7 @@ fi
|
||||
|
||||
|
||||
# Provide some information about the compiler.
|
||||
echo "$as_me:9891:" \
|
||||
echo "$as_me:10051:" \
|
||||
"checking for Fortran 77 compiler version" >&5
|
||||
ac_compiler=`set X $ac_compile; echo $2`
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||
@@ -10095,7 +10255,7 @@ _ACEOF
|
||||
# flags.
|
||||
ac_save_FFLAGS=$FFLAGS
|
||||
FFLAGS="$FFLAGS $ac_verb"
|
||||
(eval echo $as_me:10098: \"$ac_link\") >&5
|
||||
(eval echo $as_me:10258: \"$ac_link\") >&5
|
||||
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
||||
echo "$ac_f77_v_output" >&5
|
||||
FFLAGS=$ac_save_FFLAGS
|
||||
@@ -10173,7 +10333,7 @@ _ACEOF
|
||||
# flags.
|
||||
ac_save_FFLAGS=$FFLAGS
|
||||
FFLAGS="$FFLAGS $ac_cv_prog_f77_v"
|
||||
(eval echo $as_me:10176: \"$ac_link\") >&5
|
||||
(eval echo $as_me:10336: \"$ac_link\") >&5
|
||||
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
||||
echo "$ac_f77_v_output" >&5
|
||||
FFLAGS=$ac_save_FFLAGS
|
||||
|
||||
28
configure.in
28
configure.in
@@ -306,9 +306,7 @@ AC_SUBST(CXX_DEPENDS)
|
||||
|
||||
#----------------------------------------
|
||||
|
||||
|
||||
|
||||
#########################################################
|
||||
########################################################
|
||||
# User Code
|
||||
#########################################################
|
||||
USERDIR=""
|
||||
@@ -1463,11 +1461,23 @@ if test "$BUILD_WITH_F2C"="n"; then
|
||||
fi
|
||||
|
||||
AC_SUBST(LCXX_FLAGS)
|
||||
|
||||
#
|
||||
# Ending Libs for compiling static applications and
|
||||
# dynamically loaded libraries
|
||||
# (sunpro solaris needs a few for dynamic linking)
|
||||
#
|
||||
#
|
||||
# Check to see if we have a -lm line
|
||||
#
|
||||
AC_CHECK_LIB(m, printf, [add_stm=1], [add_stm=0], [ ])
|
||||
|
||||
#
|
||||
# Check to see if we have a -lstdc++ line
|
||||
#
|
||||
AC_CHECK_LIB(stdc++, printf, [add_stdc=1], [add_stdc=0], [])
|
||||
|
||||
|
||||
if test -n "$NEED_F2C" ; then
|
||||
LCXX_END_LIBS="-lctf2c ""$LCXX_END_LIBS"
|
||||
fi
|
||||
@@ -1478,6 +1488,18 @@ case $ac_sys_system in
|
||||
LCXX_END_LIBS="$LCXX_END_LIBS"" -lCrun -lCstd -lfsu" ;;
|
||||
esac ;;
|
||||
esac
|
||||
if test $add_stm = 1 ; then
|
||||
echo 'Adding -lm to the end of the LCXX_END_LIBS variable'
|
||||
LCXX_END_LIBS="$LCXX_END_LIBS"" -lm"
|
||||
echo 'LCXX_END_LIBS = ' $LCXX_END_LIBS
|
||||
fi
|
||||
if test $add_stdc = 1 ; then
|
||||
echo 'Adding -lstdc++ to the end of the LCXX_END_LIBS variable'
|
||||
LCXX_END_LIBS="$LCXX_END_LIBS"" -lstdc++ "
|
||||
echo 'LCXX_END_LIBS = ' $LCXX_END_LIBS
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST(LCXX_END_LIBS)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user