1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3# scws-1.x.x configure - modified by hightman
4
5AC_PREREQ([2.68])
6AC_INIT([scws], [1.2.3], [http://www.xunsearch.com/scws])
7
8# init automake
9AM_INIT_AUTOMAKE
10
11# copy right
12AC_COPYRIGHT([Copyright (C)2007-2016, hightman
13This package maybe copied, distributed and modified under
14the terms of my License; see COPYING for more details])
15
16# sorce code tree
17#AC_CONFIG_SUBDIRS([libscws cli])
18AC_CONFIG_SRCDIR([cli/gen_dict.c])
19AC_CONFIG_HEADERS([config.h])
20
21# Checks for programs.
22#AC_PROG_AWK
23AC_PROG_CC
24AC_PROG_SED
25AC_PROG_INSTALL
26AC_PROG_LN_S
27AC_PROG_MAKE_SET
28AC_DISABLE_STATIC
29AC_PROG_LIBTOOL
30
31# libtool
32LIBTOOL="$LIBTOOL --preserve-dup-deps"
33AC_SUBST(LIBTOOL)
34
35# libtool compile
36SHARED_LIB_VERSION=2:0:1
37AC_SUBST(SHARED_LIB_VERSION)
38
39# debug mode
40AC_ARG_ENABLE(debug,
41	AC_HELP_STRING([--enable-debug], [Compile with more warnings and debugging symbols]),
42	[
43		enable_debug=yes
44		AC_DEFINE(DEBUG,,[enable debug mode])
45	], [
46		enable_debug=no
47	]
48)
49
50if test "$enable_debug" = "no" ; then
51  tmp_cflags=`echo $CFLAGS | sed 's/-O//g'`
52  if test "$tmp_cflags" = "$CFLAGS"; then  CFLAGS="$CFLAGS -O2"; fi
53else
54  tmp_cflags=`echo $CFLAGS | sed 's/-g//g'`
55  if test "$tmp_cflags" = "$CFLAGS"; then  CFLAGS="$CFLAGS -g"; fi
56fi
57
58# name rule
59AC_ARG_ENABLE(namerule,
60	AC_HELP_STRING([--enable-namerule], [Compile with pepole and road name recognition]),
61	[ AC_DEFINE(HAVE_NAME_RULE, 1,[enable people and road name recognition]) ]
62)
63
64# Checks for libraries.
65AC_CHECK_LIB(m, logf, [], [ AC_MSG_ERROR([math lib not found]) ])
66
67# Checks for header files.
68AC_CHECK_HEADERS([fcntl.h netinet/in.h math.h stdlib.h string.h sys/file.h sys/param.h sys/time.h unistd.h])
69
70# Checks for typedefs, structures, and compiler characteristics.
71AC_C_CONST
72AC_C_INLINE
73AC_HEADER_TIME
74AC_CHECK_SIZEOF(int, 4, [], [ AC_MSG_ERROR(sizeof(int) != 4) ])
75#AC_CHECK_SIZEOF(char *, 4, [], [ AC_MSG_ERROR(sizeof(char *) != 4) ])
76AC_CHECK_SIZEOF(float, 4, [], [ AC_MSG_ERROR(sizeof(float) != 4) ])
77
78# check for struct_flock
79AC_CACHE_CHECK(for struct flock, ac_cv_struct_flock,
80	AC_TRY_COMPILE([
81#include <unistd.h>
82#include <fcntl.h>
83	], [
84		struct flock x;
85	], [
86		AC_DEFINE(HAVE_STRUCT_FLOCK, 1, [whether you have struct flock])
87	], [])
88)
89
90# Checks for library functions.
91AC_FUNC_LSTAT
92AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
93AC_FUNC_MMAP
94AC_FUNC_MEMCMP
95AC_CHECK_FUNCS([flock gettimeofday malloc memset munmap pow realpath strcasecmp strchr strdup strrchr strndup strtok_r])
96
97AC_CONFIG_FILES([Makefile cli/Makefile etc/Makefile libscws/Makefile libscws/version.h])
98AC_OUTPUT
99