-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
287 lines (247 loc) · 7.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
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.ac 4422 2011-12-07 20:49:53Z debrouxl $
# Init.
AC_PREREQ(2.57)
AC_INIT(TILP2M, 1.17, [tilp-users@lists.sourceforge.net])
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([m4])
AC_PREFIX_DEFAULT(/usr/local)
# Files to configure.
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
build/Makefile
build/mingw/Makefile
builder/Makefile
desktop/Makefile
help/Makefile
icons/Makefile
man/Makefile
pixmaps/Makefile
src/Makefile
wicons/Makefile
])
AC_MSG_CHECKING([for something to drink while compiling])
AC_MSG_RESULT([err: no fridge found!])
# Setup libtool.
AC_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_ISC_POSIX
AC_PROG_AWK
AC_CHECK_PROG(GROFF, groff, yes, no)
AM_CONDITIONAL(USE_GROFF, test "$GROFF" != "no")
AC_CHECK_TOOL(RC, windres, windres)
# Translation
AC_PROG_INTLTOOL([0.40.0])
GETTEXT_PACKAGE=tilp2
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [tilp2])
AM_GLIB_GNU_GETTEXT
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.12.0)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
# Check for zlib
AC_CHECK_HEADER(zlib.h)
AC_CHECK_LIB(z, compress)
LIBZ="$LIBS"
LIBS=""
AC_SUBST(LIBZ)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_STAT
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_STRUCT_TM
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([getcwd memset mkdir strcasecmp strchr strdup strrchr strstr strtol])
# USB cable support
AC_ARG_ENABLE(libusb,
AC_HELP_STRING([--disable-libusb], [disable USB support through libusb 0.1.x]),
[cab_cv_use_libusb=$enableval], [cab_cv_use_libusb=yes])
AC_CACHE_CHECK([whether to enable USB through libusb 0.1.x],
[cab_cv_use_libusb], [cab_cv_use_libusb=no])
AC_ARG_ENABLE(libusb10,
AC_HELP_STRING([--enable-libusb10], [enable EXPERIMENTAL USB support through libusb 1.0.x]),
[cab_cv_use_libusb10=$enableval], [cab_cv_use_libusb10=no])
AC_CACHE_CHECK([whether to enable USB through libusb 1.0.x],
[cab_cv_use_libusb10], [cab_cv_use_libusb10=no])
if [test "x$cab_cv_use_libusb" != xno]; then
if [test "x$cab_cv_use_libusb10" != xno]; then
PKG_CHECK_MODULES([LIBUSB10], [ libusb-1.0 >= 1.0.0 ],
[HAVE_USB=yes
AC_DEFINE([HAVE_LIBUSB_1_0], [1],
[Define to 1 to enable EXPERIMENTAL libusb 1.0.x support.])
AC_CHECK_LIB([usb-1.0], [libusb_strerror],
[HAVE_LIBUSB10_STRERROR=yes], [HAVE_LIBUSB10_STRERROR=no])
])
else
PKG_CHECK_MODULES([LIBUSB], [ libusb >= 0.1.12 ],
[HAVE_USB=yes
AC_DEFINE([HAVE_LIBUSB], [1], [Define to 1 to enable libusb 0.1.x support.])
])
fi
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_STAT
AC_CHECK_FUNCS([memset strcasecmp strchr strdup strrchr])
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LIBS)
AC_SUBST(LIBUSB10_CFLAGS)
AC_SUBST(LIBUSB10_LIBS)
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([stdint.h termios.h linux/parport.h linux/ppdev.h linux/serial.h] linux/ticable.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_C_CONST
AC_HEADER_TIME
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_CHECK_FUNCS([cfmakeraw])
# Logging
AC_ARG_ENABLE(logging,
AC_HELP_STRING([--enable-logging], [enable logging]),
[cab_cv_enable_logging=$enableval], [])
AC_CACHE_CHECK([whether to enable logging],
[cab_cv_enable_logging], [cab_cv_enable_logging=no])
if test x$cab_cv_enable_logging = xyes; then
AC_DEFINE(ENABLE_LOGGING, 1, [Define to 1 to enable logging.])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNCS([bzero memmove memset strcasecmp strdup])
# Platform specific tests.
dnl AC_CANONICAL_HOST
case "$host" in
*-*-mingw*) ARCH="-D__WIN32__ -D__MINGW32__" ;;
*-*-cygwin) ARCH="-D__WIN32__ -D__CYGWIN__ -mno-cygwin" ;;
*-*-*bsd*) ARCH="-D__BSD__" ;;
*) ARCH="-D__LINUX__" ;;
esac
CFLAGS="$CFLAGS $ARCH"
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
case $host_os in
*mingw*|*cygwin*)
if test x$GCC = xyes; then
msnative_struct=''
AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
if test -z "$ac_cv_prog_CC"; then
our_gcc="$CC"
else
our_gcc="$ac_cv_prog_CC"
fi
case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
2.)
if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
msnative_struct='-fnative-struct'
fi
;;
*)
if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
msnative_struct='-mms-bitfields'
fi
;;
esac
if test x"$msnative_struct" = x ; then
AC_MSG_RESULT([no way])
AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
else
CFLAGS="$CFLAGS $msnative_struct"
AC_MSG_RESULT([${msnative_struct}])
fi
fi
;;
esac
AM_CONDITIONAL(OS_WIN32, test "$msnative_struct")
# Check for the new -fvisibility=hidden flag introduced in gcc 4.0
# Allow to reduce shared library size and avoid symbol clash
case $host_os in
*mingw*)
;;
*)
if test x$GCC = xyes; then
visibility_flag=''
AC_MSG_CHECKING([whether gcc accepts -fvisibility])
if test -z "$ac_cv_prog_CC"; then
our_gcc="$CC"
else
our_gcc="$ac_cv_prog_CC"
fi
if $our_gcc -v --help 2>/dev/null | grep "fvisibility" >/dev/null; then
visibility_flag='-fvisibility=hidden'
fi
if test x"$visibility_flag" = x ; then
AC_MSG_RESULT([no])
else
CFLAGS="$CFLAGS $visibility_flag"
AC_MSG_RESULT([${visibility_flag}])
AC_DEFINE(HAVE_FVISIBILITY, 1, [Use -fvisibility=hidden flag])
fi
fi
;;
esac
case "$host" in
*-*-linux*) EXFL="-Wl,--export-dynamic" ;;
*-*-mingw*) EXFL="-lcomdlg32" ;;
*) EXFL="" ;;
esac
LDFLAGS="$LDFLAGS $EXFL"
# On Darwin, libglade chokes on stripped executables.
case "$host" in
*-apple-darwin*)
case "$CFLAGS $CXXFLAGS $LDFLAGS" in
*" -s "*|"-s "*|*" -s"|"-s")
echo "warning: cannot strip libglade executables on this host"
CFLAGS=`echo "$CFLAGS"|sed 's/\( -s\)* / /g;s/^-s //g;s/ -s$//g;s/^-s$//g'`
CXXFLAGS=`echo "$CXXFLAGS"|sed 's/\( -s\)* / /g;s/^-s //g;s/ -s$//g;s/^-s$//g'`
LDFLAGS=`echo "$LDFLAGS"|sed 's/\( -s\)* / /g;s/^-s //g;s/ -s$//g;s/^-s$//g'`
;;
esac
;;
esac
# some extra flags
CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED"
CXXFLAGS="$CFLAGS -fno-rtti -fno-exceptions"
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(CXXFLAGS)
# Output.
AC_OUTPUT([
po/Makefile.in
])
echo "Now, you can type 'make' and 'make install'."