summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: df85532abad964f3827b773745bc8ef85b8c7ba0 (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
AC_INIT([udev-extras],
	[20090226],
	[linux-hotplug@vger.kernel.org])
AC_PREREQ(2.60)
AM_INIT_AUTOMAKE([check-news foreign 1.9 subdir-objects dist-bzip2])
AC_DISABLE_STATIC
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AC_CONFIG_HEADERS(config.h)
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_CONFIG_MACRO_DIR([m4])

dnl prefix is /usr, exec_prefix in /, if overridden exec_prefix follows prefix
AC_PREFIX_DEFAULT([/usr])
test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=

dnl ensure that when the Automake generated makefile calls aclocal,
dnl it honours the $ACLOCAL_FLAGS environment variable
ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
if test -n "$ac_macro_dir"; then
    ACLOCAL_AMFLAGS="-I $ac_macro_dir $ACLOCAL_AMFLAGS"
fi
AC_SUBST([ACLOCAL_AMFLAGS])

PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.12)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12)
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LIBS)

PKG_CHECK_MODULES(LIBUDEV, libudev)
AC_SUBST(LIBUDEV_CFLAGS)
AC_SUBST(LIBUDEV_LIBS)

AC_PATH_PROG([XSLTPROC], [xsltproc])

AC_ARG_ENABLE(more-warnings,
AS_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]), set_more_warnings="$enableval",set_more_warnings=yes)
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
	AC_MSG_RESULT(yes)
	CFLAGS="-Wall -Werror $CFLAGS"

	for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \
		      -Wdeclaration-after-statement -Wstrict-prototypes \
		      -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \
		      -fno-strict-aliasing; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		if test $has_option = no; then
			CFLAGS="$SAVE_CFLAGS"
		fi
		AC_MSG_RESULT($has_option)
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
else
	AC_MSG_RESULT(no)
fi

AC_ARG_WITH(udev-prefix,
	AS_HELP_STRING([--with-udev-prefix=DIR], [add prefix to internal udev path names]),
	[], [with_udev_prefix='${exec_prefix}'])
udev_prefix=$with_udev_prefix
AC_SUBST(udev_prefix)

AC_DEFINE(LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE, 1, [I know the API is subject to change])

AC_CHECK_FILES([/usr/share/usb.ids], [usbids=/usr/share/usb.ids])
AC_CHECK_FILES([/usr/share/hwdata/usb.ids], [usbids=/usr/share/hwdata/usb.ids])
AC_CHECK_FILES([/usr/share/misc/usb.ids], [usbids=/usr/share/misc/usb.ids])

AC_ARG_WITH(usb-ids-path,
	AS_HELP_STRING([--usb-ids-path=DIR], [Path to usb.ids file]),
	[USB_DATABASE=${withval}],
        [if test -n "$usbids" ; then
                USB_DATABASE="$usbids"
         else
                AC_MSG_ERROR([usb.ids not found, try --with-usb-ids-path=])
         fi])

AC_SUBST(USB_DATABASE)

AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])

AC_ARG_WITH(pci-ids-path,
	AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]),
	[PCI_DATABASE=${withval}],
        [if test -n "$pciids" ; then
                PCI_DATABASE="$pciids"
         else
                AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
         fi])

AC_SUBST(PCI_DATABASE)

AC_CONFIG_FILES([
Makefile
rules.d/Makefile
modem-probe/Makefile
modem-modeswitch/Makefile
udev-acl/Makefile
usb-db/Makefile
])
AC_OUTPUT

echo "
	udev-extras $VERSION
	====================

	prefix:			${prefix}
	exec_prefix:		${exec_prefix}
	udev_prefix:		${udev_prefix}
	datarootdir:		${datarootdir}
	mandir:			${mandir}

        usb.ids:                ${USB_DATABASE}
        pci.ids:                ${PCI_DATABASE}

	compiler:		${CC}
	cflags:			${CFLAGS}
	ldflags:		${LDFLAGS}

	xsltproc:		${XSLTPROC}
"