1## To make it useful, replace <<TEXT>> with actual text for your project.
2## Also, look at comments with "## double hashes" to see if any are worth
3## uncommenting or modifying.
4
5## Process this file with autoconf to produce configure.
6## In general, the safest way to proceed is to run ./autogen.sh
7
8# make sure we're interpreted by some minimal autoconf
9AC_PREREQ(2.57)
10
11AC_INIT(cmockery2, 1.3.8, lpabon@redhat.com)
12AC_CONFIG_AUX_DIR([.])
13
14# The argument here is just something that should be in the current directory
15# (for sanity checking)
16AC_CONFIG_SRCDIR(README.md)
17AM_INIT_AUTOMAKE
18AC_GNU_SOURCE
19m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
20AC_CONFIG_HEADERS(src/cmockery/config.h)
21
22# Checks for programs.
23AC_PROG_CC
24AC_PROG_CPP
25AC_PROG_CXX
26
27# Check if CC is linked to CLANG
28AC_MSG_CHECKING([if compiling with clang])
29AC_COMPILE_IFELSE(
30[AC_LANG_PROGRAM([], [[
31#ifndef __clang__
32       not clang
33#endif
34]])],
35[CLANG=yes], [CLANG=no])
36AC_MSG_RESULT([$CLANG])
37AM_CONDITIONAL(CLANG, test "$CLANG" = yes)
38
39AM_CONDITIONAL(GCC, test "$GCC" = yes)   # let the Makefile know if we're gcc
40
41OLD_CFLAGS=$CFLAGS
42CFLAGS=
43
44# Enable gcov suport.
45AC_ARG_ENABLE([gcov],
46AC_HELP_STRING([--enable-gcov],
47[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
48if test "x$use_gcov" = xyes; then
49  if test "x$CLANG" = xyes; then
50    CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
51  else
52    CFLAGS="$CFLAGS --coverage"
53  fi
54fi
55AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
56
57if test "x$use_gcov" = xyes; then
58  CFLAGS="$CFLAGS -O0 -g -Wall"
59else
60  CFLAGS="$CFLAGS $OLD_CFLAGS"
61fi
62
63# Uncomment this if you'll be exporting libraries (.so's)
64# Use AC_PROG_LIBTOOL instead of LT_INIT because
65# we need it to support EL5
66AC_PROG_LIBTOOL
67AC_SUBST(LIBTOOL_DEPS)
68
69# Check whether some low-level functions/files are available
70AC_HEADER_STDC
71
72# For older versions of automake
73AM_PROG_CC_C_O
74
75# Here are some examples of how to check for the existence of a fn or file
76##AC_CHECK_FUNCS(memmove)
77##AC_CHECK_HEADERS(sys/resource.h)
78AC_CHECK_FUNCS(setjmp)
79AC_CHECK_FUNCS(longjmp)
80AC_CHECK_FUNCS(strcmp)
81AC_CHECK_FUNCS(strcpy)
82AC_CHECK_FUNCS(memcpy)
83AC_CHECK_FUNCS(memset)
84AC_CHECK_FUNCS(malloc)
85AC_CHECK_FUNCS(calloc)
86AC_CHECK_FUNCS(free)
87AC_CHECK_FUNCS(exit)
88AC_CHECK_FUNCS(signal)
89AC_CHECK_FUNCS(printf)
90AC_CHECK_FUNCS(fprintf)
91AC_CHECK_FUNCS(snprintf)
92AC_CHECK_FUNCS(vsnprintf)
93AC_CHECK_FUNCS(gettimeofday)
94AC_CHECK_FUNCS(strsignal)
95AC_CHECK_HEADERS(assert.h)
96AC_CHECK_HEADERS(malloc.h)
97AC_CHECK_HEADERS(setjmp.h)
98AC_CHECK_HEADERS(stdarg.h)
99AC_CHECK_HEADERS(stddef.h)
100AC_CHECK_HEADERS(stdio.h)
101AC_CHECK_HEADERS(stdlib.h)
102AC_CHECK_HEADERS(string.h)
103AC_CHECK_HEADERS(signal.h)
104AC_CHECK_HEADERS(inttypes.h)
105AC_CHECK_HEADERS(stdint.h)
106AC_CHECK_HEADERS(sys/time.h)
107AC_CHECK_TYPES([unsigned long long, uintmax_t, uintptr_t])
108
109# If pkg-config
110AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes)
111AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"])
112AS_IF([test "x$PKG_CONFIG" != "x"], [
113    AC_CONFIG_FILES([cmockery2.pc])
114])
115
116## Check out ../autoconf/ for other macros you can call to do useful stuff
117
118# Write generated configuration file
119AC_CONFIG_FILES([Makefile])
120AC_OUTPUT
121