File: configure.in

package info (click to toggle)
ggcov 0.9-14
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 4,400 kB
  • ctags: 4,055
  • sloc: cpp: 17,077; sh: 12,380; ansic: 7,743; php: 1,644; perl: 1,509; makefile: 259; yacc: 23
file content (464 lines) | stat: -rw-r--r-- 13,161 bytes parent folder | download | duplicates (3)
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
dnl Process this file with autoconf to produce a configure script.
dnl You may need the --localdir option to get the included .m4's
dnl
dnl ggcov - A GTK frontend for exploring gcov coverage data
dnl Copyright (c) 2001-2005 Greg Banks <gnb@users.sourceforge.net>
dnl 
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl 
dnl This program 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
dnl GNU General Public License for more details.
dnl 
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
dnl 
dnl $Id: configure.in,v 1.79 2010-05-09 05:55:03 gnb Exp $
dnl

AC_INIT(src/ggcov.c)
AM_INIT_AUTOMAKE(ggcov, 0.9)
AM_CONFIG_HEADER(config.h)

AM_MAINTAINER_MODE
RPM_SPEC_CONFIGURE_ARGS=

dnl Enabling debugging code
dnl This is mostly straight out of the automake manual.
AC_MSG_CHECKING(whether to enable debugging code)
AC_ARG_ENABLE(debug,
[  --enable-debug          Turn on debugging code],[
case "${enableval}" in
yes|no)
    debug=${enableval}
    ;;
*)
    AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
    ;;
esac
],[debug=no])
AC_MSG_RESULT($debug)
AM_CONDITIONAL(DEBUG, test x$debug = xyes)

dnl Disable the GUI (useful for testing on headless platforms)
AC_MSG_CHECKING(whether to enable the GUI)
AC_ARG_ENABLE(gui,
[  --disable-gui           Do not build the GUI],[
case "${enableval}" in
yes|no)
    gui=${enableval}
    ;;
*)
    AC_MSG_ERROR(bad value ${enableval} for --enable-gui)
    ;;
esac
],[gui=yes])
AC_MSG_RESULT($gui)
AM_CONDITIONAL(GUI, test x$gui = xyes)
if test x$gui = xyes ; then
    GUIPROG=ggcov
else
    GUIPROG=
    RPM_SPEC_CONFIGURE_ARGS="$RPM_SPEC_CONFIGURE_ARGS --disable-gui"
fi
AC_SUBST(GUIPROG)

dnl Try to find the Berkeley DB in any of the odd places it might be hiding
DB_LIB_db42="db-4.2"
DB_CPPFLAGS_db42="-I/usr/include/db42"
DB_LDFLAGS_db42=""

DB_LIB_db41="db-4.1"
DB_CPPFLAGS_db41="-I/usr/include/db41"
DB_LDFLAGS_db41=""

DB_LIB_plain="db"
DB_CPPFLAGS_plain=""
DB_LDFLAGS_plain=""

DB_FLAVORS="db42 db41 plain"

found=no
web=yes
for flavor in $DB_FLAVORS ; do
    AC_MSG_NOTICE(Looking for Berkeley DB flavor $flavor)
    eval "lib=\$DB_LIB_$flavor"
    eval "ldflags=\$DB_LDFLAGS_$flavor"
    eval "cppflags=\$DB_CPPFLAGS_$flavor"

    oldCPPFLAGS="$CPPFLAGS"
    oldLIBS="$LIBS"
    CPPFLAGS="$cppflags $CPPFLAGS"
    found=yes
    AC_CHECK_HEADER(db.h,[],[found=no])
    AC_CHECK_LIB($lib,db_create,[],[found=no],$ldflags)
    CPPFLAGS="$oldCPPFLAGS"
    LIBS="$oldLIBS"
    test $found = yes && break
done
if test $found = yes ; then
    DB_CPPFLAGS="$cppflags"
    DB_LIBS="-l$lib $ldflags"
    AC_SUBST(DB_CPPFLAGS)
    AC_SUBST(DB_LIBS)
else
    AC_MSG_NOTICE(Cannot find db.h, disabling web interface)
    web=no
fi

dnl Disable the web interface (useful if you haven't got Berkeley DB)
AC_MSG_CHECKING(whether to enable the WWW interface)
AC_ARG_ENABLE(web,
[  --disable-web           Do not build the WWW interface],[
case "${enableval}" in
no) web=no ;;
yes) ;;
*)
    AC_MSG_ERROR(bad value ${enableval} for --enable-web)
    ;;
esac
])
AC_MSG_RESULT($web)
AM_CONDITIONAL(WEB, test x$web = xyes)
if test x$web = xyes ; then
    WEBPROG=ggcov-webdb
else
    WEBPROG=
    RPM_SPEC_CONFIGURE_ARGS="$RPM_SPEC_CONFIGURE_ARGS --disable-web"
fi
AC_SUBST(WEBPROG)


dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_AWK
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_ENABLE_SHARED
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_RANLIB

if test x$debug = xyes ; then
##   CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED=1 -DGLIB_DISABLE_DEPRECATED=1"
    echo "debug mode on"
fi

dnl Stuff for gettext
dnl ALL_LINGUAS="la"
dnl AM_GNU_GETTEXT

dnl Check for va_copy, it might not exist or might be broken
dnl in some compilation environments.
AC_MSG_CHECKING([whether va_copy works])
AC_TRY_RUN([
#include <stdarg.h>
#include <string.h>
static int baz(va_list args)
{
	int x = 0;
	x |= strcmp(va_arg(args, const char *), "hello");
	x |= strcmp(va_arg(args, const char *), "world");
	return x;
}
static int bar(va_list args)
{
	int x = 0;
	va_list args2;
	va_copy(args2, args);
	x |= baz(args);
	x |= baz(args2);
	return x;
}
static int foo(int a, ...)
{
	int x;
	va_list args;
	va_start(args, a);
	x = bar(args);
	va_end(args);
	return x;
}
int main(int argc, char **argv)
{
	return foo(42, "hello", "world");
}
],[
    AC_DEFINE(HAVE_VA_COPY,1,[Whether the va_copy builtin works])
    AC_MSG_RESULT(yes)
],[
    AC_MSG_RESULT(no)
])


dnl Checks for libraries.
BFD_LIBS=
AC_ARG_WITH(bfd,
[  --without-bfd           Don't use BFD library (callgraphs will not work)],
[],[with_bfd=yes])
if test $with_bfd = yes ; then

dnl Try to link the bfd library (and it's buddy, -liberty) statically,
dnl falling back to dynamic linking if that fails.
dnl
dnl Why would we care?  Ubuntu, for reasons that doubtless make sense
dnl to them, include the binutils version number in the libbfd DSO name.
dnl Thus when we link ggcov against -lbfd, the name which is recorded
dnl in the ggcov executable is something like "libbfd-2.19.1.so".  When
dnl a user upgrades to a new version of binutils, the old DSO goes away
dnl and a new one appears, for example /usr/lib/libbfd-2.19.2.so.  Then
dnl the next time ggcov is run, it fails to start because the runtime
dnl linker cannot find the old DSO.  Note that this breaks ggcov every
dnl bump of binutils, not just when the libbfd ABI is incompatibly
dnl changed.  Compounding the problem, Ubuntu's packaging system detects
dnl and records a dependency on binutils but not the specific version,
dnl so there's not even a warning when the user upgrades binutils with
dnl ggcov installed.  Linking the bfd library statically should avoid
dnl all this unnecessary drama. -gnb 20110327

AC_MSG_CHECKING([for GNU bfd library, static])
have_libbfd=no
bfd_save_LIBS="$LIBS"
for dir in `$CC -print-search-dirs | sed -n -e 's|:| |g' -e 's|^libraries.*=||p'` ; do
    BFD_LIBS="$dir/libbfd.a $dir/libiberty.a"
    LIBS="$LIBS $BFD_LIBS"
    AC_LINK_IFELSE([AC_LANG_CALL([], [bfd_init])], [ have_libbfd=yes ])
    LIBS="$bfd_save_LIBS"
    test $have_libbfd = yes && break
done
AC_MSG_RESULT($have_libbfd)

if test $have_libbfd = no ; then
    AC_MSG_CHECKING([for GNU bfd library, any])
    bfd_save_LIBS="$LIBS"
    BFD_LIBS="-lbfd -liberty"
    LIBS="$LIBS $BFD_LIBS"
    AC_LINK_IFELSE([AC_LANG_CALL([], [bfd_init])], [ have_libbfd=yes ])
    LIBS="$bfd_save_LIBS"
    AC_MSG_RESULT($have_libbfd)
fi

if test $have_libbfd = yes ; then
    AC_DEFINE(HAVE_LIBBFD,1,[the GNU bfd library is available])
else
    BFD_LIBS=
fi

dnl Sometime before binutils 2.15.92.0.2, the field _raw_size
dnl in the asection struct was renamed to rawsize.
AC_MSG_CHECKING([name of raw size field in struct bfd_section])
AC_TRY_COMPILE([
#include <bfd.h>
],[
    return (int)(&((asection *)0)->rawsize);
],[
    AC_DEFINE(HAVE_BFD_ASECTION_RAWSIZE,1,[Whether the raw size field in struct bfd_section is called rawsize])
    AC_MSG_RESULT(rawsize)
],[
    AC_MSG_RESULT(_raw_size)
])
fi
AC_SUBST(BFD_LIBS)

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(malloc.h sys/ioctl.h sys/time.h unistd.h memory.h)
AC_CHECK_HEADERS(signal.h sys/filio.h stdint.h elf.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T


dnl A bunch of warning options for gcc
dnl -Wshadow
dnl TODO: -Weffc++
AC_GCC_ADD_CFLAGS([-Wall -Wchar-subscripts 
    	    	   -Wsign-compare
		   -pedantic -Wno-long-long])

AC_GCC_ADD_CFLAGS([-fno-rtti -fno-exceptions -fno-implement-inlines])


dnl Use the latest version of gtk which actually is complete and works.
dnl Should result in: gtk 1.2 on RedHat 7.3, gtk 2 on RedHat 8 & greater.

ifdef([PKG_PROG_PKG_CONFIG],[
PKG_PROG_PKG_CONFIG
])

# try gtk 2.0
have_gconf=no
libpopt=
if test x$gui = xyes ; then
    # gui enabled
    PKG_CHECK_MODULES(GGCOV_GUI, libglade-2.0 >= 2.0.0 libgnomeui-2.0 >= 2.0.0,
    	    	      [gtk2=yes],[gtk2=no])
    if test $gtk2 = yes ; then
	PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.4.0,have_gconf=yes)
	PKG_CHECK_MODULES(GGCOV_CLI, glib-2.0 >= 2.0.0 libxml-2.0 >= 2.0.0)

	dnl we don't need --export-dynamic anymore, remove it
	dnl so the executable will be smaller
	GGCOV_GUI_LIBS=`echo "$GGCOV_GUI_LIBS" | sed -e 's/-Wl,--export-dynamic//g'`
	GCONF_LIBS=`echo "$GCONF_LIBS" | sed -e 's/-Wl,--export-dynamic//g'`

	AC_CHECK_LIB(gtk-x11-2.0, gtk_text_buffer_select_range,
		  AC_DEFINE(HAVE_GTK_TEXT_BUFFER_SELECT_RANGE,1,[
     * The function gtk_text_buffer_select_range may or may
     * not be present in the gtk2 libraries...we have to work
     * around it if not.
    ]),,
		  [$GGCOV_GUI_LIBS])
	GGCOV_GLADE_FILE=ggcov-glade2.glade
	# gnome2 doesn't need popt, so it may or may not be present
	AC_CHECK_LIB(popt,poptGetContext,
		     [ libpopt=" -lpopt" ],,
		     $GGCOV_GUI_CFLAGS $GGCOV_GUI_LIBS)
	GGCOV_GUI_LIBS="$GGCOV_GUI_LIBS$libpopt"

    	gprog=no
	AC_CHECK_LIB(gnome,gnome_program_init,[gprog=yes],,[$GGCOV_GUI_LIBS])
	if test $gprog = no ; then
	    AC_CHECK_LIB(gnome-2,gnome_program_init,[gprog=yes],,[$GGCOV_GUI_LIBS])
	fi
	if test $gprog = yes ; then
	      AC_DEFINE(HAVE_GNOME_PROGRAM_INIT,1,[
    Whether to use the GnomeProgram feature to initialise GNOME.
    ])
	fi
    else
ifdef([AM_PATH_LIBGLADE],[
	# fall back to gtk 1.2
	AC_MSG_WARN([GNOME version 2 libraries not found, falling back to 1.2])
	AM_PATH_LIBGLADE(,AC_MSG_ERROR(ggcov requires the libglade library),gnome)
	AM_PATH_IMLIB(,,AC_MSG_ERROR(ggcov requires the libgdk_imlib library))
	AM_PATH_GLIB(,,AC_MSG_ERROR(ggcov requires the glib library))
	GGCOV_GUI_CFLAGS="$LIBGLADE_CFLAGS $IMLIB_CFLAGS"
	GGCOV_GUI_LIBS="$LIBGLADE_LIBS $IMLIB_LIBS"
	GGCOV_CLI_CFLAGS="$GLIB_CFLAGS"
	GGCOV_CLI_LIBS="$GLIB_LIBS"
	GGCOV_GLADE_FILE=ggcov.glade
	# gnome1.2 requires popt so we can assume it's present
	libpopt=" -lpopt"
	GGCOV_GUI_LIBS="$GGCOV_GUI_LIBS$libpopt"
],[
    	AC_MSG_ERROR([ggcov requires the GNOME libraries, unless configured with --disable-gui])
])
    fi
    AC_SUBST(GGCOV_GUI_CFLAGS)
    AC_SUBST(GGCOV_GUI_LIBS)
    AC_SUBST(GGCOV_GLADE_FILE)
else
    # gui disabled
    PKG_CHECK_MODULES(GGCOV_CLI, glib-2.0 >= 2.0.0 libxml-2.0 >= 2.0.0, [glib2=yes],[glib2=no])
    if test $glib2 = no ; then
ifdef([AM_PATH_LIBGLADE],[
	# fall back to glib 1.2
	AC_MSG_WARN([glib version 2 library not found, falling back to 1.2])
	AM_PATH_GLIB(,,AC_MSG_ERROR(ggcov requires the glib library))
	GGCOV_CLI_CFLAGS="$GLIB_CFLAGS"
	GGCOV_CLI_LIBS="$GLIB_LIBS"
],[
    	AC_MSG_ERROR([ggcov requires the glib library])
])
    fi
    # we're headless, so we have no idea whether libpopt is present
    AC_CHECK_LIB(popt,poptGetContext,
		 [ libpopt=" -lpopt" ],,
		 $GGCOV_CLI_CFLAGS $GGCOV_CLI_LIBS)
fi
GGCOV_CLI_LIBS="$GGCOV_CLI_LIBS$libpopt"
AC_SUBST(GGCOV_CLI_CFLAGS)
AC_SUBST(GGCOV_CLI_LIBS)

if test $have_gconf = yes ; then
    GCONF=
    AC_DEFINE(HAVE_LIBGCONF,1,[
    	Whether the GConf library for storing application preferences is available.])
else
    GCONF="#"
fi
AM_CONDITIONAL(GCONF, test $have_gconf = yes)
AC_SUBST(GCONF)

AC_CHECK_LIB(glib-2.0, g_hash_table_iter_init,
	     AC_DEFINE(HAVE_G_HASH_TABLE_ITER,1,[
 * An iterator for GHashTables may or may not be present
 * in the glib library...we have to work around it if not.
]),,
	      [$GGCOV_CLI_LIBS])
    
if test "x$libpopt" != x ; then
    AC_DEFINE(HAVE_LIBPOPT,,[Define to 1 if the popt library is present])
fi

dnl Compile C and C++ with the same (C++) compiler.
CXXFLAGS="$CFLAGS"
CC="$CXX"

AC_CANONICAL_HOST

AC_MSG_CHECKING(for cpu-specific defines)
CPU_DEFINES=
case "$host_cpu" in
i?86|i86pc) CPU_DEFINES=-DCOV_I386 ;;
x86_64) CPU_DEFINES="-DCOV_AMD64 -DCOV_I386" ;;
esac
AC_MSG_RESULT($CPU_DEFINES)
AC_SUBST(CPU_DEFINES)

AC_MSG_CHECKING(for OS-specific defines)
OS_DEFINES=
is_linux=no
is_redhat=no
case "$host_os" in
solaris*) OS_DEFINES=-DELF_TARGET_ALL ;;
linux*) is_linux=yes ;;
esac
AC_MSG_RESULT($OS_DEFINES)
AC_SUBST(OS_DEFINES)

if test x$is_linux = xyes ; then
    AC_MSG_CHECKING(for Linux distro-specific defines)
    dnl Are we on RedHat or similar, e.g. CentOS?
    if test -f /etc/redhat-release ; then
	is_redhat=yes
    fi
fi
AM_CONDITIONAL(REDHAT, test x$is_redhat = xyes)

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_FUNC_WAIT3
AC_CHECK_FUNCS(putenv regcomp strchr)
AC_CHECK_FUNCS(sincos)

AC_SUBST(RPM_SPEC_CONFIGURE_ARGS)

dnl AC_SUBST(ALL_LINGUAS)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_OUTPUT([
    Makefile
    src/Makefile
    src/libiberty/Makefile
    src/libggcov/Makefile
    scripts/Makefile
    ui/Makefile
    doc/Makefile
    php/Makefile
    php/lib/Makefile
    php/basic/Makefile
    ggcov.spec
    version.m4
    test/Makefile
])
dnl intl/Makefile po/Makefile.in