source: configure.ac @ 85acec94

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

Fixed shared library version number

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