-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
274 lines (230 loc) · 7.54 KB
/
configure.in
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
dnl
dnl Copyright (c) 2005-2014 edelib authors
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with this library. If not, see <http://www.gnu.org/licenses/>.
m4_define([edelib_major_version], [2])
m4_define([edelib_minor_version], [2])
m4_define([edelib_patch_version], [0])
m4_define([edelib_version], [edelib_major_version.edelib_minor_version.edelib_patch_version])
AC_PREREQ(2.13)
AC_INIT(edelib, edelib_version, [[email protected]])
AC_CONFIG_SRCDIR(src/String.cpp)
AC_CONFIG_HEADER(config.h:config.h.in)
EDELIB_MAJOR_VERSION=edelib_major_version
EDELIB_MINOR_VERSION=edelib_minor_version
EDELIB_PATCH_VERSION=edelib_patch_version
EDELIB_API_VERSION=$PACKAGE_VERSION
dnl configure fuck up CFLAGS/CXXFLAG by adding '-O2' and '-g' after AC_PROG_CC and AC_PROG_CXX
dnl and there is no way to remove them without knowing if user added them
user_cflags="$CFLAGS"
user_cxxflags="$CXXFLAGS"
dnl check for compiler and programs first before any variable was set
dnl this is for case if compiler is not a gcc, so we can set a different variables
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LN_S
AC_PATH_PROG(SED, sed)
AC_PATH_PROG(MSGFMT, msgfmt)
AC_PATH_PROG(XGETTEXT, xgettext)
AC_PATH_PROG(DOXYGEN, doxygen)
EDELIB_PROG_JAM
EDELIB_COMPILER_VENDOR
EDELIB_CPP_VARARGS
case $ac_compiler_vendor in
"gcc")
DEVELOPER_FLAGS="-Wall"
dnl older gcc's doesn't support -Wno-variadic-macros option
if test "x$ac_have_wno_variadic_macros" = "xyes"; then
DEVELOPER_FLAGS="$DEVELOPER_FLAGS -pedantic -Wshadow $ac_wno_variadic_macros"
fi
DEBUG_FLAGS="-D_DEBUG"
OPTIM_FLAGS="-O2"
DISABLE_RTTI_FLAGS="-fno-rtti -fno-exceptions"
;;
"sun")
DEVELOPER_FLAGS="+w2"
DEBUG_FLAGS="-D_DEBUG"
OPTIM_FLAGS="-xO3"
;;
*)
DEVELOPER_FLAGS=""
DEBUG_FLAGS="-D_DEBUG"
OPTIM_FLAGS=""
;;
esac
CFLAGS="-DHAVE_CONFIG_H $user_cflags"
CXXFLAGS="-DHAVE_CONFIG_H $user_cxxflags"
dnl libraries, even static one, on amd64 should be compiled with '-fPIC'
host_machine=`uname -m`
if test "$host_machine" = "x86_64"; then
CFLAGS="$CFLAGS -fPIC"
CXXFLAGS="$CXXFLAGS -fPIC"
fi
dnl basic headers
AC_HEADER_STDC
AC_CHECK_HEADER(string.h, AC_DEFINE(HAVE_STRING_H, 1, [Define to 1 if you have string.h file]))
AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF, 1, [Define to 1 if you have snprintf()]))
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF, 1, [Define to 1 if you have vsnprintf()]))
dnl freebsd have different unsetenv() impl. and is not compatible with our implementation
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV, 1, [Define to 1 if you ave unsetenv()]))
dnl terminal stuff
AC_CHECK_FUNC(grantpt, AC_DEFINE(HAVE_GRANTPT, 1, [Define to 1 if you have grantpt()]))
AC_CHECK_FUNC(ptsname, AC_DEFINE(HAVE_PTSNAME, 1, [Define to 1 if you have ptsname()]))
AC_CHECK_FUNC(unlockpt, AC_DEFINE(HAVE_UNLOCKPT, 1, [Define to 1 if you have unlockpt()]))
AC_CHECK_FUNC(_getpty, AC_DEFINE(HAVE__GETPTY, 1, [Define to 1 if you have _getpty()]))
AC_CHECK_HEADER(pty.h, AC_DEFINE(HAVE_PTY_H, 1, [Define to 1 if you have pty.h]))
AC_CHECK_HEADER(libutil.h, AC_DEFINE(HAVE_LIBUTIL_H, 1, [Define to 1 if you have libutil.h]))
AC_CHECK_HEADER(util.h, AC_DEFINE(HAVE_UTIL_H, 1, [Define to 1 if you have util.h]))
dnl xdgmimcache.c
AC_CHECK_FUNC(mmap, AC_DEFINE(HAVE_MMAP, 1, [Define to 1 if you have mmap()]))
EDELIB_DATETIME
EDELIB_X11
EDELIB_NOTIFY
EDELIB_SHARED
EDELIB_NLS
EDELIB_MIME
EDELIB_DBUS
EDELIB_LARGEFILE
EDELIB_DMALLOC
dnl user fired --without-x, we disable FLTK checks
if test "$have_x" = "yes"; then
EDELIB_FLTK
EDELIB_LIBXPM
fi
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable debug (default=no)]),,enable_debug=no)
if test "$enable_debug" = "yes"; then
if test "$ac_compiler_gnu" = yes; then
DEBUG_FLAGS="$DEBUG_FLAGS -g3"
else
DEBUG_FLAGS="$DEBUG_FLAGS -g"
fi
dnl clear all optimization flags
OPTIM_FLAGS=""
fi
AC_ARG_ENABLE(profile, AC_HELP_STRING([--enable-profile],[enable profile (default=no)]),,enable_profile=no)
if test "$enable_profile" = "yes"; then
if test "$ac_compiler_gnu" = yes; then
DEBUG_FLAGS="$DEBUG_FLAGS -pg"
dnl clear all optimization flags
OPTIM_FLAGS=""
fi
fi
AC_ARG_ENABLE(rtti, AC_HELP_STRING([--disable-rtti],[disable RTTI support (default=no)]),,enable_rtti=yes)
if test "$enable_rtti" != "yes"; then
CXXFLAGS="$CXXFLAGS $DISABLE_RTTI_FLAGS"
fi
AC_ARG_VAR([PKG_CONFIG], [pkg-config command])
AC_ARG_VAR([PKG_CONFIG_PATH], [A directory with .pc files for pkg-config])
dnl jam don't like spaces in empty string so clear vars if --without-x is given
if test "$have_x" = "yes"; then
FLTK_LIBS="$FLTK_LIBS $LIBXPM_LIBS $LIBFAM_LIBS"
FLTK_LIBS_FULL="$FLTK_LIBS_FULL $LIBXPM_LIBS $LIBFAM_LIBS"
else
FLTK_LIBS=""
FLTK_LIBS_FULL=""
fi
if test -n "$OPTIM_FLAGS"; then
CFLAGS="$CFLAGS $OPTIM_FLAGS"
CXXFLAGS="$CXXFLAGS $OPTIM_FLAGS"
else
CFLAGS="$CFLAGS $DEBUG_FLAGS"
CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS"
fi
CFLAGS="$CFLAGS $LARGEFILE $DEVELOPER_FLAGS"
CXXFLAGS="$CXXFLAGS $LARGEFILE $DEVELOPER_FLAGS"
dnl this is issued from buildbot so edelib can be used from local directory
if test -n "$EDELIB_USE_LOCALDIR"; then
prefix=`pwd`
ln -s . include
fi
EDELIB_INIT_JAM
AC_SUBST(EDELIB_MAJOR_VERSION)
AC_SUBST(EDELIB_MINOR_VERSION)
AC_SUBST(EDELIB_PATCH_VERSION)
AC_SUBST(EDELIB_API_VERSION)
AC_SUBST(FLTK_CFLAGS)
AC_SUBST(FLTK_LIBS)
AC_SUBST(FLTK_LIBS_FULL)
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
AC_SUBST(SHARED)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LDLIBS)
AC_SUBST(XDG_MIME_HAVE_MMAP)
AC_SUBST(SCHEME_FLAGS)
AC_SUBST(DMALLOC_LIBC)
AC_SUBST(DMALLOC_LIBCXX)
AC_SUBST(HAVE_FL_TREE)
dnl specific stuf which goes to edelib-config.h
AC_CONFIG_COMMANDS([outfile], [
cat > $outfile <<\_____EOF
/* generated file; please modify configure.in */
#ifndef __EDELIB_EDELIB_CONFIG_H__
#define __EDELIB_EDELIB_CONFIG_H__
_____EOF
if test "x$have_iso_varargs" = "xyes"; then
echo "#define EDELIB_HAVE_ISO_VARARGS 1" >> $outfile
fi
if test "x$have_gnuc_varargs" = "xyes"; then
echo "#define EDELIB_HAVE_GNUC_VARARGS 1" >> $outfile
fi
if test "x$have_dbus" = "xyes"; then
echo "#define EDELIB_HAVE_DBUS 1" >> $outfile
fi
if test "x$have_libxpm" = "xyes"; then
echo "#define EDELIB_HAVE_LIBXPM 1" >> $outfile
fi
if test "x$fltk_have_xft" != "x"; then
echo "#define EDELIB_HAVE_FLTK_XFT 1" >> $outfile
fi
if test "x$prefix" != "x"; then
echo "#define EDELIB_INSTALL_PREFIX \"$prefix\"" >> $outfile
fi
if test "x$enable_rtti" = "xyes"; then
echo "#define EDELIB_HAVE_RTTI 1" >> $outfile
fi
cat >> $outfile <<\_____EOF
#endif
_____EOF
], [
outfile="edelib/edelib-config.h"
have_iso_varargs=$have_iso_varargs
have_gnuc_varargs=$have_gnuc_varargs
have_dbus=$have_dbus
have_libxpm=$have_libxpm
fltk_have_xft=$fltk_have_xft
prefix=$prefix
enable_rtti=$enable_rtti
])
AC_OUTPUT([
edelib/Version.h
doc/Doxyfile
Jamconfig
pc/edelib.pc
pc/edelib-gui.pc
pc/edelib-gui-no-images.pc
pc/edelib-dbus.pc
po/update-messages.sh
])
chmod +x po/update-messages.sh
# generate scheme include files
cd sslib
./gen-c-string.sh init.ss > init_ss.h
./gen-c-string.sh theme.ss > theme_ss.h
cd ..
echo ""
echo "Now run 'jam' command."
echo ""