Detect posix_fallocate at configure time

Testing feature macros is not enough for uclibc. Fixes build of the built-in
sqlite3 with uclibc <= 0.9.33.2. Later versions will have posix_fallocate().

Change-Id: I918a52777ac63624635802221effc6b86fa2269c
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
Fatih Aşıcı 2013-11-11 17:04:46 +02:00 committed by The Qt Project
parent 2e7a90bac1
commit 1b07e4e315
4 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <fcntl.h>
int main(int, char **)
{
return ::posix_fallocate(0, 0, 0);
}

View File

@ -0,0 +1,2 @@
SOURCES = posix_fallocate.cpp
CONFIG -= qt dylib

14
configure vendored
View File

@ -686,6 +686,7 @@ CFG_MIPS_DSP=auto
CFG_MIPS_DSPR2=auto
CFG_CLOCK_GETTIME=auto
CFG_CLOCK_MONOTONIC=auto
CFG_POSIX_FALLOCATE=auto
CFG_MREMAP=auto
CFG_GETADDRINFO=auto
CFG_IPV6IFNAME=auto
@ -5440,6 +5441,15 @@ elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
CFG_CLOCK_MONOTONIC=no
fi
# detect posix_fallocate
if [ "$CFG_POSIX_FALLOCATE" = "auto" ]; then
if compileTest unix/posix_fallocate "posix_fallocate"; then
CFG_POSIX_FALLOCATE=yes
else
CFG_POSIX_FALLOCATE=no
fi
fi
# detect mremap
if [ "$CFG_MREMAP" = "auto" ]; then
if compileTest unix/mremap "mremap"; then
@ -5764,6 +5774,9 @@ fi
if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
QT_CONFIG="$QT_CONFIG clock-monotonic"
fi
if [ "$CFG_POSIX_FALLOCATE" = "yes" ]; then
QT_CONFIG="$QT_CONFIG posix_fallocate"
fi
if [ "$CFG_MREMAP" = "yes" ]; then
QT_CONFIG="$QT_CONFIG mremap"
fi
@ -6243,6 +6256,7 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
[ "$CFG_GLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
[ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
[ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
[ "$CFG_POSIX_FALLOCATE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_POSIX_FALLOCATE"
[ "$CFG_MREMAP" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
[ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
[ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"

View File

@ -1,6 +1,7 @@
CONFIG(release, debug|release):DEFINES *= NDEBUG
DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE
!contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS
contains(QT_CONFIG, posix_fallocate):DEFINES += HAVE_POSIX_FALLOCATE=1
winrt: DEFINES += SQLITE_OS_WINRT
INCLUDEPATH += $$PWD/sqlite
SOURCES += $$PWD/sqlite/sqlite3.c