]> Dogcows Code - chaz/tint2/blob - configure.ac
Update tint2conf part.
[chaz/tint2] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3 AC_PREREQ([2.61])
4 AC_INIT([tint2], [0.7.9-svn], [http://code.google.com/p/tint2/issues])
5
6 AM_INIT_AUTOMAKE
7
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_SRCDIR([src/tint.c])
10 AC_CONFIG_HEADERS([config.h])
11
12 # tint2
13 AC_ARG_ENABLE([battery],
14 [AS_HELP_STRING([--disable-battery], [Disable battery status plugin])],
15 [case "${enableval}" in
16 yes) battery=true ;;
17 no) battery=false ;;
18 *) AC_MSG_ERROR([bad value ${enableval} for --disable-battery]) ;;
19 esac], [battery=true])
20 AM_CONDITIONAL([ENABLE_BATTERY], [test x$battery = xtrue])
21 #
22
23 AC_ARG_ENABLE([examples],
24 [AS_HELP_STRING([--enable-examples], [Install additional tin2rc examples])],
25 [case "${enableval}" in
26 yes) examples=true ;;
27 no) examples=false ;;
28 *) AC_MSG_ERROR([bad value ${enableval} for --enable-examples]) ;;
29 esac],[examples=false])
30 AM_CONDITIONAL([INSTALL_EXAMPLES], [test x$examples = xtrue])
31
32 # tint2conf
33 AC_ARG_ENABLE([tint2conf],
34 [AS_HELP_STRING([--disable-tint2conf], [Disable tint2conf build, a GTK+2 theme switcher for tint2])],
35 [case "${enableval}" in
36 yes) tint2conf=true ;;
37 no) tint2conf=false ;;
38 *) AC_MSG_ERROR([bad value ${enableval} for --disable-tint2conf]) ;;
39 esac],[tint2conf=true])
40 AM_CONDITIONAL([ENABLE_TINT2CONF], [test x$tint2conf = xtrue])
41 #
42
43 # Checks for programs.
44 AC_LANG([C])
45 AC_PROG_CC
46 PKG_PROG_PKG_CONFIG
47
48 # Checks for libraries.
49 PKG_CHECK_MODULES([PANGOCAIRO], [pangocairo])
50 AC_SUBST(PANGOCAIRO_CFLAGS)
51 AC_SUBST(PANGOCAIRO_LIBS)
52
53 PKG_CHECK_MODULES([PANGO], [pango])
54 AC_SUBST(PANGO_CFLAGS)
55 AC_SUBST(PANGO_LIBS)
56
57 PKG_CHECK_MODULES([CAIRO], [cairo])
58 AC_SUBST(CAIRO_CFLAGS)
59 AC_SUBST(CAIRO_LIBS)
60
61 PKG_CHECK_MODULES([GLIB2], [glib-2.0])
62 AC_SUBST(GLIB2_CFLAGS)
63 AC_SUBST(GLIB2_LIBS)
64
65 PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0])
66 AC_SUBST(GOBJECT2_CFLAGS)
67 AC_SUBST(GOBJECT2_LIBS)
68
69 PKG_CHECK_MODULES([X11], [x11])
70 AC_SUBST(X11_CFLAGS)
71 AC_SUBST(X11_LIBS)
72
73 PKG_CHECK_MODULES([XINERAMA], [xinerama])
74 AC_SUBST(XINERAMA_CFLAGS)
75 AC_SUBST(XINERAMA_LIBS)
76
77 PKG_CHECK_MODULES([IMLIB2], [imlib2])
78 AC_SUBST(IMLIB2_CFLAGS)
79 AC_SUBST(IMLIB2_LIBS)
80
81 # Ensure that Imlib2 has been built with X support and reset LIBS since AC_CHECK_LIB adds -lImlib2 on success.
82 LIBS_SAVED=$LIBS
83 AC_CHECK_LIB([Imlib2], [imlib_context_set_display], [],
84 AC_MSG_ERROR([Imlib2 must be built with X support]))
85 LIBS=$LIBS_SAVED
86
87 # Checks for header files.
88 AC_PATH_X
89 AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h string.h sys/time.h unistd.h])
90
91 # Checks for typedefs, structures, and compiler characteristics.
92 AC_HEADER_STDBOOL
93 AC_TYPE_INT16_T
94 AC_TYPE_INT64_T
95 AC_TYPE_INT8_T
96 AC_TYPE_PID_T
97
98 # Checks for library functions.
99 AC_FUNC_FORK
100 AC_FUNC_MALLOC
101 AC_FUNC_REALLOC
102 AC_CHECK_FUNCS([alarm gettimeofday memset select setlocale strcasecmp strchr strdup])
103
104 # tint2conf (experimental)
105 if test "x$tint2conf" = xtrue;
106 then
107 # We want just link against stuff we really need so thats why I don't use PKG_CHECK_MODULES.
108 # gtk/glib is a bit horrible because we have to add -I directives for various features (like cairo, pango etc.)
109 # even if we don't need them.
110 # Sorry if that might be confusing %-)
111
112 AC_CHECK_FUNCS([strndup strrchr strstr])
113 # Save LIBS value and clear the variable, AC_CHECK_LIB will append all libs to LIBS on success.
114 LIBS_SAVED=$LIBS
115 LIBS=
116
117 AC_CHECK_LIB([pthread], [pthread_create], [],
118 [AC_MSG_ERROR([libpthread is missing, usually provided by glibc])])
119 AC_CHECK_LIB([glib-2.0], [g_free], [],
120 [AC_MSG_ERROR([glib-2.x is missing])])
121 AC_CHECK_LIB([gobject-2.0], [g_signal_connect_data], [],
122 [AC_MSG_ERROR([libgobject-2.0 is missing, usually provided by glib-2.x])])
123 AC_CHECK_LIB([gtk-x11-2.0], [gtk_main], [],
124 [AC_MSG_ERROR([gtk+-2.x is missing or not built with X support])])
125 AC_CHECK_LIB([gthread-2.0], [g_thread_init], [],
126 [AC_MSG_ERROR([libgthread-2.0 is missing, usually provided by glib-2.x])])
127
128 TINT2CONF_LIBS="${LIBS} ${PTHREAD_LIB} ${GLIB2_LIB} ${GOBJECT2_LIB}"
129 LIBS=$LIBS_SAVED
130
131 TINT2CONF_CFLAGS="$(${PKG_CONFIG} --cflags gtk+-x11-2.0 glib-2.0 gobject-2.0 gthread-2.0)"
132 AC_SUBST(TINT2CONF_CFLAGS)
133 AC_SUBST(TINT2CONF_LIBS)
134
135 # Python stuff
136 AC_PATH_PROG([__PYTHON], [python])
137 if test -z "${__PYTHON}";
138 then
139 AC_MSG_ERROR([tint2conf requires python to be installed])
140 fi
141
142 PKG_CHECK_EXISTS([pygtk-2.0],,[AC_MSG_ERROR([tint2conf requires >=pygtk-2.0])])
143 fi
144 #
145
146 #
147 AM_CFLAGS="-Wall"
148 AM_LDFLAGS="-Wl,--as-needed"
149 AC_SUBST(AM_CFLAGS)
150 AC_SUBST(AM_LDFLAGS)
151
152 DISTCLEANFILES="Makefile.in"
153 AC_SUBST(DISTCLEANFILES)
154
155 AC_CONFIG_FILES([Makefile
156 doc/Makefile
157 sample/Makefile
158 src/Makefile
159 src/tint2conf/Makefile])
160
161 AC_OUTPUT
This page took 0.042567 seconds and 5 git commands to generate.