Imported Upstream version 1.10
[platform/upstream/gdbm.git] / configure.ac
1 # This file is part of GDBM.                                   -*- autoconf -*-
2 # Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc.
3 #
4 # GDBM is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # GDBM is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with GDBM. If not, see <http://www.gnu.org/licenses/>. */
16
17 m4_define([_GDBM_VERSION_MAJOR], 1)
18 m4_define([_GDBM_VERSION_MINOR], 10)
19 dnl m4_define([_GDBM_VERSION_PATCH], 90)
20
21 AC_INIT([gdbm],
22         _GDBM_VERSION_MAJOR._GDBM_VERSION_MINOR[]m4_ifdef([_GDBM_VERSION_PATCH],._GDBM_VERSION_PATCH),
23         [bug-gdbm@gnu.org])
24 AC_PREREQ(2.63)
25 AC_CONFIG_SRCDIR([src/gdbmdefs.h])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_HEADERS([autoconf.h])
28 AC_CONFIG_MACRO_DIR([m4])
29 AM_INIT_AUTOMAKE([gnits 1.11 std-options silent-rules])
30
31 # Enable silent rules by default:
32 AM_SILENT_RULES([yes])
33
34 AC_SUBST([GDBM_VERSION_MAJOR], _GDBM_VERSION_MAJOR)
35 AC_SUBST([GDBM_VERSION_MINOR], _GDBM_VERSION_MINOR)
36 AC_SUBST([GDBM_VERSION_PATCH], m4_ifdef([_GDBM_VERSION_PATCH],_GDBM_VERSION_PATCH,0))
37
38 AC_ARG_ENABLE([memory-mapped-io],
39   AC_HELP_STRING(
40     [--enable-memory-mapped-io]
41     [Use mmap(2) for disk I/O. (Default is YES.)]),
42     [mapped_io=$enableval],
43     [mapped_io=yes])
44
45 AC_ARG_ENABLE([libgdbm-compat],
46   AC_HELP_STRING(
47     [--enable-libgdbm-compat]
48     [Build and install libgdbm_compat. (Default is NO.)]),
49     [want_compat=$enableval],
50     [want_compat=no])
51
52 AC_ARG_ENABLE([gdbm-export],
53   AC_HELP_STRING(
54     [--enable-gdbm-export],
55     [Build and install gdbmexport with specified gdbm 1.8 library. (Default is NO.)]),
56     [want_export=$enableval],
57     [want_export=no])
58
59 AC_ARG_WITH([gdbm183-library],
60   AC_HELP_STRING(
61     [--with-gdbm183-library],
62     [Build gdbmexport with specified (static) library.]),
63     [GDBM183_LIBRARY=$withval],
64     [GDBM183_LIBRARY="-lgdbm"])
65
66 AC_ARG_WITH([gdbm183-libdir],
67   AC_HELP_STRING(
68     [--with-gdbm183-libdir],
69     [Build gdbmexport with the gdbm library in the specified directory.]),
70     [GDBM183_LIBDIR=$withval],
71     [GDBM183_LIBDIR="/usr/local/lib"])
72
73 AC_ARG_WITH([gdbm183-includedir],
74   AC_HELP_STRING(
75     [--with-gdbm183-includedir],
76     [Build gdbmexport with gdbm.h in the specified directory.]),
77     [GDBM183_INCLUDEDIR=$withval],
78     [GDBM183_INCLUDEDIR="/usr/local/include"])
79     
80 dnl Check for programs
81 AC_PROG_CC
82 AC_PROG_CPP
83 AC_PROG_INSTALL
84 AC_PROG_LIBTOOL
85 AC_SYS_LARGEFILE
86 dnl AC_PROG_RANLIB
87 dnl AC_C_BIGENDIAN([])
88 AC_C_CONST
89
90 dnl Internationalization macros.
91 AM_GNU_GETTEXT([external], [need-ngettext])
92 AM_GNU_GETTEXT_VERSION(0.18)
93
94 AC_CHECK_HEADERS([stdlib.h string.h sys/file.h unistd.h fcntl.h sys/types.h memory.h sys/termios.h locale.h])
95
96 AC_CHECK_LIB(dbm, main)
97 AC_CHECK_LIB(ndbm, main)
98 AC_CHECK_FUNCS([rename ftruncate flock lockf fsync setlocale])
99
100 if test x$mapped_io = xyes
101 then
102   AC_FUNC_MMAP()
103   AC_CHECK_FUNCS([msync])
104 fi
105 AC_TYPE_OFF_T
106 AC_CHECK_SIZEOF(off_t)
107 AC_CHECK_MEMBERS([struct stat.st_blksize])
108
109 AC_SUBST(GDBM183_LIBRARY)
110 AC_SUBST(GDBM183_LIBDIR)
111 AC_SUBST(GDBM183_INCLUDEDIR)
112 AM_CONDITIONAL([COMPAT_OPT], [test "$want_compat" = yes])
113 AM_CONDITIONAL([ENABLE_EXPORT], [test "$want_export" = yes])
114
115 # Initialize the test suite.
116 AC_CONFIG_TESTDIR(tests)
117 AC_CONFIG_FILES([tests/Makefile tests/atlocal po/Makefile.in])
118 AM_MISSING_PROG([AUTOM4TE], [autom4te])
119
120 AC_CONFIG_FILES([Makefile
121                  src/Makefile
122                  src/gdbm.h
123                  doc/Makefile
124                  compat/Makefile
125                  export/Makefile])
126 AC_OUTPUT