Skip to content
Snippets Groups Projects
Commit 8b61cdec authored by Sergey Kosukhin's avatar Sergey Kosukhin
Browse files

adds configure option '--with-pic'

parent 92315f8e
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,11 @@ AC_ARG_ENABLE([rpaths],
[link with automatically generated RPATH flags @<:@default=yes@:>@])], [],
[enable_rpaths=yes])
AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic],
[compile PIC objects @<:@default=auto@:>@])], [],
[with_pic=auto])
dnl Tests for the C compiler:
dnl Make sure conftest.dSYM is removed when configured on MacOS with
dnl CFLAGS='-g':
......@@ -59,9 +64,11 @@ AS_VAR_IF([ac_cv_prog_cc_c99], [no],
[AC_MSG_FAILURE([unable to detect C compiler flag needed to accept ISO C99])])
m4_popdef([AC_PROG_CC_C_O])dnl
AC_C_RESTRICT
ACX_COMPILER_CC_VENDOR_SIMPLE
AS_VAR_IF([enable_rpaths], [yes],
[ACX_COMPILER_CC_VENDOR_SIMPLE
ACX_SHLIB_CC_RPATH_FLAG])
[ACX_SHLIB_CC_RPATH_FLAG])
AS_IF([test "x$with_pic" != xno],
[ACX_SHLIB_CC_PIC_FLAG])
dnl Tests for static library generation tools:
AC_ARG_VAR([AR], [archiver command])
......@@ -132,9 +139,11 @@ ACX_FC_INCLUDE_FLAG_PP([AC_SUBST([FCPPINC], ["$acx_cv_fc_pp_include_flag"])])
ACX_LANG_MACRO_FLAG([AC_SUBST([FCPPDEF], ["$acx_cv_fc_macro_flag"])])
ACX_FC_MODULE_CHECK([ISO_C_BINDING])
ACX_FC_PP_COMMENTS([], [:])
ACX_COMPILER_FC_VENDOR_SIMPLE
AS_VAR_IF([enable_rpaths], [yes],
[ACX_COMPILER_FC_VENDOR_SIMPLE
ACX_SHLIB_FC_RPATH_FLAG])
[ACX_SHLIB_FC_RPATH_FLAG])
AS_IF([test "x$with_pic" != xno],
[ACX_SHLIB_FC_PIC_FLAG])
AS_IF([test "`cd $srcdir && pwd`" != "`pwd`"],
[AC_SUBST([yac_fcisrc], [" ${FCPPINC}\$(srcdir)"])dnl
......@@ -652,22 +661,20 @@ AC_ARG_ENABLE([python-bindings],
[enable Python bindings @<:@default=no@:>@])], [],
[enable_python_bindings=no])
dnl Options --enable-lib-core-only and --enable-python-bindings are
dnl incompatible. If both of them equal to 'yes', it is the user's choice and we
dnl can stop with an error:
AS_IF([test x"${enable_lib_core_only}${enable_python_bindings}" = xyesyes],
[AC_MSG_ERROR([options '--enable-lib-core-only' and dnl
AS_VAR_IF([enable_python_bindings], [yes],
[AS_VAR_IF([enable_lib_core_only], [yes],
[AC_MSG_ERROR([options '--enable-lib-core-only' and dnl
'--enable-python-bindings' are incompatible])])
AS_VAR_IF([with_pic], [no],
[AC_MSG_ERROR([options '--without-pic' and '--enable-python-bindings' dnl
are incompatible])],
[with_pic=yes])])
AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS],
[test x"$enable_python_bindings" = xyes])
AS_VAR_IF([enable_python_bindings], [yes],
[ACX_SHLIB_CC_PIC_FLAG
AC_SUBST([PIC_CFLAGS], [$acx_cv_c_pic_flag])
ACX_SHLIB_PIC_FLAGS_CHECK([$PIC_CFLAGS], [], [PIC_CFLAGS=])
dnl
AC_ARG_VAR([PYTHON], [Python interpreter command])dnl
[AC_ARG_VAR([PYTHON], [Python interpreter command])dnl
ACX_PROG_SEARCH([PYTHON], [python3 python],
[yac_python_try=dnl
"$acx_candidate -c 'import sys; exit(sys.version_info@<:@0:2@:>@ < (3, 6))' dnl
......@@ -758,10 +765,18 @@ AS_VAR_IF([enable_rpaths], [yes],
ASX_VAR_APPEND_UNIQ([RPATH_FCFLAGS],
["$acx_cv_fc_rpath_flag$yac_L_arg"], [' '])
done
AC_LANG_PUSH([Fortran])
AC_LANG_PUSH([Fortran])dnl
ACX_SHLIB_RPATH_FLAGS_CHECK([$RPATH_FCFLAGS])
AC_LANG_POP([Fortran])])
AS_VAR_IF([with_pic], [yes],
[ACX_SHLIB_PIC_FLAGS_CHECK([$PIC_CFLAGS])
AC_SUBST([PIC_CFLAGS], [$acx_cv_c_pic_flag])
AC_LANG_PUSH([Fortran])dnl
ACX_SHLIB_PIC_FLAGS_CHECK([$PIC_FCFLAGS])
AC_SUBST([PIC_FCFLAGS], [$acx_cv_fc_pic_flag])
AC_LANG_POP([Fortran])])
AS_IF([test -n "$LDFLAGS"], [YAC_PKGCONF_CLIBS="$LDFLAGS $YAC_PKGCONF_CLIBS"])
AS_IF([test -n "$LIBS"], [AS_VAR_APPEND([YAC_PKGCONF_CLIBS], [" $LIBS"])])
......
......@@ -67,6 +67,8 @@ AM_CFLAGS = \
$(YAXT_CFLAGS) \
$(NETCDF_CFLAGS)
AM_FCFLAGS = $(PIC_FCFLAGS)
$(mo_yac_utils_mod): mo_yac_utils.$(OBJEXT)
@if test ! -f $@; then rm -f $<; $(MAKE) $<; fi
......
......@@ -159,6 +159,8 @@ AM_CFLAGS = \
$(NETCDF_CFLAGS) \
$(LAPACK_CFLAGS)
AM_FCFLAGS = $(PIC_FCFLAGS)
$(mo_yac_core_mod): mo_yac_core.$(OBJEXT)
@if test ! -f $@; then rm -f $<; $(MAKE) $<; fi
......
......@@ -44,6 +44,8 @@ AM_CFLAGS = \
$(FYAML_CFLAGS) \
$(MTIME_CFLAGS)
AM_FCFLAGS = $(PIC_FCFLAGS)
yac_finterface.$(OBJEXT): $(mo_yac_finterface_mod)
$(mo_yac_finterface_mod): mo_yac_finterface.$(OBJEXT)
@if test ! -f $@; then rm -f $<; $(MAKE) $<; fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment