1## -*- mode: Autoconf -*-
2##
3## Copyright (c) 2008, 2010, 2011, 2017 The University of Utah
4## All rights reserved.
5##
6## This file is part of `csmith', a random generator of C programs.
7##
8## Redistribution and use in source and binary forms, with or without
9## modification, are permitted provided that the following conditions are met:
10##
11##   * Redistributions of source code must retain the above copyright notice,
12##     this list of conditions and the following disclaimer.
13##
14##   * Redistributions in binary form must reproduce the above copyright
15##     notice, this list of conditions and the following disclaimer in the
16##     documentation and/or other materials provided with the distribution.
17##
18## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21## ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28## POSSIBILITY OF SUCH DAMAGE.
29
30###############################################################################
31
32m4_include([version.m4])
33AC_INIT(csmith, CSMITH_VERSION, CSMITH_BUGREPORT, csmith, CSMITH_URL)
34
35AC_CONFIG_SRCDIR(src/RandomProgramGenerator.cpp)
36AC_CONFIG_AUX_DIR(autoconf)
37AC_CONFIG_MACRO_DIR(m4)
38AC_CONFIG_HEADERS(config.h)
39
40AC_CANONICAL_HOST
41
42# `-Wno-portability': avoid warnings about using `:=' in `Makefile.am' files.
43AM_INIT_AUTOMAKE([-Wall -Wno-portability])
44
45AM_MAINTAINER_MODE
46
47# Avoid configure-time warnings about `--datarootdir' being ignored.
48# This can perhaps be removed in a few years after Autoconf 2.60.
49# See <http://www.gnu.org/software/libtool/manual/autoconf/Changed-Directory-Variables.html>
50#
51AC_DEFUN([AC_DATAROOTDIR_CHECKED])
52
53dnl AC_PROG_CC # Automake 1.11 want us to use AM_PROG_CC_C_O instead...
54AM_PROG_CC_C_O
55AC_PROG_CXX
56AC_PROG_RANLIB
57AC_PROG_LIBTOOL
58
59# `arc4random' and friends are available on BSD in the standard C library, and
60# on Linux in `libbsd'.  We use `arc4random_buf' if it is available, but we do
61# not require it.
62#
63AC_SEARCH_LIBS([arc4random_buf], [bsd])
64AC_CHECK_HEADERS([bsd/stdlib.h])
65AC_CHECK_FUNCS([arc4random_buf])
66
67# Csmith uses `lrand48', and we provide an implementation for platforms that
68# do not have it (in particular, Windows).
69#
70have_lrand48="no"
71AC_CHECK_FUNCS([lrand48], [have_lrand48="yes"], [have_lrand48="no"])
72AM_CONDITIONAL([HAVE_LRAND48], [test "$have_lrand48" = "yes"])
73
74# OpenBSD requires a special call to activate the standard, deterministic
75# behavior of `lrand48'.
76#
77AC_CHECK_FUNCS([srand48_deterministic])
78
79# If we're using g++, set the default `CXXFLAGS' to something more pedantic.
80#
81if test "$ac_test_CXXFLAGS" = set; then
82  # The user specified `CXXFLAGS', so do nothing.
83  CXXFLAGS="$CXXFLAGS"
84elif test "$GXX" = yes; then
85  CXXFLAGS="-g -O3 -Wall -Wextra -Wno-long-long"
86fi
87
88# Some runtime headers are generated by `m4'.
89AC_CHECK_PROGS([M4], [m4 gm4], [m4])
90
91AC_OUTPUT(
92  Makefile
93  doc/Makefile
94  runtime/Makefile
95  scripts/Makefile
96  src/Makefile
97)
98
99###############################################################################
100
101## End of file.
102