Skip to content

Commit

Permalink
On Windows, add lrand48 sources to Csmith (Automake) compile.
Browse files Browse the repository at this point in the history
When using the Automake-based build system to compile Csmith on Windows,
compile and link with an implementation of `lrand48`.

This commit is the Automake equivalent of the CMake changes that I made
earlier (in commit ef1f45a).

Having implemented this for the Automake- and CMake-based build systems,
I'm thinking that I should change the test.  We don't care about the
platform per se; we care whether or not it has `lrand48`.  We should
probably just check for that directly.
  • Loading branch information
eeide committed May 23, 2017
1 parent 4a07b8f commit 510bdfc
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 260 deletions.
5 changes: 0 additions & 5 deletions Makefile.in
Expand Up @@ -89,7 +89,6 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
Expand Down Expand Up @@ -333,11 +332,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
Expand Down
67 changes: 23 additions & 44 deletions configure
Expand Up @@ -637,6 +637,8 @@ am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
M4
WINDOWS_FALSE
WINDOWS_TRUE
CXXCPP
CPP
LT_SYS_LIBRARY_PATH
Expand Down Expand Up @@ -714,10 +716,6 @@ am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
target_os
target_vendor
target_cpu
target
host_os
host_vendor
host_cpu
Expand Down Expand Up @@ -1398,7 +1396,6 @@ Program names:
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
_ACEOF
fi

Expand Down Expand Up @@ -2374,45 +2371,6 @@ IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
$as_echo_n "checking target system type... " >&6; }
if ${ac_cv_target+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$target_alias" = x; then
ac_cv_target=$ac_cv_host
else
ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
$as_echo "$ac_cv_target" >&6; }
case $ac_cv_target in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
esac
target=$ac_cv_target
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_target
shift
target_cpu=$1
target_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
target_os=$*
IFS=$ac_save_IFS
case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac


# The aliases save the names the user supplied, while $host etc.
# will get canonicalized.
test -n "$target_alias" &&
test "$program_prefix$program_suffix$program_transform_name" = \
NONENONEs,x,x, &&
program_prefix=${target_alias}-

# `-Wno-portability': avoid warnings about using `:=' in `Makefile.am' files.
am__api_version='1.15'
Expand Down Expand Up @@ -15856,6 +15814,23 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu



# Determine if we are compiling for Windows.
#
test_windows=no
case "${host_os}" in
cygwin*|mingw*|windows*)
test_windows=yes
;;
esac
if test "$test_windows" = "yes"; then
WINDOWS_TRUE=
WINDOWS_FALSE='#'
else
WINDOWS_TRUE='#'
WINDOWS_FALSE=
fi


# If we're using g++, set the default `CXXFLAGS' to something more pedantic.
#
if test "$ac_test_CXXFLAGS" = set; then
Expand Down Expand Up @@ -16053,6 +16028,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WINDOWS_TRUE}" && test -z "${WINDOWS_FALSE}"; then
as_fn_error $? "conditional \"WINDOWS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi

: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
Expand Down
12 changes: 11 additions & 1 deletion configure.ac
Expand Up @@ -37,7 +37,7 @@ AC_CONFIG_AUX_DIR(autoconf)
AC_CONFIG_MACRO_DIR(m4)
AC_CONFIG_HEADERS(config.h)

AC_CANONICAL_TARGET
AC_CANONICAL_HOST

# `-Wno-portability': avoid warnings about using `:=' in `Makefile.am' files.
AM_INIT_AUTOMAKE([-Wall -Wno-portability])
Expand All @@ -56,6 +56,16 @@ AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_LIBTOOL

# Determine if we are compiling for Windows.
#
test_windows=no
case "${host_os}" in
cygwin*|mingw*|windows*)
test_windows=yes
;;
esac
AM_CONDITIONAL([WINDOWS], [test "$test_windows" = "yes"])

# If we're using g++, set the default `CXXFLAGS' to something more pedantic.
#
if test "$ac_test_CXXFLAGS" = set; then
Expand Down
5 changes: 0 additions & 5 deletions doc/Makefile.in
Expand Up @@ -90,7 +90,6 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
Expand Down Expand Up @@ -274,11 +273,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
Expand Down
5 changes: 0 additions & 5 deletions runtime/Makefile.in
Expand Up @@ -92,7 +92,6 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = runtime
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
Expand Down Expand Up @@ -339,11 +338,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
Expand Down
5 changes: 0 additions & 5 deletions scripts/Makefile.in
Expand Up @@ -90,7 +90,6 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = scripts
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
Expand Down Expand Up @@ -274,11 +273,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
Expand Down
12 changes: 12 additions & 0 deletions src/Makefile.am
Expand Up @@ -29,6 +29,9 @@

###############################################################################

# For source files in `windows/'.
AUTOMAKE_OPTIONS = subdir-objects

bin_PROGRAMS = csmith

GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error)
Expand Down Expand Up @@ -212,6 +215,15 @@ csmith_SOURCES = \
nodist_csmith_SOURCES = \
git_version.cpp

# Windows lacks `lrand48', so we provide an implementation.
if WINDOWS
csmith_SOURCES += \
windows/_rand48.c \
windows/lrand48.c \
windows/rand48.h \
windows/srand48.c
endif

EXTRA_DIST = \
CMakeLists.txt \
csmith.vcproj \
Expand Down

0 comments on commit 510bdfc

Please sign in to comment.