File: configure.ac

package info (click to toggle)
ddccontrol 0.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 1,144 kB
  • sloc: ansic: 7,068; xml: 1,862; makefile: 174; sh: 116; sed: 16
file content (300 lines) | stat: -rw-r--r-- 9,312 bytes parent folder | download
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
AC_INIT([DDC/CI control tool],[0.6.0],[DDCControl users list <ddccontrol-users@lists.sourceforge.net>],[ddccontrol])
AC_CONFIG_SRCDIR([src/ddccontrol/main.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([subdir-objects -Wall foreign])

IT_PROG_INTLTOOL
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.18.1])
GETTEXT_PACKAGE=ddccontrol
AC_SUBST([GETTEXT_PACKAGE])

AC_PROG_CC
AM_PROG_AR
AC_PROG_INSTALL
LT_INIT
PKG_PROG_PKG_CONFIG

AC_LANG([C])

AC_CHECK_HEADERS([stdio.h unistd.h sys/time.h stdlib.h errno.h unistd.h string.h sys/types.h sys/stat.h fcntl.h sys/ioctl.h dirent.h], [], [AC_MSG_ERROR([Important header not found, please install it.], [1])], [])

check_xsltproc=yes
AC_ARG_ENABLE(xsltproc-check,
  [AS_HELP_STRING([--disable-xsltproc-check],[omit check to see if xsltproc works (enabled)])],
  [if test x$enableval = xno; then
    check_xsltproc=no
  fi])

# /dev/i2c-* check
support_i2c_dev=yes
AC_ARG_ENABLE(i2cdev,
  [AS_HELP_STRING([--disable-i2c],[enable /dev/i2c-* busses (enabled)])],
  [if test x$enableval = xno; then
    support_i2c_dev=no
  fi])

if test "x$support_i2c_dev" = "xyes" ; then
	AC_DEFINE_UNQUOTED(HAVE_I2C_DEV, 1, [Define if ddccontrol is built with /dev/i2c-* support.])

	AC_CANONICAL_HOST
	case $host_os in
		linux*)
		AC_CHECK_HEADERS([linux/types.h], [], [AC_MSG_ERROR([Linux kernel header files not found, please install them.], [1])], [])
		;;
	esac

	support_i2c_dev_works=no
	AC_MSG_CHECKING([if linux/i2c-dev.h works with non-kernel linux/types.h])
	AC_COMPILE_IFELSE([
	[#include <linux/types.h>]
	[#include <linux/i2c-dev.h>]
	[const int a = I2C_RDWR + I2C_M_RD;]
	[struct i2c_msg i2cmsg;]
	],
	support_i2c_dev_works=yes
	AC_MSG_RESULT(yes),
	AC_MSG_RESULT(no)
	)

	if test "x$support_i2c_dev_works" = "xno" ; then
	  AC_MSG_CHECKING([if $srcdir/src/lib/i2c-dev.h works instead])
	  AC_COMPILE_IFELSE([
	  [#define HAVE_BUGGY_I2C_DEV 1]
	  [#include "$srcdir/src/lib/i2c-dev.h"]
	  [const int a = I2C_RDWR + I2C_M_RD;]
	  [struct i2c_msg i2cmsg;]
	  ],
	  AC_DEFINE(HAVE_BUGGY_I2C_DEV, 1, [Define if linux/i2c-dev.h is buggy on your system, so defaults constants and structures must be used])
	  support_i2c_dev_works=yes
	  AC_MSG_RESULT(yes),
	  AC_MSG_RESULT(no)
	  )
	  if test "x$support_i2c_dev_works" = "xno" ; then
	   AC_MSG_ERROR([Unable to use neither linux/i2c-dev.h nor src/lib/i2c-dev.h on your system, kernel headers may be more buggy than usual, or inexistant, try to (re-)install kernel headers.], [1])
	  fi
	fi
fi

AC_DEFINE(_GNU_SOURCE, 1, [Define unconditionally for setting a GNU environment.])

CFLAGS="$CFLAGS -Wall  -DDATADIR=\"\\\"${datadir}/ddccontrol-db\\\"\" -DBINDIR=\"\\\"${bindir}\\\"\""


# Check for extra libraries

AC_SEARCH_LIBS([round],[m])

# libxml2 check
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])

# Direct PCI memory access check
support_ddcpci=yes
AC_ARG_ENABLE(ddcpci,
  [AS_HELP_STRING([--disable-ddcpci],[enable direct PCI memory access (enabled)])],
  [if test x$enableval = xno; then
    support_ddcpci=no
  fi])

DDCPCI=
if test x$support_ddcpci = xyes; then
   AC_CHECK_HEADERS([pci/pci.h], [], [AC_MSG_ERROR([PCI utils headers not found, please install pci-utils.], [1])], [])
   AC_CHECK_LIB([pci], [pci_alloc], [], [
      AC_CHECK_LIB([z], [gzopen], [], [AC_MSG_ERROR([PCI utils library not found, please install pci-utils.], [1])])
      AC_CHECK_LIB([pci], [pci_fill_info], [], [AC_MSG_ERROR([PCI utils library not found, please install pci-utils.], [1])], [-lz])
   ])
   DDCPCI=ddcpci
   AC_DEFINE_UNQUOTED(HAVE_DDCPCI, 1, [Define if ddccontrol is built with ddcpci support.])
fi

AC_SUBST([DDCPCI])

AC_CHECK_HEADERS([sys/io.h])
AM_CONDITIONAL(HAVE_SYS_IO, [test x$ac_cv_header_sys_io_h = xyes])

# AMD ADL support check
support_amdadl=
AC_ARG_ENABLE(amdadl,
  [AS_HELP_STRING([--enable-amdadl],[enable AMD Display Library support (autodetect)])],
  [if test x$enableval = xno; then
    support_amdadl=no
  else
    support_amdadl=yes
  fi])

AMDADL=
if test x$support_amdadl = xyes; then
   AC_CHECK_HEADERS([ADL/adl_sdk.h], [], [AC_MSG_ERROR([ADL headers not found, but ADL support requested.], [1])],
   [#ifndef __stdcall
    #define __stdcall
    #endif
    ])
   AMDADL=amdadl
elif test x$support_amdadl = x; then
   AC_CHECK_HEADERS([ADL/adl_sdk.h], [
     AMDADL=amdadl
   ], [], [#ifndef __stdcall
           #define __stdcall
           #endif
           ])
fi

if test x$AMDADL = xamdadl; then
   AC_DEFINE_UNQUOTED(HAVE_AMDADL, 1, [Define if ddccontrol is built with ADL support.])
fi

AC_SUBST([AMDADL])

# Gnome check
support_gnome=yes
AC_ARG_ENABLE(gnome,
  AS_HELP_STRING([--disable-gnome],[disable build of gnome-console GUI (enabled)]),
  [if test x$enableval = xno; then
    support_gnome=no
  fi])

# This should use PKG_CHECK_MODULES() instead of explicitly calling $PKG_CONFIG.
GDDCCONTROL=
if test x$support_gnome = xyes; then
   if test "x$PKG_CONFIG" = "xno" ; then
      AC_MSG_ERROR(pkg-config not found, please install pkg-config)
   fi

   echo -n "checking for gtk+>=2.4 and gthread>=2.4... "
   if $PKG_CONFIG --atleast-version=2.4 gtk+-2.0 gthread-2.0 ; then
      GNOME_LDFLAGS="$LIBXML2_LIBS `$PKG_CONFIG --libs gtk+-2.0 gthread-2.0`"
      GNOME_CFLAGS="$LIBXML2_CFLAGS `$PKG_CONFIG --cflags gtk+-2.0 gthread-2.0`"
      GDDCCONTROL=gddccontrol
      echo "yes"

      # Check for X11
      AC_PATH_XTRA
   else
      echo "no"
      AC_MSG_ERROR([gtk+>=2.4 development packages not found])
   fi
fi

support_gnome_applet=yes
AC_ARG_ENABLE(	gnome-applet,
		AS_HELP_STRING([--disable-gnome-applet],[disable build of gnome panel applet (enabled)]),
		[if test x$enableval = xno; then
			support_gnome_applet=no
		fi])


# This should use PKG_CHECK_MODULES() instead of explicitly calling $PKG_CONFIG.
GNOME_APPLET=
if test x$support_gnome_applet = xyes; then
	if $PKG_CONFIG --atleast-version=2.10 libpanelapplet-2.0 ; then
		GNOME_APPLET="gnome-ddcc-applet"
	    GNOME_LDFLAGS="$LIBXML2_LIBS `$PKG_CONFIG --libs gtk+-2.0 gthread-2.0 libpanelapplet-2.0`"
	    GNOME_CFLAGS="$LIBXML2_CFLAGS `$PKG_CONFIG --cflags gtk+-2.0 gthread-2.0 libpanelapplet-2.0`"
	fi
fi


AC_SUBST([GNOME_LDFLAGS])
AC_SUBST([GNOME_CFLAGS])
AC_SUBST([GDDCCONTROL])
AC_SUBST([GNOME_APPLET])

PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0],[CFLAGS="${GIO_UNIX_CFLAGS} ${CFLAGS}" LIBS="${GIO_UNIX_LIBS} ${LIBS}"])

# Doc check
support_doc=no
AC_ARG_ENABLE(doc,
  AS_HELP_STRING([--enable-doc],[enable build of the documentation (disabled)]),
  [if test x$enableval = xyes; then
    support_doc=yes
  fi])

AM_CONDITIONAL(BUILD_DOC, test x$support_doc = xyes)

DOC=
if test x$support_doc = xyes; then
   # Docbook tests
   # Based on http://www.movement.uklinux.net/docs/docbook-autotools/configure.html
   # Copyright � 2003 John Levon
   # It's just rude to go over the net to build
   XSLTPROC_FLAGS=--nonet

   AC_MSG_CHECKING([whether /etc/xml/catalog exists])
   if test ! -f /etc/xml/catalog; then
      AC_MSG_ERROR([/etc/xml/catalog not found, fix this problem or disable doc building])
   else
      AC_MSG_RESULT(yes)
      AC_PATH_PROG(XSLTPROC,xsltproc,no)
      if test "x$XSLTPROC" = "xno" ; then
         AC_MSG_ERROR([xsltproc not found, install it or disable doc building])
      fi

      AC_PATH_PROG(SSH,ssh,ssh)
      AC_PATH_PROG(SCP,scp,scp)
      AC_PATH_PROG(ASPELL,aspell,no)
      AC_PATH_PROG(FOP,fop,no)

      AC_PATH_PROG(TIDY,tidy,no)
      if test "x$TIDY" = "xno" ; then
         AC_MSG_ERROR([tidy not found, install it or disable doc building])
      fi

      if test x$check_xsltproc = xyes ; then
         AC_MSG_CHECKING([whether xsltproc works])

         DOCBOOK_ROOT="http://docbook.sourceforge.net/release/xsl/current/xhtml"
         DB_FILE="$DOCBOOK_ROOT/docbook.xsl"

         $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<book id="test">
</book>
END
         if test "$?" = 0; then
            AC_MSG_RESULT(yes)
            DOC=doc
         else
            AC_MSG_ERROR([xsltproc does not work, fix this problem or disable doc building])
         fi
      fi
   fi
fi

AC_SUBST(XML_CATALOG)
AC_SUBST(XSLTPROC_FLAGS)
AC_SUBST(DOCBOOK_ROOT)
AC_SUBST(DOC)


dnl ---------------------------------------------------------------------------
dnl - Select whether and where to install systemd system service files
dnl ---------------------------------------------------------------------------

AC_ARG_WITH([systemdsystemunitdir],
            AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
            [],
            [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != "xno"; then
	AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])


AC_CONFIG_FILES([
	po/Makefile.in
	Makefile
	src/Makefile
	src/lib/Makefile
	src/lib/ddccontrol.pc
	src/daemon/Makefile
	src/daemon/data/Makefile
	src/ddccontrol/Makefile
	src/gddccontrol/Makefile
	src/ddcpci/Makefile
	src/gnome-ddcc-applet/Makefile
	doc/Makefile
	doc/main.xml
	man/Makefile])
AC_OUTPUT