summaryrefslogtreecommitdiff
path: root/configure.in
blob: 42b0cf94867ce9a823f77f889346ee8cc56bb2ce (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
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
dnl Process this file with autoconf to produce a configure script.

# If porting the hal tarball to work well on a distribution search
# for the string "(distro-tweaks required)" for what to tweak.
#
# Patches for that is welcome.
#

AC_PREREQ(2.57)
AC_INIT(hal, 0.5.8, david@fubar.dk)
AM_INIT_AUTOMAKE(hal, 0.5.8)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

glib_module="glib-2.0 >= 2.6.0 dbus-glib-1 >= 0.61"
dbus_module="dbus-1 >= 0.61"
volume_id_module="libvolume_id >= 0.66"
polkit_module="polkit >= 0.2"

# libtool versioning - this applies to libhal and libhal-storage
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
LT_CURRENT=1
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AM_PATH_PYTHON
AC_SYS_LARGEFILE

AC_CHECK_HEADERS([sys/ioccom.h])

AC_ARG_WITH(os-type,     [  --with-os-type=<os>     Distribution or OS (redhat)])
AC_ARG_WITH(pid-file,    [  --with-pid-file=<file>  PID file for HAL daemon])
AC_ARG_WITH(hwdata,[  --with-hwdata=<dir>     where PCI and USB IDs are found (auto)])
AC_ARG_WITH(socket-dir,[  --with-socket-dir=<dir>  Location of the HAL D-BUS listening sockets (auto)])
if ! test -z "$with_hwdata" ; then
   HWDATA_DIR="$with_hwdata"
else
   for dir in /usr/share/hwdata /usr/share/misc /usr/share /var/lib/misc; do
      AC_CHECK_FILE($dir/pci.ids,HWDATA_DIR=$dir)
   done
fi
if test -z "$HWDATA_DIR"; then
   AC_ERROR(cannot find pci.ids. Use --with-hwdata to specify location)
fi
AC_SUBST(HWDATA_DIR)
AC_DEFINE_UNQUOTED(HWDATA_DIR,"$HWDATA_DIR", [Where PCI and USB IDs are found])


AC_ARG_WITH(hal_user,[  --with-hal-user=<user>  User for running the HAL daemon (haldaemon)])
if test -z "$with_hal_user" ; then
    HAL_USER=haldaemon
else
    HAL_USER=$with_hal_user
fi
AC_SUBST(HAL_USER)
AC_DEFINE_UNQUOTED(HAL_USER,"$HAL_USER", [User for running the HAL daemon])

AC_ARG_WITH(hal_group,[  --with-hal-group=<grp>  Group for HAL (haldaemon)])
if test -z "$with_hal_group" ; then
    HAL_GROUP=haldaemon
else
    HAL_GROUP=$with_hal_group
fi
AC_SUBST(HAL_GROUP)
AC_DEFINE_UNQUOTED(HAL_GROUP,"$HAL_GROUP", [Group for HAL])


# Taken from dbus
AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
AC_ARG_ENABLE(docbook-docs,     [  --enable-docbook-docs   build documentation (requires xmlto)],enable_docbook_docs=$enableval,enable_docbook_docs=no)


GTK_DOC_CHECK([1.3])

# ACPI event source
AC_ARG_ENABLE([acpi-acpid], AC_HELP_STRING([--disable-acpi-acpid], [Do not use ACPI daemon event source]), [acpi_acpid=$enableval], [acpi_acpid=yes])
if test "x$acpi_acpid" = "xyes" ; then
   AC_DEFINE(ACPI_ACPID,1,[Common event source of ACPI events])
fi
AC_SUBST(ACPI_ACPID)
AM_CONDITIONAL(ACPI_ACPID, test x$acpi_acpid != xyes)

AC_ARG_ENABLE([acpi-proc], AC_HELP_STRING([--disable-acpi-proc], [Do not use ACPI kernel-interface directly]), [acpi_proc=$enableval], [acpi_proc=yes])
if test "x$acpi_proc" = "xyes" ; then
   AC_DEFINE(ACPI_PROC,1,[Direct kernel connection for ACPI events, the kernel interface is exclusive to one user only])
fi
AC_SUBST(ACPI_PROC)
AM_CONDITIONAL(ACPI_PROC, test x$acpi_proc = xyes)

#### gcc warning flags

if test "x$GCC" = "xyes"; then
  changequote(,)dnl
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wnested-externs[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wpointer-arith[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wcast-align[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wsign-compare[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wsign-compare" ;;
  esac

  if test "x$enable_ansi" = "xyes"; then
    case " $CFLAGS " in
    *[\ \	]-ansi[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -ansi" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-D_POSIX_C_SOURCE*) ;;
    *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-pedantic[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -pedantic" ;;
    esac
  fi
  if test x$enable_gcov = xyes; then
    case " $CFLAGS " in
    *[\ \	]-fprofile-arcs[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
    esac
    case " $CFLAGS " in
    *[\ \	]-ftest-coverage[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -ftest-coverage" ;;
    esac

    ## remove optimization
    CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
  fi
  changequote([,])dnl
else
  if test x$enable_gcov = xyes; then
    AC_MSG_ERROR([--enable-gcov can only be used with gcc])
  fi
fi

AM_CONDITIONAL(GCOV, test x$enable_gcov = xyes)


EXPAT_LIB=""
AC_ARG_WITH(expat, [  --with-expat=<dir>      ese expat from here],
                      [
                      expat=$withval
                      CPPFLAGS="$CPPFLAGS -I$withval/include"
                      LDFLAGS="$LDFLAGS -L$withval/lib"
                      ]
                      )
AC_CHECK_HEADERS(expat.h)
AC_CHECK_LIB(expat,XML_ParserCreate, EXPAT_LIB="-lexpat")
AC_SUBST(EXPAT_LIB)

dnl Check libusb
AC_PATH_PROG(LIBUSB_CONFIG, libusb-config)
if test -n "${LIBUSB_CONFIG}"; then
	USE_LIBUSB=yes
	AM_CONDITIONAL(HAVE_LIBUSB,true)
else
	USE_LIBUSB=no
	AM_CONDITIONAL(HAVE_LIBUSB,false)
fi

dnl Check for libpci
AC_CHECK_HEADERS(pci/pci.h, [
	AC_CHECK_LIB(pci, pci_init, [
		USE_LIBPCI=yes AM_CONDITIONAL(HAVE_LIBPCI,true)], [
		USE_LIBPCI=no AM_CONDITIONAL(HAVE_LIBPCI,false)])], [
	USE_LIBPCI=no AM_CONDITIONAL(HAVE_LIBPCI,false)])


AC_ARG_WITH(backend, [  --with-backend=<name>   backend to use (linux/solaris/dummy)],
                      [
                      backend=$withval
                      ]
                      )
if ! test -z "$with_backend" ; then
    HALD_BACKEND="$with_backend"
else
    case "$host" in
        *-*-solaris*)
		   HALD_BACKEND="solaris"
		   ;;
        *-*-freebsd*)
                   HALD_BACKEND="freebsd"
                   ;;
	*-linux*)
		   HALD_BACKEND="linux"
      		   ;;
        *)
		   HALD_BACKEND="dummy"
		   ;;
    esac
fi
AM_CONDITIONAL(HALD_COMPILE_DUMMY, test x$HALD_BACKEND = xdummy, [Compiling for Dummy backend])
AM_CONDITIONAL(HALD_COMPILE_LINUX, test x$HALD_BACKEND = xlinux, [Compiling for Linux])
AM_CONDITIONAL(HALD_COMPILE_FREEBSD, test x$HALD_BACKEND = xfreebsd, [Compiling for FreeBSD])
AM_CONDITIONAL(HALD_COMPILE_SOLARIS, test x$HALD_BACKEND = xsolaris, [Compiling for Solaris])
AC_SUBST(HALD_BACKEND)

dnl DBUS API is subject to changes
AC_DEFINE_UNQUOTED(DBUS_API_SUBJECT_TO_CHANGE, ,DBUS API is subject to change)

# check for PolicyKit
AM_CONDITIONAL(HAVE_POLKIT, false)
AC_ARG_ENABLE(policy-kit, [  --disable-policy-kit    Build without PolicyKit (strongly discouraged)])
msg_polkit=no
if test "x$enable_policy_kit" != "xno"; then
	PKG_CHECK_MODULES(POLKIT, polkit >= 0.2,
		  	[AM_CONDITIONAL(HAVE_POLKIT, true)
		   	AC_DEFINE(HAVE_POLKIT, [], [Set if we use PolicyKit])]
                        msg_polkit=yes,
	          	[AM_CONDITIONAL(HAVE_POLKIT, false)])
	AC_SUBST(POLKIT_CFLAGS)
	AC_SUBST(POLKIT_LIBS)
	if test "x$msg_polkit" != "xyes"; then
	   AC_MSG_ERROR([PolicyKit not explicitly disabled and no PolicyKit found])
	fi
fi

# D-Bus libs
PKG_CHECK_MODULES(DBUS, [$dbus_module])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)

# glib libs
PKG_CHECK_MODULES(GLIB, [$glib_module])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

# volume_id
case "$host" in
*-*-solaris*)
	;;
*)
	PKG_CHECK_MODULES(VOLUME_ID, [$volume_id_module])
	AC_SUBST(VOLUME_ID_CFLAGS)
	AC_SUBST(VOLUME_ID_LIBS)
esac

# Check for BLKGETSIZE64
AC_CHECK_TYPE(pgoff_t, ,
              [AC_DEFINE(pgoff_t, unsigned long, [Index into the pagecache])],
               /usr/include/sys/types.h)
AC_MSG_CHECKING(for BLKGETSIZE64)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <linux/ioctl.h>
#include <linux/fs.h>],
[int main(int argc, char *argv[])
{
	int fd = 0;
	unsigned long long int n;
	ioctl (fd, BLKGETSIZE64, &n);
	return 0;
}
], have_size64=yes, have_size64=no)
AC_MSG_RESULT($have_size64)
if test x$have_size64 = xno; then
  case "$host" in
        *-*-linux*)
	     AC_MSG_ERROR([BLKGETSIZE64 is not defined])
		;;
        *)
		;;
  esac
fi

AC_CHECK_FUNCS(getgrouplist)
AC_CHECK_FUNCS(asprintf)

# DocBook Documentation

AC_PATH_PROG(DOCBOOK, docbook2html, no)
AC_MSG_CHECKING([whether to build DocBook documentation])

if test x$DOCBOOK = xno ; then
    have_docbook=no
else
    have_docbook=yes
fi

AC_PATH_PROG(XMLLINT, xmllint, no)

if test x$XMLLINT = xno ; then
    have_xmllint=no
else
    have_xmllint=yes
fi

if test x$enable_docbook_docs = xauto ; then
    if test x$have_docbook = xno || test x$have_xmllint = xno ; then
        enable_docbook_docs=no
    else
        enable_docbook_docs=yes
    fi
fi

if test x$enable_docbook_docs = xyes; then
    if test x$have_docbook = xno; then
        AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found])
    fi
    if test x$ve_xmllint = xno; then
        AC_MSG_ERROR([Building DocBook docs explicitly required, but xmllint not found])
    fi
fi

AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
AC_MSG_RESULT(yes)



AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
AS_AC_EXPAND(DATADIR, $datadir)
AS_AC_EXPAND(BINDIR, $bindir)
AS_AC_EXPAND(SBINDIR, $sbindir)
AS_AC_EXPAND(LIBDIR, $libdir)
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)


AC_ARG_WITH(dbus-sys, [  --with-dbus-sys=<dir>   where D-BUS system.d directory is])

if ! test -z "$with_dbus_sys" ; then
    DBUS_SYS_DIR="$with_dbus_sys"
else
    DBUS_SYS_DIR="$SYSCONFDIR/dbus-1/system.d"
fi
AC_SUBST(DBUS_SYS_DIR)
AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, "$DBUS_SYS_DIR", [Where system.d dir for DBUS is])


#### Check our operating system (distro-tweaks required)
operating_system=unknown
if test -f /etc/redhat-release || test -f SYSCONFDIR/redhat-release ; then
   operating_system=redhat
fi

#### Sort out OS (distro-tweaks required)

if test x$with_os_type = x; then
    if test x$operating_system = xredhat ; then
        with_os_type=redhat
    else
        with_os_type=unknown
    fi
fi

# (distro-tweaks required)
AM_CONDITIONAL(OS_TYPE_UNKNOWN, test x$with_os_type = xunknown, [Running on unknown OS])
AM_CONDITIONAL(OS_TYPE_RED_HAT, test x$with_os_type = xredhat, [Running on Red Hat OS'es])

#### Set up the pid file (distro-tweaks required)
if ! test -z "$with_pid_file"; then
   HALD_PID_FILE=$with_pid_file
elif test x$with_os_type = xredhat ; then
   HALD_PID_FILE=${LOCALSTATEDIR}/run/haldaemon.pid
else
   HALD_PID_FILE=${LOCALSTATEDIR}/run/hald/pid
fi

AC_SUBST(HALD_PID_FILE)
AC_DEFINE_UNQUOTED(HALD_PID_FILE, "$HALD_PID_FILE", [pid file])

if ! test -z "$with_socket_dir"; then
    HALD_SOCKET_DIR=$with_socket_dir
else
    HALD_SOCKET_DIR=${LOCALSTATEDIR}/run/hald
fi

AC_SUBST(HALD_SOCKET_DIR)
AC_DEFINE_UNQUOTED(HALD_SOCKET_DIR, "$HALD_SOCKET_DIR", [socket dir])

# documentation target
AC_ARG_WITH(doc-dir,   [  --with-doc-dir=[dirname]  directory to install documentation])
if ! test -z "$with_doc_dir"; then
   DOCDIR=$with_doc_dir
else
   DOCDIR="$DATADIR/doc/hal-$VERSION"
fi

AC_SUBST(DOCDIR)


ALL_LINGUAS="ca cs da de el es eu fi fr hu it ja km ko lt nb nl pa pl pt_BR pt ru sl_SI uk zh_CN zh_TW"
AC_SUBST(ALL_LINGUAS)

GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the gettext package])

AC_PROG_INTLTOOL([0.22])
AM_GLIB_GNU_GETTEXT

AC_OUTPUT([
hal.pc
hal-storage.pc
hal.conf
Makefile
hald/Makefile
hald/dummy/Makefile
hald/linux/Makefile
hald/linux/probing/Makefile
hald/linux/addons/Makefile
hald/solaris/Makefile
hald/haldaemon
hald-runner/Makefile
libhal/Makefile
libhal-storage/Makefile
tools/Makefile
tools/freebsd/Makefile
tools/linux/Makefile
tools/device-manager/hal-device-manager
tools/device-manager/Makefile
tools/device-manager/Const.py
privileges/Makefile
fdi/Makefile
fdi/preprobe/Makefile
fdi/preprobe/10osvendor/Makefile
fdi/preprobe/20thirdparty/Makefile
fdi/preprobe/30user/Makefile
fdi/information/Makefile
fdi/information/10freedesktop/Makefile
fdi/information/20thirdparty/Makefile
fdi/information/30user/Makefile
fdi/policy/Makefile
fdi/policy/10osvendor/Makefile
fdi/policy/20thirdparty/Makefile
fdi/policy/30user/Makefile
doc/Makefile
doc/api/Makefile
doc/conf/Makefile
doc/spec/Makefile
doc/spec/hal-spec.xml
po/Makefile.in
])

dnl ==========================================================================
echo "
                    HAL $VERSION
                  ==============

        prefix:                     ${prefix}
        libdir:                     ${LIBDIR}
        libexecdir:                 ${LIBEXECDIR}
        bindir:                     ${BINDIR}
        sbindir:                    ${SBINDIR}
        datadir:                    ${DATADIR}
        sysconfdir:                 ${SYSCONFDIR}
        localstatedir:              ${LOCALSTATEDIR}
        docdir:                     ${DOCDIR}
        dbus-1 system.d dir:        ${DBUS_SYS_DIR}
        pci.ids, usb.ids dir:       ${HWDATA_DIR}

        compiler:                   ${CC}
        cflags:                     ${CFLAGS}
        cppflags:                   ${CPPFLAGS}
	docbook2html:               ${DOCBOOK}
	xmllint:                    ${XMLLINT}
        User for HAL:               ${HAL_USER}
        Group for HAL:              ${HAL_GROUP}
        hald pidfile:               ${HALD_PID_FILE}
        hald socket dir:            ${HALD_SOCKET_DIR}
        hald backend:               ${HALD_BACKEND}
        use acpi kernel interface:  ${acpi_proc}
        use acpid interface:        ${acpi_acpid}
        use libusb:                 ${USE_LIBUSB}
        use libpci:                 ${USE_LIBPCI}

        use PolicyKit:              ${msg_polkit}

        Maintainer mode:            ${USE_MAINTAINER_MODE}
        Building verbose mode:      ${enable_verbose_mode}
        Building api docs:          ${enable_gtk_doc}
        Building docs:              ${enable_docbook_docs}
"

if test x$enable_verbose_mode = xyes; then
   echo "NOTE: building with verbose mode increases library size, may slightly "
   echo "      increase security risk, and decreases performance."
   echo
fi

if test x$msg_polkit = xno; then
   echo "NOTE: WARNING! WARNING! WARNING! PolicyKit is not enabled. HAL will "
   echo "      allow any user to invoke any method. THIS IS A SECURITY RISK. "
   echo "      Use this only if you really know what you are doing. Bugs, "
   echo "      security issues and similar filed against HAL versions built"
   echo "      without PolicyKit may be ignored by the HAL maintainers."
   echo
   echo "      Disable PolicyKit usage only if you really know what you are doing."
   echo
fi

# (distro-tweaks required)
if test x$with_os_type = xredhat; then
   echo "NOTE: Red Hat style init scripts and policy will be installed"
else
   echo "NOTE: You have to install init scripts yourself and tweak your own policy"
fi
echo

echo "NOTE: Remember to create user ${HAL_USER} and group ${HAL_GROUP} before make install"
echo

echo "NOTE: For development, use run-hald.sh and debug-hald.sh scripts in hald/ to "
echo "      use programs (callouts, probers, addons) and device information files "
echo "      from build directories. You may still need 'make install' to"
echo "      install the udev rule to receive events from udev."
echo