1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000 |
- # -*- Autoconf -*-
- # Process this file with autoconf to produce a configure script.
- AC_INIT(rAthena)
- AC_REVISION($Revision$)
- AC_PREREQ([2.59])
- AC_CONFIG_SRCDIR([src/common/cbasetypes.h])
- AC_CONFIG_FILES([Makefile src/common/Makefile])
- AC_CONFIG_FILES([3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile])
- AC_CONFIG_FILES([src/char/Makefile src/login/Makefile])
- AC_CONFIG_FILES([src/map/Makefile src/tool/Makefile])
- AC_CONFIG_FILES([src/test/Makefile])
- AC_GNU_SOURCE
- #
- # Memory managers
- #
- AC_ARG_ENABLE(
- [manager],
- AC_HELP_STRING(
- [--enable-manager=ARG],
- [memory managers: no, builtin, memwatch, dmalloc, gcollect, bcheck (defaults to builtin)]
- ),
- [
- enable_manager="$enableval"
- case $enableval in
- "no");;
- "builtin");;
- "memwatch");;
- "dmalloc");;
- "gcollect");;
- "bcheck");;
- *) AC_MSG_ERROR([[unknown memory manager '$enableval'... stopping]]);;
- esac
- ],
- [enable_manager="builtin"]
- )
- #
- # packetver
- #
- AC_ARG_ENABLE(
- [packetver],
- AC_HELP_STRING(
- [--enable-packetver=ARG],
- [Sets the PACKETVER define of the map-server. (see src/map/clif.h)]
- ),
- [enable_packetver="$enableval"],
- [enable_packetver=""]
- )
- #
- # debug
- #
- AC_ARG_ENABLE(
- [debug],
- AC_HELP_STRING(
- [--enable-debug@<:@=ARG@:>@],
- [
- Compiles extra debug code. (disabled by default)
- (available options: yes, no, gdb)
- ]
- ),
- [
- enable_debug="$enableval"
- case $enableval in
- "no");;
- "yes");;
- "gdb");;
- *) AC_MSG_ERROR([[invalid argument --enable-debug=$enableval... stopping]]);;
- esac
- ],
- [enable_debug="no"]
- )
- #
- # renewal
- #
- AC_ARG_ENABLE(
- [prere],
- AC_HELP_STRING(
- [--enable-prere@<:@=ARG@:>@],
- [
- Compiles serv in prere mode. (disabled by default)
- (available options: yes, no)
- ]
- ),
- [
- enable_prere="$enableval"
- case $enableval in
- "no");;
- "yes");;
- *) AC_MSG_ERROR([[invalid argument --enable-prere=$enableval... stopping]]);;
- esac
- ],
- [enable_prere="no"]
- )
- #
- # warn
- #
- AC_ARG_ENABLE(
- [warn],
- AC_HELP_STRING(
- [--enable-warn@<:@=ARG@:>@],
- [
- Compiles with warnings. (disabled by default)
- (available options: yes, no, extra)
- ]
- ),
- [
- enable_warn="$enableval"
- case $enableval in
- "no");;
- "yes");;
- "extra");;
- *) AC_MSG_ERROR([[invalid argument --enable-warn=$enableval... stopping]]);;
- esac
- ],
- [enable_warn="no"]
- )
- #
- # Buildbot
- #
- AC_ARG_ENABLE(
- [buildbot],
- AC_HELP_STRING(
- [--enable-buildbot@<:@=ARG@:>@],
- [(available options: yes, no)]
- ),
- [
- enable_buildbot="$enableval"
- case $enableval in
- "no");;
- "yes");;
- *) AC_MSG_ERROR([[invalid argument --enable-buildbot=$enableval... stopping]]);;
- esac
- ],
- [enable_buildbot="no"]
- )
- #
- # RDTSC as Tick Source
- #
- AC_ARG_ENABLE(
- [rdtsc],
- AC_HELP_STRING(
- [--enable-rdtsc],
- [
- Uses rdtsc as timing source (disabled by default)
- Enable it when you've timing issues.
- (For example: in conjunction with XEN or Other Virtualization mechanisms)
- Note:
- Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
- (On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual
- how to disable it)
- ]
- ),
- [
- enable_rdtsc=1
- ],
- [enable_rdtsc=0]
- )
- #
- # Profiler
- #
- AC_ARG_ENABLE(
- [profiler],
- AC_HELP_STRING(
- [--enable-profiler=ARG],
- [Profilers: no, gprof (disabled by default)]
- ),
- [
- enable_profiler="$enableval"
- case $enableval in
- "no");;
- "gprof");;
- *) AC_MSG_ERROR([[invalid argument --enable-profiler=$enableval... stopping]]);;
- esac
- ],
- [enable_profiler="no"]
- )
- #
- # 64bit
- #
- AC_ARG_ENABLE(
- [64bit],
- AC_HELP_STRING(
- [--disable-64bit],
- [
- Enforce 32bit output on x86_64 systems.
- ]
- ),
- [
- enable_64bit="$enableval"
- case $enableval in
- "no");;
- "yes");;
- *) AC_MSG_ERROR([[invalid argument --enable-64bit=$enableval... stopping]]);;
- esac
- ],
- [enable_64bit="yes"]
- )
- #
- # LTO
- #
- AC_ARG_ENABLE(
- [lto],
- AC_HELP_STRING(
- [--enable-lto],
- [
- Enables or Disables Linktime Code Optimization (LTO is enabled by default)
- ]
- ),
- [
- enable_lto="$enableval"
- case $enableval in
- "no");;
- "yes");;
- *) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);;
- esac
- ],
- [enable_lto="yes"]
- )
- #
- # Optionally set the max number of network conenctions
- # the core will be support
- #
- AC_ARG_WITH(
- [maxconn],
- AC_HELP_STRING(
- [--with-maxconn@<:@=ARG@:>@],
- [optionally set the maximum connections the core can handle (default: 16384) NOT USED YET - EXPERIMENTAL]
- ),
- [
- if test "$withval" == "no"; then
- CFLAGS="$CFLAGS -DMAXCONN=16384"
- else
- if ! test "$withval" -ge 0 -o "$withval" -lt 0 2>&- ; then
- AC_MSG_ERROR([Invalid argument --with-maxconn=$withval ... stopping])
- else
- CFLAGS="$CFLAGS -DMAXCONN=$withval"
- fi
- fi
- ],
- [
- CFLAGS="$CFLAGS -DMAXCONN=16384"
- ]
- )
- #
- # output bin name
- #
- AC_ARG_WITH(
- [outputlogin],
- AC_HELP_STRING(
- [--with-outputlogin@<:@=ARG@:>@],
- [Specify the login-serv output name (defaults to login-server)]
- ),
- [output_login="$withval"],
- [output_login="login-server"]
- )
- AC_SUBST([OLOG],$output_login)
- AC_ARG_WITH(
- [outputchar],
- AC_HELP_STRING(
- [--with-outputchar@<:@=ARG@:>@],
- [Specify the char-serv output name (defaults to char-server)]
- ),
- [output_char="$withval"],
- [output_char="char-server"]
- )
- AC_SUBST([OCHR],$output_char)
- AC_ARG_WITH(
- [outputmap],
- AC_HELP_STRING(
- [--with-outputmap@<:@=ARG@:>@],
- [Specify the map-serv output name (defaults to map-server)]
- ),
- [output_map="$withval"],
- [output_map="map-server"]
- )
- AC_SUBST([OMAP],$output_map)
- #
- # Optionally specify the path to mysql_config
- #
- AC_ARG_WITH(
- [mysql],
- AC_HELP_STRING(
- [--with-mysql@<:@=ARG@:>@],
- [optionally specify the path to the mysql_config executable]
- ),
- [
- if test "$withval" != "no" ; then
- if test ! -x "$withval" ; then
- AC_MSG_ERROR([$withval is not an executable file])
- fi
- MYSQL_CONFIG_HOME="$withval"
- fi
- ]
- )
- #
- # Manual MYSQL_CFLAGS (optional)
- #
- AC_ARG_WITH(
- [MYSQL_CFLAGS],
- AC_HELP_STRING(
- [--with-MYSQL_CFLAGS=ARG],
- [specify MYSQL_CFLAGS manually (instead of using "mysql_config --include")]
- ),
- [
- manual_MYSQL_CFLAGS="yes"
- MYSQL_CFLAGS="$withval"
- ],
- [manual_MYSQL_CFLAGS="no"]
- )
- #
- # Manual MYSQL_LIBS (optional)
- #
- AC_ARG_WITH(
- [MYSQL_LIBS],
- AC_HELP_STRING(
- [--with-MYSQL_LIBS=ARG],
- [specify MYSQL_LIBS manually (instead of using "mysql_config --libs")]
- ),
- [
- manual_MYSQL_LIBS="yes"
- MYSQL_LIBS="$withval"
- ],
- [manual_MYSQL_LIBS="no"]
- )
- #
- # Enable/disable PCRE and optionally specify the path (optional library)
- #
- AC_ARG_WITH(
- [pcre],
- AC_HELP_STRING(
- [--with-pcre@<:@=ARG@:>@],
- [use PCRE library, optionally specify the full path of pcre installation directory (by default pcre is used if found)]
- ),
- [
- if test "$withval" = "no" ; then
- want_pcre="no"
- else
- want_pcre="yes"
- require_pcre="yes"
- if test "$withval" != "yes" ; then
- if test ! -d "$withval" ; then
- AC_MSG_ERROR([$withval is not a directoy])
- fi
- PCRE_HOME="$withval"
- fi
- fi
- ],
- [want_pcre="yes" require_pcre="no"]
- )
- #
- # Specify the path of the zlib library (required library)
- #
- AC_ARG_WITH(
- [zlib],
- AC_HELP_STRING(
- [--with-zlib=DIR],
- [root directory path of zlib installation (defaults to /usr/local or /usr if not found in /usr/local).
- Assumes that the header files are in DIR/include and the library files are in DIR/lib]
- ),
- [
- test -n "$withval" && ZLIB_HOME="$withval"
- ],
- [
- ZLIB_HOME=/usr/local
- test ! -f "${ZLIB_HOME}/include/zlib.h" && ZLIB_HOME=/usr
- ]
- )
- ###############################################################################
- # Check for programs and types.
- #
- AC_PROG_MAKE_SET
- AC_PROG_CC
- AC_PROG_CPP
- AC_PATH_PROG(AR, ar)
- AC_LANG([C])
- CFLAGS="$CFLAGS -pipe -ffast-math -Wall"
- CPPFLAGS="$CPPFLAGS -I../common"
- AC_C_BIGENDIAN(
- [AC_MSG_ERROR([[bigendian is not supported... stopping]])],
- ,
- [AC_MSG_WARN([[unable to determine endianess, only little endian is supported]])]
- )
- if test "$enable_64bit" = "no" ; then
- AC_MSG_CHECKING([whether pointers can be stored in ints (old code)])
- pointers_fit_in_ints="no"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[static int test_array[((long int)sizeof(int)) == ((long int)sizeof(void*)) ? 1 : -1];]])],
- [pointers_fit_in_ints="yes"],
- []
- )
- if test "$pointers_fit_in_ints" = "no" ; then
- CFLAGS="$CFLAGS -m32"
- LDFLAGS="$LDFLAGS -m32"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[static int test_array[((long int)sizeof(int)) == ((long int)sizeof(void *)) ? 1 : -1];]])],
- [pointers_fit_in_ints="yes (with -m32)"],
- []
- )
- fi
- AC_MSG_RESULT($pointers_fit_in_ints)
- if test "$pointers_fit_in_ints" = "no" ; then
- AC_MSG_ERROR([pointers cannot be stored in ints, required for old code... stopping])
- fi
- fi
- #
- # check if we're producing 32bit code - so well produce binarys for at least i686 (speedup: cmovs, and cmpchg8 support)
- #
- AC_MSG_CHECKING([whether $CC produces 32bit code])
- AC_RUN_IFELSE(
- [
- int main(int argc, char **argv){
- if(sizeof(void*) == 4) return 0;
- else return 1;
- }
- ],
- [
- AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -march=i686"
- LDFLAGS="$LDFLAGS -march=i686"
- ],
- [
- AC_MSG_RESULT([no])
- ],
- [
- AC_MSG_RESULT([guessing no])
- ]
- )
- #
- # Check if CC supports __thread attribute (Thread Local Storage)
- # (Usually our OSX friends 're lacking support of it in older llvm versions ..)
- #
- AC_MSG_CHECKING([whether $CC supports __thread specifier (TLS)])
- AC_RUN_IFELSE(
- [
- __thread int g_Test = -1;
- int main(int argc, char **argv){
- g_Test = 0;
- return g_Test;
- }
- ],
- [
- AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -DHAS_TLS"
- ],
- [
- AC_MSG_RESULT([no])
- ]
- )
- AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Wno-unused-parameter"
- AC_COMPILE_IFELSE(
- [int foo;],
- [AC_MSG_RESULT([no])],
- [
- AC_MSG_RESULT([yes])
- PROD_WARN="$PROD_WARN -Wno-unused-parameter"
- ]
- )
- CFLAGS="$OLD_CFLAGS"
- #
- # LTO Support test
- #
- if test "$enable_lto" != "no" ; then
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -flto"
- OLD_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -flto"
- AC_MSG_CHECKING([whether $CC supports -flto])
- AC_RUN_IFELSE(
- [
- int main(int argc, char **argv){
- return 0;
- }
- ],
- [
- AC_MSG_RESULT([yes])
- ],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
- LDFLAGS="$OLD_LDFLAGS"
- ],
- [
- AC_MSG_RESULT([guessing no])
- ]
- )
- fi
- AC_MSG_CHECKING([whether $CC supports -Wno-pointer-sign])
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Wno-pointer-sign"
- AC_COMPILE_IFELSE(
- [int foo;],
- [
- AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([whether $CC can actually use -Wno-pointer-sign])
- # This option causes warnings in C++ mode
- # Note: -Werror must be before -Wno-pointer-sign, otherwise it does not do anything
- CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign"
- AC_COMPILE_IFELSE(
- [int foo;],
- [
- AC_MSG_RESULT([yes])
- PROD_WARN="$PROD_WARN -Wno-pointer-sign"
- ],
- [
- AC_MSG_RESULT([no])
- ]
- )
- ],
- [
- AC_MSG_RESULT([no])
- ]
- )
- CFLAGS="$OLD_CFLAGS"
- AC_MSG_CHECKING([whether $CC supports -Wno-switch])
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Wno-switch"
- AC_COMPILE_IFELSE(
- [int foo;],
- [ AC_MSG_RESULT([yes])
- ],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
- ]
- )
- AC_MSG_CHECKING([whether $CC supports -fPIC])
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -fPIC"
- AC_COMPILE_IFELSE(
- [int foo;],
- [
- AC_MSG_RESULT([yes])
- compiler_supports_pic="yes"
- ],
- [
- AC_MSG_RESULT([no])
- compiler_supports_pic="no"
- ]
- )
- CFLAGS="$OLD_CFLAGS"
- #
- # -O2 implies -fstrict-aliasing, but the code is not safe for that
- #
- AC_MSG_CHECKING([whether $CC supports -fno-strict-aliasing])
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -fno-strict-aliasing"
- AC_COMPILE_IFELSE(
- [int foo;],
- [AC_MSG_RESULT([yes])],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
- ]
- )
- #
- # check if support conversion check
- #
- AC_MSG_CHECKING([whether $CC supports -Wconversion])
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Wconversion"
- AC_COMPILE_IFELSE(
- [int foo;],
- [
- AC_MSG_RESULT([yes])
- EXTRA_WARN="-Wconversion"
- ],
- [AC_MSG_RESULT([no])]
- )
- CFLAGS="$OLD_CFLAGS"
- ###############################################################################
- # Check for libraries and header files.
- #
- #
- # setrlimit - used to set the socket limit
- #
- AC_CHECK_FUNC([setrlimit],[CFLAGS="$CFLAGS -DHAVE_SETRLIMIT"])
- #
- # strnlen - string length with upper scan bound
- #
- AC_CHECK_FUNC([strnlen],[CFLAGS="$CFLAGS -DHAVE_STRNLEN"])
- # libconfig
- AC_CHECK_FUNCS([uselocale])
- AC_CHECK_FUNCS([newlocale])
- AC_CHECK_FUNCS([freelocale])
- AC_CHECK_HEADERS([xlocale.h])
- #
- # Memory manager
- #
- case $enable_manager in
- "no")
- CFLAGS="$CFLAGS -DNO_MEMMGR"
- ;;
- "builtin")
- # enabled by default
- ;;
- "memwatch")
- CFLAGS="$CFLAGS -DMEMWATCH"
- AC_CHECK_HEADER([memwatch.h], , [AC_MSG_ERROR([memwatch header not found... stopping])])
- ;;
- "dmalloc")
- CFLAGS="$CFLAGS -DDMALLOC -DDMALLOC_FUNC_CHECK"
- LIBS="$LIBS -ldmalloc"
- AC_CHECK_HEADER([dmalloc.h], , [AC_MSG_ERROR([dmalloc header not found... stopping])])
- ;;
- "gcollect")
- CFLAGS="$CFLAGS -DGCOLLECT"
- LIBS="$LIBS -lgc"
- AC_CHECK_HEADER([gc.h], , [AC_MSG_ERROR([gcollect header not found... stopping])])
- ;;
- "bcheck")
- CFLAGS="$CFLAGS -DBCHECK"
- ;;
- esac
- #
- # Packetver
- #
- if test -n "$enable_packetver" ; then
- CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
- fi
- #
- # Debug
- #
- case $enable_debug in
- "no")
- # default value
- CFLAGS="$CFLAGS"
- ;;
- "yes")
- CFLAGS="$CFLAGS -g -DDEBUG"
- LDFLAGS="$LDFLAGS -g"
- ;;
- "gdb")
- CFLAGS="$CFLAGS -ggdb -DDEBUG"
- LDFLAGS="$LDFLAGS -g"
- ;;
- esac
- #
- # Renewal
- #
- case $enable_prere in
- "no")
- # default value
- CFLAGS="$CFLAGS"
- ;;
- "yes")
- CFLAGS="$CFLAGS -DPRERE"
- ;;
- esac
- #
- # Warnings
- #
- case $enable_warn in
- "no") #default
- CFLAGS="$CFLAGS $PROD_WARN"
- ;;
- "yes")
- CFLAGS="$CFLAGS"
- ;;
- "extra")
- CFLAGS="$CFLAGS $EXTRA_WARN"
- ;;
- esac
- #
- # Buildbot
- #
- case $enable_buildbot in
- "no")
- # default value
- ;;
- "yes")
- CFLAGS="$CFLAGS -DBUILDBOT"
- ;;
- esac
- #
- # RDTSC
- #
- case $enable_rdtsc in
- 0)
- #default value
- ;;
- 1)
- CFLAGS="$CFLAGS -DENABLE_RDTSC"
- ;;
- esac
- #
- # Profiler
- #
- case $enable_profiler in
- "no")
- # default value
- ;;
- "gprof")
- CFLAGS="$CFLAGS -pg"
- LDFLAGS="$LDFLAGS -pg"
- ;;
- esac
- #
- # zlib library (required)
- #
- if test -n "${ZLIB_HOME}" ; then
- LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
- CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
- fi
- AC_CHECK_LIB([z], [inflateEnd], [],[AC_MSG_ERROR([zlib library not found or incompatible, please specify the correct path with --with-zlib=DIR... stopping])])
- AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([zlib header not found, please specify the correct path with --with-zlib=DIR... stopping])])
- #
- # math library (required)
- #
- AC_SEARCH_LIBS([sqrt], [m], [], [AC_MSG_ERROR([math library not found... stopping])])
- #
- # clock_gettime (optional, rt on Debian)
- #
- AC_SEARCH_LIBS([clock_gettime], [rt])
- #
- # CLOCK_MONOTONIC clock for clock_gettime
- # Normally defines _POSIX_TIMERS > 0 and _POSIX_MONOTONIC_CLOCK (for posix
- # compliant systems) and __FreeBSD_cc_version >= 500005 (for FreeBSD
- # >= 5.1.0, which does not have the posix defines (ref. r11983)) would be
- # checked but some systems define them even when they do not support it
- # (ref. bugreport:1003).
- #
- if test "$ac_cv_search_clock_gettime" != "no" ; then
- AC_MSG_CHECKING([whether CLOCK_MONOTONIC is supported and works])
- AC_RUN_IFELSE(
- [
- #include <sys/time.h>
- #include <time.h>
- #include <unistd.h>
- int main(int argc, char** argv)
- {
- struct timespec tval;
- return clock_gettime(CLOCK_MONOTONIC, &tval);
- }
- ],
- [
- AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -DHAVE_MONOTONIC_CLOCK"
- ],
- [
- # either it failed to compile (CLOCK_MONOTONIC undefined)
- # or clock_gettime has returned a non-zero value
- AC_MSG_RESULT([no])
- ],
- [
- AC_MSG_RESULT([guessing no])
- ]
- )
- fi
- #
- # pthread
- #
- AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
- AC_CHECK_LIB([pthread], [pthread_sigmask], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
- AC_CHECK_LIB([pthread], [pthread_attr_init], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
- AC_CHECK_LIB([pthread], [pthread_attr_setstacksize], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
- AC_CHECK_LIB([pthread], [pthread_attr_destroy], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
- AC_CHECK_LIB([pthread], [pthread_cancel], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
- AC_CHECK_LIB([pthread], [pthread_join], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
- LDFLAGS="$LDFLAGS -lpthread"
- #
- # MySQL library
- #
- if test -z "$MYSQL_CONFIG_HOME"; then
- AC_PATH_PROG([MYSQL_CONFIG_HOME], [mysql_config], [no])
- fi
- if test "$MYSQL_CONFIG_HOME" != "no" ; then
- MYSQL_VERSION="`$MYSQL_CONFIG_HOME --version`"
- if test "$manual_MYSQL_CFLAGS" = "no" ; then
- MYSQL_CFLAGS="`$MYSQL_CONFIG_HOME --include`"
- fi
- if test "$manual_MYSQL_LIBS" = "no" ; then
- MYSQL_LIBS="`$MYSQL_CONFIG_HOME --libs`"
- fi
- else
- MYSQL_VERSION="unknown"
- fi
- MYSQL_OLD_LDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS $MYSQL_LIBS"
- MYSQL_OLD_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS"
- AC_CHECK_LIB([mysqlclient], [mysql_init], [HAVE_MYSQL="yes"], [])
- AC_CHECK_HEADER([mysql.h], [], [HAVE_MYSQL=""])
- CPPFLAGS="$MYSQL_OLD_CPPFLAGS"
- LDFLAGS="$MYSQL_OLD_LDFLAGS"
- AC_MSG_CHECKING([MySQL library (required)])
- if test "$HAVE_MYSQL" = "yes" ; then
- AC_MSG_RESULT([yes ($MYSQL_VERSION)])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([MySQL not found or incompatible])
- fi
- AC_SUBST([HAVE_MYSQL])
- AC_SUBST([MYSQL_VERSION])
- AC_SUBST([MYSQL_CFLAGS])
- AC_SUBST([MYSQL_LIBS])
- #
- # PCRE library (optional)
- #
- PCRE_LIBS=""
- PCRE_CFLAGS=""
- if test "$want_pcre" = "no" ; then
- AC_MSG_NOTICE([ignoring PCRE (optional)])
- else
- host_os="`uname`"
- if test "$host_os" = "FreeBSD" ; then
- if test -z "$PCRE_HOME" ; then PCRE_HOME="/usr/local"; fi
- fi
- if test -z "$PCRE_HOME" ; then
- AC_SEARCH_LIBS([pcre_study], [pcre], [HAVE_PCRE="yes"], [])
- if test "$HAVE_PCRE" = "yes" ; then
- PCRE_LIBS="-lpcre"
- fi
- else
- PCRE_OLD_LDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$PCRE_HOME/lib"
- PCRE_OLD_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$PCRE_HOME/include"
- AC_CHECK_LIB(pcre, pcre_compile, [HAVE_PCRE="yes"], [])
- CPPFLAGS="$PCRE_OLD_CPPFLAGS"
- LDFLAGS="$PCRE_OLD_LDFLAGS"
- if test "$HAVE_PCRE" = "yes" ; then
- PCRE_LIBS="-L$PCRE_HOME/lib -lpcre"
- test -d "$PCRE_HOME/include" && PCRE_CFLAGS="-I$PCRE_HOME/include"
- fi
- fi
- AC_MSG_CHECKING([PCRE library (optional)])
- if test "$HAVE_PCRE" = "yes" ; then
- PCRE_VERSION="`pcre-config --version`"
- AC_MSG_RESULT([yes ($PCRE_VERSION)])
- else
- AC_MSG_RESULT([no])
- if test "$require_pcre" = "yes" ; then
- AC_MSG_ERROR([PCRE not found or incompatible (requested)])
- else
- AC_MSG_NOTICE([disabling PCRE (optional)])
- fi
- fi
- fi
- AC_SUBST([HAVE_PCRE])
- AC_SUBST([PCRE_VERSION])
- AC_SUBST([PCRE_LIBS])
- AC_SUBST([PCRE_CFLAGS])
- #
- # Host specific stuff
- #
- AC_MSG_CHECKING([host OS])
- host_os="`uname`"
- AC_MSG_RESULT([$host_os])
- fd_setsize=""
- DLLEXT=".so"
- case $host_os in
- Solaris* )
- LIBS="$LIBS -lsocket -lnsl -ldl"
- ;;
- Linux* )
- LIBS="$LIBS -ldl"
- ;;
- FreeBSD*)
- CPPFLAGS="$CPPFLAGS -D__FREEBSD__"
- ;;
- NetBSD*)
- CPPFLAGS="$CPPFLAGS -D__NETBSD__"
- ;;
- CYGWIN*)
- CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=4096 -DCYGWIN"
- fd_setsize="done"
- DLLEXT=".dll"
- ;;
- esac
- AC_SUBST([DLLEXT])
- AC_MSG_CHECKING([for MinGW])
- if test -n "`$CC --version | grep -i mingw`" ; then
- AC_MSG_RESULT([yes])
- CPPFLAGS="$CPPFLAGS -DMINGW"
- if test -z "$fd_setsize" ; then
- CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=4096"
- fi
- LIBS="$LIBS -lws2_32"
- else
- AC_MSG_RESULT([no])
- fi
- AC_MSG_NOTICE([Configure finish, CFLAGS= $CFLAGS])
- AC_MSG_NOTICE([LDFLAGS=$LDFLAGS])
- #AC_MSG_NOTICE([PROD_WARN= $PROD_WARN])
- #AC_MSG_NOTICE([EXTRA_WARN= $EXTRA_WARN])
- AC_MSG_NOTICE([output name = $output_login, $output_char, $output_map])
- ###############################################################################
- AC_OUTPUT
|