| 1 | # Makefile for libgloss/epiphany | 
|---|
| 2 |  | 
|---|
| 3 | # Copyright (c) 2011, Adapteva, Inc. | 
|---|
| 4 | # All rights reserved. | 
|---|
| 5 |  | 
|---|
| 6 | # Contributor Jeremy Bennett <jeremy.bennett@embecosm.com> for Adapteva Inc | 
|---|
| 7 |  | 
|---|
| 8 | # Redistribution and use in source and binary forms, with or without | 
|---|
| 9 | # modification, are permitted provided that the following conditions are met: | 
|---|
| 10 | #  * Redistributions of source code must retain the above copyright notice, | 
|---|
| 11 | #    this list of conditions and the following disclaimer. | 
|---|
| 12 | #  * Redistributions in binary form must reproduce the above copyright | 
|---|
| 13 | #    notice, this list of conditions and the following disclaimer in the | 
|---|
| 14 | #    documentation and/or other materials provided with the distribution. | 
|---|
| 15 | #  * Neither the name of Adapteva nor the names of its contributors may be | 
|---|
| 16 | #    used to endorse or promote products derived from this software without | 
|---|
| 17 | #    specific prior written permission. | 
|---|
| 18 |  | 
|---|
| 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 
|---|
| 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
|---|
| 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 
|---|
| 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | 
|---|
| 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 
|---|
| 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 
|---|
| 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 
|---|
| 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 
|---|
| 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 
|---|
| 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
|---|
| 29 | # POSSIBILITY OF SUCH DAMAGE.                                               */ | 
|---|
| 30 |  | 
|---|
| 31 | # Process this file with autoconf to produce a configure script | 
|---|
| 32 |  | 
|---|
| 33 | AC_PREREQ(2.59) | 
|---|
| 34 | AC_INIT(libepiphany,0.0.1) | 
|---|
| 35 | AC_CONFIG_HEADER(config.h) | 
|---|
| 36 |  | 
|---|
| 37 | # No shared libraries allowed | 
|---|
| 38 | if test "${enable_shared}" = "yes" ; then | 
|---|
| 39 |     echo "Shared libraries not supported for cross compiling, ignored" | 
|---|
| 40 | fi | 
|---|
| 41 |  | 
|---|
| 42 | # Where are the auxillary tools (confg.sub etc)? | 
|---|
| 43 | if test "$srcdir" = "." ; then | 
|---|
| 44 |   if test "${with_target_subdir}" != "." ; then | 
|---|
| 45 |     libgloss_topdir="${srcdir}/${with_multisrctop}../../.." | 
|---|
| 46 |   else | 
|---|
| 47 |     libgloss_topdir="${srcdir}/${with_multisrctop}../.." | 
|---|
| 48 |   fi | 
|---|
| 49 | else | 
|---|
| 50 |   libgloss_topdir="${srcdir}/../.." | 
|---|
| 51 | fi | 
|---|
| 52 | AC_CONFIG_AUX_DIR($libgloss_topdir) | 
|---|
| 53 |  | 
|---|
| 54 | AC_CANONICAL_SYSTEM | 
|---|
| 55 | AC_ARG_PROGRAM | 
|---|
| 56 |  | 
|---|
| 57 | AC_PROG_INSTALL | 
|---|
| 58 |  | 
|---|
| 59 | AC_DEFINE(HAVE_GNU_LD, 1, [Using GNU ld]) | 
|---|
| 60 |  | 
|---|
| 61 | # We always use ELF, define various useful associated things. | 
|---|
| 62 | AC_DEFINE(HAVE_ELF, 1, [Using ELF format]) | 
|---|
| 63 |  | 
|---|
| 64 | # Assembler directives (the assembler handles them, whether it does anything | 
|---|
| 65 | # useful with them is another matter... | 
|---|
| 66 | AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE, 1, [.previous directive allowed]) | 
|---|
| 67 | AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE, 1, | 
|---|
| 68 |           [.pushsection/.popsection directives allowed]) | 
|---|
| 69 |  | 
|---|
| 70 | # Section attributes in C don't currently work | 
|---|
| 71 | #AC_DEFINE(HAVE_SECTION_ATTRIBUTES, 1, [support for section attributes]) | 
|---|
| 72 |  | 
|---|
| 73 | # Sort out what the symbol prefix is (we could just fix it as '_', but let the | 
|---|
| 74 | # script work it out. | 
|---|
| 75 | AC_CACHE_CHECK([for symbol prefix], libc_symbol_prefix, [dnl | 
|---|
| 76 | cat > conftest.c <<\EOF | 
|---|
| 77 | foo () { } | 
|---|
| 78 | EOF | 
|---|
| 79 | dnl | 
|---|
| 80 | libc_symbol_prefix=none | 
|---|
| 81 | if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null]); | 
|---|
| 82 | then | 
|---|
| 83 |   libc_symbol_prefix='$' | 
|---|
| 84 | else | 
|---|
| 85 |   if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "_foo" > /dev/null]); | 
|---|
| 86 |   then | 
|---|
| 87 |     libc_symbol_prefix=_ | 
|---|
| 88 |   fi | 
|---|
| 89 | fi | 
|---|
| 90 | rm -f conftest* ]) | 
|---|
| 91 | if test $libc_symbol_prefix != none; then | 
|---|
| 92 |   AC_DEFINE_UNQUOTED(__SYMBOL_PREFIX, "$libc_symbol_prefix", [symbol prefix]) | 
|---|
| 93 | else | 
|---|
| 94 |   AC_DEFINE(__SYMBOL_PREFIX, "", [symbol prefix]) | 
|---|
| 95 | fi | 
|---|
| 96 |  | 
|---|
| 97 | # Standard stuff copied from libnosys. For this we'll need to an aclocal.m4 | 
|---|
| 98 | LIB_AC_PROG_CC | 
|---|
| 99 | AS=${AS-as} | 
|---|
| 100 | AC_SUBST(AS) | 
|---|
| 101 | AR=${AR-ar} | 
|---|
| 102 | AC_SUBST(AR) | 
|---|
| 103 | LD=${LD-ld} | 
|---|
| 104 | AC_SUBST(LD) | 
|---|
| 105 | AC_PROG_RANLIB | 
|---|
| 106 | LIB_AM_PROG_AS | 
|---|
| 107 |  | 
|---|
| 108 | host_makefile_frag=${srcdir}/../config/default.mh | 
|---|
| 109 |  | 
|---|
| 110 | dnl We have to assign the same value to other variables because autoconf | 
|---|
| 111 | dnl doesn't provide a mechanism to substitute a replacement keyword with | 
|---|
| 112 | dnl arbitrary data or pathnames. | 
|---|
| 113 | dnl | 
|---|
| 114 | host_makefile_frag_path=$host_makefile_frag | 
|---|
| 115 | AC_SUBST(host_makefile_frag_path) | 
|---|
| 116 | AC_SUBST_FILE(host_makefile_frag) | 
|---|
| 117 |  | 
|---|
| 118 | AC_CONFIG_FILES(Makefile, | 
|---|
| 119 | ac_file=Makefile . ${libgloss_topdir}/config-ml.in, | 
|---|
| 120 | srcdir=${srcdir} | 
|---|
| 121 | target=${target} | 
|---|
| 122 | with_multisubdir=${with_multisubdir} | 
|---|
| 123 | ac_configure_args="${ac_configure_args} --enable-multilib" | 
|---|
| 124 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} | 
|---|
| 125 | libgloss_topdir=${libgloss_topdir} | 
|---|
| 126 | ) | 
|---|
| 127 | AC_OUTPUT | 
|---|