1AC_INIT([ppcg], [0.07], [isl-development@googlegroups.com])
2AC_CONFIG_AUX_DIR([.])
3AC_CONFIG_MACRO_DIR([m4])
4AM_INIT_AUTOMAKE([foreign])
5m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
6
7AC_PROG_CC
8AC_PROG_LIBTOOL
9PKG_PROG_PKG_CONFIG
10
11AX_CHECK_OPENMP
12AX_CHECK_OPENCL
13if test $HAVE_OPENCL = yes; then
14	extra_tests="$extra_tests opencl_test.sh"
15fi
16
17AX_SUBMODULE(isl,build|bundled|system,bundled)
18AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
19
20AC_SUBST(ISL_CFLAGS)
21AC_SUBST(ISL_LIBS)
22case "$with_isl" in
23bundled)
24	ISL_CFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
25	ISL_CFLAGS="$ISL_CFLAGS"
26	ppcg_configure_args="$ppcg_configure_args --with-isl-builddir=../isl"
27	ppcg_configure_args="$ppcg_configure_args --with-isl=build"
28	ppcg_configure_args="$ppcg_configure_args --with-clang=system"
29	;;
30build)
31	ISL_BUILDDIR=`echo @abs_builddir@ | $with_isl_builddir/config.status --file=-`
32	ppcg_configure_args="$ppcg_configure_args --with-isl-builddir=$ISL_BUILDDIR"
33	ISL_CFLAGS="-I$isl_srcdir/include -I$ISL_BUILDDIR/include"
34	ISL_CFLAGS="$ISL_CFLAGS"
35	ISL_LIBS="$with_isl_builddir/libisl.la"
36	;;
37system)
38	PKG_CHECK_MODULES([ISL], [isl])
39esac
40
41AX_SUBMODULE(pet,bundled|system,bundled)
42AM_CONDITIONAL(BUNDLED_PET, test $with_pet = bundled)
43
44AC_SUBST(PET_CFLAGS)
45AC_SUBST(PET_LIBS)
46case "$with_pet" in
47bundled)
48	PET_CFLAGS="$PET_CFLAGS -I\$(top_srcdir)/pet/include"
49	;;
50system)
51	PKG_CHECK_MODULES([PET], [pet])
52	;;
53esac
54
55AC_SUBST(POLYBENCH_DIR)
56AC_SUBST(extra_tests)
57AC_ARG_WITH([polybench],
58	[AS_HELP_STRING([--with-polybench=DIR], [PolyBench location])],
59	[
60	if test -f "$with_polybench/utilities/benchmark_list"; then
61		POLYBENCH_DIR=$with_polybench
62		extra_tests="$extra_tests polybench_test.sh"
63	fi
64	])
65
66AX_DETECT_GIT_HEAD
67echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
68
69AC_CONFIG_FILES(Makefile)
70AC_CONFIG_FILES([polybench_test.sh], [chmod +x polybench_test.sh])
71AC_CONFIG_FILES([opencl_test.sh], [chmod +x opencl_test.sh])
72if test $with_isl = bundled; then
73	AC_CONFIG_SUBDIRS(isl)
74fi
75if test $with_pet = bundled; then
76	AC_CONFIG_SUBDIRS(pet)
77fi
78AC_CONFIG_COMMANDS_POST([
79	dnl pass on arguments to subdir configures, but don't
80	dnl add them to config.status
81	ac_configure_args="$ac_configure_args $ppcg_configure_args"
82])
83AC_OUTPUT
84