1#!/bin/sh 2 3AC_INIT(VERSION,, eda-dev@opencircuitdesign.com) 4AC_PREREQ(2.60) 5AC_CONFIG_SRCDIR([Makefile.in]) 6 7# Determine the host and build type. 8# =========================================================================== 9AC_CANONICAL_HOST 10 11PACKAGE=qflow 12VERSION=`cat ./VERSION | cut -d. -f1-2` 13REVISION=`cat ./VERSION | cut -d. -f3` 14 15AC_SUBST(VERSION) 16AC_SUBST(REVISION) 17AC_ARG_PROGRAM 18 19# Required programs 20# =========================================================================== 21AC_PROG_CC 22AC_PROG_CPP 23AC_ISC_POSIX 24if test "x$U" != "x"; then 25 AC_MSG_ERROR(Compiler not ANSI compliant) 26fi 27AC_PROG_INSTALL 28AC_PROG_RANLIB 29AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :) 30AC_CHECK_PROG(CP, cp, cp, :) 31AC_CHECK_PROG(RM, rm, rm, :) 32AC_CHECK_PROG(HAVE_PYTHON3, python3, yes, no) 33 34AC_LANG_C 35AC_HEADER_STDC 36AC_CHECK_FUNCS(setenv putenv) 37 38AC_PATH_PROG(ENV_PATH, env, env, $PATH) 39 40# Options 41# ========================================= 42 43dnl Path to Tcl/Tk 44 45AC_ARG_WITH(tclsh, 46[ --with-tclsh=DIR path to tclsh], [ 47 if test -d "$withval"; then 48 TCLSH_DIR=$withval 49 elif test -f "$withval"; then 50 # Path includes "/tclsh"; remove it 51 TCLSH_DIR=${withval%/tclsh} 52 else 53 TCLSH_DIR=${PATH} 54 fi 55 AC_PATH_PROG(TCLSH_PATH, tclsh, tclsh, $TCLSH_DIR) 56], [ 57 AC_PATH_PROG(TCLSH_PATH, tclsh, tclsh, )]) 58AC_DEFINE_UNQUOTED(TCLSH_PATH, "$TCLSH_PATH") 59 60dnl Path to Magic 8.X 61 62AC_ARG_WITH(magic, 63[ --with-magic=DIR path to magic-8.X], [ 64 if test -d "$withval"; then 65 QFLOW_MAGIC_DIR=$withval 66 elif test -f "$withval"; then 67 # Path includes "/magic"; remove it 68 QFLOW_MAGIC_DIR=${withval%/magic} 69 else 70 QFLOW_MAGIC_DIR=${PATH} 71 fi 72 AC_PATH_PROG(QFLOW_MAGIC_PATH, magic, , $QFLOW_MAGIC_DIR) 73], [ 74 AC_PATH_PROG(QFLOW_MAGIC_PATH, magic, , )]) 75AC_DEFINE_UNQUOTED(QFLOW_MAGIC_PATH, "$QFLOW_MAGIC_PATH") 76 77dnl Path to Netgen 78 79AC_ARG_WITH(netgen, 80[ --with-netgen=DIR path to netgen], [ 81 if test -d "$withval"; then 82 QFLOW_NETGEN_DIR=$withval 83 elif test -f "$withval"; then 84 # Path includes "/netgen"; remove it 85 QFLOW_NETGEN_DIR=${withval%/netgen} 86 else 87 QFLOW_NETGEN_DIR=${PATH} 88 fi 89 AC_PATH_PROG(QFLOW_NETGEN_PATH, netgen, , $QFLOW_NETGEN_DIR) 90], [ 91 AC_PATH_PROG(QFLOW_NETGEN_PATH, netgen, , )]) 92AC_DEFINE_UNQUOTED(QFLOW_NETGEN_PATH, "$QFLOW_NETGEN_PATH") 93 94dnl Path to Qrouter 95 96AC_ARG_WITH(qrouter, 97[ --with-qrouter=DIR path to qrouter], [ 98 if test -d "$withval"; then 99 QFLOW_QROUTER_DIR=$withval 100 elif test -f "$withval"; then 101 # Path includes "/qrouter"; remove it 102 QFLOW_QROUTER_DIR=${withval%/qrouter} 103 else 104 QFLOW_QROUTER_DIR=${PATH} 105 fi 106 AC_PATH_PROG(QFLOW_QROUTER_PATH, qrouter, , $QFLOW_QROUTER_DIR) 107], [ 108 AC_PATH_PROG(QFLOW_QROUTER_PATH, qrouter, , )]) 109AC_DEFINE_UNQUOTED(QFLOW_QROUTER_PATH, "$QFLOW_QROUTER_PATH") 110 111dnl Path to GrayWolf 112 113AC_ARG_WITH(graywolf, 114[ --with-graywolf=DIR path to graywolf], [ 115 if test -d "$withval"; then 116 QFLOW_GRAYWOLF_DIR=$withval 117 elif test -f "$withval"; then 118 # Path includes "/graywolf"; remove it 119 QFLOW_GRAYWOLF_DIR=${withval%/graywolf} 120 else 121 QFLOW_GRAYWOLF_DIR=${PATH} 122 fi 123 AC_PATH_PROG(QFLOW_GRAYWOLF_PATH, graywolf, , $QFLOW_GRAYWOLF_DIR) 124], [ 125 AC_PATH_PROG(QFLOW_GRAYWOLF_PATH, graywolf, , )]) 126AC_DEFINE_UNQUOTED(QFLOW_GRAYWOLF_PATH, "$QFLOW_GRAYWOLF_PATH") 127 128dnl Path to yosys 129 130AC_ARG_WITH(yosys, 131[ --with-yosys=DIR path to yosys], [ 132 if test -d "$withval"; then 133 QFLOW_YOSYS_DIR=$withval 134 elif test -f "$withval"; then 135 # Path includes "/yosys"; remove it 136 QFLOW_YOSYS_DIR=${withval%/yosys} 137 else 138 QFLOW_YOSYS_DIR=${PATH} 139 fi 140 AC_PATH_PROG(QFLOW_YOSYS_PATH, yosys, , $QFLOW_YOSYS_DIR) 141], [ 142 AC_PATH_PROG(QFLOW_YOSYS_PATH, yosys, , )]) 143AC_DEFINE_UNQUOTED(QFLOW_YOSYS_PATH, "$QFLOW_YOSYS_PATH") 144 145dnl Path to OpenTimer 146 147AC_ARG_WITH(opentimer, 148[ --with-opentimer=DIR path to ot-shell], [ 149 if test -d "$withval"; then 150 QFLOW_OPENTIMER_DIR=$withval 151 elif test -f "$withval"; then 152 # Path includes "ot-shell"; remove it 153 QFLOW_OPENTIMER_DIR=${withval%/ot-shell} 154 else 155 QFLOW_OPENTIMER_DIR=${PATH} 156 fi 157 AC_PATH_PROG(QFLOW_OPENTIMER_PATH, ot-shell, , $QFLOW_OPENTIMER_DIR) 158], [ 159 AC_PATH_PROG(QFLOW_OPENTIMER_PATH, ot-shell, , )]) 160AC_DEFINE_UNQUOTED(QFLOW_OPENTIMER_PATH, "$QFLOW_OPENTIMER_PATH") 161 162dnl Path to abk-openroad OpenSTA 163 164AC_ARG_WITH(opensta, 165[ --with-opensta=DIR path to sta], [ 166 if test -d "$withval"; then 167 QFLOW_OPENSTA_DIR=$withval 168 elif test -f "$withval"; then 169 # Path includes "sta"; remove it 170 QFLOW_OPENSTA_DIR=${withval%/sta} 171 else 172 QFLOW_OPENSTA_DIR=${PATH} 173 fi 174 AC_PATH_PROG(QFLOW_OPENSTA_PATH, sta, , $QFLOW_OPENSTA_DIR) 175], [ 176 AC_PATH_PROG(QFLOW_OPENSTA_PATH, sta, , )]) 177AC_DEFINE_UNQUOTED(QFLOW_OPENSTA_PATH, "$QFLOW_OPENSTA_PATH") 178 179dnl Path to abk-openroad RePlAce and detail placement ntuplace3/ntuplace4h 180 181AC_ARG_WITH(replace, 182[ --with-replace=DIR path to RePlAce], [ 183 if test -d "$withval"; then 184 QFLOW_REPLACE_DIR=$withval 185 elif test -f "$withval"; then 186 # Path includes "/RePlAce"; remove it 187 QFLOW_REPLACE_DIR=${withval%/RePlAce} 188 else 189 QFLOW_REPLACE_DIR=${PATH} 190 fi 191 AC_PATH_PROG(QFLOW_REPLACE_PATH, RePlAce, , $QFLOW_REPLACE_DIR) 192 AC_PATH_PROG(QFLOW_NTUPLACE3_PATH, ntuplace3, , ${QFLOW_REPLACE_DIR}/../ntuplace) 193 AC_PATH_PROG(QFLOW_NTUPLACE4_PATH, ntuplace4h, , ${QFLOW_REPLACE_DIR}/../ntuplace) 194], [ 195 AC_PATH_PROG(QFLOW_REPLACE_PATH, RePlAce, , ) 196 AC_PATH_PROG(QFLOW_NTUPLACE3_PATH, ntuplace3, , ) 197 AC_PATH_PROG(QFLOW_NTUPLACE4_PATH, ntuplace4h, , ) 198]) 199AC_DEFINE_UNQUOTED(QFLOW_REPLACE_PATH, "$QFLOW_REPLACE_PATH") 200dnl NOTE: The following is based on the current source distribution of RePlAce and 201dnl is likely to change. QFLOW_NTUPLACE_PATH is set to the common prefix "ntuplace" 202dnl of the actual tools, currently "ntuplace3" and "ntuplace4h". Probably better to 203dnl write a custom autoconf script for this. 204AC_DEFINE_UNQUOTED(QFLOW_NTUPLACE3_PATH, "$QFLOW_NTUPLACE3_PATH") 205AC_DEFINE_UNQUOTED(QFLOW_NTUPLACE4_PATH, "$QFLOW_NTUPLACE4_PATH") 206 207dnl Target library location 208 209AC_ARG_WITH(libdir, 210[ --with-libdir=DIR path to qflow runtime files], [ 211 QFLOW_LIB_DIR=$withval 212], [ 213 QFLOW_LIB_DIR="\${prefix}/share/qflow" 214]) 215 216AC_ARG_WITH(bindir, 217[ --with-bindir=DIR path to qflow launch script], [ 218 QFLOW_BIN_DIR=$withval 219], [ 220 QFLOW_BIN_DIR="\${prefix}/bin" 221]) 222 223# For distributed installs, where the run-time files are installed in a 224# place that is a temporary staging area, like DESTDIR, but unlike DESTDIR, 225# the prefix is replaced by the destination directory, rather than appended 226# to it. 227DIST_DIR="\${exec_prefix}" 228AC_ARG_WITH(distdir, 229[ --with-distdir=DIR install into location DIR for distribution], [ 230 if test "$withval" = "no" -o "$withval" = "NO" ; then 231 DIST_DIR="\${exec_prefix}" 232 else 233 DIST_DIR=${withval} 234 fi 235], ) 236 237dnl AC_SUBST(QFLOW_YOSYS_PATH) 238dnl AC_SUBST(QFLOW_GRAYWOLF_PATH) 239dnl AC_SUBST(QFLOW_REPLACE_PATH) 240dnl AC_SUBST(QFLOW_NTUPLACE3_PATH) 241dnl AC_SUBST(QFLOW_NTUPLACE4_PATH) 242dnl AC_SUBST(QFLOW_QROUTER_PATH) 243dnl AC_SUBST(QFLOW_MAGIC_PATH) 244dnl AC_SUBST(QFLOW_NETGEN_PATH) 245dnl AC_SUBST(QFLOW_OPENTIMER_PATH) 246dnl AC_SUBST(QFLOW_OPENSTA_PATH) 247 248AC_SUBST(QFLOW_BIN_DIR) 249AC_SUBST(QFLOW_LIB_DIR) 250 251AC_SUBST(TCLSH_PATH) 252AC_SUBST(HAVE_PYTHON3) 253 254AC_SUBST(CFLAGS) 255AC_SUBST(LDFLAGS) 256AC_SUBST(LD) 257AC_SUBST(STDLIBS) 258 259AC_SUBST(DIST_DIR) 260 261if test "x${ac_cv_path_QFLOW_YOSYS_PATH}" == "x"; then 262 HAVE_YOSYS=0 263else 264 HAVE_YOSYS=1 265fi 266 267AC_SUBST(HAVE_YOSYS) 268 269if test "x${ac_cv_path_QFLOW_MAGIC_PATH}" == "x"; then 270 HAVE_MAGIC=0 271else 272 HAVE_MAGIC=1 273fi 274 275AC_SUBST(HAVE_MAGIC) 276 277if test "x${ac_cv_path_QFLOW_NETGEN_PATH}" == "x"; then 278 HAVE_NETGEN=0 279else 280 HAVE_NETGEN=1 281fi 282 283AC_SUBST(HAVE_NETGEN) 284 285if test "x${ac_cv_path_QFLOW_OPENTIMER_PATH}" == "x"; then 286 HAVE_OPENTIMER=0 287else 288 HAVE_OPENTIMER=1 289fi 290 291AC_SUBST(HAVE_OPENTIMER) 292 293if test "x${ac_cv_path_QFLOW_OPENSTA_PATH}" == "x"; then 294 HAVE_OPENSTA=0 295else 296 HAVE_OPENSTA=1 297fi 298 299AC_SUBST(HAVE_OPENSTA) 300 301if test "x${ac_cv_path_QFLOW_GRAYWOLF_PATH}" == "x"; then 302 HAVE_GRAYWOLF=0 303else 304 HAVE_GRAYWOLF=1 305fi 306 307AC_SUBST(HAVE_GRAYWOLF) 308 309if test "x${ac_cv_path_QFLOW_REPLACE_PATH}" == "x"; then 310 HAVE_REPLACE=0 311else 312 HAVE_REPLACE=1 313fi 314 315AC_SUBST(HAVE_REPLACE) 316 317if test "x${ac_cv_path_QFLOW_QROUTER_PATH}" == "x"; then 318 HAVE_QROUTER=0 319else 320 HAVE_QROUTER=1 321fi 322 323AC_SUBST(HAVE_QROUTER) 324 325AC_OUTPUT(Makefile scripts/Makefile src/Makefile tech/Makefile tech/osu050/Makefile tech/osu035/Makefile tech/osu035_redm4/Makefile tech/osu018/Makefile tech/gscl45nm/Makefile) 326 327echo "" 328echo "Configuration results:" 329echo "----------------------------------------------------" 330echo "" 331 332FATAL=0 333WARN=0 334if test "x${ac_cv_path_QFLOW_YOSYS_PATH}" == "x"; then 335 FATAL=1 336 echo "ERROR: yosys not found. Use --with-yosys=<DIR>" 337else 338 echo "Using yosys verilog synthesis tool at: ${ac_cv_path_QFLOW_YOSYS_PATH}" 339fi 340 341# Make sure one placement tool exists 342if test "x${ac_cv_path_QFLOW_GRAYWOLF_PATH}" == "x" -a "x${ac_cv_path_QFLOW_REPLACE_PATH}" == "x"; then 343 FATAL=1 344 echo "ERROR: No placement tool found. Need either graywolf or RePlAce." 345fi 346 347if test "x${ac_cv_path_QFLOW_GRAYWOLF_PATH}" == "x"; then 348 echo "GrayWolf not found. Use --with-graywolf=<DIR> (optional)" 349else 350 echo "Using graywolf placement tool at: ${ac_cv_path_QFLOW_GRAYWOLF_PATH}" 351fi 352 353if test "x${ac_cv_path_QFLOW_REPLACE_PATH}" == "x"; then 354 echo "RePlAce not found. Use --with-replace=<DIR> (optional)" 355else 356 echo "Using RePlAce placement tool at: ${ac_cv_path_QFLOW_REPLACE_PATH}" 357fi 358 359if test "x${ac_cv_path_QFLOW_QROUTER_PATH}" == "x"; then 360 echo "ERROR: qrouter not found. Use --with-qrouter=<DIR>" 361 FATAL=1 362else 363 echo "Using qrouter detail route tool at: ${ac_cv_path_QFLOW_QROUTER_PATH}" 364fi 365 366if test "x${ac_cv_path_QFLOW_MAGIC_PATH}" == "x"; then 367 WARN=1 368 echo "WARNING: Magic 8.X layout tool not found. Use --with-magic=<DIR>" 369else 370 echo "Using Magic layout tool at: ${ac_cv_path_QFLOW_MAGIC_PATH}" 371fi 372 373if test "x${ac_cv_path_QFLOW_NETGEN_PATH}" == "x"; then 374 WARN=1 375 echo "WARNING: Netgen LVS tool not found. Use --with-netgen=<DIR>" 376else 377 echo "Using Netgen LVS tool at: ${ac_cv_path_QFLOW_NETGEN_PATH}" 378fi 379 380echo "Using Vesta STA tool (internal)" 381 382if test "x${ac_cv_path_QFLOW_OPENTIMER_PATH}" == "x"; then 383 echo "OpenTimer not found. Use --with-opentimer=<DIR> (optional)" 384else 385 echo "Using OpenTimer static timing analysys tool at: ${ac_cv_path_QFLOW_OPENTIMER_PATH}" 386fi 387 388if test "x${ac_cv_path_QFLOW_OPENSTA_PATH}" == "x"; then 389 echo "OpenSTA not found. Use --with-opensta=<DIR> (optional)" 390else 391 echo "Using OpenSTA static timing analysys tool at: ${ac_cv_path_QFLOW_OPENSTA_PATH}" 392fi 393 394if test "x${HAVE_PYTHON3}" == "x"; then 395 WARN=1 396 echo "No python3 on system, will not install qflow GUI or spi2xspice.py" 397fi 398 399echo "----------------------------------------------------" 400 401if test x$WARN = x1; then 402 echo "Some tools needed for a complete flow were not found. This will result in" 403 echo "an incomplete synthesis flow." 404 echo "" 405fi 406 407if test x$FATAL = x1; then 408 echo "One or more mandatory tools needed for a basic synthesis flow were not found." 409 echo "This will result in an unusable synthesis flow. Please check the configure" 410 echo "options with \"./configure --help\" and ensure that all tools are available" 411 echo "to qflow for a complete synthesis flow." 412 echo "" 413fi 414 415if test x$WARN = x0 -a x$FATAL = x0; then 416 echo "All tools needed for complete flow have been found." 417 echo "Run \"make\" followed by \"sudo make install\" to install qflow." 418 echo "" 419fi 420 421echo "----------------------------------------------------" 422