source: configure.ac @ c59712e

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since c59712e was c59712e, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Parent make now seems to properly call libcfa

  • Property mode set to 100644
File size: 8.4 KB
Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
5AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
6AC_CONFIG_AUX_DIR([automake])
7#AC_CONFIG_SRCDIR([src/main.cc])
8AC_CONFIG_HEADERS([config.h:src/config.h.in])
9AM_SILENT_RULES([no])
10
11AM_INIT_AUTOMAKE([subdir-objects])
12
13# Allow program name tansformation
14# will fill program_transform_name with appropriate sed regex
15AC_ARG_PROGRAM
16
17#==============================================================================
18#Trasforming cc1 will break compilation
19if test "${program_transform_name}" = ""; then
20    AC_MSG_ERROR([Program transform not supported.
21                Use --with-cfa-name='[[Desired name here]]' instead])
22fi
23
24#Define the new name of the installed command
25AC_ARG_WITH(cfa-name,
26        [  --with-cfa-name=NAME     NAME too which cfa will be installed],
27        cfa_name=$withval, cfa_name="cfa")
28
29AC_SUBST(CFA_NAME, ${cfa_name})
30
31#==============================================================================
32# handle the list of hosts to build for
33for var in $ac_configure_args
34do
35        #strip quotes surrouding values
36        var=$(echo $var | sed s/\'//g)
37        case $var in
38                # skip cross compilation related arguments
39                --host=*) ;; host_alias=*) ;; --build=*) ;; build_alias=*) ;; --target=*) ;; target_alias=*) ;;
40
41                # append all other arguments to the sub configure arguments
42                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
43        esac
44done
45
46echo $LIBCFA_GENERAL_ARGS
47
48#==============================================================================
49# handle the list of hosts to build for
50AC_CANONICAL_BUILD
51AC_CANONICAL_HOST
52
53default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
54AC_ARG_WITH(target-hosts,
55        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
56        target_hosts=$withval, target_hosts=${default_target})
57
58AC_SUBST(TARGET_HOSTS, ${target_hosts})
59
60for i in $(echo $target_hosts | sed "s/,/ /g")
61do
62        # call your procedure/other scripts here below
63        lib_arch=$(echo $i | sed -r "s/:(.*)//g")
64        lib_config=$(echo $i | sed -r "s/(.*)://g")
65        lib_dir="libcfa-${lib_arch}-${lib_config}"
66
67        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
68        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
69
70        mkdir -p libcfa-${lib_arch}-${lib_config}
71        echo -n "${LIBCFA_GENERAL_ARGS} " > libcfa-${lib_arch}-${lib_config}/config.data
72        echo -n "--host=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
73        echo -n "CONFIGURATION=${lib_config}" >> libcfa-${lib_arch}-${lib_config}/config.data
74done
75
76AC_SUBST(LIBCFA_TARGET_DIRS)
77AC_SUBST(LIBCFA_TARGET_MAKEFILES)
78
79
80#==============================================================================
81# version information
82
83rm -f version
84echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
85chmod ugo-w version
86ver_major=`cut -d '.' -f1 version`              # subdivide version number into components at periods
87ver_minor=`cut -d '.' -f2 version`
88ver_patch=`cut -d '.' -f3 version`
89ver_build=`cut -d '.' -f4 version`
90
91# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
92AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
93AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
94AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
95AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
96AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
97AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
98AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
99AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
100
101#==============================================================================
102# HACK to be able to use conditionnals inside makefiles
103DOifskipcompile='ifeq ($(skipcompile),yes)
104else'
105AC_SUBST([DOifskipcompile])
106AM_SUBST_NOTMAKE([DOifskipcompile])
107
108DOendif='endif'
109AC_SUBST([DOendif])
110AM_SUBST_NOTMAKE([DOendif])
111
112#==============================================================================
113# backend compiler implementation
114AC_ARG_WITH(backend-compiler,
115       [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
116       backendcompiler=$withval, backendcompiler="")
117if test "x$backendcompiler" != "x"; then
118       BACKEND_CC=${backendcompiler}
119else
120       AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
121       if test "x$BACKEND_CC" = "x"; then
122               AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
123               exit 1
124       fi
125fi
126AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
127AC_SUBST(CFA_BACKEND_CC)
128
129#==============================================================================
130# Installation paths
131if test "x$prefix" = "xNONE"; then
132        cfa_prefix=${ac_default_prefix}
133else
134        cfa_prefix=${prefix}
135fi
136AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
137AC_SUBST(CFA_PREFIX, ${cfa_prefix})
138
139if test "$includedir" = '${prefix}/include'; then
140        cfa_incdir="${cfa_prefix}/include/${cfa_name}"
141else
142        cfa_incdir=${includedir}
143fi
144AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
145AC_SUBST(CFA_INCDIR, ${cfa_incdir})
146
147if test "$bindir" = '${exec_prefix}/bin'; then
148        cfa_bindir="${cfa_prefix}/bin"
149else
150        cfa_bindir=${bindir}
151fi
152AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
153AC_SUBST(CFA_BINDIR, ${cfa_bindir})
154
155if test "$libdir" = '${exec_prefix}/lib'; then
156        cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
157else
158        cfa_libdir=${libdir}
159fi
160AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
161AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
162
163#==============================================================================
164# Create variables for commonly used targets
165DRIVER_DIR='$(top_builddir)/driver'
166CFACC=${DRIVER_DIR}/cfa
167CFACPP=${DRIVER_DIR}/cfa-cpp
168AC_SUBST(DRIVER_DIR)
169AC_SUBST(CFACC)
170AC_SUBST(CFACPP)
171AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$ac_pwd/$ac_confdir/", [Top src directory])
172AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$ac_pwd/", [Top build directory])
173AC_DEFINE_UNQUOTED(PRELUDE_BUILDDIR, "$ac_pwd/libcfa/prelude/", [Directory where the prelude files are built])
174
175#==============================================================================
176# Flag variables needed to build in tree
177LIBCFA_SRC='$(top_srcdir)/libcfa/src'
178LIBCFA_BUILD='$(top_builddir)/libcfa/src'
179BUILD_IN_TREE_FLAGS_NOLIB="-XCFA -t -B${DRIVER_DIR}"
180BUILD_IN_TREE_FLAGS="${BUILD_IN_TREE_FLAGS_NOLIB} -L${LIBCFA_BUILD} -I${LIBCFA_SRC} -I${LIBCFA_SRC}/containers -I${LIBCFA_SRC}/concurrency -I${LIBCFA_SRC}/stdhdr"
181AC_SUBST(BUILD_IN_TREE_FLAGS_NOLIB)
182AC_SUBST(BUILD_IN_TREE_FLAGS)
183
184#==============================================================================
185# CAFLAGS
186AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
187AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
188
189#==============================================================================
190# Checks for programs.
191AC_PROG_CXX
192AC_PROG_CC
193AM_PROG_AS
194AM_PROG_CC_C_O  # deprecated
195# These are often not installed and people miss seeing the "no", so stop the configure.
196AC_PROG_YACC
197if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
198AC_PROG_LEX
199if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
200AC_PROG_INSTALL
201AC_PROG_MAKE_SET
202AC_PROG_RANLIB
203
204# Checks for libraries.
205
206# Checks for header files.
207AC_FUNC_ALLOCA
208AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
209
210# Checks for typedefs, structures, and compiler characteristics.
211AC_HEADER_STDBOOL
212AC_C_INLINE
213AC_TYPE_INT16_T
214AC_TYPE_INT32_T
215AC_TYPE_INT8_T
216AC_C_RESTRICT
217AC_TYPE_SIZE_T
218AC_TYPE_UINT16_T
219AC_TYPE_UINT32_T
220AC_TYPE_UINT8_T
221
222# Checks for library functions.
223AC_CHECK_FUNCS([memset putenv strchr strtol])
224
225#==============================================================================
226AC_CONFIG_FILES([
227        Makefile
228        driver/Makefile
229        src/Makefile
230        benchmark/Makefile
231        tests/Makefile
232        tests/preempt_longrun/Makefile
233        tools/Makefile
234        tools/prettyprinter/Makefile
235        ])
236
237AC_CONFIG_LINKS([tests/test.py:tests/test.py])
238
239AC_OUTPUT(tests/config.py)
240
241# Final text
242AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.