-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
289 lines (239 loc) · 8.47 KB
/
configure.ac
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
#
# Script for autoconf 2.71 or later and automake 1.16.5 or later
#
# Initialize
AC_INIT([xfe],[1.45])
AC_CONFIG_SRCDIR([src/XFileExplorer.cpp])
AM_INIT_AUTOMAKE([subdir-objects -Wall])
AC_CONFIG_HEADERS([config.h])
# Test if compilation variables are already set and if not, reset them
# This mechanism prevents these variables to be changed by the following AC macros
# while still allowing to use user's variables if they are defined
if test "$CXXFLAGS" = ""; then
CXXFLAGS=""
fi
if test "$CFLAGS" = ""; then
CFLAGS=""
fi
# Minimal LIBS
LIBS="$LIBS -lX11"
AC_USE_SYSTEM_EXTENSIONS
# Checks for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
# Internationalization
IT_PROG_INTLTOOL
GETTEXT_PACKAGE=xfe
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The package name, for gettext])
AM_GNU_GETTEXT(external)
# Checks for header files.
AC_PATH_X
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h mntent.h stdlib.h string.h sys/ioctl.h sys/statfs.h sys/time.h unistd.h utime.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_CHECK_HEADERS_ONCE([sys/time.h])
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_GETGROUPS
AC_FUNC_GETMNTENT
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_UTIME_NULL
AC_CHECK_FUNCS([endgrent endpwent gethostname getmntent gettimeofday lchown memset mkdir mkfifo putenv rmdir setlocale sqrt strchr strdup strerror strstr strtol strtoul strtoull utime])
# Large files support
AC_SYS_LARGEFILE
# Check for FOX 1.6
AC_CHECK_LIB(FOX-1.6,fxfindfox,,AC_MSG_ERROR("libFOX-1.6 not found"))
# Check for FOX 1.6 header files
AC_LANG([C++])
AC_CHECK_HEADER(fox-1.6/fx.h,,AC_MSG_ERROR("fox-1.6/fx.h not found"))
# Check if fox-config exists
AC_CHECK_PROGS(FOX_CONFIG,fox-config-1.6 fox-1.6-config fox-config)
if test no"$FOX_CONFIG" = no ; then
AC_MSG_ERROR("fox-config not found")
fi
# Include flags for the FOX library
FOXCFLAGS=`$FOX_CONFIG --cflags`
CXXFLAGS="${CXXFLAGS} $FOXCFLAGS"
# Check if FOX was compiled with xft support
TEST_XFT=`$FOX_CONFIG --libs | grep Xft`
if test "x$TEST_XFT" != "x" ; then
echo "checking whether FOX was compiled with Xft support... yes"
# Check for FreeType2
PKG_CHECK_MODULES(FREETYPE, freetype2, [
freetype_cflags="$FREETYPE_CFLAGS"
freetype_libs="$FREETYPE_LIBS"
LIBS="$LIBS $freetype_libs"
CPPFLAGS="$freetype_cflags $CPPFLAGS"
], AC_MSG_ERROR("freetype not found"))
# Check for Xft headers
xft_config=''
AC_CHECK_PROGS(xft_config,xft-config,)
if test -n "$xft_config"; then
xft_cflags=`$xft_config --cflags`
xft_libs=`$xft_config --libs`
LIBS="$LIBS $xft_libs"
CPPFLAGS="$xft_cflags $CPPFLAGS"
CXXFLAGS="${CXXFLAGS} -DHAVE_XFT_H"
else
# On some systems xft-config is deprecated and pkg-config should be used instead
PKG_CHECK_MODULES(XFT, xft, [
xft_cflags="$XFT_CFLAGS"
xft_libs="$XFT_LIBS"
LIBS="$LIBS $xft_libs"
CPPFLAGS="$xft_cflags $CPPFLAGS"
CXXFLAGS="$CXXFLAGS -DHAVE_XFT_H"
], AC_MSG_ERROR("Xft not found"))
fi
AC_CHECK_HEADER(X11/Xft/Xft.h,,AC_MSG_ERROR("Xft.h not found"))
else
echo "checking whether FOX was compiled with Xft support... no"
echo ""
echo "===================================== Error! ================================================"
echo "Configure has detected that your FOX library was compiled without Xft support."
echo "Since Xfe version 1.42, Xft is mandatory and FOX *must* have been compiled with Xft support."
echo "To enable Xft support in FOX, rebuild the FOX library using the following commands:"
echo " ./configure --with-xft"
echo " make"
echo " sudo make install"
echo "============================================================================================="
echo ""
AC_MSG_ERROR("missing Xft support in FOX")
fi
# Check for Xlib headers
AC_CHECK_HEADER(X11/Xlib.h,,AC_MSG_ERROR("Xlib.h not found"))
# Check for XRandR support
AC_MSG_CHECKING(for xrandr extension)
AC_ARG_WITH(xrandr,[ --with-xrandr compile with XRandR support])
AC_MSG_RESULT([$with_xrandr])
if test "x$with_xrandr" != "xno"; then
AC_CHECK_HEADERS(X11/extensions/Xrandr.h,CXXFLAGS="${CXXFLAGS} -DHAVE_XRANDR_H=1"; LIBS="${LIBS} -lXrandr")
fi
# Check for libPNG
AC_CHECK_LIB(png, png_read_info,,AC_MSG_ERROR("libPNG not found"))
AC_CHECK_HEADER(png.h,,AC_MSG_ERROR("png.h not found"))
# Check for fontconfig
AC_CHECK_LIB(fontconfig, FcInit,, AC_MSG_ERROR("fontconfig not found"))
AC_CHECK_HEADER(fontconfig/fontconfig.h,,AC_MSG_ERROR("fontconfig.h not found"))
# Check for startup notification support
AC_MSG_CHECKING(for startup notification)
AC_ARG_ENABLE(sn,[ --disable-sn compile without startup notification support])
AC_MSG_RESULT([$enable_sn])
AC_SUBST(STARTUPNOTIFY,false)
if test "x$enable_sn" != "xno"; then
CXXFLAGS="${CXXFLAGS} -DSTARTUP_NOTIFICATION"
AC_SUBST(STARTUPNOTIFY,true)
enable_sn=yes
# Check for xcb libs
PKG_CHECK_MODULES([xcb], [xcb >= 1.6],,
[AC_MSG_ERROR([Cannot find xcb])])
PKG_CHECK_MODULES([xcb_aux], [xcb-aux],,
[AC_MSG_ERROR([Cannot find xcb-aux])])
PKG_CHECK_MODULES([xcb_event], [xcb-event],,
[AC_MSG_ERROR([Cannot find xcb-event])])
PKG_CHECK_MODULES([x11_xcb], [x11-xcb],,
[AC_MSG_ERROR([Cannot find x11-xcb])])
LIBS="$LIBS $xcb_LIBS $xcb_aux_LIBS $x11_xcb_LIBS"
fi
AM_CONDITIONAL(STARTUPNOTIFY, [test x$enable_sn = xyes])
# Check for pkexec >= 0.102 for it's ability to run X11 apps
AM_CONDITIONAL([INSTALL_POLKIT_ACTIONS], false)
PKEXEC_REQUIRED_VERSION='0.102'
AC_MSG_CHECKING([for pkexec >= $PKEXEC_REQUIRED_VERSION])
PKEXEC_REQUIRED_INT=`echo "$PKEXEC_REQUIRED_VERSION" | $AWK -F. '{print $1 * 10000 + $2}'`
PKEXEC_VERSION_OUTPUT=`pkexec --version 2> /dev/null` ||
AC_MSG_RESULT([not found])
if test "x$PKEXEC_VERSION_OUTPUT" != 'x'; then
PKEXEC_FOUND_VERSION=`echo "$PKEXEC_VERSION_OUTPUT" | head -1 | cut -d' ' -f3`
PKEXEC_FOUND_INT=`echo "$PKEXEC_FOUND_VERSION" | $AWK -F. '{print $1 * 10000 + $2}'`
AC_MSG_RESULT([$PKEXEC_FOUND_VERSION found])
if test "$PKEXEC_FOUND_INT" -ge "$PKEXEC_REQUIRED_INT"; then
AM_CONDITIONAL([INSTALL_POLKIT_ACTIONS], true)
fi
fi
# Building for debugging
AC_MSG_CHECKING(for debugging)
AC_ARG_ENABLE(debug,[ --enable-debug compile for debugging])
AC_MSG_RESULT([$enable_debug])
# Add debug symbols
AC_MSG_CHECKING(minimalflags)
AC_ARG_ENABLE(minimalflags,[ --enable-minimalflags respect system flags as much as possible])
AC_MSG_RESULT([$enable_minimalflags])
# Building for release
AC_MSG_CHECKING(for release build)
AC_ARG_ENABLE(release,[ --enable-release compile for release (advanced optimizations)])
AC_MSG_RESULT([$enable_release])
if test "x$enable_minimalflags" = "xyes" ; then
if test "x$enable_debug" = "xyes" ; then
CPPFLAGS="$CPPFLAGS -DDEBUG"
else
CPPFLAGS="$CPPFLAGS -DNDEBUG"
fi
else
# Setting CXXFLAGS
if test "x$enable_debug" = "xyes" ; then
CXXFLAGS="${CXXFLAGS} -Wall -g -DDEBUG"
elif test "x$enable_release" = "xyes" ; then
CXXFLAGS="-DNDEBUG ${CXXFLAGS} "
if test "${GXX}" = "yes" ; then
CXXFLAGS="-O3 -Wall -ffast-math -fomit-frame-pointer -fno-strict-aliasing ${CXXFLAGS}"
fi
else
CXXFLAGS="-O2 -Wall ${CXXFLAGS}"
fi
# Setting CFLAGS
if test "x$enable_debug" = "xyes" ; then
CFLAGS="${CFLAGS} -Wall -g -DDEBUG"
elif test "x$enable_release" = "xyes" ; then
CFLAGS="-DNDEBUG ${CFLAGS}"
if test "${GCC}" = "yes" ; then
CFLAGS="-O3 -Wall -ffast-math -fomit-frame-pointer -fno-strict-aliasing ${CFLAGS}"
fi
else
CFLAGS="-O2 -Wall ${CFLAGS}"
fi
fi
# Output
AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in xfe.spec xferc xfe.desktop.in xfi.desktop.in
xfw.desktop.in xfp.desktop.in src/Makefile
icons/Makefile
icons/gnome-theme/Makefile
icons/default-theme/Makefile
icons/xfce-theme/Makefile
icons/kde-theme/Makefile])
AC_OUTPUT
# Display CXXFLAGS, CFLAGS and LIBS
echo ""
echo "======================== Compiler and linker flags ========================"
echo "CXXFLAGS=$CXXFLAGS"
echo "CFLAGS=$CFLAGS"
echo "LIBS=$LIBS"
echo "==========================================================================="
echo ""
echo "Configure finished!"
echo " Do: 'make' to compile Xfe."
echo " Then: 'make install' (as root) to install Xfe."
echo ""