File: configure.ac

package info (click to toggle)
uswsusp 1.0+20120915-6.2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,572 kB
  • sloc: ansic: 7,164; sh: 566; makefile: 223; perl: 65
file content (313 lines) | stat: -rw-r--r-- 7,823 bytes parent folder | download | duplicates (3)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
#
# configure.ac
#
# Copyright (C) 2007 Alon Bar-Lev <alon.barlev@gmail.com>
#
# This file is released under the GPLv2.
#

AC_PREREQ([2.59])
AC_INIT([suspend-utils], [1.0])
AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([suspend.c])
AC_CONFIG_MACRO_DIR([m4])

AC_CANONICAL_HOST

AC_ARG_ENABLE(
	[debug],
	[AC_HELP_STRING([--enable-debug], [enable debug mode])],
	,
	[enable_debug="no"]
)
AC_ARG_ENABLE(
	[strict],
	[AC_HELP_STRING([--enable-strict], [enable strict compile mode])],
	,
	[enable_strict="no"]
)
AC_ARG_ENABLE(
	[pedantic],
	[AC_HELP_STRING([--enable-pedantic], [enable pedantic compile mode])],
	,
	[enable_pedantic="no"]
)
AC_ARG_ENABLE(
	[minimal],
	[AC_HELP_STRING([--enable-minimal], [enable minimal build])],
	,
	[enable_minimal="no"]
)
AC_ARG_ENABLE(
	[compress],
	[AC_HELP_STRING([--enable-compress], [enable compress support])],
	,
	[enable_compress="no"]
)
AC_ARG_ENABLE(
	[encrypt],
	[AC_HELP_STRING([--enable-encrypt], [enable encryption support])],
	,
	[enable_encrypt="no"]
)
AC_ARG_ENABLE(
	[create-device],
	[AC_HELP_STRING([--enable-create-device], [enable create required devices, use only if you don't have udev])],
	,
	[enable_create_device="no"]
)
AC_ARG_ENABLE(
	[resume-static],
	[AC_HELP_STRING([--disable-resume-static], [build resume as dynamic module])],
	,
	[enable_resume_static="yes"]
)
AC_ARG_ENABLE(
	[splashy],
	[AC_HELP_STRING([--enable-splashy], [enable splashy support])],
	,
	[enable_splashy="no"]
)
AC_ARG_ENABLE(
	[fbsplash],
	[AC_HELP_STRING([--enable-fbsplash], [enable fbsplash support])],
	,
	[enable_fbsplash="no"]
)
AC_ARG_WITH(
	[devdir],
	[AC_HELP_STRING([--with-devdir=DIR], [use if --enable-create-device, put devices in this directory, default /dev])],
	[devdir="${withval}"],
	[devdir="/dev"]
)
AC_ARG_ENABLE(
	[threads],
	[AC_HELP_STRING([--enable-threads], [enable threads support])],
	,
	[enable_threads="no"]
)
AC_ARG_WITH(
	[initramfsdir],
	[AC_HELP_STRING([--with-initramfsdir=DIR], [put initramfs binaries in this directory, default LIBDIR/suspend])],
	[initramfsdir="${withval}"],
	[initramfsdir="\$(libdir)/suspend"]
)
AC_ARG_WITH(
	[libgcrypt-prefix],
	[AC_HELP_STRING([--with-libgcrypt-prefix=DIR], [define libgcrypt prefix, default /usr])],
	,
	[with_libgcrypt_prefix="/usr" ]
)
AC_ARG_WITH(
	[directfb-prefix],
	[AC_HELP_STRING([--with-directfb-prefix=DIR], [define directfb prefix, default /usr])],
	,
	[with_directfb_prefix="/usr" ]
)
AC_ARG_WITH(
	[resume-device],
	[AC_HELP_STRING([--with-resume-device=DEVICE], [define resume device (REQUIRED ONLY FOR BUILDING INITRAMFS DURING MAKE)])],
	[RESUME_DEVICE="${withval}"]
)
AC_ARG_WITH(
	[bootdir],
	[AC_HELP_STRING([--with-bootdir=DIR], [define boot directory, default /boot (REQUIRED ONLY FOR BUILDING INITRAMFS DURING MAKE)])],
	[bootdir="${withval}"],
	[bootdir="/boot" ]
)


AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL		# We are using libtool so it auto-find static dependencies
PKG_PROG_PKG_CONFIG
AC_CHECK_PROGS([M4], [m4])
AC_CHECK_PROG(PERL, perl, perl)

AC_SYS_LARGEFILE

if test "${enable_create_device}" = "yes"; then
	AC_CHECK_PROGS([MKNOD], [mknod])
	test -z "${MKNOD}" && AC_MSG_ERROR([mknod required for creating devices])
fi

case "${host}" in
	i?86-*)			ARCH="x86";;
	x86_*-*)		ARCH="x86";;
	ppc-*|powerpc-*)	ARCH="ppc";;
	ppc64-*|powerpc64-*)	ARCH="ppc";;
	s390*-*)		ARCH="s390";;
esac

CONFIG_FEATURES=""

if test "${ARCH}" = "x86"; then
	AC_DEFINE([CONFIG_ARCH_X86], [1], [Define if x86 arch])

	PKG_CHECK_MODULES(
		[LIBPCI],
		[libpci >= 2.2.4],
		,
		[
			if test -z "${LIBPCI_LIBS}"; then
				AC_CHECK_LIB(
					[pci],
					[pci_init],
					[LIBPCI_LIBS="-lpci"],
					[
					#force rescan
					unset ac_cv_lib_pci_pci_init
					AC_CHECK_LIB(
						[pci],
						[pci_init],
						[LIBPCI_LIBS="-lpci -lz"],
						[AC_MSG_ERROR([Required pciutils >= 2.2.4 not found])],
						[-lz]
					)]
				)
			fi
		]
	)

	if test -z "${LIBX86_LIBS}"; then
		AC_ARG_VAR([LIBX86_CFLAGS], [C compiler flags for libx86])
		AC_ARG_VAR([LIBX86_LIBS], [linker flags for libx86])
		AC_CHECK_LIB(
			[x86],
			[LRMI_common_init],
			[LIBX86_LIBS="-lx86"],
			[AC_MSG_ERROR([Required libx86 was not found])]
		)
	fi
elif test "${ARCH}" = "ppc"; then
	AC_DEFINE([CONFIG_ARCH_PPC], [1], [Define if ppc arch])
elif test "${ARCH}" = "s390"; then
	AC_DEFINE([CONFIG_ARCH_S390], [1], [Define if s390 arch])
else
	AC_MSG_ERROR([Unsupported architecture ${host}])
fi

if test -z "${LIBBLKID_LIBS}"; then
	AC_ARG_VAR([LIBBLKID_CFLAGS], [C compiler flags for libblkid])
	AC_ARG_VAR([LIBBLKID_LIBS], [linker flags for libblkid])
	AC_CHECK_LIB(
		[blkid],
		[blkid_new_probe],
		[LIBBLKID_LIBS="-lblkid"],
		[AC_MSG_ERROR([Required libblkid was not found])]
	)
fi

if test "${enable_compress}" = "yes"; then
	CONFIG_FEATURES="${CONFIG_FEATURES} compress"
	AC_DEFINE([CONFIG_COMPRESS], [1], [Define if compression enabled])
	if test -z "${LZO_LIBS}"; then
		AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
		AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
		AC_CHECK_LIB(
			[lzo2],
			[lzo1x_1_compress],
			[LZO_LIBS="-llzo2"],
			[AC_CHECK_LIB(
				[lzo],
				[lzo1x_1_compress],
				[LZO_LIBS="-llzo"],
				[AC_MSG_ERROR([Required lzo library not found])]
			)]
		)
	fi
fi

if test "${enable_splashy}" = "yes"; then
	CONFIG_FEATURES="${CONFIG_FEATURES} splashy"
	AC_DEFINE([CONFIG_SPLASHY], [1], [Define if splashy enabled])

	# Workaround a wierd splashy issue
	AC_CHECK_LIB([gcc_s], [strlen])

	if test -z "${SPLASHY_LIBS}"; then
		AC_ARG_VAR([SPLASHY_CFLAGS], [C compiler flags for libsplashy])
		AC_ARG_VAR([SPLASHY_LIBS], [linker flags for libsplashy])
		AC_CHECK_LIB(
			[splashy],
			[splashy_init],
			[SPLASHY_LIBS="-lsplashy"],
			[AC_MSG_ERROR([Required libsplashy was not found])]
		)
	fi
fi

if test "${enable_fbsplash}" = "yes"; then
	CONFIG_FEATURES="${CONFIG_FEATURES} fbsplash"
	AC_DEFINE([CONFIG_FBSPLASH], [1], [Define if fbsplash enabled])

	PKG_CHECK_MODULES(
		[FBSPLASH],
		[libfbsplashrender >= 0.1],
		,
		[AC_MSG_ERROR([Required libfbsplashrender was not found])]
	)
fi

if test "${enable_threads}" = "yes"; then
	CONFIG_FEATURES="${CONFIG_FEATURES} threads"
	AC_DEFINE([CONFIG_THREADS], [1], [Define if threads enabled])
	if test -z "${PTHREAD_LIBS}"; then
		AC_ARG_VAR([PTHREAD_LIBS], [linker flags for threads])
		AC_CHECK_LIB(
			[pthread],
			[pthread_create],
			[PTHREAD_LIBS="-lpthread"],
			[AC_MSG_ERROR([Required pthread library not found])]
		)
	fi
fi

AC_DEFINE_UNQUOTED([CONFIG_FEATURES], ["${CONFIG_FEATURES## }"], [String representation of available features])

AC_HEADER_STDC
AC_CHECK_HEADERS([ \
	inttypes.h \
	stdint.h \
])

if test "${enable_pedantic}" = "yes"; then
	enable_strict="yes";
	CFLAGS="${CFLAGS} -pedantic"
fi
if test "${enable_strict}" = "yes"; then
	CFLAGS="${CFLAGS} -Wall -Wextra"
fi

# workaround for old autoconf
if test -z "${docdir}"; then
	docdir="\$(datarootdir)/doc/\$(PACKAGE_NAME)"
	AC_SUBST([docdir])
fi
# end workaround

AC_SUBST([devdir])
AC_SUBST([initramfsdir])
AC_SUBST([bootdir])
AC_SUBST([LIBGCRYPT_CFLAGS])
AC_SUBST([LIBGCRYPT_LIBS])
AC_SUBST([RESUME_DEVICE])
AM_CONDITIONAL([ENABLE_DEBUG], [test "${enable_debug}" = "yes"])
AM_CONDITIONAL([ENABLE_MINIMAL], [test "${enable_minimal}" = "yes"])
AM_CONDITIONAL([ARCH_X86], [test "${ARCH}" = "x86"])
AM_CONDITIONAL([ARCH_PPC], [test "${ARCH}" = "ppc"])
AM_CONDITIONAL([ENABLE_ENCRYPT], [0])
AM_CONDITIONAL([ENABLE_RESUME_STATIC], [test "${enable_resume_static}" = "yes"])
AM_CONDITIONAL([ENABLE_CREATE_DEVICE], [test "${enable_create_device}" = "yes"])
AM_CONDITIONAL([ENABLE_SPLASHY], [test "${enable_splashy}" = "yes"])
AM_CONDITIONAL([ENABLE_FBSPLASH], [test "${enable_fbsplash}" = "yes"])
AC_CONFIG_FILES([
	Makefile
	doc/Makefile
	manpages/Makefile
	scripts/Makefile
	scripts/suse-10.1/Makefile
])
AC_OUTPUT