configure: modernize iconv use

use library objects for all variants, and inline the tests.

Change-Id: I029f9a6655a783dab4a22abf601aadbb484c03af
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2018-07-16 14:10:42 +02:00
parent 98689cd2f9
commit 52934d74be
7 changed files with 42 additions and 127 deletions

View File

@ -1,54 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <iconv.h>
int main(int, char **)
{
iconv_t x = iconv_open("", "");
const char *inp;
char *outp;
size_t inbytes, outbytes;
iconv(x, &inp, &inbytes, &outp, &outbytes);
iconv_close(x);
return 0;
}

View File

@ -1 +0,0 @@
SOURCES = gnu-libiconv.cpp

View File

@ -1,54 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <iconv.h>
int main(int, char **)
{
iconv_t x = iconv_open("", "");
char *inp;
char *outp;
size_t inbytes, outbytes;
iconv(x, &inp, &inbytes, &outp, &outbytes);
iconv_close(x);
return 0;
}

View File

@ -1,2 +0,0 @@
SOURCES = iconv.cpp
mac|mingw|openbsd|qnx|haiku:LIBS += -liconv

View File

@ -1 +0,0 @@
SOURCES = ../gnu-libiconv/gnu-libiconv.cpp

View File

@ -56,8 +56,7 @@ qtConfig(textcodec) {
qtConfig(iconv) { qtConfig(iconv) {
HEADERS += codecs/qiconvcodec_p.h HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp SOURCES += codecs/qiconvcodec.cpp
qtConfig(gnu-libiconv): \ QMAKE_USE_PRIVATE += iconv
QMAKE_USE_PRIVATE += iconv
} }
win32 { win32 {

View File

@ -47,14 +47,52 @@
{ "type": "pkgConfig", "args": "glib-2.0 gthread-2.0" } { "type": "pkgConfig", "args": "glib-2.0 gthread-2.0" }
] ]
}, },
"posix_iconv": {
"label": "POSIX iconv",
"export": "iconv",
"test": {
"main": [
"iconv_t x = iconv_open(\"\", \"\");",
"char *inp, *outp;",
"size_t inbytes, outbytes;",
"iconv(x, &inp, &inbytes, &outp, &outbytes);",
"iconv_close(x);"
]
},
"headers": "iconv.h",
"sources": [
{ "libs": "-liconv", "condition": "config.openbsd || config.haiku" },
{ "libs": "", "condition": "!(config.openbsd || config.haiku)" }
]
},
"gnu_iconv": { "gnu_iconv": {
"label": "GNU libiconv", "label": "GNU libiconv",
"export": "iconv", "export": "iconv",
"test": "gnu-libiconv", "test": {
"main": [
"iconv_t x = iconv_open(\"\", \"\");",
"const char *inp;",
"char *outp;",
"size_t inbytes, outbytes;",
"iconv(x, &inp, &inbytes, &outp, &outbytes);",
"iconv_close(x);"
]
},
"headers": "iconv.h",
"sources": [ "sources": [
"-liconv" "-liconv"
] ]
}, },
"sun_iconv": {
"label": "SUN libiconv",
"export": "iconv",
"test": {
"inherit": "gnu_iconv"
},
"sources": [
""
]
},
"icu": { "icu": {
"label": "ICU", "label": "ICU",
"test": { "test": {
@ -336,16 +374,6 @@
] ]
} }
}, },
"posix-iconv": {
"label": "POSIX iconv",
"type": "compile",
"test": "iconv"
},
"sun-iconv": {
"label": "SUN libiconv",
"type": "compile",
"test": "sun-libiconv"
},
"inotify": { "inotify": {
"label": "inotify", "label": "inotify",
"type": "compile", "type": "compile",
@ -576,14 +604,14 @@
"label": "POSIX iconv", "label": "POSIX iconv",
"enable": "input.iconv == 'posix'", "enable": "input.iconv == 'posix'",
"disable": "input.iconv == 'sun' || input.iconv == 'gnu' || input.iconv == 'no'", "disable": "input.iconv == 'sun' || input.iconv == 'gnu' || input.iconv == 'no'",
"condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && tests.posix-iconv", "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && libs.posix_iconv",
"output": [ "privateFeature" ] "output": [ "privateFeature" ]
}, },
"sun-libiconv": { "sun-libiconv": {
"label": "SUN iconv", "label": "SUN iconv",
"enable": "input.iconv == 'sun'", "enable": "input.iconv == 'sun'",
"disable": "input.iconv == 'posix' || input.iconv == 'gnu' || input.iconv == 'no'", "disable": "input.iconv == 'posix' || input.iconv == 'gnu' || input.iconv == 'no'",
"condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && !features.posix-libiconv && tests.sun-iconv" "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && !features.posix-libiconv && libs.sun_iconv"
}, },
"gnu-libiconv": { "gnu-libiconv": {
"label": "GNU iconv", "label": "GNU iconv",