1# Source of configuration for Tokyo Cabinet 2 3 4 5#================================================================ 6# Generic Settings 7#================================================================ 8 9# Package name 10AC_INIT(tokyocabinet, 1.4.48) 11 12# Package information 13MYLIBVER=9 14MYLIBREV=11 15MYFORMATVER="1.0" 16 17# Targets 18MYHEADERFILES="tcutil.h tchdb.h tcbdb.h tcfdb.h tctdb.h tcadb.h" 19MYLIBRARYFILES="libtokyocabinet.a" 20MYLIBOBJFILES="tcutil.o tchdb.o tcbdb.o tcfdb.o tctdb.o tcadb.o myconf.o md5.o" 21MYCOMMANDFILES="tcutest tcumttest tcucodec tchtest tchmttest tchmgr" 22MYCOMMANDFILES="$MYCOMMANDFILES tcbtest tcbmttest tcbmgr tcftest tcfmttest tcfmgr" 23MYCOMMANDFILES="$MYCOMMANDFILES tcttest tctmttest tctmgr tcatest tcamttest tcamgr" 24MYCGIFILES="tcawmgr.cgi" 25MYMAN1FILES="tcutest.1 tcumttest.1 tcucodec.1 tchtest.1 tchmttest.1 tchmgr.1" 26MYMAN1FILES="$MYMAN1FILES tcbtest.1 tcbmttest.1 tcbmgr.1 tcftest.1 tcfmttest.1 tcfmgr.1" 27MYMAN1FILES="$MYMAN1FILES tcttest.1 tctmttest.1 tctmgr.1 tcatest.1 tcamttest.1 tcamgr.1" 28MYMAN3FILES="tokyocabinet.3 tcutil.3 tcxstr.3 tclist.3 tcmap.3 tctree.3 tcmdb.3 tcmpool.3" 29MYMAN3FILES="$MYMAN3FILES tchdb.3 tcbdb.3 tcfdb.3 tctdb.3 tcadb.3" 30MYDOCUMENTFILES="COPYING ChangeLog doc tokyocabinet.idl" 31MYPCFILES="tokyocabinet.pc" 32 33# Building flags 34MYCFLAGS="-std=c99 -Wall -fPIC -fsigned-char -O2" 35MYCPPFLAGS="-I. -I\$(INCLUDEDIR) -I$HOME/include -I/usr/local/include" 36MYCPPFLAGS="$MYCPPFLAGS -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__" 37MYLDFLAGS="-L. -L\$(LIBDIR) -L$HOME/lib -L/usr/local/lib" 38MYCMDLDFLAGS="" 39MYRUNPATH="\$(LIBDIR)" 40MYLDLIBPATHENV="LD_LIBRARY_PATH" 41MYPOSTCMD="true" 42 43# Building paths 44PATH="$PATH:$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" 45PATH="$PATH:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/ucb" 46CPATH="$HOME/include:/usr/local/include:$CPATH" 47LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH" 48LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH" 49PKG_CONFIG_PATH="$HOME/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" 50export PATH CPATH LIBRARY_PATH LD_LIBRARY_PATH PKG_CONFIG_PATH 51 52 53 54#================================================================ 55# Options 56#================================================================ 57 58 59# Internal variables 60enables="" 61 62# Debug mode 63AC_ARG_ENABLE(debug, 64 AC_HELP_STRING([--enable-debug], [build for debugging])) 65if test "$enable_debug" = "yes" 66then 67 MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -g -O0" 68 MYCPPFLAGS="$MYCPPFLAGS -UNDEBUG" 69 MYCMDLDFLAGS="$MYCMDLDFLAGS -static" 70 enables="$enables (debug)" 71fi 72 73# Developping mode 74AC_ARG_ENABLE(devel, 75 AC_HELP_STRING([--enable-devel], [build for development])) 76if test "$enable_devel" = "yes" 77then 78 MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -g -O2 -pipe" 79 MYCPPFLAGS="$MYCPPFLAGS -UNDEBUG" 80 enables="$enables (devel)" 81fi 82 83# Profiling mode 84AC_ARG_ENABLE(profile, 85 AC_HELP_STRING([--enable-profile], [build for profiling])) 86if test "$enable_profile" = "yes" 87then 88 MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -g -pg -O2 -pipe" 89 enables="$enables (profile)" 90fi 91 92# Static mode 93AC_ARG_ENABLE(static, 94 AC_HELP_STRING([--enable-static], [build by static linking])) 95if test "$enable_static" = "yes" 96then 97 MYCMDLDFLAGS="$MYCMDLDFLAGS -static" 98 enables="$enables (static)" 99fi 100 101# Fastest mode 102AC_ARG_ENABLE(fastest, 103 AC_HELP_STRING([--enable-fastest], [build for fastest run])) 104if test "$enable_fastest" = "yes" 105then 106 MYLIBOBJFILES="tokyocabinet_all.o" 107 MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -O3" 108 MYCFLAGS="$MYCFLAGS -fomit-frame-pointer -fforce-addr -minline-all-stringops" 109 MYCPPFLAGS="$MYCPPFLAGS -D_MYFASTEST" 110 enables="$enables (fastest)" 111fi 112 113# 64-bit offset mode 114AC_ARG_ENABLE(off64, 115 AC_HELP_STRING([--enable-off64], [build with 64-bit file offset on 32-bit system])) 116if test "$enable_off64" = "yes" 117then 118 MYCPPFLAGS="$MYCPPFLAGS -D_FILE_OFFSET_BITS=64" 119 enables="$enables (off64)" 120fi 121 122# Swapping byte-orders mode 123AC_ARG_ENABLE(swab, 124 AC_HELP_STRING([--enable-swab], [build for swapping byte-orders])) 125if test "$enable_swab" = "yes" 126then 127 MYCPPFLAGS="$MYCPPFLAGS -D_MYSWAB" 128 enables="$enables (swab)" 129fi 130 131# Micro yield mode 132AC_ARG_ENABLE(uyield, 133 AC_HELP_STRING([--enable-uyield], [build for detecting race conditions])) 134if test "$enable_uyield" = "yes" 135then 136 MYCPPFLAGS="$MYCPPFLAGS -D_MYMICROYIELD" 137 enables="$enables (uyield)" 138fi 139 140# Disable the unified buffer cache assumption 141AC_ARG_ENABLE(ubc, 142 AC_HELP_STRING([--disable-ubc], [build without the unified buffer cache assumption])) 143if test "$enable_ubc" = "no" 144then 145 MYCPPFLAGS="$MYCPPFLAGS -D_MYNOUBC" 146 enables="$enables (no-ubc)" 147fi 148 149# Disable ZLIB compression 150AC_ARG_ENABLE(zlib, 151 AC_HELP_STRING([--disable-zlib], [build without ZLIB compression])) 152if test "$enable_zlib" = "no" 153then 154 MYCPPFLAGS="$MYCPPFLAGS -D_MYNOZLIB" 155 enables="$enables (no-zlib)" 156fi 157 158# Disable BZIP2 compression 159AC_ARG_ENABLE(bzip, 160 AC_HELP_STRING([--disable-bzip], [build without BZIP2 compression])) 161if test "$enable_bzip" = "no" 162then 163 MYCPPFLAGS="$MYCPPFLAGS -D_MYNOBZIP" 164 enables="$enables (no-bzip)" 165fi 166 167# Disable POSIX thread 168AC_ARG_ENABLE(pthread, 169 AC_HELP_STRING([--disable-pthread], [build without POSIX thread support])) 170if test "$enable_pthread" = "no" 171then 172 MYCPPFLAGS="$MYCPPFLAGS -D_MYNOPTHREAD" 173 enables="$enables (no-pthread)" 174fi 175 176# Disable shared object 177AC_ARG_ENABLE(shared, 178 AC_HELP_STRING([--disable-shared], [avoid to build shared libraries])) 179if test "$enable_shared" = "no" 180then 181 enables="$enables (no-shared)" 182fi 183 184# Enable custom codec functions of LZMA 185AC_ARG_ENABLE(exlzma, 186 AC_HELP_STRING([--disable-exlzma], [build with the custom codec of LZMA])) 187if test "$enable_exlzma" = "yes" 188then 189 MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZMA" 190 enables="$enables (exlzma)" 191fi 192 193# Enable custom codec functions of LZO 194AC_ARG_ENABLE(exlzo, 195 AC_HELP_STRING([--disable-exlzo], [build with the custom codec of LZO])) 196if test "$enable_exlzo" = "yes" 197then 198 MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZO" 199 enables="$enables (exlzo)" 200fi 201 202# Specify the installation path of ZLIB 203AC_ARG_WITH(zlib, 204 AC_HELP_STRING([--with-zlib=DIR], [search DIR/include and DIR/lib for ZLIB])) 205if test -n "$with_zlib" 206then 207 MYCPPFLAGS="$MYCPPFLAGS -I$with_zlib/include" 208 MYLDFLAGS="$MYLDFLAGS -L$with_zlib/lib" 209 MYRUNPATH="$MYRUNPATH:$with_zlib/lib" 210 CPATH="$CPATH:$with_zlib/include" 211 LIBRARY_PATH="$LIBRARY_PATH:$with_zlib/lib" 212 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_zlib/lib" 213fi 214 215# Specify the installation path of BZIP2 216AC_ARG_WITH(bzip, 217 AC_HELP_STRING([--with-bzip=DIR], [search DIR/include and DIR/lib for BZIP2])) 218if test -n "$with_bzip" 219then 220 MYCPPFLAGS="$MYCPPFLAGS -I$with_bzip/include" 221 MYLDFLAGS="$MYLDFLAGS -L$with_bzip/lib" 222 MYRUNPATH="$MYRUNPATH:$with_bzip/lib" 223 CPATH="$CPATH:$with_bzip/include" 224 LIBRARY_PATH="$LIBRARY_PATH:$with_bzip/lib" 225 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_bzip/lib" 226fi 227 228# Messages 229printf '#================================================================\n' 230printf '# Configuring Tokyo Cabinet version %s%s.\n' "$PACKAGE_VERSION" "$enables" 231printf '#================================================================\n' 232 233 234 235#================================================================ 236# Checking Commands and Libraries 237#================================================================ 238 239# C compiler 240AC_PROG_CC 241 242# Reset variables 243if test "$GCC" != "yes" 244then 245 AC_MSG_WARN([another compiler except for GCC was detected]) 246 MYCFLAGS="" 247fi 248test -n "$CFLAGS" && MYCFLAGS="$CFLAGS $MYCFLAGS" 249test -n "$CPPFLAGS" && MYCPPFLAGS="$CPPFLAGS $MYCPPFLAGS" 250test -n "$LDFLAGS" && MYLDFLAGS="$LDFLAGS $MYLDFLAGS" 251 252# Byte order 253AC_C_BIGENDIAN(MYCPPFLAGS="$MYCPPFLAGS -D_MYBIGEND") 254 255# Underlying libraries 256AC_CHECK_LIB(c, main) 257AC_CHECK_LIB(m, main) 258if test "$enable_pthread" != "no" 259then 260 AC_CHECK_LIB(pthread, main) 261 AC_CHECK_LIB(rt, main) 262fi 263if test "$enable_zlib" != "no" 264then 265 AC_CHECK_LIB(z, main) 266fi 267if test "$enable_bzip" != "no" 268then 269 AC_CHECK_LIB(bz2, main) 270fi 271if test "$enable_exlzma" = "yes" 272then 273 AC_CHECK_LIB(lzma, main) 274fi 275if test "$enable_exlzo" = "yes" 276then 277 AC_CHECK_LIB(lzo2, main) 278fi 279AC_CHECK_LIB(tokyocabinet, main, AC_MSG_WARN([old version of Tokyo Cabinet was detected])) 280 281# Necessary headers 282AC_CHECK_HEADER(stdlib.h, true, AC_MSG_ERROR([stdlib.h is required])) 283AC_CHECK_HEADER(stdint.h, true, AC_MSG_ERROR([stdint.h is required])) 284AC_CHECK_HEADER(unistd.h, true, AC_MSG_ERROR([unistd.h is required])) 285AC_CHECK_HEADER(dirent.h, true, AC_MSG_ERROR([dirent.h is required])) 286AC_CHECK_HEADER(regex.h, true, AC_MSG_ERROR([regex.h is required])) 287AC_CHECK_HEADER(glob.h, true, AC_MSG_ERROR([glob.h is required])) 288if test "$enable_pthread" != "no" 289then 290 AC_CHECK_HEADER(pthread.h, true, AC_MSG_ERROR([pthread.h is required])) 291fi 292if test "$enable_zlib" != "no" 293then 294 AC_CHECK_HEADER(zlib.h, true, AC_MSG_ERROR([zlib.h is required])) 295fi 296if test "$enable_bzip" != "no" 297then 298 AC_CHECK_HEADER(bzlib.h, true, AC_MSG_ERROR([bzlib.h is required])) 299fi 300if test "$enable_exlzma" = "yes" 301then 302 AC_CHECK_HEADER(lzmalib.h, true, AC_MSG_ERROR([lzmalib.h is required])) 303fi 304if test "$enable_exlzo" = "yes" 305then 306 AC_CHECK_HEADER(lzo/lzo1x.h, true, AC_MSG_ERROR([lzo/lzo1x.h is required])) 307fi 308 309# Shared libraries 310if test "$enable_shared" != "no" && test "$enable_profile" != "yes" 311then 312 if uname | grep Darwin >/dev/null 313 then 314 MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.$MYLIBVER.$MYLIBREV.0.dylib" 315 MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.$MYLIBVER.dylib" 316 MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.dylib" 317 MYLDLIBPATHENV="DYLD_LIBRARY_PATH" 318 else 319 MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.so.$MYLIBVER.$MYLIBREV.0" 320 MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.so.$MYLIBVER" 321 MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.so" 322 fi 323fi 324 325 326 327#================================================================ 328# Generic Settings 329#================================================================ 330 331# Export variables 332AC_SUBST(MYLIBVER) 333AC_SUBST(MYLIBREV) 334AC_SUBST(MYFORMATVER) 335AC_SUBST(MYHEADERFILES) 336AC_SUBST(MYLIBRARYFILES) 337AC_SUBST(MYLIBOBJFILES) 338AC_SUBST(MYCOMMANDFILES) 339AC_SUBST(MYCGIFILES) 340AC_SUBST(MYMAN1FILES) 341AC_SUBST(MYMAN3FILES) 342AC_SUBST(MYDOCUMENTFILES) 343AC_SUBST(MYPCFILES) 344AC_SUBST(MYCFLAGS) 345AC_SUBST(MYCPPFLAGS) 346AC_SUBST(MYLDFLAGS) 347AC_SUBST(MYCMDLDFLAGS) 348AC_SUBST(MYRUNPATH) 349AC_SUBST(MYLDLIBPATHENV) 350AC_SUBST(MYPOSTCMD) 351 352# Targets 353AC_OUTPUT(Makefile tokyocabinet.pc) 354 355# Messages 356printf '#================================================================\n' 357printf '# Ready to make.\n' 358printf '#================================================================\n' 359 360 361 362# END OF FILE 363