1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
dnl ##########################################################################
dnl MALOC = < Minimal Abstraction Layer for Object-oriented C >
dnl Copyright (C) 1994--2000 Michael Holst
dnl
dnl This program is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 2 of the License, or (at your
dnl option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl See the GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program; if not, write to the Free Software Foundation, Inc.,
dnl 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl rcsid="INTENTIONALLY LEFT BLANK"
dnl ##########################################################################
dnl ##########################################################################
dnl File: configure.ac
dnl
dnl Purpose: configure.ac script for a typical MALOC application.
dnl
dnl Author: Michael Holst
dnl ##########################################################################
dnl 0. autoconf initialization
AC_INIT(malocapp, 1.0, mholst@math.ucsd.edu)
AC_CONFIG_SRCDIR(main.c)
AC_CONFIG_AUX_DIR(config)
AC_PREFIX_DEFAULT(${HOME})
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
fetk_cpu_vendor_os="${host_cpu}-${host_vendor}-${host_os}";
AC_SUBST(fetk_cpu_vendor_os)
dnl 1. automake initialization (uncomment only if rebuilding Makefile.in's)
AM_INIT_AUTOMAKE([foreign])
FETK_VERSION="1:0:0"
AC_SUBST(FETK_VERSION)
AM_MAINTAINER_MODE
dnl 2. checks for programs
AC_LANG_C
AC_PROG_CC
AC_PROG_CPP
dnl 3. checks for libraries
AC_CHECK_LIB(m,pow,[math_lib="-lm"],[math_lib=""])
AC_SUBST(math_lib)
AC_CHECK_LIB(iberty,strerrno,[liberty_lib="-liberty"],[liberty_lib=""])
AC_SUBST(liberty_lib)
nsl_lib="";
AC_CHECK_FUNC(gethostbyname,[try_nsl=""],[try_nsl="yes"])
if test -n "${try_nsl}"; then
AC_CHECK_LIB(nsl,gethostbyname,[nsl_lib="-lnsl"],[nsl_lib=""])
fi
AC_SUBST(nsl_lib)
socket_lib="";
AC_CHECK_FUNC(connect,[try_socket=""],[try_socket="yes"])
if test -n "${try_socket}"; then
AC_CHECK_LIB(socket,connect,[socket_lib="-lsocket"],[socket_lib=""])
fi
AC_SUBST(socket_lib)
thread_lib="";
AC_CHECK_FUNC(thr_create,[try_thread=""],[try_thread="yes"])
if test -n "${try_thread}"; then
AC_CHECK_LIB(thread,thr_create,[thread_lib="-lthread"],[thread_lib=""])
fi
AC_SUBST(thread_lib)
dnl 4. checks for header files
dnl 5. checks for typedefs
dnl 6. checks for structures
dnl 7. checks for compiler characteristics
dnl 8. checks for library functions
dnl 9. checks for system services
dnl 10. checks for anything else
dnl # ---------------------------
dnl # HANDLE THE READLINE LIBRARY
dnl # ---------------------------
rl_lib="";
AC_MSG_CHECKING([whether your environment defines FETK_RL_LIBRARY])
if test -n "${FETK_RL_LIBRARY}"; then
AC_MSG_RESULT([yes])
rl_lib_path="-L${FETK_RL_LIBRARY} ";
else
AC_MSG_RESULT([no])
rl_lib_path="";
fi
LDFLAGS_SAVE=${LDFLAGS};
LDFLAGS=${rl_lib_path};
AC_CHECK_LIB(ncurses,tgetnum,
[ncurses_lib="-lncurses"],
[ncurses_lib=""],
[${math_lib}])
AC_CHECK_LIB(readline,readline,
[rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
[rl_use="";rl_lib=""],
[${rl_lib_path} ${ncurses_lib} ${math_lib}])
if test -n "${rl_use}"; then
AC_CHECK_LIB(readline,add_history,
[rl_use="yes";rl_lib="${rl_lib_path}-lreadline ${ncurses_lib}"],
[rl_use="";rl_lib=""],
[${rl_lib_path} ${ncurses_lib} ${math_lib}])
fi
LDFLAGS=${LDFLAGS_SAVE};
AC_SUBST(rl_lib)
dnl # ----------------------
dnl # HANDLE THE MPI LIBRARY
dnl # ----------------------
mpi_lib="";
AC_MSG_CHECKING([whether your environment defines FETK_MPI_LIBRARY])
if test -n "${FETK_MPI_LIBRARY}"; then
AC_MSG_RESULT([yes])
mpi_lib_path="-L${FETK_MPI_LIBRARY} ";
else
AC_MSG_RESULT([no])
mpi_lib_path="";
fi
LDFLAGS_SAVE=${LDFLAGS};
LDFLAGS=${mpi_lib_path};
mpi_use="";
AC_CHECK_LIB(mpi,main,
[mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpi"],
[mpi_use="";mpi_lib=""],${mpi_lib_path})
if test -z "${mpi_use}"; then
AC_CHECK_LIB(mpich,main,
[mpi_use="yes";mpi_lib="${mpi_lib_path}-lmpich"],
[mpi_use="";mpi_lib=""],${mpi_lib_path})
fi
LDFLAGS=${LDFLAGS_SAVE};
AC_SUBST(mpi_lib)
AC_MSG_RESULT([----------- begin processing APP configure options ---------])
dnl # --------------------------------
dnl # HANDLE ANSI/PEDANTIC COMPILATION
dnl # --------------------------------
AC_MSG_CHECKING([whether you want pedantic ANSI compilation])
AC_ARG_ENABLE(pansi,
[ --enable-pansi enable pedantic ANSI compilation],
[ pansi_use="yes" ],
[ pansi_use="" ]
)
if test -z "${pansi_use}"; then
AC_MSG_RESULT([no])
wall=""
wall_pedantic=""
wall_pedantic_ansi=""
pedantic_ansi=""
else
AC_MSG_RESULT([yes])
wall="-Wall"
wall_pedantic="-Wall -pedantic"
wall_pedantic_ansi="-Wall -pedantic -ansi"
pedantic_ansi="-pedantic -ansi"
fi
AC_SUBST(wall)
AC_SUBST(wall_pedantic)
AC_SUBST(wall_pedantic_ansi)
AC_SUBST(pedantic_ansi)
dnl # ----------------
dnl # HANDLE PROFILING
dnl # ----------------
AC_MSG_CHECKING([whether you want profiling])
AC_ARG_ENABLE(gprof,
[ --enable-gprof enable gprof profiling [default=no]],
[ gprof_use="yes" ],
[ gprof_use="" ]
)
if test -z "${gprof_use}"; then
AC_MSG_RESULT([no])
profile=""
profile_lib=""
else
AC_MSG_RESULT([yes])
profile="-pg"
profile_lib="-pg"
fi
AC_SUBST(profile)
AC_SUBST(profile_lib)
dnl # ---------------------------------
dnl # HANDLE THE ELECTRIC FENCE LIBRARY
dnl # ---------------------------------
AC_MSG_CHECKING([whether you want ElectricFence])
AC_ARG_ENABLE(efence,
[ --enable-efence enable ElectricFence malloc lib [default=no]],
[ efence_use="yes" ],
[ efence_use="" ]
)
if test -z "${efence_use}"; then
AC_MSG_RESULT([no])
zfence="";
zfence_lib="";
else
AC_MSG_RESULT([yes ...poking around for it])
AC_CHECK_LIB(efence,main,
[efence_use="yes";zfence="zfence";zfence_lib="-lefence"],
[efence_use="";zfence="";zfence_lib=""])
fi
AC_SUBST(zfence)
AC_SUBST(zfence_lib)
dnl # -----------------------------
dnl # HANDLE BUILDING LIBRARY TESTS
dnl # -----------------------------
AC_MSG_CHECKING([whether you want to build library test programs])
AC_ARG_ENABLE(vtst,
[ --enable-vtst enable building of library tests [default=no]],
[ vtst="tests";AC_MSG_RESULT([yes]) ],
[ vtst="";AC_MSG_RESULT([no]) ]
)
AC_SUBST(vtst)
AC_MSG_RESULT([------------ end processing APP configure options ----------])
AC_MSG_RESULT([---------- begin configuring for MALOC linkage ------------])
dnl # ------------------------
dnl # HANDLE THE MALOC LIBRARY
dnl # ------------------------
dnl # MALOC header location ENV specification
AC_MSG_CHECKING([whether your environment defines FETK_INCLUDE])
if test -n "${FETK_INCLUDE}"; then
AC_MSG_RESULT([yes])
maloc_inc_path="-I${FETK_INCLUDE} ";
else
AC_MSG_RESULT([no])
maloc_inc_path="-I${HOME}/include ";
fi
dnl # MALOC library location ENV specification
AC_MSG_CHECKING([whether your environment defines FETK_LIBRARY])
if test -n "${FETK_LIBRARY}"; then
AC_MSG_RESULT([yes])
maloc_lib_path="-L${FETK_LIBRARY}/${fetk_cpu_vendor_os} ";
else
AC_MSG_RESULT([no])
maloc_lib_path="-L${HOME}/lib/${fetk_cpu_vendor_os} ";
fi
dnl # Setup temp LDFLAGS and look for MALOC library/header
LDFLAGS_SAVE=${LDFLAGS};
CPPFLAGS_SAVE=${CPPFLAGS};
LDFLAGS=${maloc_lib_path};
CPPFLAGS=${maloc_inc_path};
maloc_found="";
AC_CHECK_HEADER(maloc/maloc.h,
[maloc_found="yes";maloc_inc="${maloc_inc_path}"],
[maloc_found="";maloc_inc=""])
if test -n "${maloc_found}"; then
AC_CHECK_LIB(maloc,maloc_link,
[maloc_found="yes";maloc_lib="${maloc_lib_path}-lmaloc"],
[maloc_found="";maloc_lib=""],
[${maloc_lib_path}-lmaloc ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
fi
if test -z "${maloc_found}"; then
AC_MSG_ERROR([MALOC libraries OR headers missing ...EXITING ON ERROR])
else
AC_MSG_RESULT([MALOC libraries AND headers were found ...rocking on...])
fi
dnl # Return LDFLAGS and CPPFLAGS to normal
LDFLAGS=${LDFLAGS_SAVE};
CPPFLAGS=${CPPFLAGS_SAVE};
AC_SUBST(maloc_lib)
AC_SUBST(maloc_inc)
dnl # Check whether MALOC actually needs the READLINE library
AC_CHECK_LIB(maloc,maloc_needs_rl,
[rl_use="yes"],
[rl_use=""],
[${maloc_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
dnl # Check whether MALOC actually needs the MPI library
AC_CHECK_LIB(maloc,maloc_needs_mpi,
[mpi_use="yes"],
[mpi_use=""],
[${maloc_lib} ${mpi_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${thread_lib} ${math_lib} ${zfence_lib} ${profile_lib}])
AC_MSG_RESULT([---------- end configuring for MALOC linkage --------------])
dnl 11. generate the makefiles
AC_OUTPUT([
Makefile
tests/Makefile
tests/zfence/Makefile
tests/aloc/Makefile
tests/vsh/Makefile
tests/psh/Makefile
])
|