1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
# Copyright (C) 2011-2012,2019 G.P. Halkes
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
EXTENSIONS="c libtool pkgconfig verbose_compile gettext lfs"
LTSHARED=1
INSTALLDIRS="libdir docdir includedir"
DEFAULT_LINGUAS=nl
config() {
has_support_c99
clean_c
cat > .config.c <<EOF
#include <inttypes.h>
#include <stdint.h>
int main(int argc, char *argv[]) {
intmax_t value = strtoimax("123", (char *)0, 0);
int64_t value64 = value;
return 0;
}
EOF
test_link "integer types from C99"
clean_c
cat > .config.c <<EOF
#include <string.h>
int main(int argc, char *argv[]) {
strdup(argv[0]);
return 0;
}
EOF
test_link "strdup" && CONFIGFLAGS="${CONFIGFLAGS} -DHAS_STRDUP"
clean_c
cat > .config.c <<EOF
#include <locale.h>
int main(int argc, char *argv[]) {
locale_t c_locale = newlocale(LC_ALL, "C", (locale_t) 0);
uselocale(c_locale);
freelocale(c_locale);
return 0;
}
EOF
if test_link "newlocale/uselocale/freelocale in locale.h" ; then
CONFIGFLAGS="${CONFIGFLAGS} -DHAS_USELOCALE"
else
clean_c
cat > .config.c <<EOF
#include <locale.h>
#include <xlocale.h>
int main(int argc, char *argv[]) {
locale_t c_locale = newlocale(LC_ALL, "C", (locale_t) 0);
uselocale(c_locale);
freelocale(c_locale);
return 0;
}
EOF
test_link "newlocale/uselocale/freelocale in xlocale.h" && CONFIGFLAGS="${CONFIGFLAGS} -DHAS_USELOCALE -DUSE_XLOCALE_H"
fi
cat > .config.c <<EOF
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pwd.h>
int main(int argc, char *argv[]) {
char name[] = "testXXXXXX";
int fd;
FILE *file;
struct passwd pw;
struct passwd *pw_addr;
fd = mkstemp(name);
file = fdopen(fd, "w");
fd = fileno(file);
fsync(fd);
close(fd);
unlink(name);
mkdir(name, 755);
fd = EEXIST;
fd = ENOENT;
getpwuid_r(getuid(), &pw, NULL, 0, &pw_addr);
return 0;
}
EOF
if not test_link "POSIX file handling and user database functions" ; then
check_message_result "!! POSIX file handling and/or user database functions are not available (see config.log for details)."
check_message_result "!! This build will NOT provide the safe write or XDG Base Directory functions."
CONFIGFLAGS="${CONFIGFLAGS} -DNO_XDG"
fi
PKGCONFIG_DESC="Configuration file library"
PKGCONFIG_VERSION="1.0.0"
PKGCONFIG_URL="http://os.ghalkes.nl/t3/libt3config.html"
PKGCONFIG_CFLAGS="-I\${includedir}/t3/config"
PKGCONFIG_LIBS="-lt3config"
gen_pkgconfig libt3config
create_makefile "CONFIGFLAGS=${CONFIGFLAGS}"
}
|