summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 28c3d98f8988b72430117cc05f5035b56edf49a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#
#  This file is part of gummiboot.
#
#  Copyright (C) 2013 Karel Zak <kzak@redhat.com>
#
#  gummiboot is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
#  gummiboot is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with systemd; If not, see <http://www.gnu.org/licenses/>.

AC_INIT([gummiboot],
        [25],
        [systemd-devel@lists.freedesktop.org],
        [gummiboot],
        [http://freedesktop.org/wiki/Software/gummiboot])

AC_CONFIG_SRCDIR([src/setup/setup.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_PREFIX_DEFAULT([/usr])

AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
AM_SILENT_RULES([yes])

AC_CANONICAL_HOST
AC_SYS_LARGEFILE

AC_PROG_CC

dnl Don't try to use things like -std=c99 for efi compilation
GNUEFI_CC=$CC
AC_SUBST([GNUEFI_CC])

AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_GCC_TRADITIONAL

AC_PROG_MKDIR_P
AC_PATH_PROG([XSLTPROC], [xsltproc])
AC_PATH_PROG([QEMU_KVM], [qemu-kvm])

dnl Define ARCH_<NAME> conditionals
SET_ARCH(I686, i686*)
SET_ARCH(X86_64, x86_64*)
SET_ARCH(IA64, ia64*)

ARCH=`echo $host | sed "s/\(-\).*$//"`

AM_COND_IF(ARCH_I686, [
        ARCH=ia32
        MACHINE_TYPE_NAME=ia32])

AM_COND_IF(ARCH_X86_64, [
        MACHINE_TYPE_NAME=x64])

AC_SUBST([ARCH])
AC_SUBST([MACHINE_TYPE_NAME])

# test bios
AC_CHECK_FILE([/usr/lib/qemu-bios],        [BIOS=/usr/lib/qemu-bios])
AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios])
AC_SUBST([BIOS])

# ------------------------------------------------------------------------------
dnl Compile EFI stuff is so tricky that it's probably better to check for the
dnl include files that try to use AC_CHECK_HEADERS to compile any conftest.c
AC_CHECK_FILES([/usr/include/efi/efi.h
                /usr/include/efi/${ARCH}/efibind.h], [],
        [AC_MSG_ERROR([*** GNU Efi headers not found])])

efiroot=$(echo $(cd /usr/lib/$(gcc -print-multi-os-directory); pwd))
GNUEFI_LIBS="-L $efiroot"

dnl extra objects and linker scripts
GNUEFI_LDS_DIR="$efiroot"
if test -d "${efiroot}/gnuefi"; then
        GNUEFI_LDS_DIR="${efiroot}/gnuefi"
fi
AC_SUBST([GNUEFI_LIBS])
AC_SUBST([GNUEFI_LDS_DIR])

# ------------------------------------------------------------------------------
AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
if test "x$enable_blkid" != "xno"; then
        PKG_CHECK_MODULES(BLKID, [ blkid >= 2.20 ],
                [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
        if test "x$have_blkid" = xno -a "x$enable_blkid" = xyes; then
                AC_MSG_ERROR([*** blkid support requested but libraries not found])
        fi
fi
AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"])

# ------------------------------------------------------------------------------
AC_CONFIG_FILES([
        Makefile
])

AC_OUTPUT
AC_MSG_RESULT([
        $PACKAGE_NAME $VERSION

        arch:                    $ARCH
        machine type:            $MACHINE_TYPE_NAME

        prefix:                  ${prefix}
        libexecdir:              ${libexecdir}
        libdir:                  ${libdir}

        blkid:                   ${have_blkid}
        efi libs:                ${GNUEFI_LIBS}
        efi lds:                 ${GNUEFI_LDS_DIR}

        test bios:               ${BIOS}
])