PR ada/66205
[official-gcc.git] / liboffloadmic / configure.ac
blob64728f1a1a7fb7cc59a956005f56c3ab388d6105
1 #    Copyright (c) 2014 Intel Corporation.  All Rights Reserved.
3 #    Redistribution and use in source and binary forms, with or without
4 #    modification, are permitted provided that the following conditions
5 #    are met:
7 #      * Redistributions of source code must retain the above copyright
8 #        notice, this list of conditions and the following disclaimer.
9 #      * Redistributions in binary form must reproduce the above copyright
10 #        notice, this list of conditions and the following disclaimer in the
11 #        documentation and/or other materials provided with the distribution.
12 #      * Neither the name of Intel Corporation nor the names of its
13 #        contributors may be used to endorse or promote products derived
14 #        from this software without specific prior written permission.
16 #    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 #    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 #    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 #    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 #    HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 #    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 #    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 #    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 #    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 #    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 #    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 # Process this file with autoconf to produce a configure script, like so:
29 # aclocal -I .. -I ../config && autoconf && automake
31 AC_PREREQ([2.64])
32 AC_INIT([MIC Offload Runtime Library], [1.0], ,[liboffloadmic])
34 AC_CANONICAL_SYSTEM
35 target_alias=${target_alias-$host_alias}
36 AC_SUBST(target_alias)
38 AM_INIT_AUTOMAKE(foreign no-dist)
39 AM_MAINTAINER_MODE
41 AC_PROG_CC
42 AC_PROG_CXX
43 AC_CONFIG_FILES([Makefile liboffloadmic_host.spec liboffloadmic_target.spec])
44 AM_ENABLE_MULTILIB(, ..)
45 AC_CONFIG_SUBDIRS(plugin)
46 AC_FUNC_ALLOCA
47 AC_CHECK_HEADERS([mm_malloc.h], [], [AC_MSG_ERROR(["Couldn't find mm_malloc.h"])])
48 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
50 # Get target configure.
51 . ${srcdir}/configure.tgt
52 if test -n "$UNSUPPORTED"; then
53   AC_MSG_ERROR([Configuration ${target} is unsupported])
56 if test "${multilib}" = "yes"; then
57   multilib_arg="--enable-multilib"
58 else
59   multilib_arg=
62 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
63 AC_ARG_ENABLE([version-specific-runtime-libs],
64   AC_HELP_STRING([--enable-version-specific-runtime-libs],
65                  [Specify that runtime libraries should be installed in a compiler-specific directory]),
66   [case "$enableval" in
67     yes) enable_version_specific_runtime_libs=yes ;;
68     no)  enable_version_specific_runtime_libs=no ;;
69     *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
70    esac],
71   [enable_version_specific_runtime_libs=no])
72 AC_MSG_RESULT($enable_version_specific_runtime_libs)
74 # Make sure liboffloadmic is enabled
75 case "$enable_liboffloadmic" in
76   host | target)
77     ;;
78   *)
79     AC_MSG_ERROR([Liboffloadmic is disabled]) ;;
80 esac
81 AM_CONDITIONAL(LIBOFFLOADMIC_HOST, [test x"$enable_liboffloadmic" = xhost])
83 # Calculate toolexeclibdir.
84 # Also toolexecdir, though it's only used in toolexeclibdir.
85 case ${enable_version_specific_runtime_libs} in
86   yes)
87     # Need the gcc compiler version to know where to install libraries
88     # and header files if --enable-version-specific-runtime-libs option
89     # is selected.
90     toolexecdir='$(libdir)/gcc/$(target_alias)'
91     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
92     ;;
93   no)
94     if test -n "$with_cross_host" &&
95        test x"$with_cross_host" != x"no"; then
96       # Install a library built with a cross compiler in tooldir, not libdir.
97       toolexecdir='$(exec_prefix)/$(target_alias)'
98       toolexeclibdir='$(toolexecdir)/lib'
99     else
100       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
101       toolexeclibdir='$(libdir)'
102     fi
103     multi_os_directory=`$CC -print-multi-os-directory`
104     case $multi_os_directory in
105       .) ;; # Avoid trailing /.
106       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
107     esac
108     ;;
109 esac
111 AC_LIBTOOL_DLOPEN
112 AM_PROG_LIBTOOL
113 # Forbid libtool to hardcode RPATH, because we want to be able to specify
114 # library search directory using LD_LIBRARY_PATH
115 hardcode_into_libs=no
116 AC_SUBST(toolexecdir)
117 AC_SUBST(toolexeclibdir)
119 AC_SUBST(lt_cv_dlopen_libs)
121 if test $enable_shared = yes; then
122   link_offloadmic_host="-loffloadmic_host %{static: $LIBS}"
123   link_offloadmic_target="-loffloadmic_target %{static: $LIBS}"
124 else
125   link_offloadmic_host="-loffloadmic_host $LIBS"
126   link_offloadmic_target="-loffloadmic_target $LIBS"
128 AC_SUBST(link_offloadmic_host)
129 AC_SUBST(link_offloadmic_target)
131 # Determine what GCC version number to use in filesystem paths.
132 GCC_BASE_VER
134 # Must be last
135 AC_OUTPUT