aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: bf0ac6935cab1fb675ef8c1ec7ff78514a28ea78 (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
AC_PREREQ(2.53)
AC_INIT([matchbox-panel], 0.8.3, [mallum@handhelds.org])
AC_CONFIG_SRCDIR([src/panel.c])

AM_INIT_AUTOMAKE()
AM_MAINTAINER_MODE
AM_CONFIG_HEADER([config.h])

# Checks for programs.
AC_GNU_SOURCE
AC_PROG_CC
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([libintl.h stdlib.h string.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_HEADER_TIME

# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_FORK
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([alarm getcwd gettimeofday memset mkdir select setenv setlocale strcasecmp strdup strpbrk strstr])

AC_ARG_ENABLE(dnotify,
  [  --enable-dnotify      enable dnotify support (Linux 2.4+ only).],
  enable_dnotify=$enableval, enable_dnotify=no)

AC_ARG_ENABLE(startup_notification,
  [  --enable-startup-notification   enable startup notification support],
     enable_startup_notification=$enableval, enable_startup_notification=no )

AC_ARG_ENABLE(nls,
  [  --enable-nls        enable Native Language Support ( gettext/libintl )],
   enable_nls=$enableval, enable_nls=no)

AC_ARG_ENABLE(small_icons,
  [  --enable-small-icons    enable small icons],
     enable_small_icons=$enableval, enable_small_icons=no )

AC_ARG_ENABLE(dnotify,
  [  --enable-dnotify      enable dnotify support (Linux 2.4+ only).],
  enable_dnotify=$enableval, enable_dnotify=no)

AC_ARG_ENABLE(debug,
  [  --enable-debug    enable debug ( verbose ) build],
     enable_debug=$enableval, enable_debug=no )


PKG_CHECK_MODULES(LIBMB, libmb >= 1.5,,
	         AC_MSG_ERROR([*** Required Matchbox Library (libmb) 1.5 not installed ***]))

dnl ------ Debug Build ------------------------------------------------------

if test x$enable_debug = xyes; then
      LIBMB_CFLAGS="$LIBMB_CFLAGS -DDEBUG"
fi

dnl ----- DNOTIFY ----------------------------------------------------------

if test x$enable_dnotify = xyes; then
## FIXME: need to actually check its present
  AC_DEFINE(USE_DNOTIFY, [1], [Has dnotify support])
fi

dnl ----- Startup Notification ---------------------------------------------


if test x$enable_startup_notification != xno; then
  PKG_CHECK_MODULES(SN, libstartup-notification-1.0, ,
			   AC_MSG_ERROR([*** Required Startup Notification Librays not installed ***]))

  AC_DEFINE(USE_LIBSN, [1], [Has StartupNotification Support])
fi

dnl ----- NLS Fun -----------------------------------------------------------

INTLIBS=""
MOFILES=""

if test x$enable_nls = xyes; then

  LINGUAS="en_GB es_ES fi_FI de cs fr_FR zh_TW"

  AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
	     AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
		  	 INTLIBS="" ))

  AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
  AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge)
  AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)

  if test "$XGETTEXT" != ""; then 
    if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
        echo "xgettext isn't GNU version"
        XGETTEXT=""
    fi
  fi

  if test "$LINGUAS" != ""; then
    if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
       PO=""
       if test "$LINGUAS" = ""; then
   	    ling=` (cd src/po; /bin/ls *.po) `
    	    for l in $ling; do
	        lcode=`basename $l .po`
	        LINGUAS="$LINGUAS $lcode"
           done
       fi
       AC_DEFINE(ENABLE_NLS, [1], [NLS Please])
       echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
    else
        LINGUAS=""
        PO=""
        echo "xgettext and libintl.a don't both exist; will not build i18n support"
    fi
  else
    INTLIBS=""
    MOFILES=""
    PO=""
  fi

  for lang in $LINGUAS; do
    MOFILES="$MOFILES $lang.mo"
  done

fi

AC_SUBST(INTLIBS)
AC_SUBST(MOFILES)

dnl ----- Xsettings ---------------------------------------------------------

AC_MSG_CHECKING([for libmb xsettings support])

if $PKG_CONFIG --libs libmb | grep -i xsettings ; then
     mb_have_xsettings="yes"
     AC_DEFINE(USE_XSETTINGS, [1], [Use XSettings])
     AC_MSG_RESULT([yes])
else
     mb_have_xsettings="no"	
     AC_MSG_RESULT([no])
fi


dnl ---- Png Support -------------------------------------------------------

if $PKG_CONFIG --libs libmb | grep png ; then
   found_png="yes"
else
   found_png="no"	
fi

AM_CONDITIONAL(WANT_PNGS, test x$found_png = xyes)  


dnl ---- Icons --------------------------------------------------------------

AM_CONDITIONAL(WANT_SMALL_ICONS, test x$enable_small_icons = xyes)  

dnl ----- DNOTIFY ----------------------------------------------------------

if test x$enable_dnotify = xyes; then
## FIXME: need to actually check its present
  AC_DEFINE(USE_DNOTIFY, [1], [Has dnotify support])
fi

AM_CONDITIONAL(WANT_SMALL_ICONS, test x$enable_small_icons = xyes)  

dnl ----- Specific Applet deps ----------------------------------------------

miniapm_enabled="no, missing deps"

AC_CHECK_HEADERS(apm.h, enable_linux_apm=yes, enable_linux_apm=no)
if test x$enable_linux_apm = xyes; then
   miniapm_enabled="yes"
   AC_DEFINE(HAVE_APM_H, [1], [Have Linux APM headers])
fi

AC_CHECK_HEADERS(apmvar.h, enable_bsd_apm=yes, enable_bsd_apm=no)
if test x$enable_bsd_apm = xyes; then
   AC_DEFINE(HAVE_APMVAR_H, [1], [Have BSD APM headers])
   miniapm_enabled="yes"
fi

AM_CONDITIONAL(WANT_APM, test x$miniapm_enabled = x"yes")


dnl ------ wireless checks --------------------------------------------------

wifi_enabled="no"

AC_MSG_CHECKING(for suitable wireless headers)
AC_TRY_COMPILE([#include <linux/wireless.h>],
               [#if WIRELESS_EXT < 11
                #error "Wireless Extension v11 or newer required"
                #endif ], enable_linux_wifi=yes, enable_linux_wifi=no)

if test x$enable_linux_wifi = xyes; then
   wifi_enabled="yes"
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi

AM_CONDITIONAL(WANT_WIFI, test x$wifi_enabled = x"yes")

dnl ------ GCC flags --------------------------------------------------------

if test "x$GCC" = "xyes"; then
        GCC_WARNINGS="-g -Wall -fno-strict-aliasing"
        LIBMB_CFLAGS="$GCC_WARNINGS $LIBMB_CFLAGS"
fi


dnl ------ Substitute in found libs, clags to Makefiles etc -----------------

AC_SUBST(LIBMB_CFLAGS)
AC_SUBST(LIBMB_LIBS)

AC_SUBST(SN_CFLAGS)
AC_SUBST(SN_LIBS)

AC_OUTPUT([
Makefile
src/Makefile  
applets/Makefile
applets/dotdesktop/Makefile
applets/icons/Makefile
applets/small-icons/Makefile
po/Makefile
])

dnl ==========================================================================
echo "
                    Matchbox-panel $VERSION
                  =========================

        prefix:                 ${prefix}
        source code location:   ${srcdir}
        compiler:               ${CC} 

        Building with Debug:                ${enable_debug}

        Building with Startup-Notification: ${enable_startup_notification}
	Building with NLS:                  ${enable_nls}
        Building with small icons:          ${enable_small_icons}
	Building with DNOTIFY:		    ${enable_dnotify}

        Building mb-applet-battery:         ${miniapm_enabled}
        Building mb-applet-wireless:        ${wifi_enabled}
"