-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
266 lines (217 loc) · 7.6 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
#
# Script for autoconf 2.69 or later and automake 1.14 or later
#
# Initialize
AC_INIT([xfe], [1.42])
AC_CONFIG_SRCDIR([src/XFileExplorer.cpp])
AM_INIT_AUTOMAKE([subdir-objects -Wall])
AM_CONFIG_HEADER([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
# 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
# Checks for header files.
AC_PATH_X
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
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_HEADER_TIME
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_HEADER_STDC
AC_LANG_CPLUSPLUS
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 headers
freetype_config=''
AC_CHECK_PROGS(freetype_config,freetype-config,)
if test -n "$freetype_config"; then
freetype_cflags=`$freetype_config --cflags`
freetype_libs=`$freetype_config --libs`
LIBS="$LIBS $freetype_libs"
CPPFLAGS="$freetype_cflags $CPPFLAGS"
fi
AC_CHECK_HEADER(config/ftheader.h,,[AC_CHECK_HEADER(freetype/config/ftheader.h,,AC_MSG_ERROR("ftheader.h 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 (e.g. Fedora) xft-config is deprecated and pkg-config should be used instead
pkg_config=''
AC_CHECK_PROGS(pkg_config,pkg-config,)
if test -n "$pkg_config"; then
xft_cflags=`$pkg_config --cflags xft`
xft_libs=`$pkg_config --libs xft`
LIBS="$LIBS $xft_libs"
CPPFLAGS="$xft_cflags $CPPFLAGS"
CXXFLAGS="${CXXFLAGS} -DHAVE_XFT_H"
fi
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
fi
AM_CONDITIONAL(STARTUPNOTIFY, [test x$enable_sn = xyes])
# 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_OUTPUT(Makefile intl/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/xfe-theme/Makefile icons/gnome-theme/Makefile
icons/gnomeblue-theme/Makefile icons/windows-theme/Makefile
icons/tango-theme/Makefile icons/kde-theme/Makefile)
# 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 ""