summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 9c1b8d058df6e869899dc3c790982c446aebe4e4 (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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# vim:tw=0:ts=8:sw=8:et

AC_PREREQ(2.59)
AC_INIT([biosdevname],[0.3.4],[Matt_Domsch@dell.com])
AC_LANG([C])
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_SRCDIR([src/read_proc.c])
AC_CONFIG_HEADER([config.h])
AC_PREFIX_DEFAULT()
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE

# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_PROG_CXX
AC_PROG_RANLIB
AC_CHECK_PROGS([READELF], [readelf])
AC_CHECK_FUNCS([realpath])
# Checks for libraries.
AC_CHECK_LIB([c], [snprintf])
# libz has to come before libpci because libpci needs it now.
AC_CHECK_LIB([z], [gzopen], [],
	    [AC_MSG_ERROR([You must install zlib-devel (Fedora/Red Hat/SuSE), libzip-dev (Debian/Ubuntu), or equivalent])])
AC_CHECK_LIB([pci], [pci_alloc], [],
	    [AC_MSG_ERROR([You must install pciutils-devel (Fedora/Red Hat/SuSE), pciutils-dev (Debian/Ubuntu), or equivalent])],
	    -lz)

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h limits.h locale.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/time.h syslog.h unistd.h])
AC_CHECK_HEADER([pci/pci.h], ,
	    [AC_MSG_ERROR([You must install pciutils-devel or equivalent])])
AC_CHECK_HEADER([zlib.h], ,
	    [AC_MSG_ERROR([You must install zlib-devel or equivalent])])

# Check for pci_dev.domain
AC_CHECK_MEMBERS([struct pci_dev.domain], , , [#include<pci/pci.h>])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_HEADER_TIME
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([dup2 gettimeofday memset munmap select socket strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul])

# this is ugly, but accounts for SLES 10, Red Hat/Fedora, and Ubuntu
# handles default udev rules as of udev 114 or thereabouts
RULEDEST=71-biosdevname.rules
if [[ -e /etc/udev/rules.d/60-net.rules ]]; then
     # RHEL / Fedora
     RULEDEST=60-biosdevname.rules
elif [[ -e /etc/udev/rules.d/31-network.rules ]]; then
     # SLES 10
     RULEDEST=31-biosdevname.rules
elif [[ -e /etc/udev/rules.d/25-iftab.rules ]]; then
     # Ubuntu
     RULEDEST=25-biosdevname.rules
fi
AC_SUBST(RULEDEST, $RULEDEST)

echo "PACKAGE_NAME='$PACKAGE_NAME'" > version
echo "PACKAGE_VERSION='$PACKAGE_VERSION'" >> version
echo "PACKAGE_STRING='$PACKAGE_STRING'" >> version

AC_CONFIG_FILES([Makefile biosdevname.spec.fedora biosdevname.spec.suse])
AC_OUTPUT