version 34
[platform/upstream/gummiboot.git] / configure.ac
1 #
2 #  This file is part of gummiboot.
3 #
4 #  Copyright (C) 2013 Karel Zak <kzak@redhat.com>
5 #
6 #  gummiboot is free software; you can redistribute it and/or modify it
7 #  under the terms of the GNU Lesser General Public License as published by
8 #  the Free Software Foundation; either version 2.1 of the License, or
9 #  (at your option) any later version.
10 #
11 #  gummiboot is distributed in the hope that it will be useful, but
12 #  WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public License
17 #  along with systemd; If not, see <http://www.gnu.org/licenses/>.
18
19 AC_INIT([gummiboot],
20         [34],
21         [systemd-devel@lists.freedesktop.org],
22         [gummiboot],
23         [http://freedesktop.org/wiki/Software/gummiboot])
24
25 AC_CONFIG_SRCDIR([src/setup/setup.c])
26 AC_CONFIG_MACRO_DIR([m4])
27 AC_CONFIG_HEADERS([config.h])
28 AC_CONFIG_AUX_DIR([build-aux])
29 AC_PREFIX_DEFAULT([/usr])
30
31 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
32 AM_SILENT_RULES([yes])
33
34 AC_CANONICAL_HOST
35 AC_SYS_LARGEFILE
36
37 AC_PROG_CC
38
39 dnl Don't try to use things like -std=c99 for efi compilation
40 GNUEFI_CC=$CC
41 AC_SUBST([GNUEFI_CC])
42
43 AC_PROG_CC_C99
44 AM_PROG_CC_C_O
45 AC_PROG_GCC_TRADITIONAL
46
47 AC_PROG_MKDIR_P
48 AC_PATH_PROG([XSLTPROC], [xsltproc])
49 AC_PATH_PROG([QEMU_KVM], [qemu-kvm])
50
51 dnl Define ARCH_<NAME> conditionals
52 SET_ARCH(I686, i686*)
53 SET_ARCH(X86_64, x86_64*)
54 SET_ARCH(IA64, ia64*)
55
56 ARCH=`echo $host | sed "s/\(-\).*$//"`
57
58 AM_COND_IF(ARCH_I686, [
59         ARCH=ia32
60         MACHINE_TYPE_NAME=ia32])
61
62 AM_COND_IF(ARCH_X86_64, [
63         MACHINE_TYPE_NAME=x64])
64
65 AC_SUBST([ARCH])
66 AC_SUBST([MACHINE_TYPE_NAME])
67
68 # test bios
69 AC_CHECK_FILE([/usr/lib/qemu-bios],        [BIOS=/usr/lib/qemu-bios])
70 AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios])
71 AC_SUBST([BIOS])
72
73 # ------------------------------------------------------------------------------
74 dnl Compile EFI stuff is so tricky that it's probably better to check for the
75 dnl include files that try to use AC_CHECK_HEADERS to compile any conftest.c
76 AC_CHECK_FILES([/usr/include/efi/efi.h
77                 /usr/include/efi/${ARCH}/efibind.h], [],
78         [AC_MSG_ERROR([*** GNU Efi headers not found])])
79
80 efiroot=$(echo $(cd /usr/lib/$(gcc -print-multi-os-directory); pwd))
81 GNUEFI_LIBS="-L $efiroot"
82
83 dnl extra objects and linker scripts
84 GNUEFI_LDS_DIR="$efiroot"
85 if test -d "${efiroot}/gnuefi"; then
86         GNUEFI_LDS_DIR="${efiroot}/gnuefi"
87 fi
88 AC_SUBST([GNUEFI_LIBS])
89 AC_SUBST([GNUEFI_LDS_DIR])
90
91 # ------------------------------------------------------------------------------
92 AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
93 if test "x$enable_blkid" != "xno"; then
94         PKG_CHECK_MODULES(BLKID, [ blkid >= 2.20 ],
95                 [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
96         if test "x$have_blkid" = xno -a "x$enable_blkid" = xyes; then
97                 AC_MSG_ERROR([*** blkid support requested but libraries not found])
98         fi
99 fi
100 AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"])
101
102 # ------------------------------------------------------------------------------
103 have_manpages=no
104 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
105 AS_IF([test "x$enable_manpages" != xno], [
106         AS_IF([test "x$enable_manpages" = xyes -a "x$XSLTPROC" = x], [
107                 AC_MSG_ERROR([*** Manpages requested but xsltproc not found])
108         ])
109         AS_IF([test "x$XSLTPROC" != x], [have_manpages=yes])
110 ])
111 AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
112
113 # ------------------------------------------------------------------------------
114 AC_CONFIG_FILES([
115         Makefile
116 ])
117
118 AC_OUTPUT
119 AC_MSG_RESULT([
120         $PACKAGE_NAME $VERSION
121
122         arch:                    $ARCH
123         EFI machine type:        $MACHINE_TYPE_NAME
124
125         prefix:                  ${prefix}
126         efi libs:                ${GNUEFI_LIBS}
127         efi lds:                 ${GNUEFI_LDS_DIR}
128         blkid:                   ${have_blkid}
129         man pages:               ${have_manpages}
130
131         test QEMU bios:          ${BIOS}
132 ])