File: config.pkg

package info (click to toggle)
libt3config 0.2.11-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 524 kB
  • sloc: ansic: 3,753; sh: 828; xml: 172; lex: 87; makefile: 56
file content (108 lines) | stat: -rw-r--r-- 2,778 bytes parent folder | download
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
# Copyright (C) 2011-2012 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() {
	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="0.2.11"
	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}"
}