configure.ac 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.64])
  4. AC_INIT(package-unused, version-unused, libmpx)
  5. # -------
  6. # Options
  7. # -------
  8. AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
  9. AC_ARG_ENABLE(version-specific-runtime-libs,
  10. [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
  11. [case "$enableval" in
  12. yes) version_specific_libs=yes ;;
  13. no) version_specific_libs=no ;;
  14. *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
  15. esac],
  16. [version_specific_libs=no])
  17. AC_MSG_RESULT($version_specific_libs)
  18. # Do not delete or change the following two lines. For why, see
  19. # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
  20. AC_CANONICAL_SYSTEM
  21. target_alias=${target_alias-$host_alias}
  22. AC_SUBST(target_alias)
  23. # See if supported.
  24. unset LIBMPX_SUPPORTED
  25. AC_MSG_CHECKING([for target support for Intel MPX runtime library])
  26. echo "int i[[sizeof (void *) == 4 ? 1 : -1]] = { __x86_64__ };" > conftest.c
  27. if AC_TRY_COMMAND([${CC} ${CFLAGS} -c -o conftest.o conftest.c 1>&AS_MESSAGE_LOG_FD])
  28. then
  29. LIBMPX_SUPPORTED=no
  30. else
  31. LIBMPX_SUPPORTED=yes
  32. fi
  33. rm -f conftest.o conftest.c
  34. AC_MSG_RESULT($LIBMPX_SUPPORTED)
  35. AM_CONDITIONAL(LIBMPX_SUPPORTED, [test "x$LIBMPX_SUPPORTED" = "xyes"])
  36. link_libmpx="-lpthread"
  37. link_mpx=""
  38. AC_MSG_CHECKING([whether ld accepts -z bndplt])
  39. echo "int main() {};" > conftest.c
  40. if AC_TRY_COMMAND([${CC} ${CFLAGS} -Wl,-z,bndplt -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
  41. then
  42. AC_MSG_RESULT([yes])
  43. link_mpx="$link_mpx -z bndplt"
  44. else
  45. AC_MSG_RESULT([no])
  46. fi
  47. AC_SUBST(link_libmpx)
  48. AC_SUBST(link_mpx)
  49. AM_INIT_AUTOMAKE(foreign no-dist no-dependencies)
  50. AM_ENABLE_MULTILIB(, ..)
  51. AM_MAINTAINER_MODE
  52. AC_GNU_SOURCE
  53. AC_CHECK_FUNCS([secure_getenv])
  54. # Calculate toolexeclibdir
  55. # Also toolexecdir, though it's only used in toolexeclibdir
  56. case ${version_specific_libs} in
  57. yes)
  58. # Need the gcc compiler version to know where to install libraries
  59. # and header files if --enable-version-specific-runtime-libs option
  60. # is selected.
  61. toolexecdir='$(libdir)/gcc/$(target_alias)'
  62. toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
  63. ;;
  64. no)
  65. if test -n "$with_cross_host" &&
  66. test x"$with_cross_host" != x"no"; then
  67. # Install a library built with a cross compiler in tooldir, not libdir.
  68. toolexecdir='$(exec_prefix)/$(target_alias)'
  69. toolexeclibdir='$(toolexecdir)/lib'
  70. else
  71. toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
  72. toolexeclibdir='$(libdir)'
  73. fi
  74. multi_os_directory=`$CC -print-multi-os-directory`
  75. case $multi_os_directory in
  76. .) ;; # Avoid trailing /.
  77. *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
  78. esac
  79. ;;
  80. esac
  81. AC_SUBST(toolexecdir)
  82. AC_SUBST(toolexeclibdir)
  83. # Check for programs.
  84. m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
  85. m4_define([_AC_ARG_VAR_PRECIOUS],[])
  86. AC_PROG_CC
  87. m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
  88. AM_PROG_CC_C_O
  89. AC_SUBST(CFLAGS)
  90. # Newer automakes demand CCAS and CCASFLAGS.
  91. : ${CCAS='$(CC)'}
  92. : ${CCASFLAGS='$(CFLAGS)'}
  93. AC_SUBST(CCAS)
  94. AC_SUBST(CCASFLAGS)
  95. AC_CHECK_TOOL(AS, as)
  96. AC_CHECK_TOOL(AR, ar)
  97. AC_CHECK_TOOL(RANLIB, ranlib, :)
  98. # Check we may build wrappers library
  99. echo "test: bndmov %bnd0, %bnd1" > conftest.s
  100. if AC_TRY_COMMAND([$AS -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
  101. then
  102. mpx_as=yes
  103. else
  104. mpx_as=no
  105. echo "configure: no MPX support fo as" >&AS_MESSAGE_LOG_FD
  106. fi
  107. rm -f conftest.o conftest.s
  108. AM_CONDITIONAL(MPX_AS_SUPPORTED, [test "x$mpx_as" = "xyes"])
  109. # Configure libtool
  110. AC_LIBTOOL_DLOPEN
  111. AM_PROG_LIBTOOL
  112. AC_SUBST(enable_shared)
  113. AC_SUBST(enable_static)
  114. XCFLAGS="-Wall -Wextra"
  115. AC_SUBST(XCFLAGS)
  116. if test "${multilib}" = "yes"; then
  117. multilib_arg="--enable-multilib"
  118. else
  119. multilib_arg=
  120. fi
  121. AC_CONFIG_FILES([Makefile libmpx.spec])
  122. AC_CONFIG_HEADERS(config.h)
  123. AC_CONFIG_FILES(AC_FOREACH([DIR], [mpxrt mpxwrap], [DIR/Makefile ]),
  124. [cat > vpsed$$ << \_EOF
  125. s!`test -f '$<' || echo '$(srcdir)/'`!!
  126. _EOF
  127. sed -f vpsed$$ $ac_file > tmp$$
  128. mv tmp$$ $ac_file
  129. rm vpsed$$
  130. echo 'MULTISUBDIR =' >> $ac_file
  131. ml_norecursion=yes
  132. . ${multi_basedir}/config-ml.in
  133. AS_UNSET([ml_norecursion])
  134. ])
  135. AC_OUTPUT