Imported Upstream version 1.4.8
This commit is contained in:
parent
6a280f6f24
commit
6dd54dd8e2
352 changed files with 42813 additions and 27251 deletions
607
gl/Makefile.am
Normal file
607
gl/Makefile.am
Normal file
|
@ -0,0 +1,607 @@
|
|||
## DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
# Copyright (C) 2004-2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. As a special exception to the GNU General
|
||||
# Public License, this file may be distributed as part of a program
|
||||
# that contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits
|
||||
|
||||
noinst_HEADERS =
|
||||
noinst_LIBRARIES =
|
||||
noinst_LTLIBRARIES =
|
||||
EXTRA_DIST =
|
||||
BUILT_SOURCES =
|
||||
SUFFIXES =
|
||||
MOSTLYCLEANFILES = core *.stackdump
|
||||
MOSTLYCLEANDIRS =
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
MAINTAINERCLEANFILES =
|
||||
|
||||
AM_CPPFLAGS =
|
||||
|
||||
noinst_LIBRARIES += libgnu.a
|
||||
|
||||
libgnu_a_SOURCES =
|
||||
libgnu_a_LIBADD = $(gl_LIBOBJS)
|
||||
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
|
||||
EXTRA_libgnu_a_SOURCES =
|
||||
|
||||
## begin gnulib module alloca
|
||||
|
||||
|
||||
EXTRA_DIST += alloca.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += alloca.c
|
||||
|
||||
libgnu_a_LIBADD += @ALLOCA@
|
||||
libgnu_a_DEPENDENCIES += @ALLOCA@
|
||||
## end gnulib module alloca
|
||||
|
||||
## begin gnulib module alloca-opt
|
||||
|
||||
BUILT_SOURCES += $(ALLOCA_H)
|
||||
|
||||
# We need the following in order to create <alloca.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
alloca.h: alloca_.h
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/alloca_.h; \
|
||||
} > $@-t
|
||||
mv -f $@-t $@
|
||||
MOSTLYCLEANFILES += alloca.h alloca.h-t
|
||||
|
||||
EXTRA_DIST += alloca_.h
|
||||
|
||||
## end gnulib module alloca-opt
|
||||
|
||||
## begin gnulib module arpa_inet
|
||||
|
||||
BUILT_SOURCES += $(ARPA_INET_H)
|
||||
|
||||
# We need the following in order to create <arpa/inet.h> when the system
|
||||
# doesn't have one.
|
||||
arpa/inet.h:
|
||||
test -d arpa || mkdir arpa
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
echo '#include <sys/socket.h>'; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
|
||||
MOSTLYCLEANDIRS += arpa
|
||||
|
||||
## end gnulib module arpa_inet
|
||||
|
||||
## begin gnulib module c-strtod
|
||||
|
||||
|
||||
EXTRA_DIST += c-strtod.c c-strtod.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += c-strtod.c
|
||||
|
||||
## end gnulib module c-strtod
|
||||
|
||||
## begin gnulib module cloexec
|
||||
|
||||
|
||||
EXTRA_DIST += cloexec.c cloexec.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += cloexec.c
|
||||
|
||||
## end gnulib module cloexec
|
||||
|
||||
## begin gnulib module dirname
|
||||
|
||||
|
||||
EXTRA_DIST += basename.c dirname.c dirname.h stripslash.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += basename.c dirname.c stripslash.c
|
||||
|
||||
## end gnulib module dirname
|
||||
|
||||
## begin gnulib module error
|
||||
|
||||
|
||||
EXTRA_DIST += error.c error.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += error.c
|
||||
|
||||
## end gnulib module error
|
||||
|
||||
## begin gnulib module exit
|
||||
|
||||
libgnu_a_SOURCES += exit.h
|
||||
|
||||
## end gnulib module exit
|
||||
|
||||
## begin gnulib module exitfail
|
||||
|
||||
|
||||
EXTRA_DIST += exitfail.c exitfail.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += exitfail.c
|
||||
|
||||
## end gnulib module exitfail
|
||||
|
||||
## begin gnulib module fcntl-safer
|
||||
|
||||
|
||||
EXTRA_DIST += creat-safer.c fcntl--.h fcntl-safer.h open-safer.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += creat-safer.c open-safer.c
|
||||
|
||||
## end gnulib module fcntl-safer
|
||||
|
||||
## begin gnulib module fsusage
|
||||
|
||||
|
||||
EXTRA_DIST += fsusage.c fsusage.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += fsusage.c
|
||||
|
||||
## end gnulib module fsusage
|
||||
|
||||
## begin gnulib module full-read
|
||||
|
||||
libgnu_a_SOURCES += full-read.h full-read.c
|
||||
|
||||
## end gnulib module full-read
|
||||
|
||||
## begin gnulib module full-write
|
||||
|
||||
libgnu_a_SOURCES += full-write.h full-write.c
|
||||
|
||||
## end gnulib module full-write
|
||||
|
||||
## begin gnulib module getaddrinfo
|
||||
|
||||
|
||||
EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += gai_strerror.c getaddrinfo.c
|
||||
|
||||
## end gnulib module getaddrinfo
|
||||
|
||||
## begin gnulib module gethostname
|
||||
|
||||
|
||||
EXTRA_DIST += gethostname.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += gethostname.c
|
||||
|
||||
## end gnulib module gethostname
|
||||
|
||||
## begin gnulib module getloadavg
|
||||
|
||||
|
||||
EXTRA_DIST += getloadavg.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += getloadavg.c
|
||||
|
||||
## end gnulib module getloadavg
|
||||
|
||||
## begin gnulib module getopt
|
||||
|
||||
BUILT_SOURCES += $(GETOPT_H)
|
||||
|
||||
# We need the following in order to create <getopt.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
getopt.h: getopt_.h
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/getopt_.h; \
|
||||
} > $@-t
|
||||
mv -f $@-t $@
|
||||
MOSTLYCLEANFILES += getopt.h getopt.h-t
|
||||
|
||||
EXTRA_DIST += getopt.c getopt1.c getopt_.h getopt_int.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c
|
||||
|
||||
## end gnulib module getopt
|
||||
|
||||
## begin gnulib module gettext
|
||||
|
||||
# This is for those projects which use "gettextize --intl" to put a source-code
|
||||
# copy of libintl into their package. In such projects, every Makefile.am needs
|
||||
# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory.
|
||||
# For the Makefile.ams in other directories it is the maintainer's
|
||||
# responsibility; for the one from gnulib we do it here.
|
||||
# This option has no effect when the user disables NLS (because then the intl
|
||||
# directory contains no libintl.h file) or when the project does not use
|
||||
# "gettextize --intl".
|
||||
AM_CPPFLAGS += -I$(top_builddir)/intl
|
||||
|
||||
## end gnulib module gettext
|
||||
|
||||
## begin gnulib module gettext-h
|
||||
|
||||
libgnu_a_SOURCES += gettext.h
|
||||
|
||||
## end gnulib module gettext-h
|
||||
|
||||
## begin gnulib module inet_ntop
|
||||
|
||||
|
||||
EXTRA_DIST += inet_ntop.c inet_ntop.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += inet_ntop.c
|
||||
|
||||
## end gnulib module inet_ntop
|
||||
|
||||
## begin gnulib module intprops
|
||||
|
||||
|
||||
EXTRA_DIST += intprops.h
|
||||
|
||||
## end gnulib module intprops
|
||||
|
||||
## begin gnulib module malloc
|
||||
|
||||
|
||||
EXTRA_DIST += malloc.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += malloc.c
|
||||
|
||||
## end gnulib module malloc
|
||||
|
||||
## begin gnulib module mbchar
|
||||
|
||||
|
||||
EXTRA_DIST += mbchar.c mbchar.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += mbchar.c
|
||||
|
||||
## end gnulib module mbchar
|
||||
|
||||
## begin gnulib module mbuiter
|
||||
|
||||
libgnu_a_SOURCES += mbuiter.h
|
||||
|
||||
## end gnulib module mbuiter
|
||||
|
||||
## begin gnulib module memchr
|
||||
|
||||
|
||||
EXTRA_DIST += memchr.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += memchr.c
|
||||
|
||||
## end gnulib module memchr
|
||||
|
||||
## begin gnulib module minmax
|
||||
|
||||
libgnu_a_SOURCES += minmax.h
|
||||
|
||||
## end gnulib module minmax
|
||||
|
||||
## begin gnulib module mountlist
|
||||
|
||||
|
||||
EXTRA_DIST += mountlist.c mountlist.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += mountlist.c
|
||||
|
||||
## end gnulib module mountlist
|
||||
|
||||
## begin gnulib module netinet_in
|
||||
|
||||
BUILT_SOURCES += $(NETINET_IN_H)
|
||||
|
||||
# We need the following in order to create <netinet/in.h> when the system
|
||||
# doesn't have one.
|
||||
netinet/in.h:
|
||||
test -d netinet || mkdir netinet
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
echo '#include <sys/socket.h>'; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
|
||||
MOSTLYCLEANDIRS += netinet
|
||||
|
||||
## end gnulib module netinet_in
|
||||
|
||||
## begin gnulib module regex
|
||||
|
||||
|
||||
EXTRA_DIST += regcomp.c regex.c regex.h regex_internal.c regex_internal.h regexec.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += regcomp.c regex.c regex_internal.c regexec.c
|
||||
|
||||
## end gnulib module regex
|
||||
|
||||
## begin gnulib module safe-read
|
||||
|
||||
|
||||
EXTRA_DIST += safe-read.c safe-read.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += safe-read.c
|
||||
|
||||
## end gnulib module safe-read
|
||||
|
||||
## begin gnulib module safe-write
|
||||
|
||||
|
||||
EXTRA_DIST += safe-write.c safe-write.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += safe-write.c
|
||||
|
||||
## end gnulib module safe-write
|
||||
|
||||
## begin gnulib module size_max
|
||||
|
||||
libgnu_a_SOURCES += size_max.h
|
||||
|
||||
## end gnulib module size_max
|
||||
|
||||
## begin gnulib module snprintf
|
||||
|
||||
|
||||
EXTRA_DIST += snprintf.c snprintf.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += snprintf.c
|
||||
|
||||
## end gnulib module snprintf
|
||||
|
||||
## begin gnulib module stdbool
|
||||
|
||||
BUILT_SOURCES += $(STDBOOL_H)
|
||||
|
||||
# We need the following in order to create <stdbool.h> when the system
|
||||
# doesn't have one that works.
|
||||
stdbool.h: stdbool_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
|
||||
|
||||
EXTRA_DIST += stdbool_.h
|
||||
|
||||
## end gnulib module stdbool
|
||||
|
||||
## begin gnulib module stdint
|
||||
|
||||
BUILT_SOURCES += $(STDINT_H)
|
||||
|
||||
# We need the following in order to create <stdint.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
stdint.h: stdint_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
|
||||
-e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \
|
||||
-e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
|
||||
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
|
||||
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
|
||||
-e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
|
||||
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
|
||||
-e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
|
||||
-e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
|
||||
-e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
|
||||
-e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
|
||||
-e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
|
||||
-e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
|
||||
-e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
|
||||
< $(srcdir)/stdint_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdint.h stdint.h-t
|
||||
|
||||
EXTRA_DIST += stdint_.h
|
||||
|
||||
## end gnulib module stdint
|
||||
|
||||
## begin gnulib module strcase
|
||||
|
||||
|
||||
EXTRA_DIST += strcase.h strcasecmp.c strncasecmp.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += strcasecmp.c strncasecmp.c
|
||||
|
||||
## end gnulib module strcase
|
||||
|
||||
## begin gnulib module strdup
|
||||
|
||||
|
||||
EXTRA_DIST += strdup.c strdup.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += strdup.c
|
||||
|
||||
## end gnulib module strdup
|
||||
|
||||
## begin gnulib module strndup
|
||||
|
||||
|
||||
EXTRA_DIST += strndup.c strndup.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += strndup.c
|
||||
|
||||
## end gnulib module strndup
|
||||
|
||||
## begin gnulib module strnlen
|
||||
|
||||
|
||||
EXTRA_DIST += strnlen.c strnlen.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += strnlen.c
|
||||
|
||||
## end gnulib module strnlen
|
||||
|
||||
## begin gnulib module strnlen1
|
||||
|
||||
libgnu_a_SOURCES += strnlen1.h strnlen1.c
|
||||
|
||||
## end gnulib module strnlen1
|
||||
|
||||
## begin gnulib module sys_socket
|
||||
|
||||
BUILT_SOURCES += $(SYS_SOCKET_H)
|
||||
|
||||
# We need the following in order to create <sys/socket.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
sys/socket.h: socket_.h
|
||||
@MKDIR_P@ sys
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/socket_.h; \
|
||||
} > $@-t
|
||||
mv -f $@-t $@
|
||||
MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
|
||||
MOSTLYCLEANDIRS += sys
|
||||
|
||||
EXTRA_DIST += socket_.h
|
||||
|
||||
## end gnulib module sys_socket
|
||||
|
||||
## begin gnulib module unistd
|
||||
|
||||
BUILT_SOURCES += $(UNISTD_H)
|
||||
|
||||
# We need the following in order to create an empty placeholder for
|
||||
# <unistd.h> when the system doesn't have one.
|
||||
unistd.h: unistd_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''ABSOLUTE_UNISTD_H''@|$(ABSOLUTE_UNISTD_H)|g' \
|
||||
< $(srcdir)/unistd_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += unistd.h unistd.h-t
|
||||
|
||||
EXTRA_DIST += unistd_.h
|
||||
|
||||
## end gnulib module unistd
|
||||
|
||||
## begin gnulib module unistd-safer
|
||||
|
||||
|
||||
EXTRA_DIST += dup-safer.c fd-safer.c pipe-safer.c unistd--.h unistd-safer.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += dup-safer.c fd-safer.c pipe-safer.c
|
||||
|
||||
## end gnulib module unistd-safer
|
||||
|
||||
## begin gnulib module vasnprintf
|
||||
|
||||
|
||||
EXTRA_DIST += asnprintf.c printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
|
||||
|
||||
## end gnulib module vasnprintf
|
||||
|
||||
## begin gnulib module vasprintf
|
||||
|
||||
|
||||
EXTRA_DIST += asprintf.c vasprintf.c vasprintf.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += asprintf.c vasprintf.c
|
||||
|
||||
## end gnulib module vasprintf
|
||||
|
||||
## begin gnulib module vsnprintf
|
||||
|
||||
|
||||
EXTRA_DIST += vsnprintf.c vsnprintf.h
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += vsnprintf.c
|
||||
|
||||
## end gnulib module vsnprintf
|
||||
|
||||
## begin gnulib module wchar
|
||||
|
||||
BUILT_SOURCES += $(WCHAR_H)
|
||||
|
||||
# We need the following in order to create <wchar.h> when the system
|
||||
# version does not work standalone.
|
||||
wchar.h: wchar_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''ABSOLUTE_WCHAR_H''@|$(ABSOLUTE_WCHAR_H)|g' \
|
||||
< $(srcdir)/wchar_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += wchar.h wchar.h-t
|
||||
|
||||
EXTRA_DIST += wchar_.h
|
||||
|
||||
## end gnulib module wchar
|
||||
|
||||
## begin gnulib module wctype
|
||||
|
||||
BUILT_SOURCES += $(WCTYPE_H)
|
||||
|
||||
# We need the following in order to create <wctype.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
wctype.h: wctype_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
|
||||
-e 's|@''ABSOLUTE_WCTYPE_H''@|$(ABSOLUTE_WCTYPE_H)|g' \
|
||||
-e 's/@''HAVE_WCTYPE_CTMP_BUG''@/$(HAVE_WCTYPE_CTMP_BUG)/g' \
|
||||
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
|
||||
< $(srcdir)/wctype_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += wctype.h wctype.h-t
|
||||
|
||||
EXTRA_DIST += wctype_.h
|
||||
|
||||
## end gnulib module wctype
|
||||
|
||||
## begin gnulib module wcwidth
|
||||
|
||||
libgnu_a_SOURCES += wcwidth.h
|
||||
|
||||
## end gnulib module wcwidth
|
||||
|
||||
## begin gnulib module xalloc
|
||||
|
||||
|
||||
EXTRA_DIST += xalloc.h xmalloc.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += xmalloc.c
|
||||
|
||||
## end gnulib module xalloc
|
||||
|
||||
## begin gnulib module xalloc-die
|
||||
|
||||
libgnu_a_SOURCES += xalloc-die.c
|
||||
|
||||
## end gnulib module xalloc-die
|
||||
|
||||
## begin gnulib module xsize
|
||||
|
||||
libgnu_a_SOURCES += xsize.h
|
||||
|
||||
## end gnulib module xsize
|
||||
|
||||
## begin gnulib module xstrndup
|
||||
|
||||
libgnu_a_SOURCES += xstrndup.h xstrndup.c
|
||||
|
||||
## end gnulib module xstrndup
|
||||
|
||||
|
||||
mostlyclean-local: mostlyclean-generic
|
||||
@for dir in '' $(MOSTLYCLEANDIRS); do \
|
||||
if test -n "$$dir" && test -d $$dir; then \
|
||||
echo "rmdir $$dir"; rmdir $$dir; \
|
||||
fi; \
|
||||
done
|
859
gl/Makefile.in
Normal file
859
gl/Makefile.in
Normal file
|
@ -0,0 +1,859 @@
|
|||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
# Copyright (C) 2004-2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. As a special exception to the GNU General
|
||||
# Public License, this file may be distributed as part of a program
|
||||
# that contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf
|
||||
|
||||
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = gl
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in alloca.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
|
||||
$(top_srcdir)/gl/m4/absolute-header.m4 \
|
||||
$(top_srcdir)/gl/m4/alloca.m4 \
|
||||
$(top_srcdir)/gl/m4/arpa_inet_h.m4 \
|
||||
$(top_srcdir)/gl/m4/c-strtod.m4 $(top_srcdir)/gl/m4/cloexec.m4 \
|
||||
$(top_srcdir)/gl/m4/codeset.m4 $(top_srcdir)/gl/m4/dirname.m4 \
|
||||
$(top_srcdir)/gl/m4/dos.m4 \
|
||||
$(top_srcdir)/gl/m4/double-slash-root.m4 \
|
||||
$(top_srcdir)/gl/m4/eoverflow.m4 $(top_srcdir)/gl/m4/error.m4 \
|
||||
$(top_srcdir)/gl/m4/exitfail.m4 \
|
||||
$(top_srcdir)/gl/m4/extensions.m4 \
|
||||
$(top_srcdir)/gl/m4/fcntl-safer.m4 \
|
||||
$(top_srcdir)/gl/m4/fstypename.m4 \
|
||||
$(top_srcdir)/gl/m4/fsusage.m4 \
|
||||
$(top_srcdir)/gl/m4/getaddrinfo.m4 \
|
||||
$(top_srcdir)/gl/m4/gethostname.m4 \
|
||||
$(top_srcdir)/gl/m4/getloadavg.m4 \
|
||||
$(top_srcdir)/gl/m4/getopt.m4 $(top_srcdir)/gl/m4/gettext.m4 \
|
||||
$(top_srcdir)/gl/m4/gnulib-common.m4 \
|
||||
$(top_srcdir)/gl/m4/gnulib-comp.m4 \
|
||||
$(top_srcdir)/gl/m4/iconv.m4 $(top_srcdir)/gl/m4/inet_ntop.m4 \
|
||||
$(top_srcdir)/gl/m4/inline.m4 $(top_srcdir)/gl/m4/intmax_t.m4 \
|
||||
$(top_srcdir)/gl/m4/inttypes_h.m4 \
|
||||
$(top_srcdir)/gl/m4/lib-ld.m4 $(top_srcdir)/gl/m4/lib-link.m4 \
|
||||
$(top_srcdir)/gl/m4/lib-prefix.m4 $(top_srcdir)/gl/m4/lock.m4 \
|
||||
$(top_srcdir)/gl/m4/longdouble.m4 \
|
||||
$(top_srcdir)/gl/m4/longlong.m4 \
|
||||
$(top_srcdir)/gl/m4/ls-mntd-fs.m4 \
|
||||
$(top_srcdir)/gl/m4/mbchar.m4 $(top_srcdir)/gl/m4/mbiter.m4 \
|
||||
$(top_srcdir)/gl/m4/mbrtowc.m4 $(top_srcdir)/gl/m4/memchr.m4 \
|
||||
$(top_srcdir)/gl/m4/minmax.m4 $(top_srcdir)/gl/m4/mountlist.m4 \
|
||||
$(top_srcdir)/gl/m4/netinet_in_h.m4 $(top_srcdir)/gl/m4/nls.m4 \
|
||||
$(top_srcdir)/gl/m4/onceonly_2_57.m4 $(top_srcdir)/gl/m4/po.m4 \
|
||||
$(top_srcdir)/gl/m4/progtest.m4 $(top_srcdir)/gl/m4/regex.m4 \
|
||||
$(top_srcdir)/gl/m4/safe-read.m4 \
|
||||
$(top_srcdir)/gl/m4/safe-write.m4 \
|
||||
$(top_srcdir)/gl/m4/size_max.m4 \
|
||||
$(top_srcdir)/gl/m4/snprintf.m4 $(top_srcdir)/gl/m4/socklen.m4 \
|
||||
$(top_srcdir)/gl/m4/sockpfaf.m4 $(top_srcdir)/gl/m4/ssize_t.m4 \
|
||||
$(top_srcdir)/gl/m4/stdbool.m4 $(top_srcdir)/gl/m4/stdint.m4 \
|
||||
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/strcase.m4 \
|
||||
$(top_srcdir)/gl/m4/strdup.m4 $(top_srcdir)/gl/m4/strndup.m4 \
|
||||
$(top_srcdir)/gl/m4/strnlen.m4 \
|
||||
$(top_srcdir)/gl/m4/sys_socket_h.m4 \
|
||||
$(top_srcdir)/gl/m4/ulonglong.m4 \
|
||||
$(top_srcdir)/gl/m4/unistd-safer.m4 \
|
||||
$(top_srcdir)/gl/m4/unistd_h.m4 \
|
||||
$(top_srcdir)/gl/m4/vasnprintf.m4 \
|
||||
$(top_srcdir)/gl/m4/vasprintf.m4 \
|
||||
$(top_srcdir)/gl/m4/vsnprintf.m4 $(top_srcdir)/gl/m4/wchar.m4 \
|
||||
$(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/gl/m4/wctype.m4 \
|
||||
$(top_srcdir)/gl/m4/wcwidth.m4 $(top_srcdir)/gl/m4/wint_t.m4 \
|
||||
$(top_srcdir)/gl/m4/xalloc.m4 $(top_srcdir)/gl/m4/xsize.m4 \
|
||||
$(top_srcdir)/gl/m4/xstrndup.m4 $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
ARFLAGS = cru
|
||||
libgnu_a_AR = $(AR) $(ARFLAGS)
|
||||
am__DEPENDENCIES_1 =
|
||||
am_libgnu_a_OBJECTS = full-read.$(OBJEXT) full-write.$(OBJEXT) \
|
||||
strnlen1.$(OBJEXT) xalloc-die.$(OBJEXT) xstrndup.$(OBJEXT)
|
||||
libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS)
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libgnu_a_SOURCES) $(EXTRA_libgnu_a_SOURCES)
|
||||
DIST_SOURCES = $(libgnu_a_SOURCES) $(EXTRA_libgnu_a_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
INSTALL = @INSTALL@
|
||||
ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
|
||||
ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@
|
||||
ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@
|
||||
ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
ALLOCA_H = @ALLOCA_H@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
ARPA_INET_H = @ARPA_INET_H@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BASENAME = @BASENAME@
|
||||
BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
|
||||
BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
|
||||
BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
|
||||
BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
|
||||
BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DEPLIBS = @DEPLIBS@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EOVERFLOW = @EOVERFLOW@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRAS = @EXTRAS@
|
||||
EXTRAS_ROOT = @EXTRAS_ROOT@
|
||||
EXTRA_NETOBJS = @EXTRA_NETOBJS@
|
||||
EXTRA_TEST = @EXTRA_TEST@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GETOPT_H = @GETOPT_H@
|
||||
GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@
|
||||
GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
|
||||
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
|
||||
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
|
||||
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
|
||||
HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
|
||||
HAVE_STDINT_H = @HAVE_STDINT_H@
|
||||
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
|
||||
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
|
||||
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
|
||||
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
|
||||
HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
|
||||
HAVE_WINT_T = @HAVE_WINT_T@
|
||||
HAVE__BOOL = @HAVE__BOOL@
|
||||
HOSTNAME = @HOSTNAME@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
KRBINCLUDE = @KRBINCLUDE@
|
||||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
MYSQLCFLAGS = @MYSQLCFLAGS@
|
||||
MYSQLINCLUDE = @MYSQLINCLUDE@
|
||||
MYSQLLIBS = @MYSQLLIBS@
|
||||
NEED_SETGID = @NEED_SETGID@
|
||||
NETINET_IN_H = @NETINET_IN_H@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PATH_TO_APTGET = @PATH_TO_APTGET@
|
||||
PATH_TO_DIG = @PATH_TO_DIG@
|
||||
PATH_TO_FPING = @PATH_TO_FPING@
|
||||
PATH_TO_LMSTAT = @PATH_TO_LMSTAT@
|
||||
PATH_TO_LSPS = @PATH_TO_LSPS@
|
||||
PATH_TO_MAILQ = @PATH_TO_MAILQ@
|
||||
PATH_TO_NSLOOKUP = @PATH_TO_NSLOOKUP@
|
||||
PATH_TO_PING = @PATH_TO_PING@
|
||||
PATH_TO_PING6 = @PATH_TO_PING6@
|
||||
PATH_TO_PS = @PATH_TO_PS@
|
||||
PATH_TO_QMAIL_QSTAT = @PATH_TO_QMAIL_QSTAT@
|
||||
PATH_TO_QSTAT = @PATH_TO_QSTAT@
|
||||
PATH_TO_QUAKESTAT = @PATH_TO_QUAKESTAT@
|
||||
PATH_TO_RPCINFO = @PATH_TO_RPCINFO@
|
||||
PATH_TO_SMBCLIENT = @PATH_TO_SMBCLIENT@
|
||||
PATH_TO_SNMPGET = @PATH_TO_SNMPGET@
|
||||
PATH_TO_SNMPGETNEXT = @PATH_TO_SNMPGETNEXT@
|
||||
PATH_TO_SSH = @PATH_TO_SSH@
|
||||
PATH_TO_SWAP = @PATH_TO_SWAP@
|
||||
PATH_TO_SWAPINFO = @PATH_TO_SWAPINFO@
|
||||
PATH_TO_UPTIME = @PATH_TO_UPTIME@
|
||||
PATH_TO_WHO = @PATH_TO_WHO@
|
||||
PERL = @PERL@
|
||||
PGINCLUDE = @PGINCLUDE@
|
||||
PGLIBS = @PGLIBS@
|
||||
PKG_ARCH = @PKG_ARCH@
|
||||
PLUGIN_TEST = @PLUGIN_TEST@
|
||||
POSUB = @POSUB@
|
||||
POW_LIB = @POW_LIB@
|
||||
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
|
||||
PYTHON = @PYTHON@
|
||||
RADIUSLIBS = @RADIUSLIBS@
|
||||
RANLIB = @RANLIB@
|
||||
RELEASE = @RELEASE@
|
||||
REV_DATESTAMP = @REV_DATESTAMP@
|
||||
REV_TIMESTAMP = @REV_TIMESTAMP@
|
||||
SCRIPT_TEST = @SCRIPT_TEST@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
|
||||
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
|
||||
SOCKETLIBS = @SOCKETLIBS@
|
||||
SSLINCLUDE = @SSLINCLUDE@
|
||||
SSLLIBS = @SSLLIBS@
|
||||
STDBOOL_H = @STDBOOL_H@
|
||||
STDINT_H = @STDINT_H@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
SYS_SOCKET_H = @SYS_SOCKET_H@
|
||||
UNISTD_H = @UNISTD_H@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARRANTY = @WARRANTY@
|
||||
WCHAR_H = @WCHAR_H@
|
||||
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
|
||||
WCTYPE_H = @WCTYPE_H@
|
||||
WINT_T_SUFFIX = @WINT_T_SUFFIX@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
check_tcp_ssl = @check_tcp_ssl@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
gl_LIBOBJS = @gl_LIBOBJS@
|
||||
gl_LTLIBOBJS = @gl_LTLIBOBJS@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
np_mysql_config = @np_mysql_config@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
with_trusted_path = @with_trusted_path@
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits
|
||||
noinst_HEADERS =
|
||||
noinst_LIBRARIES = libgnu.a
|
||||
noinst_LTLIBRARIES =
|
||||
EXTRA_DIST = alloca.c alloca_.h c-strtod.c c-strtod.h cloexec.c \
|
||||
cloexec.h basename.c dirname.c dirname.h stripslash.c error.c \
|
||||
error.h exitfail.c exitfail.h creat-safer.c fcntl--.h \
|
||||
fcntl-safer.h open-safer.c fsusage.c fsusage.h gai_strerror.c \
|
||||
getaddrinfo.c getaddrinfo.h gethostname.c getloadavg.c \
|
||||
getopt.c getopt1.c getopt_.h getopt_int.h inet_ntop.c \
|
||||
inet_ntop.h intprops.h malloc.c mbchar.c mbchar.h memchr.c \
|
||||
mountlist.c mountlist.h regcomp.c regex.c regex.h \
|
||||
regex_internal.c regex_internal.h regexec.c safe-read.c \
|
||||
safe-read.h safe-write.c safe-write.h snprintf.c snprintf.h \
|
||||
stdbool_.h stdint_.h strcase.h strcasecmp.c strncasecmp.c \
|
||||
strdup.c strdup.h strndup.c strndup.h strnlen.c strnlen.h \
|
||||
socket_.h unistd_.h dup-safer.c fd-safer.c pipe-safer.c \
|
||||
unistd--.h unistd-safer.h asnprintf.c printf-args.c \
|
||||
printf-args.h printf-parse.c printf-parse.h vasnprintf.c \
|
||||
vasnprintf.h asprintf.c vasprintf.c vasprintf.h vsnprintf.c \
|
||||
vsnprintf.h wchar_.h wctype_.h xalloc.h xmalloc.c
|
||||
BUILT_SOURCES = $(ALLOCA_H) $(ARPA_INET_H) $(GETOPT_H) $(NETINET_IN_H) \
|
||||
$(STDBOOL_H) $(STDINT_H) $(SYS_SOCKET_H) $(UNISTD_H) \
|
||||
$(WCHAR_H) $(WCTYPE_H)
|
||||
SUFFIXES =
|
||||
MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \
|
||||
arpa/inet.h-t getopt.h getopt.h-t netinet/in.h netinet/in.h-t \
|
||||
stdbool.h stdbool.h-t stdint.h stdint.h-t sys/socket.h \
|
||||
sys/socket.h-t unistd.h unistd.h-t wchar.h wchar.h-t wctype.h \
|
||||
wctype.h-t
|
||||
MOSTLYCLEANDIRS = arpa netinet sys
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
MAINTAINERCLEANFILES =
|
||||
|
||||
# This is for those projects which use "gettextize --intl" to put a source-code
|
||||
# copy of libintl into their package. In such projects, every Makefile.am needs
|
||||
# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory.
|
||||
# For the Makefile.ams in other directories it is the maintainer's
|
||||
# responsibility; for the one from gnulib we do it here.
|
||||
# This option has no effect when the user disables NLS (because then the intl
|
||||
# directory contains no libintl.h file) or when the project does not use
|
||||
# "gettextize --intl".
|
||||
AM_CPPFLAGS = -I$(top_builddir)/intl
|
||||
libgnu_a_SOURCES = exit.h full-read.h full-read.c full-write.h \
|
||||
full-write.c gettext.h mbuiter.h minmax.h size_max.h \
|
||||
strnlen1.h strnlen1.c wcwidth.h xalloc-die.c xsize.h \
|
||||
xstrndup.h xstrndup.c
|
||||
libgnu_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@
|
||||
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
|
||||
EXTRA_libgnu_a_SOURCES = alloca.c c-strtod.c cloexec.c basename.c \
|
||||
dirname.c stripslash.c error.c exitfail.c creat-safer.c \
|
||||
open-safer.c fsusage.c gai_strerror.c getaddrinfo.c \
|
||||
gethostname.c getloadavg.c getopt.c getopt1.c inet_ntop.c \
|
||||
malloc.c mbchar.c memchr.c mountlist.c regcomp.c regex.c \
|
||||
regex_internal.c regexec.c safe-read.c safe-write.c snprintf.c \
|
||||
strcasecmp.c strncasecmp.c strdup.c strndup.c strnlen.c \
|
||||
dup-safer.c fd-safer.c pipe-safer.c asnprintf.c printf-args.c \
|
||||
printf-parse.c vasnprintf.c asprintf.c vasprintf.c vsnprintf.c \
|
||||
xmalloc.c
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits gl/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnits gl/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
libgnu.a: $(libgnu_a_OBJECTS) $(libgnu_a_DEPENDENCIES)
|
||||
-rm -f libgnu.a
|
||||
$(libgnu_a_AR) libgnu.a $(libgnu_a_OBJECTS) $(libgnu_a_LIBADD)
|
||||
$(RANLIB) libgnu.a
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloca.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strtod.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/creat-safer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsusage.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full-read.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full-write.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gai_strerror.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getaddrinfo.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gethostname.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbchar.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mountlist.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open-safer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe-safer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-args.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regcomp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex_internal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexec.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-read.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-write.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strncasecmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen1.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsnprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrndup.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
|
||||
clean-noinstLTLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf $(DEPDIR) ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf $(DEPDIR) ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool mostlyclean-local
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \
|
||||
ctags distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
|
||||
pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
|
||||
|
||||
|
||||
# We need the following in order to create <alloca.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
alloca.h: alloca_.h
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/alloca_.h; \
|
||||
} > $@-t
|
||||
mv -f $@-t $@
|
||||
|
||||
# We need the following in order to create <arpa/inet.h> when the system
|
||||
# doesn't have one.
|
||||
arpa/inet.h:
|
||||
test -d arpa || mkdir arpa
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
echo '#include <sys/socket.h>'; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <getopt.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
getopt.h: getopt_.h
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/getopt_.h; \
|
||||
} > $@-t
|
||||
mv -f $@-t $@
|
||||
|
||||
# We need the following in order to create <netinet/in.h> when the system
|
||||
# doesn't have one.
|
||||
netinet/in.h:
|
||||
test -d netinet || mkdir netinet
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
echo '#include <sys/socket.h>'; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <stdbool.h> when the system
|
||||
# doesn't have one that works.
|
||||
stdbool.h: stdbool_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <stdint.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
stdint.h: stdint_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
|
||||
-e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \
|
||||
-e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
|
||||
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
|
||||
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
|
||||
-e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
|
||||
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
|
||||
-e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
|
||||
-e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
|
||||
-e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
|
||||
-e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
|
||||
-e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
|
||||
-e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
|
||||
-e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
|
||||
-e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
|
||||
-e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
|
||||
< $(srcdir)/stdint_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <sys/socket.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
sys/socket.h: socket_.h
|
||||
@MKDIR_P@ sys
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
cat $(srcdir)/socket_.h; \
|
||||
} > $@-t
|
||||
mv -f $@-t $@
|
||||
|
||||
# We need the following in order to create an empty placeholder for
|
||||
# <unistd.h> when the system doesn't have one.
|
||||
unistd.h: unistd_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''ABSOLUTE_UNISTD_H''@|$(ABSOLUTE_UNISTD_H)|g' \
|
||||
< $(srcdir)/unistd_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <wchar.h> when the system
|
||||
# version does not work standalone.
|
||||
wchar.h: wchar_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''ABSOLUTE_WCHAR_H''@|$(ABSOLUTE_WCHAR_H)|g' \
|
||||
< $(srcdir)/wchar_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <wctype.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
wctype.h: wctype_.h
|
||||
rm -f $@-t $@
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
|
||||
-e 's|@''ABSOLUTE_WCTYPE_H''@|$(ABSOLUTE_WCTYPE_H)|g' \
|
||||
-e 's/@''HAVE_WCTYPE_CTMP_BUG''@/$(HAVE_WCTYPE_CTMP_BUG)/g' \
|
||||
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
|
||||
< $(srcdir)/wctype_.h; \
|
||||
} > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
mostlyclean-local: mostlyclean-generic
|
||||
@for dir in '' $(MOSTLYCLEANDIRS); do \
|
||||
if test -n "$$dir" && test -d $$dir; then \
|
||||
echo "rmdir $$dir"; rmdir $$dir; \
|
||||
fi; \
|
||||
done
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
489
gl/alloca.c
Normal file
489
gl/alloca.c
Normal file
|
@ -0,0 +1,489 @@
|
|||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
This implementation of the PWB library alloca function,
|
||||
which is used to allocate space off the run-time stack so
|
||||
that it is automatically reclaimed upon procedure exit,
|
||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||
J.Otto Tennant <jot@cray.com> contributed the Cray support.
|
||||
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
The general concept of this implementation is to keep
|
||||
track of all alloca-allocated blocks, and reclaim any
|
||||
that are found to be deeper in the stack than the current
|
||||
invocation. This heuristic does not reclaim storage as
|
||||
soon as it becomes invalid, but it will do so eventually.
|
||||
|
||||
As a special case, alloca(0) reclaims storage without
|
||||
allocating any. It is a good idea to use alloca(0) in
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <alloca.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef emacs
|
||||
# include "lisp.h"
|
||||
# include "blockinput.h"
|
||||
# ifdef EMACS_FREE
|
||||
# undef free
|
||||
# define free EMACS_FREE
|
||||
# endif
|
||||
#else
|
||||
# define memory_full() abort ()
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
# ifndef alloca
|
||||
|
||||
# ifdef emacs
|
||||
# ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
# ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
/* Using #error here is not wise since this file should work for
|
||||
old and obscure compilers. */
|
||||
# endif /* STACK_DIRECTION undefined */
|
||||
# endif /* static */
|
||||
# endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
# else
|
||||
# define ADDRESS_FUNCTION(arg) &(arg)
|
||||
# endif
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
# ifndef STACK_DIRECTION
|
||||
# define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
# endif
|
||||
|
||||
# if STACK_DIRECTION != 0
|
||||
|
||||
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
# else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
# define STACK_DIR stack_dir
|
||||
|
||||
static void
|
||||
find_stack_direction (void)
|
||||
{
|
||||
static char *addr = NULL; /* Address of first `dummy', once known. */
|
||||
auto char dummy; /* To get stack address. */
|
||||
|
||||
if (addr == NULL)
|
||||
{ /* Initial entry. */
|
||||
addr = ADDRESS_FUNCTION (dummy);
|
||||
|
||||
find_stack_direction (); /* Recurse once. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Second entry. */
|
||||
if (ADDRESS_FUNCTION (dummy) > addr)
|
||||
stack_dir = 1; /* Stack grew upward. */
|
||||
else
|
||||
stack_dir = -1; /* Stack grew downward. */
|
||||
}
|
||||
}
|
||||
|
||||
# endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
# ifndef ALIGN_SIZE
|
||||
# define ALIGN_SIZE sizeof(double)
|
||||
# endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
|
||||
/* Return a pointer to at least SIZE bytes of storage,
|
||||
which will be automatically reclaimed upon exit from
|
||||
the procedure that called alloca. Originally, this space
|
||||
was supposed to be taken from the current stack frame of the
|
||||
caller, but that method cannot be made to work for some
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
void *
|
||||
alloca (size_t size)
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
# if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
find_stack_direction ();
|
||||
# endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
# ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
# endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||
{
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free (hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
# ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
# endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
/* Address of header. */
|
||||
register header *new;
|
||||
|
||||
size_t combined_size = sizeof (header) + size;
|
||||
if (combined_size < sizeof (header))
|
||||
memory_full ();
|
||||
|
||||
new = malloc (combined_size);
|
||||
|
||||
if (! new)
|
||||
memory_full ();
|
||||
|
||||
new->h.next = last_alloca_header;
|
||||
new->h.deep = depth;
|
||||
|
||||
last_alloca_header = new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (void *) (new + 1);
|
||||
}
|
||||
}
|
||||
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
# ifndef CRAY_STACK
|
||||
# define CRAY_STACK
|
||||
# ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
long shgrow:32; /* Number of times stack has grown. */
|
||||
long shaseg:32; /* Size of increments to stack. */
|
||||
long shhwm:32; /* High water mark of stack. */
|
||||
long shsize:32; /* Current size of stack (all segments). */
|
||||
};
|
||||
|
||||
/* The stack segment linkage control information occurs at
|
||||
the high-address end of a stack segment. (The stack
|
||||
grows from low addresses to high addresses.) The initial
|
||||
part of the stack segment linkage control information is
|
||||
0200 (octal) words. This provides for register storage
|
||||
for the routine which overflows the stack. */
|
||||
|
||||
struct stack_segment_linkage
|
||||
{
|
||||
long ss[0200]; /* 0200 overflow words. */
|
||||
long sssize:32; /* Number of words in this segment. */
|
||||
long ssbase:32; /* Offset to stack base. */
|
||||
long:32;
|
||||
long sspseg:32; /* Offset to linkage control of previous
|
||||
segment of stack. */
|
||||
long:32;
|
||||
long sstcpt:32; /* Pointer to task common address block. */
|
||||
long sscsnm; /* Private control structure number for
|
||||
microtasking. */
|
||||
long ssusr1; /* Reserved for user. */
|
||||
long ssusr2; /* Reserved for user. */
|
||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||
long sscray[7]; /* Reserved for Cray Research. */
|
||||
long ssa0;
|
||||
long ssa1;
|
||||
long ssa2;
|
||||
long ssa3;
|
||||
long ssa4;
|
||||
long ssa5;
|
||||
long ssa6;
|
||||
long ssa7;
|
||||
long sss0;
|
||||
long sss1;
|
||||
long sss2;
|
||||
long sss3;
|
||||
long sss4;
|
||||
long sss5;
|
||||
long sss6;
|
||||
long sss7;
|
||||
};
|
||||
|
||||
# else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
{
|
||||
long now; /* Current total stack size. */
|
||||
long maxc; /* Amount of contiguous space which would
|
||||
be required to satisfy the maximum
|
||||
stack demand to date. */
|
||||
long high_water; /* Stack high-water mark. */
|
||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||
long hits; /* Number of internal buffer hits. */
|
||||
long extends; /* Number of block extensions. */
|
||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||
long segments; /* Current number of stack segments. */
|
||||
long maxs; /* Maximum number of stack segments so far. */
|
||||
long pad_size; /* Stack pad size. */
|
||||
long current_address; /* Current stack segment address. */
|
||||
long current_size; /* Current stack segment size. This
|
||||
number is actually corrupted by STKSTAT to
|
||||
include the fifteen word trailer area. */
|
||||
long initial_address; /* Address of initial segment. */
|
||||
long initial_size; /* Size of initial segment. */
|
||||
};
|
||||
|
||||
/* The following structure describes the data structure which trails
|
||||
any stack segment. I think that the description in 'asdef' is
|
||||
out of date. I only describe the parts that I am sure about. */
|
||||
|
||||
struct stk_trailer
|
||||
{
|
||||
long this_address; /* Address of this block. */
|
||||
long this_size; /* Size of this block (does not include
|
||||
this trailer). */
|
||||
long unknown2;
|
||||
long unknown3;
|
||||
long link; /* Address of trailer block of previous
|
||||
segment. */
|
||||
long unknown5;
|
||||
long unknown6;
|
||||
long unknown7;
|
||||
long unknown8;
|
||||
long unknown9;
|
||||
long unknown10;
|
||||
long unknown11;
|
||||
long unknown12;
|
||||
long unknown13;
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
# endif /* CRAY2 */
|
||||
# endif /* not CRAY_STACK */
|
||||
|
||||
# ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
{
|
||||
struct stk_stat status;
|
||||
struct stk_trailer *trailer;
|
||||
long *block, size;
|
||||
long result = 0;
|
||||
|
||||
/* We want to iterate through all of the segments. The first
|
||||
step is to get the stack status structure. We could do this
|
||||
more quickly and more directly, perhaps, by referencing the
|
||||
$LM00 common block, but I know that this works. */
|
||||
|
||||
STKSTAT (&status);
|
||||
|
||||
/* Set up the iteration. */
|
||||
|
||||
trailer = (struct stk_trailer *) (status.current_address
|
||||
+ status.current_size
|
||||
- 15);
|
||||
|
||||
/* There must be at least one stack segment. Therefore it is
|
||||
a fatal error if "trailer" is null. */
|
||||
|
||||
if (trailer == 0)
|
||||
abort ();
|
||||
|
||||
/* Discard segments that do not contain our argument address. */
|
||||
|
||||
while (trailer != 0)
|
||||
{
|
||||
block = (long *) trailer->this_address;
|
||||
size = trailer->this_size;
|
||||
if (block == 0 || size == 0)
|
||||
abort ();
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
if ((block <= address) && (address < (block + size)))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the result to the offset in this segment and add the sizes
|
||||
of all predecessor segments. */
|
||||
|
||||
result = address - block;
|
||||
|
||||
if (trailer == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (trailer->this_size <= 0)
|
||||
abort ();
|
||||
result += trailer->this_size;
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
}
|
||||
while (trailer != 0);
|
||||
|
||||
/* We are done. Note that if you present a bogus address (one
|
||||
not in any segment), you will get a different number back, formed
|
||||
from subtracting the address of the first block. This is probably
|
||||
not what you want. */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
# else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
routine is to linearize, in some sense, stack addresses
|
||||
for alloca. */
|
||||
|
||||
static long
|
||||
i00afunc (long address)
|
||||
{
|
||||
long stkl = 0;
|
||||
|
||||
long size, pseg, this_segment, stack;
|
||||
long result = 0;
|
||||
|
||||
struct stack_segment_linkage *ssptr;
|
||||
|
||||
/* Register B67 contains the address of the end of the
|
||||
current stack segment. If you (as a subprogram) store
|
||||
your registers on the stack and find that you are past
|
||||
the contents of B67, you have overflowed the segment.
|
||||
|
||||
B67 also points to the stack segment linkage control
|
||||
area, which is what we are really interested in. */
|
||||
|
||||
stkl = CRAY_STACKSEG_END ();
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
|
||||
/* If one subtracts 'size' from the end of the segment,
|
||||
one has the address of the first word of the segment.
|
||||
|
||||
If this is not the first segment, 'pseg' will be
|
||||
nonzero. */
|
||||
|
||||
pseg = ssptr->sspseg;
|
||||
size = ssptr->sssize;
|
||||
|
||||
this_segment = stkl - size;
|
||||
|
||||
/* It is possible that calling this routine itself caused
|
||||
a stack overflow. Discard stack segments which do not
|
||||
contain the target address. */
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
# endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
this_segment = stkl - size;
|
||||
}
|
||||
|
||||
result = address - this_segment;
|
||||
|
||||
/* If you subtract pseg from the current end of the stack,
|
||||
you get the address of the previous stack segment's end.
|
||||
This seems a little convoluted to me, but I'll bet you save
|
||||
a cycle somewhere. */
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
# endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
result += size;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
# endif /* not CRAY2 */
|
||||
# endif /* CRAY */
|
||||
|
||||
# endif /* no alloca */
|
||||
#endif /* not GCC version 2 */
|
54
gl/alloca_.h
Normal file
54
gl/alloca_.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* Memory allocation on the stack.
|
||||
|
||||
Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
|
||||
means there is a real alloca function. */
|
||||
#ifndef _GNULIB_ALLOCA_H
|
||||
# define _GNULIB_ALLOCA_H
|
||||
|
||||
/* alloca (N) returns a pointer to N bytes of memory
|
||||
allocated on the stack, which will last until the function returns.
|
||||
Use of alloca should be avoided:
|
||||
- inside arguments of function calls - undefined behaviour,
|
||||
- in inline functions - the allocation may actually last until the
|
||||
calling function returns,
|
||||
- for huge N (say, N >= 65536) - you never know how large (or small)
|
||||
the stack is, and when the stack cannot fulfill the memory allocation
|
||||
request, the program just crashes.
|
||||
*/
|
||||
|
||||
#ifndef alloca
|
||||
# ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# elif defined _AIX
|
||||
# define alloca __alloca
|
||||
# elif defined _MSC_VER
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# else
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
void *alloca (size_t);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _GNULIB_ALLOCA_H */
|
35
gl/asnprintf.c
Normal file
35
gl/asnprintf.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* Formatted output to strings.
|
||||
Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "vasnprintf.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
char *
|
||||
asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *result;
|
||||
|
||||
va_start (args, format);
|
||||
result = vasnprintf (resultbuf, lengthp, format, args);
|
||||
va_end (args);
|
||||
return result;
|
||||
}
|
35
gl/asprintf.c
Normal file
35
gl/asprintf.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* Formatted output to strings.
|
||||
Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "vasprintf.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
asprintf (char **resultp, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int result;
|
||||
|
||||
va_start (args, format);
|
||||
result = vasprintf (resultp, format, args);
|
||||
va_end (args);
|
||||
return result;
|
||||
}
|
129
gl/basename.c
Normal file
129
gl/basename.c
Normal file
|
@ -0,0 +1,129 @@
|
|||
/* basename.c -- return the last element in a file name
|
||||
|
||||
Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "dirname.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "xalloc.h"
|
||||
#include "xstrndup.h"
|
||||
|
||||
/* Return the address of the last file name component of NAME. If
|
||||
NAME has no relative file name components because it is a file
|
||||
system root, return the empty string. */
|
||||
|
||||
char *
|
||||
last_component (char const *name)
|
||||
{
|
||||
char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
|
||||
char const *p;
|
||||
bool saw_slash = false;
|
||||
|
||||
while (ISSLASH (*base))
|
||||
base++;
|
||||
|
||||
for (p = base; *p; p++)
|
||||
{
|
||||
if (ISSLASH (*p))
|
||||
saw_slash = true;
|
||||
else if (saw_slash)
|
||||
{
|
||||
base = p;
|
||||
saw_slash = false;
|
||||
}
|
||||
}
|
||||
|
||||
return (char *) base;
|
||||
}
|
||||
|
||||
|
||||
/* In general, we can't use the builtin `basename' function if available,
|
||||
since it has different meanings in different environments.
|
||||
In some environments the builtin `basename' modifies its argument.
|
||||
|
||||
Return the last file name component of NAME, allocated with
|
||||
xmalloc. On systems with drive letters, a leading "./"
|
||||
distinguishes relative names that would otherwise look like a drive
|
||||
letter. Unlike POSIX basename(), NAME cannot be NULL,
|
||||
base_name("") returns "", and the first trailing slash is not
|
||||
stripped.
|
||||
|
||||
If lstat (NAME) would succeed, then { chdir (dir_name (NAME));
|
||||
lstat (base_name (NAME)); } will access the same file. Likewise,
|
||||
if the sequence { chdir (dir_name (NAME));
|
||||
rename (base_name (NAME), "foo"); } succeeds, you have renamed NAME
|
||||
to "foo" in the same directory NAME was in. */
|
||||
|
||||
char *
|
||||
base_name (char const *name)
|
||||
{
|
||||
char const *base = last_component (name);
|
||||
size_t length;
|
||||
|
||||
/* If there is no last component, then name is a file system root or the
|
||||
empty string. */
|
||||
if (! *base)
|
||||
return xstrndup (name, base_len (name));
|
||||
|
||||
/* Collapse a sequence of trailing slashes into one. */
|
||||
length = base_len (base);
|
||||
if (ISSLASH (base[length]))
|
||||
length++;
|
||||
|
||||
/* On systems with drive letters, `a/b:c' must return `./b:c' rather
|
||||
than `b:c' to avoid confusion with a drive letter. On systems
|
||||
with pure POSIX semantics, this is not an issue. */
|
||||
if (FILE_SYSTEM_PREFIX_LEN (base))
|
||||
{
|
||||
char *p = xmalloc (length + 3);
|
||||
p[0] = '.';
|
||||
p[1] = '/';
|
||||
memcpy (p + 2, base, length);
|
||||
p[length + 2] = '\0';
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Finally, copy the basename. */
|
||||
return xstrndup (base, length);
|
||||
}
|
||||
|
||||
/* Return the length of the basename NAME. Typically NAME is the
|
||||
value returned by base_name or last_component. Act like strlen
|
||||
(NAME), except omit all trailing slashes. */
|
||||
|
||||
size_t
|
||||
base_len (char const *name)
|
||||
{
|
||||
size_t len;
|
||||
size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
|
||||
|
||||
for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--)
|
||||
continue;
|
||||
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1
|
||||
&& ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2])
|
||||
return 2;
|
||||
|
||||
if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len
|
||||
&& len == prefix_len && ISSLASH (name[prefix_len]))
|
||||
return prefix_len + 1;
|
||||
|
||||
return len;
|
||||
}
|
79
gl/c-strtod.c
Normal file
79
gl/c-strtod.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* Convert string to double, using the C locale.
|
||||
|
||||
Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "c-strtod.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xalloc.h"
|
||||
|
||||
#if LONG
|
||||
# define C_STRTOD c_strtold
|
||||
# define DOUBLE long double
|
||||
# define STRTOD_L strtold_l
|
||||
#else
|
||||
# define C_STRTOD c_strtod
|
||||
# define DOUBLE double
|
||||
# define STRTOD_L strtod_l
|
||||
#endif
|
||||
|
||||
/* c_strtold falls back on strtod if strtold doesn't conform to C99. */
|
||||
#if LONG && HAVE_C99_STRTOLD
|
||||
# define STRTOD strtold
|
||||
#else
|
||||
# define STRTOD strtod
|
||||
#endif
|
||||
|
||||
DOUBLE
|
||||
C_STRTOD (char const *nptr, char **endptr)
|
||||
{
|
||||
DOUBLE r;
|
||||
|
||||
#ifdef LC_ALL_MASK
|
||||
|
||||
locale_t c_locale = newlocale (LC_ALL_MASK, "C", 0);
|
||||
r = STRTOD_L (nptr, endptr, c_locale);
|
||||
freelocale (c_locale);
|
||||
|
||||
#else
|
||||
|
||||
char *saved_locale = setlocale (LC_NUMERIC, NULL);
|
||||
|
||||
if (saved_locale)
|
||||
{
|
||||
saved_locale = xstrdup (saved_locale);
|
||||
setlocale (LC_NUMERIC, "C");
|
||||
}
|
||||
|
||||
r = STRTOD (nptr, endptr);
|
||||
|
||||
if (saved_locale)
|
||||
{
|
||||
setlocale (LC_NUMERIC, saved_locale);
|
||||
free (saved_locale);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return r;
|
||||
}
|
2
gl/c-strtod.h
Normal file
2
gl/c-strtod.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
double c_strtod (char const *, char **);
|
||||
long double c_strtold (char const *, char **);
|
59
gl/cloexec.c
Normal file
59
gl/cloexec.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* closexec.c - set or clear the close-on-exec descriptor flag
|
||||
|
||||
Copyright (C) 1991, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
The code is taken from glibc/manual/llio.texi */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cloexec.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef FD_CLOEXEC
|
||||
# define FD_CLOEXEC 1
|
||||
#endif
|
||||
|
||||
/* Set the `FD_CLOEXEC' flag of DESC if VALUE is true,
|
||||
or clear the flag if VALUE is false.
|
||||
Return 0 on success, or -1 on error with `errno' set. */
|
||||
|
||||
int
|
||||
set_cloexec_flag (int desc, bool value)
|
||||
{
|
||||
#if defined F_GETFD && defined F_SETFD
|
||||
|
||||
int flags = fcntl (desc, F_GETFD, 0);
|
||||
|
||||
if (0 <= flags)
|
||||
{
|
||||
int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC);
|
||||
|
||||
if (flags == newflags
|
||||
|| fcntl (desc, F_SETFD, newflags) != -1)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
#else
|
||||
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
}
|
2
gl/cloexec.h
Normal file
2
gl/cloexec.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include <stdbool.h>
|
||||
int set_cloexec_flag (int desc, bool value);
|
32
gl/creat-safer.c
Normal file
32
gl/creat-safer.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* Invoke creat, but avoid some glitches.
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Jim Meyering. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "fcntl-safer.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "unistd-safer.h"
|
||||
|
||||
int
|
||||
creat_safer (char const *file, mode_t mode)
|
||||
{
|
||||
return fd_safer (creat (file, mode));
|
||||
}
|
85
gl/dirname.c
Normal file
85
gl/dirname.c
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* dirname.c -- return all but the last element in a file name
|
||||
|
||||
Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "dirname.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "xalloc.h"
|
||||
|
||||
/* Return the length of the prefix of FILE that will be used by
|
||||
dir_name. If FILE is in the working directory, this returns zero
|
||||
even though `dir_name (FILE)' will return ".". Works properly even
|
||||
if there are trailing slashes (by effectively ignoring them). */
|
||||
|
||||
size_t
|
||||
dir_len (char const *file)
|
||||
{
|
||||
size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file);
|
||||
size_t length;
|
||||
|
||||
/* Advance prefix_length beyond important leading slashes. */
|
||||
prefix_length += (prefix_length != 0
|
||||
? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
|
||||
&& ISSLASH (file[prefix_length]))
|
||||
: (ISSLASH (file[0])
|
||||
? ((DOUBLE_SLASH_IS_DISTINCT_ROOT
|
||||
&& ISSLASH (file[1]) && ! ISSLASH (file[2])
|
||||
? 2 : 1))
|
||||
: 0));
|
||||
|
||||
/* Strip the basename and any redundant slashes before it. */
|
||||
for (length = last_component (file) - file;
|
||||
prefix_length < length; length--)
|
||||
if (! ISSLASH (file[length - 1]))
|
||||
break;
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
/* In general, we can't use the builtin `dirname' function if available,
|
||||
since it has different meanings in different environments.
|
||||
In some environments the builtin `dirname' modifies its argument.
|
||||
|
||||
Return the leading directories part of FILE, allocated with xmalloc.
|
||||
Works properly even if there are trailing slashes (by effectively
|
||||
ignoring them). Unlike POSIX dirname(), FILE cannot be NULL.
|
||||
|
||||
If lstat (FILE) would succeed, then { chdir (dir_name (FILE));
|
||||
lstat (base_name (FILE)); } will access the same file. Likewise,
|
||||
if the sequence { chdir (dir_name (FILE));
|
||||
rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE
|
||||
to "foo" in the same directory FILE was in. */
|
||||
|
||||
char *
|
||||
dir_name (char const *file)
|
||||
{
|
||||
size_t length = dir_len (file);
|
||||
bool append_dot = (length == 0
|
||||
|| (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
|
||||
&& length == FILE_SYSTEM_PREFIX_LEN (file)
|
||||
&& file[2] != '\0' && ! ISSLASH (file[2])));
|
||||
char *dir = xmalloc (length + append_dot + 1);
|
||||
memcpy (dir, file, length);
|
||||
if (append_dot)
|
||||
dir[length++] = '.';
|
||||
dir[length] = '\0';
|
||||
return dir;
|
||||
}
|
70
gl/dirname.h
Normal file
70
gl/dirname.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/* Take file names apart into directory and base names.
|
||||
|
||||
Copyright (C) 1998, 2001, 2003-2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef DIRNAME_H_
|
||||
# define DIRNAME_H_ 1
|
||||
|
||||
# include <stdbool.h>
|
||||
# include <stddef.h>
|
||||
|
||||
# ifndef DIRECTORY_SEPARATOR
|
||||
# define DIRECTORY_SEPARATOR '/'
|
||||
# endif
|
||||
|
||||
# ifndef ISSLASH
|
||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||
# endif
|
||||
|
||||
# ifndef FILE_SYSTEM_PREFIX_LEN
|
||||
# if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
|
||||
/* This internal macro assumes ASCII, but all hosts that support drive
|
||||
letters use ASCII. */
|
||||
# define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \
|
||||
<= 'z' - 'a')
|
||||
# define FILE_SYSTEM_PREFIX_LEN(Filename) \
|
||||
(_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
|
||||
# else
|
||||
# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
|
||||
# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
|
||||
# endif
|
||||
|
||||
# ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
|
||||
# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
|
||||
# endif
|
||||
|
||||
# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
|
||||
# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
|
||||
# else
|
||||
# define IS_ABSOLUTE_FILE_NAME(F) \
|
||||
(ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F))
|
||||
# endif
|
||||
# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
|
||||
|
||||
char *base_name (char const *file);
|
||||
char *dir_name (char const *file);
|
||||
size_t base_len (char const *file);
|
||||
size_t dir_len (char const *file);
|
||||
char *last_component (char const *file);
|
||||
|
||||
bool strip_trailing_slashes (char *file);
|
||||
|
||||
#endif /* not DIRNAME_H_ */
|
45
gl/dup-safer.c
Normal file
45
gl/dup-safer.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/* Invoke dup, but avoid some glitches.
|
||||
|
||||
Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "unistd-safer.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#ifndef STDERR_FILENO
|
||||
# define STDERR_FILENO 2
|
||||
#endif
|
||||
|
||||
/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or
|
||||
STDERR_FILENO. */
|
||||
|
||||
int
|
||||
dup_safer (int fd)
|
||||
{
|
||||
#if defined F_DUPFD && !defined FCHDIR_REPLACEMENT
|
||||
return fcntl (fd, F_DUPFD, STDERR_FILENO + 1);
|
||||
#else
|
||||
/* fd_safer calls us back, but eventually the recursion unwinds and
|
||||
does the right thing. */
|
||||
return fd_safer (dup (fd));
|
||||
#endif
|
||||
}
|
338
gl/error.c
Normal file
338
gl/error.c
Normal file
|
@ -0,0 +1,338 @@
|
|||
/* Error handler for noninteractive utilities
|
||||
Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||
|
||||
#if !_LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !_LIBC && ENABLE_NLS
|
||||
# include "gettext.h"
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
# include <stdbool.h>
|
||||
# include <stdint.h>
|
||||
# include <wchar.h>
|
||||
# define mbsrtowcs __mbsrtowcs
|
||||
#endif
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#endif
|
||||
|
||||
#ifndef _
|
||||
# define _(String) String
|
||||
#endif
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
function without parameters instead. */
|
||||
void (*error_print_progname) (void);
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
unsigned int error_message_count;
|
||||
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library, there is a predefined variable for this. */
|
||||
|
||||
# define program_name program_invocation_name
|
||||
# include <errno.h>
|
||||
# include <limits.h>
|
||||
# include <libio/libioP.h>
|
||||
|
||||
/* In GNU libc we want do not want to use the common name `error' directly.
|
||||
Instead make it a weak alias. */
|
||||
extern void __error (int status, int errnum, const char *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
extern void __error_at_line (int status, int errnum, const char *file_name,
|
||||
unsigned int line_number, const char *message,
|
||||
...)
|
||||
__attribute__ ((__format__ (__printf__, 5, 6)));;
|
||||
# define error __error
|
||||
# define error_at_line __error_at_line
|
||||
|
||||
# include <libio/iolibio.h>
|
||||
# define fflush(s) INTUSE(_IO_fflush) (s)
|
||||
# undef putc
|
||||
# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
|
||||
|
||||
# include <bits/libc-lock.h>
|
||||
|
||||
#else /* not _LIBC */
|
||||
|
||||
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
|
||||
# ifndef HAVE_DECL_STRERROR_R
|
||||
"this configure-time declaration test was not run"
|
||||
# endif
|
||||
char *strerror_r ();
|
||||
# endif
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
name of the executing program. */
|
||||
extern char *program_name;
|
||||
|
||||
# if HAVE_STRERROR_R || defined strerror_r
|
||||
# define __strerror_r strerror_r
|
||||
# endif /* HAVE_STRERROR_R || defined strerror_r */
|
||||
#endif /* not _LIBC */
|
||||
|
||||
static void
|
||||
print_errno_message (int errnum)
|
||||
{
|
||||
char const *s;
|
||||
|
||||
#if defined HAVE_STRERROR_R || _LIBC
|
||||
char errbuf[1024];
|
||||
# if STRERROR_R_CHAR_P || _LIBC
|
||||
s = __strerror_r (errnum, errbuf, sizeof errbuf);
|
||||
# else
|
||||
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
|
||||
s = errbuf;
|
||||
else
|
||||
s = 0;
|
||||
# endif
|
||||
#else
|
||||
s = strerror (errnum);
|
||||
#endif
|
||||
|
||||
#if !_LIBC
|
||||
if (! s)
|
||||
s = _("Unknown system error");
|
||||
#endif
|
||||
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, ": %s", s);
|
||||
#else
|
||||
fprintf (stderr, ": %s", s);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
error_tail (int status, int errnum, const char *message, va_list args)
|
||||
{
|
||||
#if _LIBC
|
||||
if (_IO_fwide (stderr, 0) > 0)
|
||||
{
|
||||
# define ALLOCA_LIMIT 2000
|
||||
size_t len = strlen (message) + 1;
|
||||
wchar_t *wmessage = NULL;
|
||||
mbstate_t st;
|
||||
size_t res;
|
||||
const char *tmp;
|
||||
bool use_malloc = false;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (__libc_use_alloca (len * sizeof (wchar_t)))
|
||||
wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
|
||||
else
|
||||
{
|
||||
if (!use_malloc)
|
||||
wmessage = NULL;
|
||||
|
||||
wchar_t *p = (wchar_t *) realloc (wmessage,
|
||||
len * sizeof (wchar_t));
|
||||
if (p == NULL)
|
||||
{
|
||||
free (wmessage);
|
||||
fputws_unlocked (L"out of memory\n", stderr);
|
||||
return;
|
||||
}
|
||||
wmessage = p;
|
||||
use_malloc = true;
|
||||
}
|
||||
|
||||
memset (&st, '\0', sizeof (st));
|
||||
tmp = message;
|
||||
|
||||
res = mbsrtowcs (wmessage, &tmp, len, &st);
|
||||
if (res != len)
|
||||
break;
|
||||
|
||||
if (__builtin_expect (len >= SIZE_MAX / 2, 0))
|
||||
{
|
||||
/* This really should not happen if everything is fine. */
|
||||
res = (size_t) -1;
|
||||
break;
|
||||
}
|
||||
|
||||
len *= 2;
|
||||
}
|
||||
|
||||
if (res == (size_t) -1)
|
||||
{
|
||||
/* The string cannot be converted. */
|
||||
if (use_malloc)
|
||||
{
|
||||
free (wmessage);
|
||||
use_malloc = false;
|
||||
}
|
||||
wmessage = (wchar_t *) L"???";
|
||||
}
|
||||
|
||||
__vfwprintf (stderr, wmessage, args);
|
||||
|
||||
if (use_malloc)
|
||||
free (wmessage);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
vfprintf (stderr, message, args);
|
||||
va_end (args);
|
||||
|
||||
++error_message_count;
|
||||
if (errnum)
|
||||
print_errno_message (errnum);
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, "\n");
|
||||
#else
|
||||
putc ('\n', stderr);
|
||||
#endif
|
||||
fflush (stderr);
|
||||
if (status)
|
||||
exit (status);
|
||||
}
|
||||
|
||||
|
||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
format string with optional args.
|
||||
If ERRNUM is nonzero, print its corresponding system error message.
|
||||
Exit with status STATUS if it is nonzero. */
|
||||
void
|
||||
error (int status, int errnum, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
#if defined _LIBC && defined __libc_ptf_call
|
||||
/* We do not want this call to be cut short by a thread
|
||||
cancellation. Therefore disable cancellation for now. */
|
||||
int state = PTHREAD_CANCEL_ENABLE;
|
||||
__libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
|
||||
0);
|
||||
#endif
|
||||
|
||||
fflush (stdout);
|
||||
#ifdef _LIBC
|
||||
_IO_flockfile (stderr);
|
||||
#endif
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, "%s: ", program_name);
|
||||
#else
|
||||
fprintf (stderr, "%s: ", program_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
va_start (args, message);
|
||||
error_tail (status, errnum, message, args);
|
||||
|
||||
#ifdef _LIBC
|
||||
_IO_funlockfile (stderr);
|
||||
# ifdef __libc_ptf_call
|
||||
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Sometimes we want to have at most one error per line. This
|
||||
variable controls whether this mode is selected or not. */
|
||||
int error_one_per_line;
|
||||
|
||||
void
|
||||
error_at_line (int status, int errnum, const char *file_name,
|
||||
unsigned int line_number, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (error_one_per_line)
|
||||
{
|
||||
static const char *old_file_name;
|
||||
static unsigned int old_line_number;
|
||||
|
||||
if (old_line_number == line_number
|
||||
&& (file_name == old_file_name
|
||||
|| strcmp (old_file_name, file_name) == 0))
|
||||
/* Simply return and print nothing. */
|
||||
return;
|
||||
|
||||
old_file_name = file_name;
|
||||
old_line_number = line_number;
|
||||
}
|
||||
|
||||
#if defined _LIBC && defined __libc_ptf_call
|
||||
/* We do not want this call to be cut short by a thread
|
||||
cancellation. Therefore disable cancellation for now. */
|
||||
int state = PTHREAD_CANCEL_ENABLE;
|
||||
__libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
|
||||
0);
|
||||
#endif
|
||||
|
||||
fflush (stdout);
|
||||
#ifdef _LIBC
|
||||
_IO_flockfile (stderr);
|
||||
#endif
|
||||
if (error_print_progname)
|
||||
(*error_print_progname) ();
|
||||
else
|
||||
{
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, "%s:", program_name);
|
||||
#else
|
||||
fprintf (stderr, "%s:", program_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBC
|
||||
__fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
|
||||
file_name, line_number);
|
||||
#else
|
||||
fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
|
||||
file_name, line_number);
|
||||
#endif
|
||||
|
||||
va_start (args, message);
|
||||
error_tail (status, errnum, message, args);
|
||||
|
||||
#ifdef _LIBC
|
||||
_IO_funlockfile (stderr);
|
||||
# ifdef __libc_ptf_call
|
||||
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Make the weak alias. */
|
||||
# undef error
|
||||
# undef error_at_line
|
||||
weak_alias (__error, error)
|
||||
weak_alias (__error_at_line, error_at_line)
|
||||
#endif
|
66
gl/error.h
Normal file
66
gl/error.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* Declaration for error-reporting function
|
||||
Copyright (C) 1995, 1996, 1997, 2003, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _ERROR_H
|
||||
#define _ERROR_H 1
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Print a message with `fprintf (stderr, FORMAT, ...)';
|
||||
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
|
||||
If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
|
||||
|
||||
extern void error (int __status, int __errnum, const char *__format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
|
||||
extern void error_at_line (int __status, int __errnum, const char *__fname,
|
||||
unsigned int __lineno, const char *__format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 5, 6)));
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
function without parameters instead. */
|
||||
extern void (*error_print_progname) (void);
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
extern unsigned int error_message_count;
|
||||
|
||||
/* Sometimes we want to have at most one error per line. This
|
||||
variable controls whether this mode is selected or not. */
|
||||
extern int error_one_per_line;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* error.h */
|
32
gl/exit.h
Normal file
32
gl/exit.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* exit() function.
|
||||
Copyright (C) 1995, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _EXIT_H
|
||||
#define _EXIT_H
|
||||
|
||||
/* Get exit() declaration. */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
|
||||
#ifndef EXIT_SUCCESS
|
||||
# define EXIT_SUCCESS 0
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#endif /* _EXIT_H */
|
25
gl/exitfail.c
Normal file
25
gl/exitfail.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* Failure exit status
|
||||
|
||||
Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "exitfail.h"
|
||||
#include "exit.h"
|
||||
|
||||
int volatile exit_failure = EXIT_FAILURE;
|
20
gl/exitfail.h
Normal file
20
gl/exitfail.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* Failure exit status
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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; see the file COPYING.
|
||||
If not, write to the Free Software Foundation,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
extern int volatile exit_failure;
|
28
gl/fcntl--.h
Normal file
28
gl/fcntl--.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* Like fcntl.h, but redefine some names to avoid glitches.
|
||||
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "fcntl-safer.h"
|
||||
|
||||
#undef open
|
||||
#define open open_safer
|
||||
|
||||
#undef creat
|
||||
#define creat creat_safer
|
24
gl/fcntl-safer.h
Normal file
24
gl/fcntl-safer.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* Invoke fcntl-like functions, but avoid some glitches.
|
||||
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int open_safer (char const *, int, ...);
|
||||
int creat_safer (char const *, mode_t);
|
57
gl/fd-safer.c
Normal file
57
gl/fd-safer.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
/* Return a safer copy of a file descriptor.
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "unistd-safer.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#ifndef STDIN_FILENO
|
||||
# define STDIN_FILENO 0
|
||||
#endif
|
||||
#ifndef STDERR_FILENO
|
||||
# define STDERR_FILENO 2
|
||||
#endif
|
||||
|
||||
/* Return FD, unless FD would be a copy of standard input, output, or
|
||||
error; in that case, return a duplicate of FD, closing FD. On
|
||||
failure to duplicate, close FD, set errno, and return -1. Preserve
|
||||
errno if FD is negative, so that the caller can always inspect
|
||||
errno when the returned value is negative.
|
||||
|
||||
This function is usefully wrapped around functions that return file
|
||||
descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */
|
||||
|
||||
int
|
||||
fd_safer (int fd)
|
||||
{
|
||||
if (STDIN_FILENO <= fd && fd <= STDERR_FILENO)
|
||||
{
|
||||
int f = dup_safer (fd);
|
||||
int e = errno;
|
||||
close (fd);
|
||||
errno = e;
|
||||
fd = f;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
264
gl/fsusage.c
Normal file
264
gl/fsusage.c
Normal file
|
@ -0,0 +1,264 @@
|
|||
/* fsusage.c -- return space usage of mounted file systems
|
||||
|
||||
Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "fsusage.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if STAT_STATVFS /* POSIX 1003.1-2001 (and later) with XSI */
|
||||
# include <sys/statvfs.h>
|
||||
#else
|
||||
/* Don't include backward-compatibility files unless they're needed.
|
||||
Eventually we'd like to remove all this cruft. */
|
||||
# include <fcntl.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/stat.h>
|
||||
# if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# endif
|
||||
# if HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
# endif
|
||||
# if HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
# endif
|
||||
# if HAVE_SYS_FS_S5PARAM_H /* Fujitsu UXP/V */
|
||||
# include <sys/fs/s5param.h>
|
||||
# endif
|
||||
# if defined HAVE_SYS_FILSYS_H && !defined _CRAY
|
||||
# include <sys/filsys.h> /* SVR2 */
|
||||
# endif
|
||||
# if HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
# endif
|
||||
# if HAVE_DUSTAT_H /* AIX PS/2 */
|
||||
# include <sys/dustat.h>
|
||||
# endif
|
||||
# include "full-read.h"
|
||||
#endif
|
||||
|
||||
/* The results of open() in this file are not used with fchdir,
|
||||
therefore save some unnecessary work in fchdir.c. */
|
||||
#undef open
|
||||
#undef close
|
||||
|
||||
/* Many space usage primitives use all 1 bits to denote a value that is
|
||||
not applicable or unknown. Propagate this information by returning
|
||||
a uintmax_t value that is all 1 bits if X is all 1 bits, even if X
|
||||
is unsigned and narrower than uintmax_t. */
|
||||
#define PROPAGATE_ALL_ONES(x) \
|
||||
((sizeof (x) < sizeof (uintmax_t) \
|
||||
&& (~ (x) == (sizeof (x) < sizeof (int) \
|
||||
? - (1 << (sizeof (x) * CHAR_BIT)) \
|
||||
: 0))) \
|
||||
? UINTMAX_MAX : (uintmax_t) (x))
|
||||
|
||||
/* Extract the top bit of X as an uintmax_t value. */
|
||||
#define EXTRACT_TOP_BIT(x) ((x) \
|
||||
& ((uintmax_t) 1 << (sizeof (x) * CHAR_BIT - 1)))
|
||||
|
||||
/* If a value is negative, many space usage primitives store it into an
|
||||
integer variable by assignment, even if the variable's type is unsigned.
|
||||
So, if a space usage variable X's top bit is set, convert X to the
|
||||
uintmax_t value V such that (- (uintmax_t) V) is the negative of
|
||||
the original value. If X's top bit is clear, just yield X.
|
||||
Use PROPAGATE_TOP_BIT if the original value might be negative;
|
||||
otherwise, use PROPAGATE_ALL_ONES. */
|
||||
#define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1))
|
||||
|
||||
/* Fill in the fields of FSP with information about space usage for
|
||||
the file system on which FILE resides.
|
||||
DISK is the device on which FILE is mounted, for space-getting
|
||||
methods that need to know it.
|
||||
Return 0 if successful, -1 if not. When returning -1, ensure that
|
||||
ERRNO is either a system error value, or zero if DISK is NULL
|
||||
on a system that requires a non-NULL value. */
|
||||
int
|
||||
get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
|
||||
{
|
||||
#if defined STAT_STATVFS /* POSIX */
|
||||
|
||||
struct statvfs fsd;
|
||||
|
||||
if (statvfs (file, &fsd) < 0)
|
||||
return -1;
|
||||
|
||||
/* f_frsize isn't guaranteed to be supported. */
|
||||
fsp->fsu_blocksize = (fsd.f_frsize
|
||||
? PROPAGATE_ALL_ONES (fsd.f_frsize)
|
||||
: PROPAGATE_ALL_ONES (fsd.f_bsize));
|
||||
|
||||
#elif defined STAT_STATFS2_FS_DATA /* Ultrix */
|
||||
|
||||
struct fs_data fsd;
|
||||
|
||||
if (statfs (file, &fsd) != 1)
|
||||
return -1;
|
||||
|
||||
fsp->fsu_blocksize = 1024;
|
||||
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
|
||||
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
|
||||
fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.fd_req.bfreen);
|
||||
fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.fd_req.bfreen) != 0;
|
||||
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
|
||||
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
|
||||
|
||||
#elif defined STAT_READ_FILSYS /* SVR2 */
|
||||
# ifndef SUPERBOFF
|
||||
# define SUPERBOFF (SUPERB * 512)
|
||||
# endif
|
||||
|
||||
struct filsys fsd;
|
||||
int fd;
|
||||
|
||||
if (! disk)
|
||||
{
|
||||
errno = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = open (disk, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
lseek (fd, (off_t) SUPERBOFF, 0);
|
||||
if (full_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
|
||||
{
|
||||
close (fd);
|
||||
return -1;
|
||||
}
|
||||
close (fd);
|
||||
|
||||
fsp->fsu_blocksize = (fsd.s_type == Fs2b ? 1024 : 512);
|
||||
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.s_fsize);
|
||||
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.s_tfree);
|
||||
fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.s_tfree);
|
||||
fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.s_tfree) != 0;
|
||||
fsp->fsu_files = (fsd.s_isize == -1
|
||||
? UINTMAX_MAX
|
||||
: (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1));
|
||||
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.s_tinode);
|
||||
|
||||
#elif defined STAT_STATFS3_OSF1
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (file, &fsd, sizeof (struct statfs)) != 0)
|
||||
return -1;
|
||||
|
||||
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
|
||||
|
||||
#elif defined STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (file, &fsd) < 0)
|
||||
return -1;
|
||||
|
||||
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
|
||||
|
||||
# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
|
||||
|
||||
/* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
|
||||
struct statfs are truncated to 2GB. These conditions detect that
|
||||
truncation, presumably without botching the 4.1.1 case, in which
|
||||
the values are not truncated. The correct counts are stored in
|
||||
undocumented spare fields. */
|
||||
if (fsd.f_blocks == 0x7fffffff / fsd.f_bsize && fsd.f_spare[0] > 0)
|
||||
{
|
||||
fsd.f_blocks = fsd.f_spare[0];
|
||||
fsd.f_bfree = fsd.f_spare[1];
|
||||
fsd.f_bavail = fsd.f_spare[2];
|
||||
}
|
||||
# endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
|
||||
|
||||
#elif defined STAT_STATFS2_FSIZE /* 4.4BSD */
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (file, &fsd) < 0)
|
||||
return -1;
|
||||
|
||||
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
|
||||
|
||||
#elif defined STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
|
||||
|
||||
# if !_AIX && !defined _SEQUENT_ && !defined DOLPHIN
|
||||
# define f_bavail f_bfree
|
||||
# endif
|
||||
|
||||
struct statfs fsd;
|
||||
|
||||
if (statfs (file, &fsd, sizeof fsd, 0) < 0)
|
||||
return -1;
|
||||
|
||||
/* Empirically, the block counts on most SVR3 and SVR3-derived
|
||||
systems seem to always be in terms of 512-byte blocks,
|
||||
no matter what value f_bsize has. */
|
||||
# if _AIX || defined _CRAY
|
||||
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
|
||||
# else
|
||||
fsp->fsu_blocksize = 512;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined STAT_STATVFS \
|
||||
|| (!defined STAT_STATFS2_FS_DATA && !defined STAT_READ_FILSYS))
|
||||
|
||||
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
|
||||
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
|
||||
fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.f_bavail);
|
||||
fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.f_bavail) != 0;
|
||||
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
|
||||
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined _AIX && defined _I386
|
||||
/* AIX PS/2 does not supply statfs. */
|
||||
|
||||
int
|
||||
statfs (char *file, struct statfs *fsb)
|
||||
{
|
||||
struct stat stats;
|
||||
struct dustat fsd;
|
||||
|
||||
if (stat (file, &stats) != 0)
|
||||
return -1;
|
||||
if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd)))
|
||||
return -1;
|
||||
fsb->f_type = 0;
|
||||
fsb->f_bsize = fsd.du_bsize;
|
||||
fsb->f_blocks = fsd.du_fsize - fsd.du_isize;
|
||||
fsb->f_bfree = fsd.du_tfree;
|
||||
fsb->f_bavail = fsd.du_tfree;
|
||||
fsb->f_files = (fsd.du_isize - 2) * fsd.du_inopb;
|
||||
fsb->f_ffree = fsd.du_tinode;
|
||||
fsb->f_fsid.val[0] = fsd.du_site;
|
||||
fsb->f_fsid.val[1] = fsd.du_pckno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _AIX && _I386 */
|
41
gl/fsusage.h
Normal file
41
gl/fsusage.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* fsusage.h -- declarations for file system space usage info
|
||||
|
||||
Copyright (C) 1991, 1992, 1997, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Space usage statistics for a file system. Blocks are 512-byte. */
|
||||
|
||||
#if !defined FSUSAGE_H_
|
||||
# define FSUSAGE_H_
|
||||
|
||||
# include <stdint.h>
|
||||
# include <stdbool.h>
|
||||
|
||||
struct fs_usage
|
||||
{
|
||||
uintmax_t fsu_blocksize; /* Size of a block. */
|
||||
uintmax_t fsu_blocks; /* Total blocks. */
|
||||
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
|
||||
uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */
|
||||
bool fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */
|
||||
uintmax_t fsu_files; /* Total file nodes. */
|
||||
uintmax_t fsu_ffree; /* Free file nodes. */
|
||||
};
|
||||
|
||||
int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp);
|
||||
|
||||
#endif
|
19
gl/full-read.c
Normal file
19
gl/full-read.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* An interface to read that retries after partial reads and interrupts.
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#define FULL_READ
|
||||
#include "full-write.c"
|
24
gl/full-read.h
Normal file
24
gl/full-read.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* An interface to read() that reads all it is asked to read.
|
||||
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, read to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Read COUNT bytes at BUF to descriptor FD, retrying if interrupted
|
||||
or if partial reads occur. Return the number of bytes successfully
|
||||
read, setting errno if that is less than COUNT. errno = 0 means EOF. */
|
||||
extern size_t full_read (int fd, void *buf, size_t count);
|
81
gl/full-write.c
Normal file
81
gl/full-write.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
/* An interface to read and write that retries (if necessary) until complete.
|
||||
|
||||
Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||
2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#ifdef FULL_READ
|
||||
# include "full-read.h"
|
||||
#else
|
||||
# include "full-write.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef FULL_READ
|
||||
# include "safe-read.h"
|
||||
# define safe_rw safe_read
|
||||
# define full_rw full_read
|
||||
# undef const
|
||||
# define const /* empty */
|
||||
#else
|
||||
# include "safe-write.h"
|
||||
# define safe_rw safe_write
|
||||
# define full_rw full_write
|
||||
#endif
|
||||
|
||||
#ifdef FULL_READ
|
||||
/* Set errno to zero upon EOF. */
|
||||
# define ZERO_BYTE_TRANSFER_ERRNO 0
|
||||
#else
|
||||
/* Some buggy drivers return 0 when one tries to write beyond
|
||||
a device's end. (Example: Linux 1.2.13 on /dev/fd0.)
|
||||
Set errno to ENOSPC so they get a sensible diagnostic. */
|
||||
# define ZERO_BYTE_TRANSFER_ERRNO ENOSPC
|
||||
#endif
|
||||
|
||||
/* Write(read) COUNT bytes at BUF to(from) descriptor FD, retrying if
|
||||
interrupted or if a partial write(read) occurs. Return the number
|
||||
of bytes transferred.
|
||||
When writing, set errno if fewer than COUNT bytes are written.
|
||||
When reading, if fewer than COUNT bytes are read, you must examine
|
||||
errno to distinguish failure from EOF (errno == 0). */
|
||||
size_t
|
||||
full_rw (int fd, const void *buf, size_t count)
|
||||
{
|
||||
size_t total = 0;
|
||||
const char *ptr = (const char *) buf;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
size_t n_rw = safe_rw (fd, ptr, count);
|
||||
if (n_rw == (size_t) -1)
|
||||
break;
|
||||
if (n_rw == 0)
|
||||
{
|
||||
errno = ZERO_BYTE_TRANSFER_ERRNO;
|
||||
break;
|
||||
}
|
||||
total += n_rw;
|
||||
ptr += n_rw;
|
||||
count -= n_rw;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
35
gl/full-write.h
Normal file
35
gl/full-write.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* An interface to write() that writes all it is asked to write.
|
||||
|
||||
Copyright (C) 2002-2003 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Write COUNT bytes at BUF to descriptor FD, retrying if interrupted
|
||||
or if partial writes occur. Return the number of bytes successfully
|
||||
written, setting errno if that is less than COUNT. */
|
||||
extern size_t full_write (int fd, const void *buf, size_t count);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
77
gl/gai_strerror.c
Normal file
77
gl/gai_strerror.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <config.h>
|
||||
# include "getaddrinfo.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <libintl.h>
|
||||
#else
|
||||
# include "gettext.h"
|
||||
# define _(String) gettext (String)
|
||||
# define N_(String) String
|
||||
#endif
|
||||
|
||||
static struct
|
||||
{
|
||||
int code;
|
||||
const char *msg;
|
||||
}
|
||||
values[] =
|
||||
{
|
||||
{ EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
|
||||
{ EAI_AGAIN, N_("Temporary failure in name resolution") },
|
||||
{ EAI_BADFLAGS, N_("Bad value for ai_flags") },
|
||||
{ EAI_FAIL, N_("Non-recoverable failure in name resolution") },
|
||||
{ EAI_FAMILY, N_("ai_family not supported") },
|
||||
{ EAI_MEMORY, N_("Memory allocation failure") },
|
||||
{ EAI_NODATA, N_("No address associated with hostname") },
|
||||
{ EAI_NONAME, N_("Name or service not known") },
|
||||
{ EAI_SERVICE, N_("Servname not supported for ai_socktype") },
|
||||
{ EAI_SOCKTYPE, N_("ai_socktype not supported") },
|
||||
{ EAI_SYSTEM, N_("System error") },
|
||||
#ifdef __USE_GNU
|
||||
{ EAI_INPROGRESS, N_("Processing request in progress") },
|
||||
{ EAI_CANCELED, N_("Request canceled") },
|
||||
{ EAI_NOTCANCELED, N_("Request not canceled") },
|
||||
{ EAI_ALLDONE, N_("All requests done") },
|
||||
{ EAI_INTR, N_("Interrupted by a signal") },
|
||||
{ EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *
|
||||
gai_strerror (int code)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
|
||||
if (values[i].code == code)
|
||||
return _(values[i].msg);
|
||||
|
||||
return _("Unknown error");
|
||||
}
|
||||
#ifdef _LIBC
|
||||
libc_hidden_def (gai_strerror)
|
||||
#endif
|
417
gl/getaddrinfo.c
Normal file
417
gl/getaddrinfo.c
Normal file
|
@ -0,0 +1,417 @@
|
|||
/* Get address information (partial implementation).
|
||||
Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
Contributed by Simon Josefsson <simon@josefsson.org>.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "getaddrinfo.h"
|
||||
|
||||
#if HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
/* Get calloc. */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Get memcpy. */
|
||||
#include <string.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "gettext.h"
|
||||
#define _(String) gettext (String)
|
||||
#define N_(String) String
|
||||
|
||||
#include "inet_ntop.h"
|
||||
#include "snprintf.h"
|
||||
#include "strdup.h"
|
||||
|
||||
/* BeOS has AF_INET, but not PF_INET. */
|
||||
#ifndef PF_INET
|
||||
# define PF_INET AF_INET
|
||||
#endif
|
||||
/* BeOS also lacks PF_UNSPEC. */
|
||||
#ifndef PF_UNSPEC
|
||||
# define PF_UNSPEC 0
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# define WIN32_NATIVE
|
||||
#endif
|
||||
|
||||
#ifdef WIN32_NATIVE
|
||||
typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
|
||||
const struct addrinfo*,
|
||||
struct addrinfo**);
|
||||
typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
|
||||
typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
|
||||
socklen_t, char*, DWORD,
|
||||
char*, DWORD, int);
|
||||
|
||||
static getaddrinfo_func getaddrinfo_ptr = NULL;
|
||||
static freeaddrinfo_func freeaddrinfo_ptr = NULL;
|
||||
static getnameinfo_func getnameinfo_ptr = NULL;
|
||||
|
||||
static int
|
||||
use_win32_p (void)
|
||||
{
|
||||
static int done = 0;
|
||||
HMODULE h;
|
||||
|
||||
if (done)
|
||||
return getaddrinfo_ptr ? 1 : 0;
|
||||
|
||||
done = 1;
|
||||
|
||||
h = GetModuleHandle ("ws2_32.dll");
|
||||
|
||||
if (h)
|
||||
{
|
||||
getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
|
||||
freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo");
|
||||
getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
|
||||
}
|
||||
|
||||
/* If either is missing, something is odd. */
|
||||
if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
|
||||
{
|
||||
getaddrinfo_ptr = NULL;
|
||||
freeaddrinfo_ptr = NULL;
|
||||
getnameinfo_ptr = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool
|
||||
validate_family (int family)
|
||||
{
|
||||
/* FIXME: Support more families. */
|
||||
#if HAVE_IPV4
|
||||
if (family == PF_INET)
|
||||
return true;
|
||||
#endif
|
||||
#if HAVE_IPV6
|
||||
if (family == PF_INET6)
|
||||
return true;
|
||||
#endif
|
||||
if (family == PF_UNSPEC)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Translate name of a service location and/or a service name to set of
|
||||
socket addresses. */
|
||||
int
|
||||
getaddrinfo (const char *restrict nodename,
|
||||
const char *restrict servname,
|
||||
const struct addrinfo *restrict hints,
|
||||
struct addrinfo **restrict res)
|
||||
{
|
||||
struct addrinfo *tmp;
|
||||
int port = 0;
|
||||
struct hostent *he;
|
||||
void *storage;
|
||||
size_t size;
|
||||
#if HAVE_IPV6
|
||||
struct v6_pair {
|
||||
struct addrinfo addrinfo;
|
||||
struct sockaddr_in6 sockaddr_in6;
|
||||
};
|
||||
#endif
|
||||
#if HAVE_IPV4
|
||||
struct v4_pair {
|
||||
struct addrinfo addrinfo;
|
||||
struct sockaddr_in sockaddr_in;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WIN32_NATIVE
|
||||
if (use_win32_p ())
|
||||
return getaddrinfo_ptr (nodename, servname, hints, res);
|
||||
#endif
|
||||
|
||||
if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
|
||||
/* FIXME: Support more flags. */
|
||||
return EAI_BADFLAGS;
|
||||
|
||||
if (hints && !validate_family (hints->ai_family))
|
||||
return EAI_FAMILY;
|
||||
|
||||
if (hints &&
|
||||
hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
|
||||
/* FIXME: Support other socktype. */
|
||||
return EAI_SOCKTYPE; /* FIXME: Better return code? */
|
||||
|
||||
if (!nodename)
|
||||
{
|
||||
if (!(hints->ai_flags & AI_PASSIVE))
|
||||
return EAI_NONAME;
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
|
||||
#else
|
||||
nodename = "0.0.0.0";
|
||||
#endif
|
||||
}
|
||||
|
||||
if (servname)
|
||||
{
|
||||
struct servent *se = NULL;
|
||||
const char *proto =
|
||||
(hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
|
||||
|
||||
if (!(hints->ai_flags & AI_NUMERICSERV))
|
||||
/* FIXME: Use getservbyname_r if available. */
|
||||
se = getservbyname (servname, proto);
|
||||
|
||||
if (!se)
|
||||
{
|
||||
char *c;
|
||||
if (!(*servname >= '0' && *servname <= '9'))
|
||||
return EAI_NONAME;
|
||||
port = strtoul (servname, &c, 10);
|
||||
if (*c || port > 0xffff)
|
||||
return EAI_NONAME;
|
||||
port = htons (port);
|
||||
}
|
||||
else
|
||||
port = se->s_port;
|
||||
}
|
||||
|
||||
/* FIXME: Use gethostbyname_r if available. */
|
||||
he = gethostbyname (nodename);
|
||||
if (!he || he->h_addr_list[0] == NULL)
|
||||
return EAI_NONAME;
|
||||
|
||||
switch (he->h_addrtype)
|
||||
{
|
||||
#if HAVE_IPV6
|
||||
case PF_INET6:
|
||||
size = sizeof (struct v6_pair);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if HAVE_IPV4
|
||||
case PF_INET:
|
||||
size = sizeof (struct v4_pair);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return EAI_NODATA;
|
||||
}
|
||||
|
||||
storage = calloc (1, size);
|
||||
if (!storage)
|
||||
return EAI_MEMORY;
|
||||
|
||||
switch (he->h_addrtype)
|
||||
{
|
||||
#if HAVE_IPV6
|
||||
case PF_INET6:
|
||||
{
|
||||
struct v6_pair *p = storage;
|
||||
struct sockaddr_in6 *sinp = &p->sockaddr_in6;
|
||||
tmp = &p->addrinfo;
|
||||
|
||||
if (port)
|
||||
sinp->sin6_port = port;
|
||||
|
||||
if (he->h_length != sizeof (sinp->sin6_addr))
|
||||
{
|
||||
free (storage);
|
||||
return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */
|
||||
}
|
||||
|
||||
memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
|
||||
|
||||
tmp->ai_addr = (struct sockaddr *) sinp;
|
||||
tmp->ai_addrlen = sizeof *sinp;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if HAVE_IPV4
|
||||
case PF_INET:
|
||||
{
|
||||
struct v4_pair *p = storage;
|
||||
struct sockaddr_in *sinp = &p->sockaddr_in;
|
||||
tmp = &p->addrinfo;
|
||||
|
||||
if (port)
|
||||
sinp->sin_port = port;
|
||||
|
||||
if (he->h_length != sizeof (sinp->sin_addr))
|
||||
{
|
||||
free (storage);
|
||||
return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */
|
||||
}
|
||||
|
||||
memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
|
||||
|
||||
tmp->ai_addr = (struct sockaddr *) sinp;
|
||||
tmp->ai_addrlen = sizeof *sinp;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
free (storage);
|
||||
return EAI_NODATA;
|
||||
}
|
||||
|
||||
if (hints && hints->ai_flags & AI_CANONNAME)
|
||||
{
|
||||
const char *cn;
|
||||
if (he->h_name)
|
||||
cn = he->h_name;
|
||||
else
|
||||
cn = nodename;
|
||||
|
||||
tmp->ai_canonname = strdup (cn);
|
||||
if (!tmp->ai_canonname)
|
||||
{
|
||||
free (storage);
|
||||
return EAI_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
|
||||
tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
|
||||
tmp->ai_addr->sa_family = he->h_addrtype;
|
||||
tmp->ai_family = he->h_addrtype;
|
||||
|
||||
/* FIXME: If more than one address, create linked list of addrinfo's. */
|
||||
|
||||
*res = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Free `addrinfo' structure AI including associated storage. */
|
||||
void
|
||||
freeaddrinfo (struct addrinfo *ai)
|
||||
{
|
||||
#ifdef WIN32_NATIVE
|
||||
if (use_win32_p ())
|
||||
{
|
||||
freeaddrinfo_ptr (ai);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (ai)
|
||||
{
|
||||
struct addrinfo *cur;
|
||||
|
||||
cur = ai;
|
||||
ai = ai->ai_next;
|
||||
|
||||
if (cur->ai_canonname) free (cur->ai_canonname);
|
||||
free (cur);
|
||||
}
|
||||
}
|
||||
|
||||
int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
|
||||
char *restrict node, socklen_t nodelen,
|
||||
char *restrict service, socklen_t servicelen,
|
||||
int flags)
|
||||
{
|
||||
#ifdef WIN32_NATIVE
|
||||
if (use_win32_p ())
|
||||
return getnameinfo_ptr (sa, salen, node, nodelen,
|
||||
service, servicelen, flags);
|
||||
#endif
|
||||
|
||||
/* FIXME: Support other flags. */
|
||||
if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
|
||||
(service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
|
||||
(flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
|
||||
return EAI_BADFLAGS;
|
||||
|
||||
if (sa == NULL || salen < sizeof (sa->sa_family))
|
||||
return EAI_FAMILY;
|
||||
|
||||
switch (sa->sa_family)
|
||||
{
|
||||
#if HAVE_IPV4
|
||||
case AF_INET:
|
||||
if (salen < sizeof (struct sockaddr_in))
|
||||
return EAI_FAMILY;
|
||||
break;
|
||||
#endif
|
||||
#if HAVE_IPV6
|
||||
case AF_INET6:
|
||||
if (salen < sizeof (struct sockaddr_in6))
|
||||
return EAI_FAMILY;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return EAI_FAMILY;
|
||||
}
|
||||
|
||||
if (node && nodelen > 0 && flags & NI_NUMERICHOST)
|
||||
{
|
||||
switch (sa->sa_family)
|
||||
{
|
||||
#if HAVE_IPV4
|
||||
case AF_INET:
|
||||
if (!inet_ntop (AF_INET,
|
||||
&(((const struct sockaddr_in *) sa)->sin_addr),
|
||||
node, nodelen))
|
||||
return EAI_SYSTEM;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if HAVE_IPV6
|
||||
case AF_INET6:
|
||||
if (!inet_ntop (AF_INET6,
|
||||
&(((const struct sockaddr_in6 *) sa)->sin6_addr),
|
||||
node, nodelen))
|
||||
return EAI_SYSTEM;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return EAI_FAMILY;
|
||||
}
|
||||
}
|
||||
|
||||
if (service && servicelen > 0 && flags & NI_NUMERICSERV)
|
||||
switch (sa->sa_family)
|
||||
{
|
||||
#if HAVE_IPV4
|
||||
case AF_INET:
|
||||
#endif
|
||||
#if HAVE_IPV6
|
||||
case AF_INET6:
|
||||
#endif
|
||||
{
|
||||
unsigned short int port
|
||||
= ntohs (((const struct sockaddr_in *) sa)->sin_port);
|
||||
if (servicelen <= snprintf (service, servicelen, "%u", port))
|
||||
return EAI_OVERFLOW;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
155
gl/getaddrinfo.h
Normal file
155
gl/getaddrinfo.h
Normal file
|
@ -0,0 +1,155 @@
|
|||
/* Get address information.
|
||||
Copyright (C) 1996-2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Simon Josefsson <simon@josefsson.org>.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef GETADDRINFO_H
|
||||
#define GETADDRINFO_H
|
||||
|
||||
/* sys/socket.h in i386-unknown-freebsd4.10 and
|
||||
powerpc-apple-darwin5.5 require sys/types.h, so include it first.
|
||||
Then we'll also get 'socklen_t' and 'struct sockaddr' which are
|
||||
used below. */
|
||||
#include <sys/types.h>
|
||||
/* Get all getaddrinfo related declarations, if available. */
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRUCT_ADDRINFO
|
||||
|
||||
/* Structure to contain information about address of a service provider. */
|
||||
struct addrinfo
|
||||
{
|
||||
int ai_flags; /* Input flags. */
|
||||
int ai_family; /* Protocol family for socket. */
|
||||
int ai_socktype; /* Socket type. */
|
||||
int ai_protocol; /* Protocol for socket. */
|
||||
socklen_t ai_addrlen; /* Length of socket address. */
|
||||
struct sockaddr *ai_addr; /* Socket address for socket. */
|
||||
char *ai_canonname; /* Canonical name for service location. */
|
||||
struct addrinfo *ai_next; /* Pointer to next in list. */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Possible values for `ai_flags' field in `addrinfo' structure. */
|
||||
#ifndef AI_PASSIVE
|
||||
# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
|
||||
#endif
|
||||
#ifndef AI_CANONNAME
|
||||
# define AI_CANONNAME 0x0002 /* Request for canonical name. */
|
||||
#endif
|
||||
#ifndef AI_NUMERICSERV
|
||||
# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* The commented out definitions below are not yet implemented in the
|
||||
GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
|
||||
cause conflicts on systems with a getaddrinfo() function which does not
|
||||
define them.
|
||||
|
||||
If they are restored, be sure to protect the definitions with #ifndef. */
|
||||
#define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
|
||||
#define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
|
||||
#define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
|
||||
#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
|
||||
returned address type.. */
|
||||
#endif /* 0 */
|
||||
|
||||
/* Error values for `getaddrinfo' function. */
|
||||
#ifndef EAI_BADFLAGS
|
||||
# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
|
||||
# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
|
||||
# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
|
||||
# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
|
||||
# define EAI_NODATA -5 /* No address associated with NAME. */
|
||||
# define EAI_FAMILY -6 /* `ai_family' not supported. */
|
||||
# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
|
||||
# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
|
||||
# define EAI_MEMORY -10 /* Memory allocation failure. */
|
||||
#endif
|
||||
#ifndef EAI_OVERFLOW
|
||||
/* Not defined on mingw32. */
|
||||
# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
|
||||
#endif
|
||||
#ifndef EAI_ADDRFAMILY
|
||||
/* Not defined on mingw32. */
|
||||
# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
|
||||
#endif
|
||||
#ifndef EAI_SYSTEM
|
||||
/* Not defined on mingw32. */
|
||||
# define EAI_SYSTEM -11 /* System error returned in `errno'. */
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# ifndef EAI_INPROGRESS
|
||||
# define EAI_INPROGRESS -100 /* Processing request in progress. */
|
||||
# define EAI_CANCELED -101 /* Request canceled. */
|
||||
# define EAI_NOTCANCELED -102 /* Request not canceled. */
|
||||
# define EAI_ALLDONE -103 /* All requests done. */
|
||||
# define EAI_INTR -104 /* Interrupted by a signal. */
|
||||
# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETADDRINFO
|
||||
/* Translate name of a service location and/or a service name to set of
|
||||
socket addresses.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
|
||||
extern int getaddrinfo (const char *restrict nodename,
|
||||
const char *restrict servname,
|
||||
const struct addrinfo *restrict hints,
|
||||
struct addrinfo **restrict res);
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_FREEADDRINFO
|
||||
/* Free `addrinfo' structure AI including associated storage.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
|
||||
extern void freeaddrinfo (struct addrinfo *ai);
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GAI_STRERROR
|
||||
/* Convert error return from getaddrinfo() to a string.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
|
||||
extern const char *gai_strerror (int ecode);
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_GETNAMEINFO
|
||||
/* Convert socket address to printable node and service names.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
|
||||
extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
|
||||
char *restrict node, socklen_t nodelen,
|
||||
char *restrict service, socklen_t servicelen,
|
||||
int flags);
|
||||
|
||||
#endif
|
||||
|
||||
/* Possible flags for getnameinfo. */
|
||||
#ifndef NI_NUMERICHOST
|
||||
# define NI_NUMERICHOST 1
|
||||
#endif
|
||||
#ifndef NI_NUMERICSERV
|
||||
# define NI_NUMERICSERV 2
|
||||
#endif
|
||||
|
||||
#endif /* GETADDRINFO_H */
|
52
gl/gethostname.c
Normal file
52
gl/gethostname.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* gethostname emulation for SysV and POSIX.1.
|
||||
|
||||
Copyright (C) 1992, 2003, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* David MacKenzie <djm@gnu.ai.mit.edu> */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_UNAME
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
/* Put up to LEN chars of the host name into NAME.
|
||||
Null terminate it if the name is shorter than LEN.
|
||||
Return 0 if ok, -1 if error. */
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
int
|
||||
gethostname (char *name, size_t len)
|
||||
{
|
||||
#ifdef HAVE_UNAME
|
||||
struct utsname uts;
|
||||
|
||||
if (uname (&uts) == -1)
|
||||
return -1;
|
||||
if (len > sizeof (uts.nodename))
|
||||
{
|
||||
/* More space than we need is available. */
|
||||
name[sizeof (uts.nodename)] = '\0';
|
||||
len = sizeof (uts.nodename);
|
||||
}
|
||||
strncpy (name, uts.nodename, len);
|
||||
#else
|
||||
strcpy (name, ""); /* Hardcode your system name if you want. */
|
||||
#endif
|
||||
return 0;
|
||||
}
|
1020
gl/getloadavg.c
Normal file
1020
gl/getloadavg.c
Normal file
File diff suppressed because it is too large
Load diff
1191
gl/getopt.c
Normal file
1191
gl/getopt.c
Normal file
File diff suppressed because it is too large
Load diff
171
gl/getopt1.c
Normal file
171
gl/getopt1.c
Normal file
|
@ -0,0 +1,171 @@
|
|||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <getopt.h>
|
||||
#else
|
||||
# include <config.h>
|
||||
# include "getopt.h"
|
||||
#endif
|
||||
#include "getopt_int.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||||
opt_index, 0, 0);
|
||||
}
|
||||
|
||||
int
|
||||
_getopt_long_r (int argc, char **argv, const char *options,
|
||||
const struct option *long_options, int *opt_index,
|
||||
struct _getopt_data *d)
|
||||
{
|
||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||
0, 0, d);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (int argc, char *__getopt_argv_const *argv,
|
||||
const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||||
opt_index, 1, 0);
|
||||
}
|
||||
|
||||
int
|
||||
_getopt_long_only_r (int argc, char **argv, const char *options,
|
||||
const struct option *long_options, int *opt_index,
|
||||
struct _getopt_data *d)
|
||||
{
|
||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||
1, 0, d);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
226
gl/getopt_.h
Normal file
226
gl/getopt_.h
Normal file
|
@ -0,0 +1,226 @@
|
|||
/* Declarations for getopt.
|
||||
Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||
identifier that prefixes the external functions and variables
|
||||
defined in this header. When this happens, include the
|
||||
headers that might declare getopt so that they will not cause
|
||||
confusion if included after this file. Then systematically rename
|
||||
identifiers so that they do not collide with the system functions
|
||||
and variables. Renaming avoids problems with some compilers and
|
||||
linkers. */
|
||||
#if defined __GETOPT_PREFIX && !defined __need_getopt
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
# undef __need_getopt
|
||||
# undef getopt
|
||||
# undef getopt_long
|
||||
# undef getopt_long_only
|
||||
# undef optarg
|
||||
# undef opterr
|
||||
# undef optind
|
||||
# undef optopt
|
||||
# define __GETOPT_CONCAT(x, y) x ## y
|
||||
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
||||
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
||||
# define getopt __GETOPT_ID (getopt)
|
||||
# define getopt_long __GETOPT_ID (getopt_long)
|
||||
# define getopt_long_only __GETOPT_ID (getopt_long_only)
|
||||
# define optarg __GETOPT_ID (optarg)
|
||||
# define opterr __GETOPT_ID (opterr)
|
||||
# define optind __GETOPT_ID (optind)
|
||||
# define optopt __GETOPT_ID (optopt)
|
||||
#endif
|
||||
|
||||
/* Standalone applications get correct prototypes for getopt_long and
|
||||
getopt_long_only; they declare "char **argv". libc uses prototypes
|
||||
with "char *const *argv" that are incorrect because getopt_long and
|
||||
getopt_long_only can permute argv; this is required for backward
|
||||
compatibility (e.g., for LSB 2.0.1).
|
||||
|
||||
This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
|
||||
but it caused redefinition warnings if both unistd.h and getopt.h were
|
||||
included, since unistd.h includes getopt.h having previously defined
|
||||
__need_getopt.
|
||||
|
||||
The only place where __getopt_argv_const is used is in definitions
|
||||
of getopt_long and getopt_long_only below, but these are visible
|
||||
only if __need_getopt is not defined, so it is quite safe to rewrite
|
||||
the conditional as follows:
|
||||
*/
|
||||
#if !defined __need_getopt
|
||||
# if defined __GETOPT_PREFIX
|
||||
# define __getopt_argv_const /* empty */
|
||||
# else
|
||||
# define __getopt_argv_const const
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||
standalone, or this is the first header included in the source file.
|
||||
If we are being used with glibc, we need to include <features.h>, but
|
||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||
#if !defined __GNU_LIBRARY__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifndef __THROW
|
||||
# ifndef __GNUC_PREREQ
|
||||
# define __GNUC_PREREQ(maj, min) (0)
|
||||
# endif
|
||||
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
#ifndef __need_getopt
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
# define no_argument 0
|
||||
# define required_argument 1
|
||||
# define optional_argument 2
|
||||
#endif /* need getopt */
|
||||
|
||||
|
||||
/* Get definitions and prototypes for functions to process the
|
||||
arguments in ARGV (ARGC of them, minus the program name) for
|
||||
options given in OPTS.
|
||||
|
||||
Return the option character from OPTS just read. Return -1 when
|
||||
there are no more options. For unrecognized options, or options
|
||||
missing arguments, `optopt' is set to the option letter, and '?' is
|
||||
returned.
|
||||
|
||||
The OPTS string is a list of characters which are recognized option
|
||||
letters, optionally followed by colons, specifying that that letter
|
||||
takes an argument, to be placed in `optarg'.
|
||||
|
||||
If a letter in OPTS is followed by two colons, its argument is
|
||||
optional. This behavior is specific to the GNU `getopt'.
|
||||
|
||||
The argument `--' causes premature termination of argument
|
||||
scanning, explicitly telling `getopt' that there are no more
|
||||
options.
|
||||
|
||||
If OPTS begins with `-', then non-option arguments are treated as
|
||||
arguments to the option '\1'. This behavior is specific to the GNU
|
||||
`getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in
|
||||
the environment, then do not permute arguments. */
|
||||
|
||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
|
||||
__THROW;
|
||||
|
||||
#ifndef __need_getopt
|
||||
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW;
|
||||
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* getopt.h */
|
131
gl/getopt_int.h
Normal file
131
gl/getopt_int.h
Normal file
|
@ -0,0 +1,131 @@
|
|||
/* Internal declarations for getopt.
|
||||
Copyright (C) 1989-1994,1996-1999,2001,2003,2004
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GETOPT_INT_H
|
||||
#define _GETOPT_INT_H 1
|
||||
|
||||
extern int _getopt_internal (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only, int __posixly_correct);
|
||||
|
||||
|
||||
/* Reentrant versions which can handle parsing multiple argument
|
||||
vectors at the same time. */
|
||||
|
||||
/* Data type for reentrant functions. */
|
||||
struct _getopt_data
|
||||
{
|
||||
/* These have exactly the same meaning as the corresponding global
|
||||
variables, except that they are used for the reentrant
|
||||
versions of getopt. */
|
||||
int optind;
|
||||
int opterr;
|
||||
int optopt;
|
||||
char *optarg;
|
||||
|
||||
/* Internal members. */
|
||||
|
||||
/* True if the internal members have been initialized. */
|
||||
int __initialized;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
in which the last option character we returned was found.
|
||||
This allows us to pick up the scan where we left off.
|
||||
|
||||
If this is zero, or a null string, it means resume the scan
|
||||
by advancing to the next ARGV-element. */
|
||||
char *__nextchar;
|
||||
|
||||
/* Describe how to deal with options that follow non-option ARGV-elements.
|
||||
|
||||
If the caller did not specify anything,
|
||||
the default is REQUIRE_ORDER if the environment variable
|
||||
POSIXLY_CORRECT is defined, PERMUTE otherwise.
|
||||
|
||||
REQUIRE_ORDER means don't recognize them as options;
|
||||
stop option processing when the first non-option is seen.
|
||||
This is what Unix does.
|
||||
This mode of operation is selected by either setting the environment
|
||||
variable POSIXLY_CORRECT, or using `+' as the first character
|
||||
of the list of option characters, or by calling getopt.
|
||||
|
||||
PERMUTE is the default. We permute the contents of ARGV as we
|
||||
scan, so that eventually all the non-options are at the end.
|
||||
This allows options to be given in any order, even with programs
|
||||
that were not written to expect this.
|
||||
|
||||
RETURN_IN_ORDER is an option available to programs that were
|
||||
written to expect options and other ARGV-elements in any order
|
||||
and that care about the ordering of the two. We describe each
|
||||
non-option ARGV-element as if it were the argument of an option
|
||||
with character code 1. Using `-' as the first character of the
|
||||
list of option characters selects this mode of operation.
|
||||
|
||||
The special argument `--' forces an end of option-scanning regardless
|
||||
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
|
||||
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
|
||||
|
||||
enum
|
||||
{
|
||||
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
||||
} __ordering;
|
||||
|
||||
/* If the POSIXLY_CORRECT environment variable is set
|
||||
or getopt was called. */
|
||||
int __posixly_correct;
|
||||
|
||||
|
||||
/* Handle permutation of arguments. */
|
||||
|
||||
/* Describe the part of ARGV that contains non-options that have
|
||||
been skipped. `first_nonopt' is the index in ARGV of the first
|
||||
of them; `last_nonopt' is the index after the last of them. */
|
||||
|
||||
int __first_nonopt;
|
||||
int __last_nonopt;
|
||||
|
||||
#if defined _LIBC && defined USE_NONOPTION_FLAGS
|
||||
int __nonoption_flags_max_len;
|
||||
int __nonoption_flags_len;
|
||||
# endif
|
||||
};
|
||||
|
||||
/* The initializer is necessary to set OPTIND and OPTERR to their
|
||||
default values and to clear the initialization flag. */
|
||||
#define _GETOPT_DATA_INITIALIZER { 1, 1 }
|
||||
|
||||
extern int _getopt_internal_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only, int __posixly_correct,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
extern int _getopt_long_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
extern int _getopt_long_only_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts,
|
||||
int *__longind,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
#endif /* getopt_int.h */
|
270
gl/gettext.h
Normal file
270
gl/gettext.h
Normal file
|
@ -0,0 +1,270 @@
|
|||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if ENABLE_NLS
|
||||
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
|
||||
/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
|
||||
the gettext() and ngettext() macros. This is an alternative to calling
|
||||
textdomain(), and is useful for libraries. */
|
||||
# ifdef DEFAULT_TEXT_DOMAIN
|
||||
# undef gettext
|
||||
# define gettext(Msgid) \
|
||||
dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
|
||||
chokes if dcgettext is defined as a macro. So include it now, to make
|
||||
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
|
||||
as well because people using "gettext.h" will not include <libintl.h>,
|
||||
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
|
||||
is OK. */
|
||||
#if defined(__sun)
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
|
||||
<libintl.h>, which chokes if dcgettext is defined as a macro. So include
|
||||
it now, to make later inclusions of <libintl.h> a NOP. */
|
||||
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
|
||||
# include <cstdlib>
|
||||
# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Disabled NLS.
|
||||
The casts to 'const char *' serve the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
|
||||
# define dcgettext(Domainname, Msgid, Category) \
|
||||
((void) (Category), dgettext (Domainname, Msgid))
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 \
|
||||
? ((void) (Msgid2), (const char *) (Msgid1)) \
|
||||
: ((void) (Msgid1), (const char *) (Msgid2)))
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# define bindtextdomain(Domainname, Dirname) \
|
||||
((void) (Domainname), (const char *) (Dirname))
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) \
|
||||
((void) (Domainname), (const char *) (Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
/* A pseudo function call that serves as a marker for the automated
|
||||
extraction of messages, but does not call gettext(). The run-time
|
||||
translation is done at a different place in the code.
|
||||
The argument, String, should be a literal string. Concatenated strings
|
||||
and other string expressions won't work.
|
||||
The macro's expansion is not parenthesized, so that it is suitable as
|
||||
initializer for static 'char[]' or 'const char[]' variables. */
|
||||
#define gettext_noop(String) String
|
||||
|
||||
/* The separator between msgctxt and msgid in a .mo file. */
|
||||
#define GETTEXT_CONTEXT_GLUE "\004"
|
||||
|
||||
/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
|
||||
MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
|
||||
short and rarely need to change.
|
||||
The letter 'p' stands for 'particular' or 'special'. */
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#else
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#endif
|
||||
#define dpgettext(Domainname, Msgctxt, Msgid) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#else
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#endif
|
||||
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
pgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
const char *translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
if (translation == msg_ctxt_id)
|
||||
return msgid;
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
npgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
const char *translation =
|
||||
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
if (translation == msg_ctxt_id || translation == msgid_plural)
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
|
||||
can be arbitrary expressions. But for string literals these macros are
|
||||
less efficient than those above. */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
|
||||
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
|
||||
/* || __STDC_VERSION__ >= 199901L */ )
|
||||
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define pgettext_expr(Msgctxt, Msgid) \
|
||||
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
|
||||
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
|
||||
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (translation != msg_ctxt_id)
|
||||
return translation;
|
||||
}
|
||||
return msgid;
|
||||
}
|
||||
|
||||
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcnpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (!(translation == msg_ctxt_id || translation == msgid_plural))
|
||||
return translation;
|
||||
}
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
}
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
238
gl/inet_ntop.c
Normal file
238
gl/inet_ntop.c
Normal file
|
@ -0,0 +1,238 @@
|
|||
/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
|
||||
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1999 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "inet_ntop.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef EAFNOSUPPORT
|
||||
# define EAFNOSUPPORT EINVAL
|
||||
#endif
|
||||
|
||||
#define NS_IN6ADDRSZ 16
|
||||
#define NS_INT16SZ 2
|
||||
|
||||
/*
|
||||
* WARNING: Don't even consider trying to compile this on a system where
|
||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||
*/
|
||||
typedef int verify_int_size[2 * sizeof (int) - 7];
|
||||
|
||||
static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
|
||||
#if HAVE_IPV6
|
||||
static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
|
||||
#endif
|
||||
|
||||
|
||||
/* char *
|
||||
* inet_ntop(af, src, dst, size)
|
||||
* convert a network format address to presentation format.
|
||||
* return:
|
||||
* pointer to presentation format address (`dst'), or NULL (see errno).
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
const char *
|
||||
inet_ntop (int af, const void *restrict src,
|
||||
char *restrict dst, socklen_t cnt)
|
||||
{
|
||||
switch (af)
|
||||
{
|
||||
#if HAVE_IPV4
|
||||
case AF_INET:
|
||||
return (inet_ntop4 (src, dst, cnt));
|
||||
#endif
|
||||
|
||||
#if HAVE_IPV6
|
||||
case AF_INET6:
|
||||
return (inet_ntop6 (src, dst, cnt));
|
||||
#endif
|
||||
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (NULL);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* const char *
|
||||
* inet_ntop4(src, dst, size)
|
||||
* format an IPv4 address
|
||||
* return:
|
||||
* `dst' (as a const)
|
||||
* notes:
|
||||
* (1) uses no statics
|
||||
* (2) takes a u_char* not an in_addr as input
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static const char *
|
||||
inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
|
||||
{
|
||||
char tmp[sizeof "255.255.255.255"];
|
||||
int len;
|
||||
|
||||
len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
|
||||
if (len < 0)
|
||||
return NULL;
|
||||
|
||||
if (len > size)
|
||||
{
|
||||
errno = ENOSPC;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return strcpy (dst, tmp);
|
||||
}
|
||||
|
||||
#if HAVE_IPV6
|
||||
|
||||
/* const char *
|
||||
* inet_ntop6(src, dst, size)
|
||||
* convert IPv6 binary address into presentation (printable) format
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static const char *
|
||||
inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
|
||||
{
|
||||
/*
|
||||
* Note that int32_t and int16_t need only be "at least" large enough
|
||||
* to contain a value of the specified size. On some systems, like
|
||||
* Crays, there is no such thing as an integer variable with 16 bits.
|
||||
* Keep this in mind if you think this function should have been coded
|
||||
* to use pointer overlays. All the world's not a VAX.
|
||||
*/
|
||||
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
|
||||
struct
|
||||
{
|
||||
int base, len;
|
||||
} best, cur;
|
||||
unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Preprocess:
|
||||
* Copy the input (bytewise) array into a wordwise array.
|
||||
* Find the longest run of 0x00's in src[] for :: shorthanding.
|
||||
*/
|
||||
memset (words, '\0', sizeof words);
|
||||
for (i = 0; i < NS_IN6ADDRSZ; i += 2)
|
||||
words[i / 2] = (src[i] << 8) | src[i + 1];
|
||||
best.base = -1;
|
||||
cur.base = -1;
|
||||
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
|
||||
{
|
||||
if (words[i] == 0)
|
||||
{
|
||||
if (cur.base == -1)
|
||||
cur.base = i, cur.len = 1;
|
||||
else
|
||||
cur.len++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cur.base != -1)
|
||||
{
|
||||
if (best.base == -1 || cur.len > best.len)
|
||||
best = cur;
|
||||
cur.base = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cur.base != -1)
|
||||
{
|
||||
if (best.base == -1 || cur.len > best.len)
|
||||
best = cur;
|
||||
}
|
||||
if (best.base != -1 && best.len < 2)
|
||||
best.base = -1;
|
||||
|
||||
/*
|
||||
* Format the result.
|
||||
*/
|
||||
tp = tmp;
|
||||
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
|
||||
{
|
||||
/* Are we inside the best run of 0x00's? */
|
||||
if (best.base != -1 && i >= best.base && i < (best.base + best.len))
|
||||
{
|
||||
if (i == best.base)
|
||||
*tp++ = ':';
|
||||
continue;
|
||||
}
|
||||
/* Are we following an initial run of 0x00s or any real hex? */
|
||||
if (i != 0)
|
||||
*tp++ = ':';
|
||||
/* Is this address an encapsulated IPv4? */
|
||||
if (i == 6 && best.base == 0 &&
|
||||
(best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
|
||||
{
|
||||
if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
|
||||
return (NULL);
|
||||
tp += strlen (tp);
|
||||
break;
|
||||
}
|
||||
{
|
||||
int len = sprintf (tp, "%x", words[i]);
|
||||
if (len < 0)
|
||||
return NULL;
|
||||
tp += len;
|
||||
}
|
||||
}
|
||||
/* Was it a trailing run of 0x00's? */
|
||||
if (best.base != -1 && (best.base + best.len) ==
|
||||
(NS_IN6ADDRSZ / NS_INT16SZ))
|
||||
*tp++ = ':';
|
||||
*tp++ = '\0';
|
||||
|
||||
/*
|
||||
* Check for overflow, copy, and we're done.
|
||||
*/
|
||||
if ((socklen_t) (tp - tmp) > size)
|
||||
{
|
||||
errno = ENOSPC;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return strcpy (dst, tmp);
|
||||
}
|
||||
|
||||
#endif
|
42
gl/inet_ntop.h
Normal file
42
gl/inet_ntop.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* Convert internet address from internal to printable, presentable format.
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
/* Converts an internet address from internal format to a printable,
|
||||
presentable format.
|
||||
AF is an internet address family, such as AF_INET or AF_INET6.
|
||||
SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
|
||||
(for AF_INET6).
|
||||
DST points to a buffer having room for CNT bytes.
|
||||
The printable representation of the address (in numeric form, not
|
||||
surrounded by [...], no reverse DNS is done) is placed in DST, and
|
||||
DST is returned. If an error occurs, the return value is NULL and
|
||||
errno is set. If CNT bytes are not sufficient to hold the result,
|
||||
the return value is NULL and errno is set to ENOSPC. A good value
|
||||
for CNT is 46.
|
||||
|
||||
For more details, see the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
|
||||
|
||||
#if !HAVE_DECL_INET_NTOP
|
||||
extern const char *inet_ntop (int af, const void *restrict src,
|
||||
char *restrict dst, socklen_t cnt);
|
||||
#endif
|
78
gl/intprops.h
Normal file
78
gl/intprops.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/* intprops.h -- properties of integer types
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* Written by Paul Eggert. */
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* The extra casts in the following macros work around compiler bugs,
|
||||
e.g., in Cray C 5.0.3.0. */
|
||||
|
||||
/* True if the arithmetic type T is an integer type. bool counts as
|
||||
an integer. */
|
||||
#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
|
||||
|
||||
/* True if negative values of the signed integer type T use two's
|
||||
complement, ones' complement, or signed magnitude representation,
|
||||
respectively. Much GNU code assumes two's complement, but some
|
||||
people like to be portable to all possible C hosts. */
|
||||
#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
|
||||
#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
|
||||
#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
|
||||
|
||||
/* True if the arithmetic type T is signed. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
|
||||
/* The maximum and minimum values for the integer type T. These
|
||||
macros have undefined behavior if T is signed and has padding bits.
|
||||
If this is a problem for you, please let us know how to fix it for
|
||||
your host. */
|
||||
#define TYPE_MINIMUM(t) \
|
||||
((t) (! TYPE_SIGNED (t) \
|
||||
? (t) 0 \
|
||||
: TYPE_SIGNED_MAGNITUDE (t) \
|
||||
? ~ (t) 0 \
|
||||
: ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
|
||||
#define TYPE_MAXIMUM(t) \
|
||||
((t) (! TYPE_SIGNED (t) \
|
||||
? (t) -1 \
|
||||
: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
|
||||
|
||||
/* Return zero if T can be determined to be an unsigned type.
|
||||
Otherwise, return 1.
|
||||
When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
|
||||
tighter bound. Otherwise, it overestimates the true bound by one byte
|
||||
when applied to unsigned types of size 2, 4, 16, ... bytes.
|
||||
The symbol signed_type_or_expr__ is private to this header file. */
|
||||
#if __GNUC__ >= 2
|
||||
# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
|
||||
#else
|
||||
# define signed_type_or_expr__(t) 1
|
||||
#endif
|
||||
|
||||
/* Bound on length of the string representing an integer type or expression T.
|
||||
Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
|
||||
add 1 for integer division truncation; add 1 more for a minus sign
|
||||
if needed. */
|
||||
#define INT_STRLEN_BOUND(t) \
|
||||
((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
|
||||
+ signed_type_or_expr__ (t) + 1)
|
||||
|
||||
/* Bound on buffer size needed to represent an integer type or expression T,
|
||||
including the terminating null. */
|
||||
#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
|
44
gl/m4/absolute-header.m4
Normal file
44
gl/m4/absolute-header.m4
Normal file
|
@ -0,0 +1,44 @@
|
|||
# absolute-header.m4 serial 6
|
||||
dnl Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Derek Price.
|
||||
|
||||
# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
|
||||
# ---------------------------------------
|
||||
# Find the absolute name of a header file, assuming the header exists.
|
||||
# If the header were sys/inttypes.h, this macro would define
|
||||
# ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h
|
||||
# in config.h
|
||||
# (e.g. `#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
|
||||
# The three "///" are to pacify Sun C 5.8, which otherwise would say
|
||||
# "warning: #include of /usr/include/... may be non-portable".
|
||||
# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
|
||||
AC_DEFUN([gl_ABSOLUTE_HEADER],
|
||||
[AC_LANG_PREPROC_REQUIRE()dnl
|
||||
AC_FOREACH([gl_HEADER_NAME], [$1],
|
||||
[AS_VAR_PUSHDEF([gl_absolute_header],
|
||||
[gl_cv_absolute_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
|
||||
AC_CACHE_CHECK([absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
|
||||
m4_quote(m4_defn([gl_absolute_header])),
|
||||
[AS_VAR_PUSHDEF([ac_header_exists],
|
||||
[ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
|
||||
AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl
|
||||
if test AS_VAR_GET(ac_header_exists) = yes; then
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])])
|
||||
dnl eval is necessary to expand ac_cpp.
|
||||
dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
|
||||
AS_VAR_SET(gl_absolute_header,
|
||||
[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
|
||||
sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`])
|
||||
fi
|
||||
AS_VAR_POPDEF([ac_header_exists])dnl
|
||||
])dnl
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
|
||||
["AS_VAR_GET(gl_absolute_header)"],
|
||||
[Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
|
||||
AS_VAR_POPDEF([gl_absolute_header])dnl
|
||||
])dnl
|
||||
])# gl_ABSOLUTE_HEADER
|
50
gl/m4/alloca.m4
Normal file
50
gl/m4/alloca.m4
Normal file
|
@ -0,0 +1,50 @@
|
|||
# alloca.m4 serial 7
|
||||
dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_ALLOCA],
|
||||
[
|
||||
dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
|
||||
AC_REQUIRE([AC_PROG_CPP])
|
||||
AC_REQUIRE([AC_PROG_EGREP])
|
||||
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])
|
||||
if test $ac_cv_func_alloca_works = no; then
|
||||
gl_PREREQ_ALLOCA
|
||||
fi
|
||||
|
||||
# Define an additional variable used in the Makefile substitution.
|
||||
if test $ac_cv_working_alloca_h = yes; then
|
||||
AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
|
||||
AC_EGREP_CPP([Need own alloca], [
|
||||
#if defined __GNUC__ || defined _AIX || defined _MSC_VER
|
||||
Need own alloca
|
||||
#endif
|
||||
], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
|
||||
])
|
||||
if test $gl_cv_rpl_alloca = yes; then
|
||||
dnl OK, alloca can be implemented through a compiler built-in.
|
||||
AC_DEFINE([HAVE_ALLOCA], 1,
|
||||
[Define to 1 if you have 'alloca' after including <alloca.h>,
|
||||
a header that may be supplied by this distribution.])
|
||||
ALLOCA_H=alloca.h
|
||||
else
|
||||
dnl alloca exists as a library function, i.e. it is slow and probably
|
||||
dnl a memory leak. Don't define HAVE_ALLOCA in this case.
|
||||
ALLOCA_H=
|
||||
fi
|
||||
else
|
||||
ALLOCA_H=alloca.h
|
||||
fi
|
||||
AC_SUBST([ALLOCA_H])
|
||||
|
||||
AC_DEFINE(HAVE_ALLOCA_H, 1,
|
||||
[Define HAVE_ALLOCA_H for backward compatibility with older code
|
||||
that includes <alloca.h> only if HAVE_ALLOCA_H is defined.])
|
||||
])
|
||||
|
||||
# Prerequisites of lib/alloca.c.
|
||||
# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
|
||||
AC_DEFUN([gl_PREREQ_ALLOCA], [:])
|
18
gl/m4/arpa_inet_h.m4
Normal file
18
gl/m4/arpa_inet_h.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
# arpa_inet_h.m4 serial 1
|
||||
dnl Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Written by Simon Josefsson
|
||||
|
||||
AC_DEFUN([gl_HEADER_ARPA_INET],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE([arpa/inet.h])
|
||||
if test $ac_cv_header_arpa_inet_h = yes; then
|
||||
ARPA_INET_H=''
|
||||
else
|
||||
ARPA_INET_H='arpa/inet.h'
|
||||
fi
|
||||
AC_SUBST(ARPA_INET_H)
|
||||
])
|
53
gl/m4/c-strtod.m4
Normal file
53
gl/m4/c-strtod.m4
Normal file
|
@ -0,0 +1,53 @@
|
|||
# c-strtod.m4 serial 9
|
||||
|
||||
# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Written by Paul Eggert.
|
||||
|
||||
AC_DEFUN([gl_C99_STRTOLD],
|
||||
[
|
||||
AC_CACHE_CHECK([whether strtold conforms to C99],
|
||||
[gl_cv_func_c99_strtold],
|
||||
[AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[/* On HP-UX before 11.23, strtold returns a struct instead of
|
||||
long double. Reject implementations like that, by requiring
|
||||
compatibility with the C99 prototype. */
|
||||
#include <stdlib.h>
|
||||
static long double (*p) (char const *, char **) = strtold;
|
||||
static long double
|
||||
test (char const *nptr, char **endptr)
|
||||
{
|
||||
long double r;
|
||||
r = strtold (nptr, endptr);
|
||||
return r;
|
||||
}]],
|
||||
[[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])],
|
||||
[gl_cv_func_c99_strtold=yes],
|
||||
[gl_cv_func_c99_strtold=no])])
|
||||
if test $gl_cv_func_c99_strtold = yes; then
|
||||
AC_DEFINE([HAVE_C99_STRTOLD], 1, [Define to 1 if strtold conforms to C99.])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_C_STRTOD],
|
||||
[
|
||||
AC_LIBOBJ([c-strtod])
|
||||
|
||||
dnl Prerequisites of lib/c-strtod.c.
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
:
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_C_STRTOLD],
|
||||
[
|
||||
AC_LIBOBJ([c-strtold])
|
||||
|
||||
dnl Prerequisites of lib/c-strtold.c.
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
AC_REQUIRE([gl_C99_STRTOLD])
|
||||
:
|
||||
])
|
10
gl/m4/cloexec.m4
Normal file
10
gl/m4/cloexec.m4
Normal file
|
@ -0,0 +1,10 @@
|
|||
#serial 6
|
||||
dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_CLOEXEC],
|
||||
[
|
||||
AC_LIBOBJ([cloexec])
|
||||
])
|
21
gl/m4/codeset.m4
Normal file
21
gl/m4/codeset.m4
Normal file
|
@ -0,0 +1,21 @@
|
|||
# codeset.m4 serial 2 (gettext-0.16)
|
||||
dnl Copyright (C) 2000-2002, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_LANGINFO_CODESET],
|
||||
[
|
||||
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
|
||||
[AC_TRY_LINK([#include <langinfo.h>],
|
||||
[char* cs = nl_langinfo(CODESET); return !cs;],
|
||||
am_cv_langinfo_codeset=yes,
|
||||
am_cv_langinfo_codeset=no)
|
||||
])
|
||||
if test $am_cv_langinfo_codeset = yes; then
|
||||
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
|
||||
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
||||
fi
|
||||
])
|
18
gl/m4/dirname.m4
Normal file
18
gl/m4/dirname.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
#serial 7 -*- autoconf -*-
|
||||
dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_DIRNAME],
|
||||
[
|
||||
AC_LIBOBJ([basename])
|
||||
AC_LIBOBJ([dirname])
|
||||
AC_LIBOBJ([stripslash])
|
||||
|
||||
dnl Prerequisites of lib/dirname.h.
|
||||
AC_REQUIRE([gl_AC_DOS])
|
||||
AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
|
||||
|
||||
dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c.
|
||||
])
|
71
gl/m4/dos.m4
Normal file
71
gl/m4/dos.m4
Normal file
|
@ -0,0 +1,71 @@
|
|||
#serial 10 -*- autoconf -*-
|
||||
|
||||
# Define some macros required for proper operation of code in lib/*.c
|
||||
# on MSDOS/Windows systems.
|
||||
|
||||
# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# From Jim Meyering.
|
||||
|
||||
AC_DEFUN([gl_AC_DOS],
|
||||
[
|
||||
AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
|
||||
[
|
||||
AC_TRY_COMPILE([],
|
||||
[#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
|
||||
neither MSDOS nor Windows
|
||||
#endif],
|
||||
[ac_cv_win_or_dos=yes],
|
||||
[ac_cv_win_or_dos=no])
|
||||
])
|
||||
|
||||
if test x"$ac_cv_win_or_dos" = xyes; then
|
||||
ac_fs_accepts_drive_letter_prefix=1
|
||||
ac_fs_backslash_is_file_name_separator=1
|
||||
AC_CACHE_CHECK([whether drive letter can start relative path],
|
||||
[ac_cv_drive_letter_can_be_relative],
|
||||
[
|
||||
AC_TRY_COMPILE([],
|
||||
[#if defined __CYGWIN__
|
||||
drive letters are always absolute
|
||||
#endif],
|
||||
[ac_cv_drive_letter_can_be_relative=yes],
|
||||
[ac_cv_drive_letter_can_be_relative=no])
|
||||
])
|
||||
if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
|
||||
ac_fs_drive_letter_can_be_relative=1
|
||||
else
|
||||
ac_fs_drive_letter_can_be_relative=0
|
||||
fi
|
||||
else
|
||||
ac_fs_accepts_drive_letter_prefix=0
|
||||
ac_fs_backslash_is_file_name_separator=0
|
||||
ac_fs_drive_letter_can_be_relative=0
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
|
||||
$ac_fs_accepts_drive_letter_prefix,
|
||||
[Define on systems for which file names may have a so-called
|
||||
`drive letter' prefix, define this to compute the length of that
|
||||
prefix, including the colon.])
|
||||
|
||||
AH_VERBATIM(ISSLASH,
|
||||
[#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
||||
#else
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
#endif])
|
||||
|
||||
AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
|
||||
$ac_fs_backslash_is_file_name_separator,
|
||||
[Define if the backslash character may also serve as a file name
|
||||
component separator.])
|
||||
|
||||
AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
|
||||
$ac_fs_drive_letter_can_be_relative,
|
||||
[Define if a drive letter prefix denotes a relative path if it is
|
||||
not followed by a file name component separator.])
|
||||
])
|
38
gl/m4/double-slash-root.m4
Normal file
38
gl/m4/double-slash-root.m4
Normal file
|
@ -0,0 +1,38 @@
|
|||
# double-slash-root.m4 serial 2 -*- Autoconf -*-
|
||||
dnl Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
|
||||
[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root],
|
||||
[ if test x"$cross_compiling" = xyes ; then
|
||||
# When cross-compiling, there is no way to tell whether // is special
|
||||
# short of a list of hosts. However, the only known hosts to date
|
||||
# that have a distinct // are Apollo DomainOS (too old to port to),
|
||||
# Cygwin, and z/OS. If anyone knows of another system for which // has
|
||||
# special semantics and is distinct from /, please report it to
|
||||
# <bug-gnulib@gnu.org>.
|
||||
case $host in
|
||||
*-cygwin | i370-ibm-openedition)
|
||||
gl_cv_double_slash_root=yes ;;
|
||||
*)
|
||||
# Be optimistic and assume that / and // are the same when we
|
||||
# don't know.
|
||||
gl_cv_double_slash_root='unknown, assuming no' ;;
|
||||
esac
|
||||
else
|
||||
set x `ls -di / //`
|
||||
if test $[2] = $[4] && wc //dev/null >/dev/null 2>&1; then
|
||||
gl_cv_double_slash_root=no
|
||||
else
|
||||
gl_cv_double_slash_root=yes
|
||||
fi
|
||||
fi])
|
||||
if test "$gl_cv_double_slash_root" = yes; then
|
||||
AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], 1,
|
||||
[Define to 1 if // is a file system root distinct from /.])
|
||||
fi
|
||||
])
|
70
gl/m4/eoverflow.m4
Normal file
70
gl/m4/eoverflow.m4
Normal file
|
@ -0,0 +1,70 @@
|
|||
# eoverflow.m4 serial 2
|
||||
dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
|
||||
# POSIX. But some systems (like AIX 3) don't define it, and some systems
|
||||
# (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
|
||||
|
||||
# Define EOVERFLOW as a C macro and as a substituted macro in such a way that
|
||||
# 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable,
|
||||
# 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric
|
||||
# value.
|
||||
|
||||
AC_DEFUN([gl_EOVERFLOW],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
|
||||
AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <errno.h>
|
||||
#ifdef EOVERFLOW
|
||||
yes
|
||||
#endif
|
||||
], have_eoverflow=1)
|
||||
if test -n "$have_eoverflow"; then
|
||||
dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves.
|
||||
ac_cv_decl_EOVERFLOW=yes
|
||||
else
|
||||
AC_EGREP_CPP(yes,[
|
||||
#define _XOPEN_SOURCE_EXTENDED 1
|
||||
#include <errno.h>
|
||||
#ifdef EOVERFLOW
|
||||
yes
|
||||
#endif
|
||||
], have_eoverflow=1)
|
||||
if test -n "$have_eoverflow"; then
|
||||
dnl EOVERFLOW exists but is hidden.
|
||||
dnl Define it to the same value.
|
||||
AC_COMPUTE_INT([ac_cv_decl_EOVERFLOW], [EOVERFLOW], [
|
||||
#define _XOPEN_SOURCE_EXTENDED 1
|
||||
#include <errno.h>
|
||||
/* The following two lines are a workaround against an autoconf-2.52 bug. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
])
|
||||
else
|
||||
dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but
|
||||
dnl don't define it as EINVAL, because snprintf() callers want to
|
||||
dnl distinguish EINVAL and EOVERFLOW.
|
||||
ac_cv_decl_EOVERFLOW=E2BIG
|
||||
fi
|
||||
fi
|
||||
])
|
||||
if test "$ac_cv_decl_EOVERFLOW" != yes; then
|
||||
AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW],
|
||||
[Define as good substitute value for EOVERFLOW.])
|
||||
EOVERFLOW="$ac_cv_decl_EOVERFLOW"
|
||||
AC_SUBST(EOVERFLOW)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
|
||||
dnl Remove this when we can assume autoconf >= 2.61.
|
||||
m4_ifdef([AC_COMPUTE_INT], [], [
|
||||
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
|
||||
])
|
22
gl/m4/error.m4
Normal file
22
gl/m4/error.m4
Normal file
|
@ -0,0 +1,22 @@
|
|||
#serial 11
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software
|
||||
# Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_ERROR],
|
||||
[
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
|
||||
gl_PREREQ_ERROR
|
||||
])
|
||||
|
||||
# Prerequisites of lib/error.c.
|
||||
AC_DEFUN([gl_PREREQ_ERROR],
|
||||
[
|
||||
AC_REQUIRE([AC_FUNC_STRERROR_R])
|
||||
:
|
||||
])
|
13
gl/m4/exitfail.m4
Normal file
13
gl/m4/exitfail.m4
Normal file
|
@ -0,0 +1,13 @@
|
|||
# exitfail.m4 serial 6
|
||||
dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_EXITFAIL],
|
||||
[
|
||||
AC_LIBOBJ([exitfail])
|
||||
|
||||
dnl No prerequisites of lib/exitfail.c.
|
||||
:
|
||||
])
|
58
gl/m4/extensions.m4
Normal file
58
gl/m4/extensions.m4
Normal file
|
@ -0,0 +1,58 @@
|
|||
# serial 4 -*- Autoconf -*-
|
||||
# Enable extensions on systems that normally disable them.
|
||||
|
||||
# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
|
||||
# Autoconf. Perhaps we can remove this once we can assume Autoconf
|
||||
# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly
|
||||
# enough in this area it's likely we'll need to redefine
|
||||
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
|
||||
|
||||
# AC_USE_SYSTEM_EXTENSIONS
|
||||
# ------------------------
|
||||
# Enable extensions on systems that normally disable them,
|
||||
# typically due to standards-conformance issues.
|
||||
AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
|
||||
[
|
||||
AC_BEFORE([$0], [AC_COMPILE_IFELSE])
|
||||
AC_BEFORE([$0], [AC_RUN_IFELSE])
|
||||
|
||||
AC_REQUIRE([AC_GNU_SOURCE])
|
||||
AC_REQUIRE([AC_AIX])
|
||||
AC_REQUIRE([AC_MINIX])
|
||||
|
||||
AH_VERBATIM([__EXTENSIONS__],
|
||||
[/* Enable extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif])
|
||||
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
|
||||
[ac_cv_safe_to_define___extensions__],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
# define __EXTENSIONS__ 1
|
||||
AC_INCLUDES_DEFAULT])],
|
||||
[ac_cv_safe_to_define___extensions__=yes],
|
||||
[ac_cv_safe_to_define___extensions__=no])])
|
||||
test $ac_cv_safe_to_define___extensions__ = yes &&
|
||||
AC_DEFINE([__EXTENSIONS__])
|
||||
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
|
||||
AC_DEFINE([_TANDEM_SOURCE])
|
||||
])
|
||||
|
||||
# gl_USE_SYSTEM_EXTENSIONS
|
||||
# ------------------------
|
||||
# Enable extensions on systems that normally disable them,
|
||||
# typically due to standards-conformance issues.
|
||||
AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
|
||||
[AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
|
11
gl/m4/fcntl-safer.m4
Normal file
11
gl/m4/fcntl-safer.m4
Normal file
|
@ -0,0 +1,11 @@
|
|||
#serial 5
|
||||
dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FCNTL_SAFER],
|
||||
[
|
||||
AC_LIBOBJ([open-safer])
|
||||
AC_LIBOBJ([creat-safer])
|
||||
])
|
22
gl/m4/fstypename.m4
Normal file
22
gl/m4/fstypename.m4
Normal file
|
@ -0,0 +1,22 @@
|
|||
#serial 6
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
dnl See if struct statfs has the f_fstypename member.
|
||||
dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME.
|
||||
dnl
|
||||
|
||||
# Copyright (C) 1998, 1999, 2001, 2004, 2006 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FSTYPENAME],
|
||||
[
|
||||
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
])
|
||||
])
|
265
gl/m4/fsusage.m4
Normal file
265
gl/m4/fsusage.m4
Normal file
|
@ -0,0 +1,265 @@
|
|||
#serial 22
|
||||
# Obtaining file system usage information.
|
||||
|
||||
# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
|
||||
# Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Written by Jim Meyering.
|
||||
|
||||
AC_DEFUN([gl_FSUSAGE],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE(sys/param.h)
|
||||
AC_CHECK_HEADERS_ONCE(sys/vfs.h sys/fs_types.h)
|
||||
AC_CHECK_HEADERS(sys/mount.h, [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif]])
|
||||
gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
|
||||
if test $gl_cv_fs_space = yes; then
|
||||
AC_LIBOBJ(fsusage)
|
||||
gl_PREREQ_FSUSAGE_EXTRA
|
||||
fi
|
||||
])
|
||||
|
||||
# Try to determine how a program can obtain file system usage information.
|
||||
# If successful, define the appropriate symbol (see fsusage.c) and
|
||||
# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
|
||||
#
|
||||
# gl_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
|
||||
AC_DEFUN([gl_FILE_SYSTEM_USAGE],
|
||||
[
|
||||
|
||||
AC_MSG_NOTICE([checking how to get file system space usage])
|
||||
ac_fsusage_space=no
|
||||
|
||||
# Perform only the link test since it seems there are no variants of the
|
||||
# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
|
||||
# because that got a false positive on SCO OSR5. Adding the declaration
|
||||
# of a `struct statvfs' causes this test to fail (as it should) on such
|
||||
# systems. That system is reported to work fine with STAT_STATFS4 which
|
||||
# is what it gets when this test fails.
|
||||
if test $ac_fsusage_space = no; then
|
||||
# SVR4
|
||||
AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
|
||||
[AC_TRY_LINK([#include <sys/types.h>
|
||||
#if defined __GLIBC__ && !defined __BEOS__
|
||||
Do not use statvfs on systems with GNU libc, because that function stats
|
||||
all preceding entries in /proc/mounts, and that makes df hang if even
|
||||
one of the corresponding file systems is hard-mounted, but not available.
|
||||
statvfs in GNU libc on BeOS operates differently: it only makes a system
|
||||
call.
|
||||
#endif
|
||||
#include <sys/statvfs.h>],
|
||||
[struct statvfs fsd; statvfs (0, &fsd);],
|
||||
fu_cv_sys_stat_statvfs=yes,
|
||||
fu_cv_sys_stat_statvfs=no)])
|
||||
if test $fu_cv_sys_stat_statvfs = yes; then
|
||||
ac_fsusage_space=yes
|
||||
AC_DEFINE(STAT_STATVFS, 1,
|
||||
[ Define if there is a function named statvfs. (SVR4)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_fsusage_space = no; then
|
||||
# DEC Alpha running OSF/1
|
||||
AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
|
||||
AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
|
||||
[AC_TRY_RUN([
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct statfs fsd;
|
||||
fsd.f_fsize = 0;
|
||||
return statfs (".", &fsd, sizeof (struct statfs)) != 0;
|
||||
}],
|
||||
fu_cv_sys_stat_statfs3_osf1=yes,
|
||||
fu_cv_sys_stat_statfs3_osf1=no,
|
||||
fu_cv_sys_stat_statfs3_osf1=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
|
||||
if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
|
||||
ac_fsusage_space=yes
|
||||
AC_DEFINE(STAT_STATFS3_OSF1, 1,
|
||||
[ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_fsusage_space = no; then
|
||||
# AIX
|
||||
AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
|
||||
member (AIX, 4.3BSD)])
|
||||
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
|
||||
[AC_TRY_RUN([
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct statfs fsd;
|
||||
fsd.f_bsize = 0;
|
||||
return statfs (".", &fsd) != 0;
|
||||
}],
|
||||
fu_cv_sys_stat_statfs2_bsize=yes,
|
||||
fu_cv_sys_stat_statfs2_bsize=no,
|
||||
fu_cv_sys_stat_statfs2_bsize=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
|
||||
if test $fu_cv_sys_stat_statfs2_bsize = yes; then
|
||||
ac_fsusage_space=yes
|
||||
AC_DEFINE(STAT_STATFS2_BSIZE, 1,
|
||||
[ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
|
||||
(4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_fsusage_space = no; then
|
||||
# SVR3
|
||||
AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
|
||||
AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
|
||||
[AC_TRY_RUN([#include <sys/types.h>
|
||||
#include <sys/statfs.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct statfs fsd;
|
||||
return statfs (".", &fsd, sizeof fsd, 0) != 0;
|
||||
}],
|
||||
fu_cv_sys_stat_statfs4=yes,
|
||||
fu_cv_sys_stat_statfs4=no,
|
||||
fu_cv_sys_stat_statfs4=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
|
||||
if test $fu_cv_sys_stat_statfs4 = yes; then
|
||||
ac_fsusage_space=yes
|
||||
AC_DEFINE(STAT_STATFS4, 1,
|
||||
[ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_fsusage_space = no; then
|
||||
# 4.4BSD and NetBSD
|
||||
AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
|
||||
member (4.4BSD and NetBSD)])
|
||||
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
|
||||
[AC_TRY_RUN([#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct statfs fsd;
|
||||
fsd.f_fsize = 0;
|
||||
return statfs (".", &fsd) != 0;
|
||||
}],
|
||||
fu_cv_sys_stat_statfs2_fsize=yes,
|
||||
fu_cv_sys_stat_statfs2_fsize=no,
|
||||
fu_cv_sys_stat_statfs2_fsize=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
|
||||
if test $fu_cv_sys_stat_statfs2_fsize = yes; then
|
||||
ac_fsusage_space=yes
|
||||
AC_DEFINE(STAT_STATFS2_FSIZE, 1,
|
||||
[ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
|
||||
(4.4BSD, NetBSD)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_fsusage_space = no; then
|
||||
# Ultrix
|
||||
AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
|
||||
AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
|
||||
[AC_TRY_RUN([#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FS_TYPES_H
|
||||
#include <sys/fs_types.h>
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct fs_data fsd;
|
||||
/* Ultrix's statfs returns 1 for success,
|
||||
0 for not mounted, -1 for failure. */
|
||||
return statfs (".", &fsd) != 1;
|
||||
}],
|
||||
fu_cv_sys_stat_fs_data=yes,
|
||||
fu_cv_sys_stat_fs_data=no,
|
||||
fu_cv_sys_stat_fs_data=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
|
||||
if test $fu_cv_sys_stat_fs_data = yes; then
|
||||
ac_fsusage_space=yes
|
||||
AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
|
||||
[ Define if statfs takes 2 args and the second argument has
|
||||
type struct fs_data. (Ultrix)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_fsusage_space = no; then
|
||||
# SVR2
|
||||
AC_TRY_CPP([#include <sys/filsys.h>
|
||||
],
|
||||
AC_DEFINE(STAT_READ_FILSYS, 1,
|
||||
[Define if there is no specific function for reading file systems usage
|
||||
information and you have the <sys/filsys.h> header file. (SVR2)])
|
||||
ac_fsusage_space=yes)
|
||||
fi
|
||||
|
||||
AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
|
||||
|
||||
])
|
||||
|
||||
|
||||
# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
|
||||
# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
|
||||
# enable the work-around code in fsusage.c.
|
||||
AC_DEFUN([gl_STATFS_TRUNCATES],
|
||||
[
|
||||
AC_MSG_CHECKING([for statfs that truncates block counts])
|
||||
AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#if !defined(sun) && !defined(__sun)
|
||||
choke -- this is a workaround for a Sun-specific problem
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/vfs.h>]],
|
||||
[[struct statfs t; long c = *(t.f_spare);
|
||||
if (c) return 0;]])],
|
||||
[fu_cv_sys_truncating_statfs=yes],
|
||||
[fu_cv_sys_truncating_statfs=no])])
|
||||
if test $fu_cv_sys_truncating_statfs = yes; then
|
||||
AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
|
||||
[Define if the block counts reported by statfs may be truncated to 2GB
|
||||
and the correct values may be stored in the f_spare array.
|
||||
(SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
|
||||
SunOS 4.1.1 seems not to be affected.)])
|
||||
fi
|
||||
AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
|
||||
])
|
||||
|
||||
|
||||
# Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE.
|
||||
AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
|
||||
[
|
||||
AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h)
|
||||
gl_STATFS_TRUNCATES
|
||||
])
|
88
gl/m4/getaddrinfo.m4
Normal file
88
gl/m4/getaddrinfo.m4
Normal file
|
@ -0,0 +1,88 @@
|
|||
# getaddrinfo.m4 serial 11
|
||||
dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_GETADDRINFO],
|
||||
[
|
||||
AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
|
||||
|
||||
AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
|
||||
AC_CHECK_FUNCS(getaddrinfo,, [
|
||||
AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
|
||||
gl_cv_w32_getaddrinfo, [
|
||||
gl_cv_w32_getaddrinfo=no
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lws2_32"
|
||||
AC_TRY_LINK([
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes)
|
||||
LIBS="$am_save_LIBS"])
|
||||
if test "$gl_cv_w32_getaddrinfo" = "yes"; then
|
||||
LIBS="$LIBS -lws2_32"
|
||||
else
|
||||
AC_LIBOBJ(getaddrinfo)
|
||||
fi
|
||||
])
|
||||
|
||||
AC_REPLACE_FUNCS(gai_strerror)
|
||||
gl_PREREQ_GETADDRINFO
|
||||
])
|
||||
|
||||
# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c.
|
||||
AC_DEFUN([gl_PREREQ_GETADDRINFO], [
|
||||
AC_SEARCH_LIBS(gethostbyname, [inet nsl])
|
||||
AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet])
|
||||
AC_CHECK_FUNCS(gethostbyname,, [
|
||||
AC_CACHE_CHECK(for gethostbyname in winsock2.h and -lws2_32,
|
||||
gl_cv_w32_gethostbyname, [
|
||||
gl_cv_w32_gethostbyname=no
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lws2_32"
|
||||
AC_TRY_LINK([
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes)
|
||||
LIBS="$am_save_LIBS"])
|
||||
if test "$gl_cv_w32_gethostbyname" = "yes"; then
|
||||
LIBS="$LIBS -lws2_32"
|
||||
fi
|
||||
])
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
AC_REQUIRE([gl_SOCKET_FAMILIES])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
AC_REQUIRE([AC_GNU_SOURCE])
|
||||
AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h)
|
||||
AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
|
||||
/* sys/types.h is not needed according to POSIX, but the
|
||||
sys/socket.h in i386-unknown-freebsd4.10 and
|
||||
powerpc-apple-darwin5.5 required it. */
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
])
|
||||
AC_CHECK_TYPES([struct addrinfo],,,[
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
])
|
||||
])
|
18
gl/m4/gethostname.m4
Normal file
18
gl/m4/gethostname.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
# gethostname.m4 serial 2
|
||||
dnl Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_GETHOSTNAME],
|
||||
[
|
||||
AC_REPLACE_FUNCS(gethostname)
|
||||
if test $ac_cv_func_gethostname = no; then
|
||||
gl_PREREQ_GETHOSTNAME
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/gethostname.c.
|
||||
AC_DEFUN([gl_PREREQ_GETHOSTNAME], [
|
||||
AC_CHECK_FUNCS(uname)
|
||||
])
|
155
gl/m4/getloadavg.m4
Normal file
155
gl/m4/getloadavg.m4
Normal file
|
@ -0,0 +1,155 @@
|
|||
# Check for getloadavg.
|
||||
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003,
|
||||
# 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
|
||||
# New applications should use gl_GETLOADAVG instead.
|
||||
|
||||
# gl_GETLOADAVG(LIBOBJDIR)
|
||||
# ------------------------
|
||||
AC_DEFUN([gl_GETLOADAVG],
|
||||
[gl_have_func=no # yes means we've found a way to get the load average.
|
||||
|
||||
# Make sure getloadavg.c is where it belongs, at configure-time.
|
||||
test -f "$srcdir/$1/getloadavg.c" ||
|
||||
AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
|
||||
|
||||
gl_save_LIBS=$LIBS
|
||||
|
||||
# Check for getloadavg, but be sure not to touch the cache variable.
|
||||
(AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && gl_have_func=yes
|
||||
|
||||
# On HPUX9, an unprivileged user can get load averages through this function.
|
||||
AC_CHECK_FUNCS(pstat_getdynamic)
|
||||
|
||||
# Solaris has libkstat which does not require root.
|
||||
AC_CHECK_LIB(kstat, kstat_open)
|
||||
test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes
|
||||
|
||||
# Some systems with -lutil have (and need) -lkvm as well, some do not.
|
||||
# On Solaris, -lkvm requires nlist from -lelf, so check that first
|
||||
# to get the right answer into the cache.
|
||||
# For kstat on solaris, we need libelf to force the definition of SVR4 below.
|
||||
if test $gl_have_func = no; then
|
||||
AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
|
||||
fi
|
||||
if test $gl_have_func = no; then
|
||||
AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
|
||||
# Check for the 4.4BSD definition of getloadavg.
|
||||
AC_CHECK_LIB(util, getloadavg,
|
||||
[LIBS="-lutil $LIBS" gl_have_func=yes gl_cv_func_getloadavg_setgid=yes])
|
||||
fi
|
||||
|
||||
if test $gl_have_func = no; then
|
||||
# There is a commonly available library for RS/6000 AIX.
|
||||
# Since it is not a standard part of AIX, it might be installed locally.
|
||||
gl_getloadavg_LIBS=$LIBS
|
||||
LIBS="-L/usr/local/lib $LIBS"
|
||||
AC_CHECK_LIB(getloadavg, getloadavg,
|
||||
[LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS])
|
||||
fi
|
||||
|
||||
# Make sure it is really in the library, if we think we found it,
|
||||
# otherwise set up the replacement function.
|
||||
AC_CHECK_FUNCS(getloadavg, [],
|
||||
[gl_PREREQ_GETLOADAVG])
|
||||
|
||||
# Some definitions of getloadavg require that the program be installed setgid.
|
||||
AC_CACHE_CHECK(whether getloadavg requires setgid,
|
||||
gl_cv_func_getloadavg_setgid,
|
||||
[AC_EGREP_CPP([Yowza Am I SETGID yet],
|
||||
[#define CONFIGURING_GETLOADAVG
|
||||
#include "$srcdir/$1/getloadavg.c"
|
||||
#ifdef LDAV_PRIVILEGED
|
||||
Yowza Am I SETGID yet
|
||||
#endif
|
||||
],
|
||||
gl_cv_func_getloadavg_setgid=yes,
|
||||
gl_cv_func_getloadavg_setgid=no)])
|
||||
if test $gl_cv_func_getloadavg_setgid = yes; then
|
||||
NEED_SETGID=true
|
||||
AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
|
||||
[Define to 1 if the `getloadavg' function needs to be run setuid
|
||||
or setgid.])
|
||||
else
|
||||
NEED_SETGID=false
|
||||
fi
|
||||
AC_SUBST(NEED_SETGID)dnl
|
||||
|
||||
if test $gl_cv_func_getloadavg_setgid = yes; then
|
||||
AC_CACHE_CHECK(group of /dev/kmem, gl_cv_group_kmem,
|
||||
[ # On Solaris, /dev/kmem is a symlink. Get info on the real file.
|
||||
ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
|
||||
# If we got an error (system does not support symlinks), try without -L.
|
||||
test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
|
||||
gl_cv_group_kmem=`echo $ac_ls_output \
|
||||
| sed -ne ['s/[ ][ ]*/ /g
|
||||
s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/
|
||||
/ /s/.* //;p']`
|
||||
])
|
||||
AC_SUBST(KMEM_GROUP, $gl_cv_group_kmem)dnl
|
||||
fi
|
||||
if test "x$gl_save_LIBS" = x; then
|
||||
GETLOADAVG_LIBS=$LIBS
|
||||
else
|
||||
GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"`
|
||||
fi
|
||||
LIBS=$gl_save_LIBS
|
||||
|
||||
AC_SUBST(GETLOADAVG_LIBS)dnl
|
||||
])# gl_GETLOADAVG
|
||||
|
||||
|
||||
# gl_PREREQ_GETLOADAVG
|
||||
# --------------------
|
||||
# Set up the AC_LIBOBJ replacement of `getloadavg'.
|
||||
AC_DEFUN([gl_PREREQ_GETLOADAVG],
|
||||
[AC_LIBOBJ(getloadavg)
|
||||
AC_DEFINE(C_GETLOADAVG, 1, [Define to 1 if using `getloadavg.c'.])
|
||||
# Figure out what our getloadavg.c needs.
|
||||
gl_have_func=no
|
||||
AC_CHECK_HEADER(sys/dg_sys_info.h,
|
||||
[gl_have_func=yes
|
||||
AC_DEFINE(DGUX, 1, [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
|
||||
AC_CHECK_LIB(dgc, dg_sys_info)])
|
||||
|
||||
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
|
||||
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
|
||||
# Irix 4.0.5F has the header but not the library.
|
||||
if test $gl_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then
|
||||
gl_have_func=yes
|
||||
AC_DEFINE(SVR4, 1, [Define to 1 on System V Release 4.])
|
||||
fi
|
||||
|
||||
if test $gl_have_func = no; then
|
||||
AC_CHECK_HEADER(inq_stats/cpustats.h,
|
||||
[gl_have_func=yes
|
||||
AC_DEFINE(UMAX, 1, [Define to 1 for Encore UMAX.])
|
||||
AC_DEFINE(UMAX4_3, 1,
|
||||
[Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h>
|
||||
instead of <sys/cpustats.h>.])])
|
||||
fi
|
||||
|
||||
if test $gl_have_func = no; then
|
||||
AC_CHECK_HEADER(sys/cpustats.h,
|
||||
[gl_have_func=yes; AC_DEFINE(UMAX)])
|
||||
fi
|
||||
|
||||
if test $gl_have_func = no; then
|
||||
AC_CHECK_HEADERS(mach/mach.h)
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(nlist.h,
|
||||
[AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
|
||||
[AC_DEFINE(NLIST_NAME_UNION, 1,
|
||||
[Define to 1 if your `struct nlist' has an
|
||||
`n_un' member. Obsolete, depend on
|
||||
`HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
|
||||
[@%:@include <nlist.h>])
|
||||
])dnl
|
||||
])# gl_PREREQ_GETLOADAVG
|
83
gl/m4/getopt.m4
Normal file
83
gl/m4/getopt.m4
Normal file
|
@ -0,0 +1,83 @@
|
|||
# getopt.m4 serial 13
|
||||
dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# The getopt module assume you want GNU getopt, with getopt_long etc,
|
||||
# rather than vanilla POSIX getopt. This means your code should
|
||||
# always include <getopt.h> for the getopt prototypes.
|
||||
|
||||
AC_DEFUN([gl_GETOPT_SUBSTITUTE],
|
||||
[
|
||||
AC_LIBOBJ([getopt])
|
||||
AC_LIBOBJ([getopt1])
|
||||
gl_GETOPT_SUBSTITUTE_HEADER
|
||||
gl_PREREQ_GETOPT
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
|
||||
[
|
||||
GETOPT_H=getopt.h
|
||||
AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
|
||||
[Define to rpl_ if the getopt replacement functions and variables
|
||||
should be used.])
|
||||
AC_SUBST([GETOPT_H])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
|
||||
[
|
||||
if test -z "$GETOPT_H"; then
|
||||
AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
|
||||
fi
|
||||
|
||||
if test -z "$GETOPT_H"; then
|
||||
AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
|
||||
fi
|
||||
|
||||
dnl BSD getopt_long uses an incompatible method to reset option processing,
|
||||
dnl and (as of 2004-10-15) mishandles optional option-arguments.
|
||||
if test -z "$GETOPT_H"; then
|
||||
AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
|
||||
fi
|
||||
|
||||
dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
|
||||
dnl option string (as of 2005-05-05).
|
||||
if test -z "$GETOPT_H"; then
|
||||
AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include <getopt.h>],
|
||||
[[
|
||||
char *myargv[3];
|
||||
myargv[0] = "conftest";
|
||||
myargv[1] = "-+";
|
||||
myargv[2] = 0;
|
||||
return getopt (2, myargv, "+a") != '?';
|
||||
]])],
|
||||
[gl_cv_func_gnu_getopt=yes],
|
||||
[gl_cv_func_gnu_getopt=no],
|
||||
[dnl cross compiling - pessimistically guess based on decls
|
||||
dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
|
||||
dnl option string (as of 2005-05-05).
|
||||
AC_CHECK_DECL([getopt_clip],
|
||||
[gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
|
||||
[#include <getopt.h>])])])
|
||||
if test "$gl_cv_func_gnu_getopt" = "no"; then
|
||||
GETOPT_H=getopt.h
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_GETOPT_IFELSE],
|
||||
[
|
||||
AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
|
||||
AS_IF([test -n "$GETOPT_H"], [$1], [$2])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
|
||||
|
||||
# Prerequisites of lib/getopt*.
|
||||
AC_DEFUN([gl_PREREQ_GETOPT],
|
||||
[
|
||||
AC_CHECK_DECLS_ONCE([getenv])
|
||||
])
|
419
gl/m4/gettext.m4
Normal file
419
gl/m4/gettext.m4
Normal file
|
@ -0,0 +1,419 @@
|
|||
# gettext.m4 serial 59 (gettext-0.16.1)
|
||||
dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
dnl
|
||||
dnl This file can can be used in projects which are not available under
|
||||
dnl the GNU General Public License or the GNU Library General Public
|
||||
dnl License but which still want to provide support for the GNU gettext
|
||||
dnl functionality.
|
||||
dnl Please note that the actual code of the GNU gettext library is covered
|
||||
dnl by the GNU Library General Public License, and the rest of the GNU
|
||||
dnl gettext package package is covered by the GNU General Public License.
|
||||
dnl They are *not* in the public domain.
|
||||
|
||||
dnl Authors:
|
||||
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
|
||||
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006.
|
||||
|
||||
dnl Macro to add for using GNU gettext.
|
||||
|
||||
dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
|
||||
dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
|
||||
dnl default (if it is not specified or empty) is 'no-libtool'.
|
||||
dnl INTLSYMBOL should be 'external' for packages with no intl directory,
|
||||
dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
|
||||
dnl If INTLSYMBOL is 'use-libtool', then a libtool library
|
||||
dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
|
||||
dnl depending on --{enable,disable}-{shared,static} and on the presence of
|
||||
dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
|
||||
dnl $(top_builddir)/intl/libintl.a will be created.
|
||||
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
|
||||
dnl implementations (in libc or libintl) without the ngettext() function
|
||||
dnl will be ignored. If NEEDSYMBOL is specified and is
|
||||
dnl 'need-formatstring-macros', then GNU gettext implementations that don't
|
||||
dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
|
||||
dnl INTLDIR is used to find the intl libraries. If empty,
|
||||
dnl the value `$(top_builddir)/intl/' is used.
|
||||
dnl
|
||||
dnl The result of the configuration is one of three cases:
|
||||
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
|
||||
dnl and used.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 2) GNU gettext has been found in the system's C library.
|
||||
dnl Catalog format: GNU --> install in $(datadir)
|
||||
dnl Catalog extension: .mo after installation, .gmo in source tree
|
||||
dnl 3) No internationalization, always use English msgid.
|
||||
dnl Catalog format: none
|
||||
dnl Catalog extension: none
|
||||
dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
|
||||
dnl The use of .gmo is historical (it was needed to avoid overwriting the
|
||||
dnl GNU format catalogs when building on a platform with an X/Open gettext),
|
||||
dnl but we keep it in order not to force irrelevant filename changes on the
|
||||
dnl maintainers.
|
||||
dnl
|
||||
AC_DEFUN([AM_GNU_GETTEXT],
|
||||
[
|
||||
dnl Argument checking.
|
||||
ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
|
||||
[errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
|
||||
])])])])])
|
||||
ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
|
||||
[errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
|
||||
])])])])
|
||||
define([gt_included_intl],
|
||||
ifelse([$1], [external],
|
||||
ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
|
||||
[yes]))
|
||||
define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
|
||||
gt_NEEDS_INIT
|
||||
AM_GNU_GETTEXT_NEED([$2])
|
||||
|
||||
AC_REQUIRE([AM_PO_SUBDIRS])dnl
|
||||
ifelse(gt_included_intl, yes, [
|
||||
AC_REQUIRE([AM_INTL_SUBDIR])dnl
|
||||
])
|
||||
|
||||
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
AC_REQUIRE([AC_LIB_RPATH])
|
||||
|
||||
dnl Sometimes libintl requires libiconv, so first search for libiconv.
|
||||
dnl Ideally we would do this search only after the
|
||||
dnl if test "$USE_NLS" = "yes"; then
|
||||
dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
|
||||
dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
|
||||
dnl the configure script would need to contain the same shell code
|
||||
dnl again, outside any 'if'. There are two solutions:
|
||||
dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
|
||||
dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
|
||||
dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
|
||||
dnl documented, we avoid it.
|
||||
ifelse(gt_included_intl, yes, , [
|
||||
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
|
||||
])
|
||||
|
||||
dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
|
||||
gt_INTL_MACOSX
|
||||
|
||||
dnl Set USE_NLS.
|
||||
AC_REQUIRE([AM_NLS])
|
||||
|
||||
ifelse(gt_included_intl, yes, [
|
||||
BUILD_INCLUDED_LIBINTL=no
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
])
|
||||
LIBINTL=
|
||||
LTLIBINTL=
|
||||
POSUB=
|
||||
|
||||
dnl Add a version number to the cache macros.
|
||||
case " $gt_needs " in
|
||||
*" need-formatstring-macros "*) gt_api_version=3 ;;
|
||||
*" need-ngettext "*) gt_api_version=2 ;;
|
||||
*) gt_api_version=1 ;;
|
||||
esac
|
||||
gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
|
||||
gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
gt_use_preinstalled_gnugettext=no
|
||||
ifelse(gt_included_intl, yes, [
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
])
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If GNU gettext is available we use this. Else we have
|
||||
dnl to fall back to GNU NLS library.
|
||||
|
||||
if test $gt_api_version -ge 3; then
|
||||
gt_revision_test_code='
|
||||
#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
|
||||
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
|
||||
#endif
|
||||
changequote(,)dnl
|
||||
typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
|
||||
changequote([,])dnl
|
||||
'
|
||||
else
|
||||
gt_revision_test_code=
|
||||
fi
|
||||
if test $gt_api_version -ge 2; then
|
||||
gt_expression_test_code=' + * ngettext ("", "", 0)'
|
||||
else
|
||||
gt_expression_test_code=
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
|
||||
[AC_TRY_LINK([#include <libintl.h>
|
||||
$gt_revision_test_code
|
||||
extern int _nl_msg_cat_cntr;
|
||||
extern int *_nl_domain_bindings;],
|
||||
[bindtextdomain ("", "");
|
||||
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
|
||||
[eval "$gt_func_gnugettext_libc=yes"],
|
||||
[eval "$gt_func_gnugettext_libc=no"])])
|
||||
|
||||
if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
|
||||
dnl Sometimes libintl requires libiconv, so first search for libiconv.
|
||||
ifelse(gt_included_intl, yes, , [
|
||||
AM_ICONV_LINK
|
||||
])
|
||||
dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
|
||||
dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
|
||||
dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
|
||||
dnl even if libiconv doesn't exist.
|
||||
AC_LIB_LINKFLAGS_BODY([intl])
|
||||
AC_CACHE_CHECK([for GNU gettext in libintl],
|
||||
[$gt_func_gnugettext_libintl],
|
||||
[gt_save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $INCINTL"
|
||||
gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBINTL"
|
||||
dnl Now see whether libintl exists and does not depend on libiconv.
|
||||
AC_TRY_LINK([#include <libintl.h>
|
||||
$gt_revision_test_code
|
||||
extern int _nl_msg_cat_cntr;
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
const char *_nl_expand_alias (const char *);],
|
||||
[bindtextdomain ("", "");
|
||||
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
|
||||
[eval "$gt_func_gnugettext_libintl=yes"],
|
||||
[eval "$gt_func_gnugettext_libintl=no"])
|
||||
dnl Now see whether libintl exists and depends on libiconv.
|
||||
if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
|
||||
LIBS="$LIBS $LIBICONV"
|
||||
AC_TRY_LINK([#include <libintl.h>
|
||||
$gt_revision_test_code
|
||||
extern int _nl_msg_cat_cntr;
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
const char *_nl_expand_alias (const char *);],
|
||||
[bindtextdomain ("", "");
|
||||
return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
|
||||
[LIBINTL="$LIBINTL $LIBICONV"
|
||||
LTLIBINTL="$LTLIBINTL $LTLIBICONV"
|
||||
eval "$gt_func_gnugettext_libintl=yes"
|
||||
])
|
||||
fi
|
||||
CPPFLAGS="$gt_save_CPPFLAGS"
|
||||
LIBS="$gt_save_LIBS"])
|
||||
fi
|
||||
|
||||
dnl If an already present or preinstalled GNU gettext() is found,
|
||||
dnl use it. But if this macro is used in GNU gettext, and GNU
|
||||
dnl gettext is already preinstalled in libintl, we update this
|
||||
dnl libintl. (Cf. the install rule in intl/Makefile.in.)
|
||||
if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
|
||||
|| { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
|
||||
&& test "$PACKAGE" != gettext-runtime \
|
||||
&& test "$PACKAGE" != gettext-tools; }; then
|
||||
gt_use_preinstalled_gnugettext=yes
|
||||
else
|
||||
dnl Reset the values set by searching for libintl.
|
||||
LIBINTL=
|
||||
LTLIBINTL=
|
||||
INCINTL=
|
||||
fi
|
||||
|
||||
ifelse(gt_included_intl, yes, [
|
||||
if test "$gt_use_preinstalled_gnugettext" != "yes"; then
|
||||
dnl GNU gettext is not found in the C library.
|
||||
dnl Fall back on included GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
|
||||
LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
|
||||
LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
|
||||
fi
|
||||
|
||||
CATOBJEXT=
|
||||
if test "$gt_use_preinstalled_gnugettext" = "yes" \
|
||||
|| test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions to use GNU gettext tools.
|
||||
CATOBJEXT=.gmo
|
||||
fi
|
||||
])
|
||||
|
||||
if test -n "$INTL_MACOSX_LIBS"; then
|
||||
if test "$gt_use_preinstalled_gnugettext" = "yes" \
|
||||
|| test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Some extra flags are needed during linking.
|
||||
LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
|
||||
LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$gt_use_preinstalled_gnugettext" = "yes" \
|
||||
|| test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS, 1,
|
||||
[Define to 1 if translation of program messages to the user's native language
|
||||
is requested.])
|
||||
else
|
||||
USE_NLS=no
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to use NLS])
|
||||
AC_MSG_RESULT([$USE_NLS])
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_MSG_CHECKING([where the gettext function comes from])
|
||||
if test "$gt_use_preinstalled_gnugettext" = "yes"; then
|
||||
if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
|
||||
gt_source="external libintl"
|
||||
else
|
||||
gt_source="libc"
|
||||
fi
|
||||
else
|
||||
gt_source="included intl directory"
|
||||
fi
|
||||
AC_MSG_RESULT([$gt_source])
|
||||
fi
|
||||
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
|
||||
if test "$gt_use_preinstalled_gnugettext" = "yes"; then
|
||||
if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
|
||||
AC_MSG_CHECKING([how to link with libintl])
|
||||
AC_MSG_RESULT([$LIBINTL])
|
||||
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
|
||||
fi
|
||||
|
||||
dnl For backward compatibility. Some packages may be using this.
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define if the GNU gettext() function is already present or preinstalled.])
|
||||
AC_DEFINE(HAVE_DCGETTEXT, 1,
|
||||
[Define if the GNU dcgettext() function is already present or preinstalled.])
|
||||
fi
|
||||
|
||||
dnl We need to process the po/ directory.
|
||||
POSUB=po
|
||||
fi
|
||||
|
||||
ifelse(gt_included_intl, yes, [
|
||||
dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
|
||||
dnl to 'yes' because some of the testsuite requires it.
|
||||
if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
|
||||
BUILD_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(BUILD_INCLUDED_LIBINTL)
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
|
||||
dnl For backward compatibility. Some configure.ins may be using this.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
DATADIRNAME=share
|
||||
AC_SUBST(DATADIRNAME)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
INSTOBJEXT=.mo
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
GENCAT=gencat
|
||||
AC_SUBST(GENCAT)
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
INTLOBJS=
|
||||
if test "$USE_INCLUDED_LIBINTL" = yes; then
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
fi
|
||||
AC_SUBST(INTLOBJS)
|
||||
|
||||
dnl Enable libtool support if the surrounding package wishes it.
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
|
||||
AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
|
||||
])
|
||||
|
||||
dnl For backward compatibility. Some Makefiles may be using this.
|
||||
INTLLIBS="$LIBINTL"
|
||||
AC_SUBST(INTLLIBS)
|
||||
|
||||
dnl Make all documented variables known to autoconf.
|
||||
AC_SUBST(LIBINTL)
|
||||
AC_SUBST(LTLIBINTL)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
|
||||
dnl Checks for special options needed on MacOS X.
|
||||
dnl Defines INTL_MACOSX_LIBS.
|
||||
AC_DEFUN([gt_INTL_MACOSX],
|
||||
[
|
||||
dnl Check for API introduced in MacOS X 10.2.
|
||||
AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
|
||||
gt_cv_func_CFPreferencesCopyAppValue,
|
||||
[gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
|
||||
AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
|
||||
[CFPreferencesCopyAppValue(NULL, NULL)],
|
||||
[gt_cv_func_CFPreferencesCopyAppValue=yes],
|
||||
[gt_cv_func_CFPreferencesCopyAppValue=no])
|
||||
LIBS="$gt_save_LIBS"])
|
||||
if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
|
||||
AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
|
||||
[Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
|
||||
fi
|
||||
dnl Check for API introduced in MacOS X 10.3.
|
||||
AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
|
||||
[gt_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
|
||||
AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
|
||||
[gt_cv_func_CFLocaleCopyCurrent=yes],
|
||||
[gt_cv_func_CFLocaleCopyCurrent=no])
|
||||
LIBS="$gt_save_LIBS"])
|
||||
if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
|
||||
AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
|
||||
[Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
|
||||
fi
|
||||
INTL_MACOSX_LIBS=
|
||||
if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
|
||||
INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
|
||||
fi
|
||||
AC_SUBST([INTL_MACOSX_LIBS])
|
||||
])
|
||||
|
||||
|
||||
dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
|
||||
m4_define([gt_NEEDS_INIT],
|
||||
[
|
||||
m4_divert_text([DEFAULTS], [gt_needs=])
|
||||
m4_define([gt_NEEDS_INIT], [])
|
||||
])
|
||||
|
||||
|
||||
dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
|
||||
AC_DEFUN([AM_GNU_GETTEXT_NEED],
|
||||
[
|
||||
m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
|
||||
])
|
||||
|
||||
|
||||
dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
|
||||
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
|
22
gl/m4/gnulib-common.m4
Normal file
22
gl/m4/gnulib-common.m4
Normal file
|
@ -0,0 +1,22 @@
|
|||
# gnulib-common.m4 serial 2
|
||||
dnl Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# gl_MODULE_INDICATOR([modulename])
|
||||
# defines a C macro indicating the presence of the given module.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR],
|
||||
[
|
||||
AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
|
||||
[Define to 1 when using the gnulib module ]$1[.])
|
||||
])
|
||||
|
||||
# AC_PROG_MKDIR_P
|
||||
# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
|
||||
# Remove this macro when we can assume autoconf >= 2.60.
|
||||
m4_ifdef([AC_PROG_MKDIR_P], [], [
|
||||
AC_DEFUN([AC_PROG_MKDIR_P],
|
||||
[AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
|
||||
MKDIR_P='$(mkdir_p)'
|
||||
AC_SUBST([MKDIR_P])])])
|
326
gl/m4/gnulib-comp.m4
Normal file
326
gl/m4/gnulib-comp.m4
Normal file
|
@ -0,0 +1,326 @@
|
|||
# DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
# Copyright (C) 2004-2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software, distributed under the terms of the GNU
|
||||
# General Public License. As a special exception to the GNU General
|
||||
# Public License, this file may be distributed as part of a program
|
||||
# that contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
#
|
||||
# This file represents the compiled summary of the specification in
|
||||
# gnulib-cache.m4. It lists the computed macro invocations that need
|
||||
# to be invoked from configure.ac.
|
||||
# In projects using CVS, this file can be treated like other built files.
|
||||
|
||||
|
||||
# This macro should be invoked from ./configure.in, in the section
|
||||
# "Checks for programs", right after AC_PROG_CC, and certainly before
|
||||
# any checks for libraries, header files, types and library functions.
|
||||
AC_DEFUN([gl_EARLY],
|
||||
[
|
||||
m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
|
||||
m4_pattern_allow([^gl_ES$])dnl a valid locale name
|
||||
m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
|
||||
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
|
||||
AC_REQUIRE([AC_PROG_RANLIB])
|
||||
AC_REQUIRE([AC_GNU_SOURCE])
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
AC_REQUIRE([gl_LOCK_EARLY])
|
||||
])
|
||||
|
||||
# This macro should be invoked from ./configure.in, in the section
|
||||
# "Check for header files, types and library functions".
|
||||
AC_DEFUN([gl_INIT],
|
||||
[
|
||||
m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
|
||||
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
|
||||
m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
|
||||
AM_CONDITIONAL([GL_COND_LIBTOOL], [false])
|
||||
gl_cond_libtool=false
|
||||
gl_libdeps=
|
||||
gl_ltlibdeps=
|
||||
gl_source_base='gl'
|
||||
gl_FUNC_ALLOCA
|
||||
gl_HEADER_ARPA_INET
|
||||
gl_C_STRTOD
|
||||
gl_CLOEXEC
|
||||
gl_DIRNAME
|
||||
gl_DOUBLE_SLASH_ROOT
|
||||
gl_ERROR
|
||||
gl_EXITFAIL
|
||||
dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac.
|
||||
gl_FCNTL_SAFER
|
||||
gl_MODULE_INDICATOR([fcntl-safer])
|
||||
gl_FSUSAGE
|
||||
gl_GETADDRINFO
|
||||
gl_FUNC_GETHOSTNAME
|
||||
gl_GETLOADAVG([$gl_source_base])
|
||||
gl_GETOPT
|
||||
dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
|
||||
AM_GNU_GETTEXT_VERSION([0.15])
|
||||
gl_INET_NTOP
|
||||
gl_INLINE
|
||||
AC_FUNC_MALLOC
|
||||
gl_MBCHAR
|
||||
gl_MBITER
|
||||
gl_FUNC_MEMCHR
|
||||
gl_MINMAX
|
||||
gl_MOUNTLIST
|
||||
gl_HEADER_NETINET_IN
|
||||
gl_REGEX
|
||||
gl_SAFE_READ
|
||||
gl_SAFE_WRITE
|
||||
gl_SIZE_MAX
|
||||
gl_FUNC_SNPRINTF
|
||||
gl_TYPE_SOCKLEN_T
|
||||
gt_TYPE_SSIZE_T
|
||||
AM_STDBOOL_H
|
||||
gl_STDINT_H
|
||||
gl_STRCASE
|
||||
gl_FUNC_STRDUP
|
||||
gl_FUNC_STRNDUP
|
||||
gl_FUNC_STRNLEN
|
||||
gl_HEADER_SYS_SOCKET
|
||||
AC_PROG_MKDIR_P
|
||||
gl_HEADER_UNISTD
|
||||
gl_UNISTD_SAFER
|
||||
gl_FUNC_VASNPRINTF
|
||||
gl_FUNC_VASPRINTF
|
||||
gl_FUNC_VSNPRINTF
|
||||
gl_WCHAR_H
|
||||
gl_WCTYPE_H
|
||||
gl_FUNC_WCWIDTH
|
||||
gl_XALLOC
|
||||
gl_XSIZE
|
||||
gl_XSTRNDUP
|
||||
LIBGNU_LIBDEPS="$gl_libdeps"
|
||||
AC_SUBST([LIBGNU_LIBDEPS])
|
||||
LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
|
||||
AC_SUBST([LIBGNU_LTLIBDEPS])
|
||||
m4_popdef([AC_LIBSOURCES])
|
||||
m4_popdef([AC_REPLACE_FUNCS])
|
||||
m4_popdef([AC_LIBOBJ])
|
||||
AC_CONFIG_COMMANDS_PRE([
|
||||
gl_libobjs=
|
||||
gl_ltlibobjs=
|
||||
if test -n "$gl_LIBOBJS"; then
|
||||
# Remove the extension.
|
||||
sed_drop_objext='s/\.o$//;s/\.obj$//'
|
||||
for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
|
||||
gl_libobjs="$gl_libobjs $i.$ac_objext"
|
||||
gl_ltlibobjs="$gl_ltlibobjs $i.lo"
|
||||
done
|
||||
fi
|
||||
AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
|
||||
AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
|
||||
])
|
||||
])
|
||||
|
||||
# Like AC_LIBOBJ, except that the module name goes
|
||||
# into gl_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([gl_LIBOBJ],
|
||||
[gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"])
|
||||
|
||||
# Like AC_REPLACE_FUNCS, except that the module name goes
|
||||
# into gl_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([gl_REPLACE_FUNCS],
|
||||
[AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])])
|
||||
|
||||
# Like AC_LIBSOURCES, except that it does nothing.
|
||||
# We rely on EXTRA_lib..._SOURCES instead.
|
||||
AC_DEFUN([gl_LIBSOURCES],
|
||||
[])
|
||||
|
||||
# This macro records the list of files which have been installed by
|
||||
# gnulib-tool and may be removed by future gnulib-tool invocations.
|
||||
AC_DEFUN([gl_FILE_LIST], [
|
||||
build-aux/config.rpath
|
||||
lib/alloca.c
|
||||
lib/alloca_.h
|
||||
lib/asnprintf.c
|
||||
lib/asprintf.c
|
||||
lib/basename.c
|
||||
lib/c-strtod.c
|
||||
lib/c-strtod.h
|
||||
lib/cloexec.c
|
||||
lib/cloexec.h
|
||||
lib/creat-safer.c
|
||||
lib/dirname.c
|
||||
lib/dirname.h
|
||||
lib/dup-safer.c
|
||||
lib/error.c
|
||||
lib/error.h
|
||||
lib/exit.h
|
||||
lib/exitfail.c
|
||||
lib/exitfail.h
|
||||
lib/fcntl--.h
|
||||
lib/fcntl-safer.h
|
||||
lib/fd-safer.c
|
||||
lib/fsusage.c
|
||||
lib/fsusage.h
|
||||
lib/full-read.c
|
||||
lib/full-read.h
|
||||
lib/full-write.c
|
||||
lib/full-write.h
|
||||
lib/gai_strerror.c
|
||||
lib/getaddrinfo.c
|
||||
lib/getaddrinfo.h
|
||||
lib/gethostname.c
|
||||
lib/getloadavg.c
|
||||
lib/getopt.c
|
||||
lib/getopt1.c
|
||||
lib/getopt_.h
|
||||
lib/getopt_int.h
|
||||
lib/gettext.h
|
||||
lib/inet_ntop.c
|
||||
lib/inet_ntop.h
|
||||
lib/intprops.h
|
||||
lib/malloc.c
|
||||
lib/mbchar.c
|
||||
lib/mbchar.h
|
||||
lib/mbuiter.h
|
||||
lib/memchr.c
|
||||
lib/minmax.h
|
||||
lib/mountlist.c
|
||||
lib/mountlist.h
|
||||
lib/open-safer.c
|
||||
lib/pipe-safer.c
|
||||
lib/printf-args.c
|
||||
lib/printf-args.h
|
||||
lib/printf-parse.c
|
||||
lib/printf-parse.h
|
||||
lib/regcomp.c
|
||||
lib/regex.c
|
||||
lib/regex.h
|
||||
lib/regex_internal.c
|
||||
lib/regex_internal.h
|
||||
lib/regexec.c
|
||||
lib/safe-read.c
|
||||
lib/safe-read.h
|
||||
lib/safe-write.c
|
||||
lib/safe-write.h
|
||||
lib/size_max.h
|
||||
lib/snprintf.c
|
||||
lib/snprintf.h
|
||||
lib/socket_.h
|
||||
lib/stdbool_.h
|
||||
lib/stdint_.h
|
||||
lib/strcase.h
|
||||
lib/strcasecmp.c
|
||||
lib/strdup.c
|
||||
lib/strdup.h
|
||||
lib/stripslash.c
|
||||
lib/strncasecmp.c
|
||||
lib/strndup.c
|
||||
lib/strndup.h
|
||||
lib/strnlen.c
|
||||
lib/strnlen.h
|
||||
lib/strnlen1.c
|
||||
lib/strnlen1.h
|
||||
lib/unistd--.h
|
||||
lib/unistd-safer.h
|
||||
lib/unistd_.h
|
||||
lib/vasnprintf.c
|
||||
lib/vasnprintf.h
|
||||
lib/vasprintf.c
|
||||
lib/vasprintf.h
|
||||
lib/vsnprintf.c
|
||||
lib/vsnprintf.h
|
||||
lib/wchar_.h
|
||||
lib/wctype_.h
|
||||
lib/wcwidth.h
|
||||
lib/xalloc-die.c
|
||||
lib/xalloc.h
|
||||
lib/xmalloc.c
|
||||
lib/xsize.h
|
||||
lib/xstrndup.c
|
||||
lib/xstrndup.h
|
||||
m4/absolute-header.m4
|
||||
m4/alloca.m4
|
||||
m4/arpa_inet_h.m4
|
||||
m4/c-strtod.m4
|
||||
m4/cloexec.m4
|
||||
m4/codeset.m4
|
||||
m4/dirname.m4
|
||||
m4/dos.m4
|
||||
m4/double-slash-root.m4
|
||||
m4/eoverflow.m4
|
||||
m4/error.m4
|
||||
m4/exitfail.m4
|
||||
m4/extensions.m4
|
||||
m4/fcntl-safer.m4
|
||||
m4/fstypename.m4
|
||||
m4/fsusage.m4
|
||||
m4/getaddrinfo.m4
|
||||
m4/gethostname.m4
|
||||
m4/getloadavg.m4
|
||||
m4/getopt.m4
|
||||
m4/gettext.m4
|
||||
m4/glibc2.m4
|
||||
m4/glibc21.m4
|
||||
m4/gnulib-common.m4
|
||||
m4/iconv.m4
|
||||
m4/inet_ntop.m4
|
||||
m4/inline.m4
|
||||
m4/intdiv0.m4
|
||||
m4/intl.m4
|
||||
m4/intldir.m4
|
||||
m4/intmax.m4
|
||||
m4/intmax_t.m4
|
||||
m4/inttypes-pri.m4
|
||||
m4/inttypes_h.m4
|
||||
m4/lcmessage.m4
|
||||
m4/lib-ld.m4
|
||||
m4/lib-link.m4
|
||||
m4/lib-prefix.m4
|
||||
m4/lock.m4
|
||||
m4/longdouble.m4
|
||||
m4/longlong.m4
|
||||
m4/ls-mntd-fs.m4
|
||||
m4/mbchar.m4
|
||||
m4/mbiter.m4
|
||||
m4/mbrtowc.m4
|
||||
m4/memchr.m4
|
||||
m4/minmax.m4
|
||||
m4/mountlist.m4
|
||||
m4/netinet_in_h.m4
|
||||
m4/nls.m4
|
||||
m4/onceonly_2_57.m4
|
||||
m4/po.m4
|
||||
m4/printf-posix.m4
|
||||
m4/progtest.m4
|
||||
m4/regex.m4
|
||||
m4/safe-read.m4
|
||||
m4/safe-write.m4
|
||||
m4/size_max.m4
|
||||
m4/snprintf.m4
|
||||
m4/socklen.m4
|
||||
m4/sockpfaf.m4
|
||||
m4/ssize_t.m4
|
||||
m4/stdbool.m4
|
||||
m4/stdint.m4
|
||||
m4/stdint_h.m4
|
||||
m4/strcase.m4
|
||||
m4/strdup.m4
|
||||
m4/strndup.m4
|
||||
m4/strnlen.m4
|
||||
m4/sys_socket_h.m4
|
||||
m4/uintmax_t.m4
|
||||
m4/ulonglong.m4
|
||||
m4/unistd-safer.m4
|
||||
m4/unistd_h.m4
|
||||
m4/vasnprintf.m4
|
||||
m4/vasprintf.m4
|
||||
m4/visibility.m4
|
||||
m4/vsnprintf.m4
|
||||
m4/wchar.m4
|
||||
m4/wchar_t.m4
|
||||
m4/wctype.m4
|
||||
m4/wcwidth.m4
|
||||
m4/wint_t.m4
|
||||
m4/xalloc.m4
|
||||
m4/xsize.m4
|
||||
m4/xstrndup.m4
|
||||
])
|
101
gl/m4/iconv.m4
Normal file
101
gl/m4/iconv.m4
Normal file
|
@ -0,0 +1,101 @@
|
|||
# iconv.m4 serial AM4 (gettext-0.11.3)
|
||||
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
|
||||
[
|
||||
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
AC_REQUIRE([AC_LIB_RPATH])
|
||||
|
||||
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
|
||||
dnl accordingly.
|
||||
AC_LIB_LINKFLAGS_BODY([iconv])
|
||||
])
|
||||
|
||||
AC_DEFUN([AM_ICONV_LINK],
|
||||
[
|
||||
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
dnl those with the standalone portable GNU libiconv installed).
|
||||
|
||||
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
|
||||
dnl accordingly.
|
||||
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
|
||||
|
||||
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
|
||||
dnl because if the user has installed libiconv and not disabled its use
|
||||
dnl via --without-libiconv-prefix, he wants to use it. The first
|
||||
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
|
||||
am_save_CPPFLAGS="$CPPFLAGS"
|
||||
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
|
||||
|
||||
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
||||
am_cv_func_iconv="no, consider installing GNU libiconv"
|
||||
am_cv_lib_iconv=no
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_func_iconv=yes)
|
||||
if test "$am_cv_func_iconv" != yes; then
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBICONV"
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_lib_iconv=yes
|
||||
am_cv_func_iconv=yes)
|
||||
LIBS="$am_save_LIBS"
|
||||
fi
|
||||
])
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
fi
|
||||
if test "$am_cv_lib_iconv" = yes; then
|
||||
AC_MSG_CHECKING([how to link with libiconv])
|
||||
AC_MSG_RESULT([$LIBICONV])
|
||||
else
|
||||
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
|
||||
dnl either.
|
||||
CPPFLAGS="$am_save_CPPFLAGS"
|
||||
LIBICONV=
|
||||
LTLIBICONV=
|
||||
fi
|
||||
AC_SUBST(LIBICONV)
|
||||
AC_SUBST(LTLIBICONV)
|
||||
])
|
||||
|
||||
AC_DEFUN([AM_ICONV],
|
||||
[
|
||||
AM_ICONV_LINK
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
}[$]am_cv_proto_iconv)
|
||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
||||
[Define as const if the declaration of iconv() needs const.])
|
||||
fi
|
||||
])
|
19
gl/m4/inet_ntop.m4
Normal file
19
gl/m4/inet_ntop.m4
Normal file
|
@ -0,0 +1,19 @@
|
|||
# inet_ntop.m4 serial 3
|
||||
dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_INET_NTOP],
|
||||
[
|
||||
AC_REPLACE_FUNCS(inet_ntop)
|
||||
gl_PREREQ_INET_NTOP
|
||||
])
|
||||
|
||||
# Prerequisites of lib/inet_ntop.h and lib/inet_ntop.c.
|
||||
AC_DEFUN([gl_PREREQ_INET_NTOP], [
|
||||
AC_CHECK_HEADERS_ONCE([netinet/in.h arpa/inet.h])
|
||||
AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
|
||||
AC_REQUIRE([gl_SOCKET_FAMILIES])
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
])
|
40
gl/m4/inline.m4
Normal file
40
gl/m4/inline.m4
Normal file
|
@ -0,0 +1,40 @@
|
|||
# inline.m4 serial 3
|
||||
dnl Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Test for the 'inline' keyword or equivalent.
|
||||
dnl Define 'inline' to a supported equivalent, or to nothing if not supported,
|
||||
dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an
|
||||
dnl equivalent is effectively supported, i.e. if the compiler is likely to
|
||||
dnl drop unused 'static inline' functions.
|
||||
AC_DEFUN([gl_INLINE],
|
||||
[
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
AC_CACHE_CHECK([whether the compiler generally respects inline],
|
||||
[gl_cv_c_inline_effective],
|
||||
[if test $ac_cv_c_inline = no; then
|
||||
gl_cv_c_inline_effective=no
|
||||
else
|
||||
dnl GCC defines __NO_INLINE__ if not optimizing or if -fno-inline is
|
||||
dnl specified.
|
||||
dnl Use AC_COMPILE_IFELSE here, not AC_EGREP_CPP, because the result
|
||||
dnl depends on optimization flags, which can be in CFLAGS.
|
||||
dnl (AC_EGREP_CPP looks only at the CPPFLAGS.)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]],
|
||||
[[#ifdef __NO_INLINE__
|
||||
#error "inline is not effective"
|
||||
#endif]])],
|
||||
[gl_cv_c_inline_effective=yes],
|
||||
[gl_cv_c_inline_effective=no])
|
||||
fi
|
||||
])
|
||||
if test $gl_cv_c_inline_effective = yes; then
|
||||
AC_DEFINE([HAVE_INLINE], 1,
|
||||
[Define to 1 if the compiler supports one of the keywords
|
||||
'inline', '__inline__', '__inline' and effectively inlines
|
||||
functions marked as such.])
|
||||
fi
|
||||
])
|
61
gl/m4/intmax_t.m4
Normal file
61
gl/m4/intmax_t.m4
Normal file
|
@ -0,0 +1,61 @@
|
|||
# intmax_t.m4 serial 5
|
||||
dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert.
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
|
||||
# Define intmax_t to 'long' or 'long long'
|
||||
# if it is not already defined in <stdint.h> or <inttypes.h>.
|
||||
|
||||
AC_DEFUN([gl_AC_TYPE_INTMAX_T],
|
||||
[
|
||||
dnl For simplicity, we assume that a header file defines 'intmax_t' if and
|
||||
dnl only if it defines 'uintmax_t'.
|
||||
AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
|
||||
AC_REQUIRE([gl_AC_HEADER_STDINT_H])
|
||||
if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
|
||||
AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
|
||||
test $ac_cv_type_long_long = yes \
|
||||
&& ac_type='long long' \
|
||||
|| ac_type='long'
|
||||
AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
|
||||
[Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
|
||||
else
|
||||
AC_DEFINE(HAVE_INTMAX_T, 1,
|
||||
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl An alternative would be to explicitly test for 'intmax_t'.
|
||||
|
||||
AC_DEFUN([gt_AC_TYPE_INTMAX_T],
|
||||
[
|
||||
AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
|
||||
AC_REQUIRE([gl_AC_HEADER_STDINT_H])
|
||||
AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
|
||||
[AC_TRY_COMPILE([
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_STDINT_H_WITH_UINTMAX
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#if HAVE_INTTYPES_H_WITH_UINTMAX
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
|
||||
if test $gt_cv_c_intmax_t = yes; then
|
||||
AC_DEFINE(HAVE_INTMAX_T, 1,
|
||||
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
|
||||
else
|
||||
AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
|
||||
test $ac_cv_type_long_long = yes \
|
||||
&& ac_type='long long' \
|
||||
|| ac_type='long'
|
||||
AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
|
||||
[Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
|
||||
fi
|
||||
])
|
26
gl/m4/inttypes_h.m4
Normal file
26
gl/m4/inttypes_h.m4
Normal file
|
@ -0,0 +1,26 @@
|
|||
# inttypes_h.m4 serial 7
|
||||
dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert.
|
||||
|
||||
# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
|
||||
# doesn't clash with <sys/types.h>, and declares uintmax_t.
|
||||
|
||||
AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
|
||||
[
|
||||
AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
|
||||
[AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>
|
||||
#include <inttypes.h>],
|
||||
[uintmax_t i = (uintmax_t) -1; return !i;],
|
||||
gl_cv_header_inttypes_h=yes,
|
||||
gl_cv_header_inttypes_h=no)])
|
||||
if test $gl_cv_header_inttypes_h = yes; then
|
||||
AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
|
||||
[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
|
||||
and declares uintmax_t. ])
|
||||
fi
|
||||
])
|
110
gl/m4/lib-ld.m4
Normal file
110
gl/m4/lib-ld.m4
Normal file
|
@ -0,0 +1,110 @@
|
|||
# lib-ld.m4 serial 3 (gettext-0.13)
|
||||
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Subroutines of libtool.m4,
|
||||
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
|
||||
dnl with libtool.m4.
|
||||
|
||||
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
|
||||
AC_DEFUN([AC_LIB_PROG_LD_GNU],
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
case `$LD -v 2>&1 </dev/null` in
|
||||
*GNU* | *'with BFD'*)
|
||||
acl_cv_prog_gnu_ld=yes ;;
|
||||
*)
|
||||
acl_cv_prog_gnu_ld=no ;;
|
||||
esac])
|
||||
with_gnu_ld=$acl_cv_prog_gnu_ld
|
||||
])
|
||||
|
||||
dnl From libtool-1.4. Sets the variable LD.
|
||||
AC_DEFUN([AC_LIB_PROG_LD],
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
# Prepare PATH_SEPARATOR.
|
||||
# The user is always right.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
echo "#! /bin/sh" >conf$$.sh
|
||||
echo "exit 0" >>conf$$.sh
|
||||
chmod +x conf$$.sh
|
||||
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -f conf$$.sh
|
||||
fi
|
||||
ac_prog=ld
|
||||
if test "$GCC" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
case $host in
|
||||
*-*-mingw*)
|
||||
# gcc leaves a trailing carriage return which upsets mingw
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
|
||||
*)
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
|
||||
esac
|
||||
case $ac_prog in
|
||||
# Accept absolute paths.
|
||||
[[\\/]* | [A-Za-z]:[\\/]*)]
|
||||
[re_direlt='/[^/][^/]*/\.\./']
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(acl_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
acl_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
|
||||
*GNU* | *'with BFD'*)
|
||||
test "$with_gnu_ld" != no && break ;;
|
||||
*)
|
||||
test "$with_gnu_ld" != yes && break ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
acl_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$acl_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_LIB_PROG_LD_GNU
|
||||
])
|
709
gl/m4/lib-link.m4
Normal file
709
gl/m4/lib-link.m4
Normal file
|
@ -0,0 +1,709 @@
|
|||
# lib-link.m4 serial 13 (gettext-0.16.2)
|
||||
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_PREREQ(2.54)
|
||||
|
||||
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
|
||||
dnl the libraries corresponding to explicit and implicit dependencies.
|
||||
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
|
||||
dnl augments the CPPFLAGS variable.
|
||||
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
|
||||
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||
AC_DEFUN([AC_LIB_LINKFLAGS],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
AC_REQUIRE([AC_LIB_RPATH])
|
||||
define([Name],[translit([$1],[./-], [___])])
|
||||
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
|
||||
AC_LIB_LINKFLAGS_BODY([$1], [$2])
|
||||
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
|
||||
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
|
||||
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
|
||||
ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
|
||||
])
|
||||
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
|
||||
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
|
||||
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
|
||||
LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
|
||||
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
|
||||
AC_SUBST([LIB]NAME)
|
||||
AC_SUBST([LTLIB]NAME)
|
||||
AC_SUBST([LIB]NAME[_PREFIX])
|
||||
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
|
||||
dnl results of this search when this library appears as a dependency.
|
||||
HAVE_LIB[]NAME=yes
|
||||
undefine([Name])
|
||||
undefine([NAME])
|
||||
])
|
||||
|
||||
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
|
||||
dnl searches for libname and the libraries corresponding to explicit and
|
||||
dnl implicit dependencies, together with the specified include files and
|
||||
dnl the ability to compile and link the specified testcode. If found, it
|
||||
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
|
||||
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
|
||||
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
|
||||
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
|
||||
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
|
||||
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
AC_REQUIRE([AC_LIB_RPATH])
|
||||
define([Name],[translit([$1],[./-], [___])])
|
||||
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||
|
||||
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
|
||||
dnl accordingly.
|
||||
AC_LIB_LINKFLAGS_BODY([$1], [$2])
|
||||
|
||||
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
|
||||
dnl because if the user has installed lib[]Name and not disabled its use
|
||||
dnl via --without-lib[]Name-prefix, he wants to use it.
|
||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
|
||||
|
||||
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIB[]NAME"
|
||||
AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
|
||||
LIBS="$ac_save_LIBS"
|
||||
])
|
||||
if test "$ac_cv_lib[]Name" = yes; then
|
||||
HAVE_LIB[]NAME=yes
|
||||
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
|
||||
AC_MSG_CHECKING([how to link with lib[]$1])
|
||||
AC_MSG_RESULT([$LIB[]NAME])
|
||||
else
|
||||
HAVE_LIB[]NAME=no
|
||||
dnl If $LIB[]NAME didn't lead to a usable library, we don't need
|
||||
dnl $INC[]NAME either.
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||
LIB[]NAME=
|
||||
LTLIB[]NAME=
|
||||
LIB[]NAME[]_PREFIX=
|
||||
fi
|
||||
AC_SUBST([HAVE_LIB]NAME)
|
||||
AC_SUBST([LIB]NAME)
|
||||
AC_SUBST([LTLIB]NAME)
|
||||
AC_SUBST([LIB]NAME[_PREFIX])
|
||||
undefine([Name])
|
||||
undefine([NAME])
|
||||
])
|
||||
|
||||
dnl Determine the platform dependent parameters needed to use rpath:
|
||||
dnl acl_libext,
|
||||
dnl acl_shlibext,
|
||||
dnl acl_hardcode_libdir_flag_spec,
|
||||
dnl acl_hardcode_libdir_separator,
|
||||
dnl acl_hardcode_direct,
|
||||
dnl acl_hardcode_minus_L.
|
||||
AC_DEFUN([AC_LIB_RPATH],
|
||||
[
|
||||
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
|
||||
m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
|
||||
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
|
||||
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
|
||||
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
|
||||
AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
|
||||
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
|
||||
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
|
||||
. ./conftest.sh
|
||||
rm -f ./conftest.sh
|
||||
acl_cv_rpath=done
|
||||
])
|
||||
wl="$acl_cv_wl"
|
||||
acl_libext="$acl_cv_libext"
|
||||
acl_shlibext="$acl_cv_shlibext"
|
||||
acl_libname_spec="$acl_cv_libname_spec"
|
||||
acl_library_names_spec="$acl_cv_library_names_spec"
|
||||
acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
|
||||
acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
|
||||
acl_hardcode_direct="$acl_cv_hardcode_direct"
|
||||
acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
|
||||
dnl Determine whether the user wants rpath handling at all.
|
||||
AC_ARG_ENABLE(rpath,
|
||||
[ --disable-rpath do not hardcode runtime library paths],
|
||||
:, enable_rpath=yes)
|
||||
])
|
||||
|
||||
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
|
||||
dnl the libraries corresponding to explicit and implicit dependencies.
|
||||
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
|
||||
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
|
||||
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
|
||||
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
|
||||
dnl Autoconf >= 2.61 supports dots in --with options.
|
||||
define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
|
||||
dnl By default, look in $includedir and $libdir.
|
||||
use_additional=yes
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
|
||||
[ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
|
||||
--without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir],
|
||||
[
|
||||
if test "X$withval" = "Xno"; then
|
||||
use_additional=no
|
||||
else
|
||||
if test "X$withval" = "X"; then
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
else
|
||||
additional_includedir="$withval/include"
|
||||
additional_libdir="$withval/$acl_libdirstem"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
dnl Search the library and its dependencies in $additional_libdir and
|
||||
dnl $LDFLAGS. Using breadth-first-seach.
|
||||
LIB[]NAME=
|
||||
LTLIB[]NAME=
|
||||
INC[]NAME=
|
||||
LIB[]NAME[]_PREFIX=
|
||||
rpathdirs=
|
||||
ltrpathdirs=
|
||||
names_already_handled=
|
||||
names_next_round='$1 $2'
|
||||
while test -n "$names_next_round"; do
|
||||
names_this_round="$names_next_round"
|
||||
names_next_round=
|
||||
for name in $names_this_round; do
|
||||
already_handled=
|
||||
for n in $names_already_handled; do
|
||||
if test "$n" = "$name"; then
|
||||
already_handled=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$already_handled"; then
|
||||
names_already_handled="$names_already_handled $name"
|
||||
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
|
||||
dnl or AC_LIB_HAVE_LINKFLAGS call.
|
||||
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
|
||||
eval value=\"\$HAVE_LIB$uppername\"
|
||||
if test -n "$value"; then
|
||||
if test "$value" = yes; then
|
||||
eval value=\"\$LIB$uppername\"
|
||||
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
|
||||
eval value=\"\$LTLIB$uppername\"
|
||||
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
|
||||
else
|
||||
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
|
||||
dnl that this library doesn't exist. So just drop it.
|
||||
:
|
||||
fi
|
||||
else
|
||||
dnl Search the library lib$name in $additional_libdir and $LDFLAGS
|
||||
dnl and the already constructed $LIBNAME/$LTLIBNAME.
|
||||
found_dir=
|
||||
found_la=
|
||||
found_so=
|
||||
found_a=
|
||||
eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
|
||||
if test -n "$acl_shlibext"; then
|
||||
shrext=".$acl_shlibext" # typically: shrext=.so
|
||||
else
|
||||
shrext=
|
||||
fi
|
||||
if test $use_additional = yes; then
|
||||
dir="$additional_libdir"
|
||||
dnl The same code as in the loop below:
|
||||
dnl First look for a shared library.
|
||||
if test -n "$acl_shlibext"; then
|
||||
if test -f "$dir/$libname$shrext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/$libname$shrext"
|
||||
else
|
||||
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
|
||||
ver=`(cd "$dir" && \
|
||||
for f in "$libname$shrext".*; do echo "$f"; done \
|
||||
| sed -e "s,^$libname$shrext\\\\.,," \
|
||||
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
|
||||
| sed 1q ) 2>/dev/null`
|
||||
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/$libname$shrext.$ver"
|
||||
fi
|
||||
else
|
||||
eval library_names=\"$acl_library_names_spec\"
|
||||
for f in $library_names; do
|
||||
if test -f "$dir/$f"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
dnl Then look for a static library.
|
||||
if test "X$found_dir" = "X"; then
|
||||
if test -f "$dir/$libname.$acl_libext"; then
|
||||
found_dir="$dir"
|
||||
found_a="$dir/$libname.$acl_libext"
|
||||
fi
|
||||
fi
|
||||
if test "X$found_dir" != "X"; then
|
||||
if test -f "$dir/$libname.la"; then
|
||||
found_la="$dir/$libname.la"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "X$found_dir" = "X"; then
|
||||
for x in $LDFLAGS $LTLIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
case "$x" in
|
||||
-L*)
|
||||
dir=`echo "X$x" | sed -e 's/^X-L//'`
|
||||
dnl First look for a shared library.
|
||||
if test -n "$acl_shlibext"; then
|
||||
if test -f "$dir/$libname$shrext"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/$libname$shrext"
|
||||
else
|
||||
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
|
||||
ver=`(cd "$dir" && \
|
||||
for f in "$libname$shrext".*; do echo "$f"; done \
|
||||
| sed -e "s,^$libname$shrext\\\\.,," \
|
||||
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
|
||||
| sed 1q ) 2>/dev/null`
|
||||
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/$libname$shrext.$ver"
|
||||
fi
|
||||
else
|
||||
eval library_names=\"$acl_library_names_spec\"
|
||||
for f in $library_names; do
|
||||
if test -f "$dir/$f"; then
|
||||
found_dir="$dir"
|
||||
found_so="$dir/$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
dnl Then look for a static library.
|
||||
if test "X$found_dir" = "X"; then
|
||||
if test -f "$dir/$libname.$acl_libext"; then
|
||||
found_dir="$dir"
|
||||
found_a="$dir/$libname.$acl_libext"
|
||||
fi
|
||||
fi
|
||||
if test "X$found_dir" != "X"; then
|
||||
if test -f "$dir/$libname.la"; then
|
||||
found_la="$dir/$libname.la"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "X$found_dir" != "X"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test "X$found_dir" != "X"; then
|
||||
dnl Found the library.
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
|
||||
if test "X$found_so" != "X"; then
|
||||
dnl Linking with a shared library. We attempt to hardcode its
|
||||
dnl directory into the executable's runpath, unless it's the
|
||||
dnl standard /usr/lib.
|
||||
if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
|
||||
dnl No hardcoding is needed.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
dnl Use an explicit option to hardcode DIR into the resulting
|
||||
dnl binary.
|
||||
dnl Potentially add DIR to ltrpathdirs.
|
||||
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
|
||||
haveit=
|
||||
for x in $ltrpathdirs; do
|
||||
if test "X$x" = "X$found_dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
ltrpathdirs="$ltrpathdirs $found_dir"
|
||||
fi
|
||||
dnl The hardcoding into $LIBNAME is system dependent.
|
||||
if test "$acl_hardcode_direct" = yes; then
|
||||
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
dnl resulting binary.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
|
||||
dnl Use an explicit option to hardcode DIR into the resulting
|
||||
dnl binary.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
dnl Potentially add DIR to rpathdirs.
|
||||
dnl The rpathdirs will be appended to $LIBNAME at the end.
|
||||
haveit=
|
||||
for x in $rpathdirs; do
|
||||
if test "X$x" = "X$found_dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
rpathdirs="$rpathdirs $found_dir"
|
||||
fi
|
||||
else
|
||||
dnl Rely on "-L$found_dir".
|
||||
dnl But don't add it if it's already contained in the LDFLAGS
|
||||
dnl or the already constructed $LIBNAME
|
||||
haveit=
|
||||
for x in $LDFLAGS $LIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$found_dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
|
||||
fi
|
||||
if test "$acl_hardcode_minus_L" != no; then
|
||||
dnl FIXME: Not sure whether we should use
|
||||
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
|
||||
dnl here.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
|
||||
else
|
||||
dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
|
||||
dnl here, because this doesn't fit in flags passed to the
|
||||
dnl compiler. So give up. No hardcoding. This affects only
|
||||
dnl very old systems.
|
||||
dnl FIXME: Not sure whether we should use
|
||||
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
|
||||
dnl here.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test "X$found_a" != "X"; then
|
||||
dnl Linking with a static library.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
|
||||
else
|
||||
dnl We shouldn't come here, but anyway it's good to have a
|
||||
dnl fallback.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
|
||||
fi
|
||||
fi
|
||||
dnl Assume the include files are nearby.
|
||||
additional_includedir=
|
||||
case "$found_dir" in
|
||||
*/$acl_libdirstem | */$acl_libdirstem/)
|
||||
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
|
||||
LIB[]NAME[]_PREFIX="$basedir"
|
||||
additional_includedir="$basedir/include"
|
||||
;;
|
||||
esac
|
||||
if test "X$additional_includedir" != "X"; then
|
||||
dnl Potentially add $additional_includedir to $INCNAME.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/include,
|
||||
dnl 2. if it's /usr/local/include and we are using GCC on Linux,
|
||||
dnl 3. if it's already present in $CPPFLAGS or the already
|
||||
dnl constructed $INCNAME,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_includedir" != "X/usr/include"; then
|
||||
haveit=
|
||||
if test "X$additional_includedir" = "X/usr/local/include"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
for x in $CPPFLAGS $INC[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-I$additional_includedir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_includedir"; then
|
||||
dnl Really add $additional_includedir to $INCNAME.
|
||||
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
dnl Look for dependencies.
|
||||
if test -n "$found_la"; then
|
||||
dnl Read the .la file. It defines the variables
|
||||
dnl dlname, library_names, old_library, dependency_libs, current,
|
||||
dnl age, revision, installed, dlopen, dlpreopen, libdir.
|
||||
save_libdir="$libdir"
|
||||
case "$found_la" in
|
||||
*/* | *\\*) . "$found_la" ;;
|
||||
*) . "./$found_la" ;;
|
||||
esac
|
||||
libdir="$save_libdir"
|
||||
dnl We use only dependency_libs.
|
||||
for dep in $dependency_libs; do
|
||||
case "$dep" in
|
||||
-L*)
|
||||
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
|
||||
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/lib,
|
||||
dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
|
||||
dnl 3. if it's already present in $LDFLAGS or the already
|
||||
dnl constructed $LIBNAME,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
|
||||
haveit=
|
||||
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
haveit=
|
||||
for x in $LDFLAGS $LIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$additional_libdir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_libdir"; then
|
||||
dnl Really add $additional_libdir to $LIBNAME.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
|
||||
fi
|
||||
fi
|
||||
haveit=
|
||||
for x in $LDFLAGS $LTLIB[]NAME; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$additional_libdir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_libdir"; then
|
||||
dnl Really add $additional_libdir to $LTLIBNAME.
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
-R*)
|
||||
dir=`echo "X$dep" | sed -e 's/^X-R//'`
|
||||
if test "$enable_rpath" != no; then
|
||||
dnl Potentially add DIR to rpathdirs.
|
||||
dnl The rpathdirs will be appended to $LIBNAME at the end.
|
||||
haveit=
|
||||
for x in $rpathdirs; do
|
||||
if test "X$x" = "X$dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
rpathdirs="$rpathdirs $dir"
|
||||
fi
|
||||
dnl Potentially add DIR to ltrpathdirs.
|
||||
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
|
||||
haveit=
|
||||
for x in $ltrpathdirs; do
|
||||
if test "X$x" = "X$dir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
ltrpathdirs="$ltrpathdirs $dir"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
-l*)
|
||||
dnl Handle this in the next round.
|
||||
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
|
||||
;;
|
||||
*.la)
|
||||
dnl Handle this in the next round. Throw away the .la's
|
||||
dnl directory; it is already contained in a preceding -L
|
||||
dnl option.
|
||||
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
|
||||
;;
|
||||
*)
|
||||
dnl Most likely an immediate library name.
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
else
|
||||
dnl Didn't find the library; assume it is in the system directories
|
||||
dnl known to the linker and runtime loader. (All the system
|
||||
dnl directories known to the linker should also be known to the
|
||||
dnl runtime loader, otherwise the system is severely misconfigured.)
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
if test "X$rpathdirs" != "X"; then
|
||||
if test -n "$acl_hardcode_libdir_separator"; then
|
||||
dnl Weird platform: only the last -rpath option counts, the user must
|
||||
dnl pass all path elements in one option. We can arrange that for a
|
||||
dnl single library, but not when more than one $LIBNAMEs are used.
|
||||
alldirs=
|
||||
for found_dir in $rpathdirs; do
|
||||
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
|
||||
done
|
||||
dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$alldirs"
|
||||
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||
else
|
||||
dnl The -rpath options are cumulative.
|
||||
for found_dir in $rpathdirs; do
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$found_dir"
|
||||
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if test "X$ltrpathdirs" != "X"; then
|
||||
dnl When using libtool, the option that works for both libraries and
|
||||
dnl executables is -R. The -R options are cumulative.
|
||||
for found_dir in $ltrpathdirs; do
|
||||
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
|
||||
dnl unless already present in VAR.
|
||||
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
|
||||
dnl contains two or three consecutive elements that belong together.
|
||||
AC_DEFUN([AC_LIB_APPENDTOVAR],
|
||||
[
|
||||
for element in [$2]; do
|
||||
haveit=
|
||||
for x in $[$1]; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X$element"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
[$1]="${[$1]}${[$1]:+ }$element"
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
dnl For those cases where a variable contains several -L and -l options
|
||||
dnl referring to unknown libraries and directories, this macro determines the
|
||||
dnl necessary additional linker options for the runtime path.
|
||||
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
|
||||
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
|
||||
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
|
||||
dnl otherwise linking without libtool is assumed.
|
||||
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
|
||||
[
|
||||
AC_REQUIRE([AC_LIB_RPATH])
|
||||
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||
$1=
|
||||
if test "$enable_rpath" != no; then
|
||||
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
|
||||
dnl Use an explicit option to hardcode directories into the resulting
|
||||
dnl binary.
|
||||
rpathdirs=
|
||||
next=
|
||||
for opt in $2; do
|
||||
if test -n "$next"; then
|
||||
dir="$next"
|
||||
dnl No need to hardcode the standard /usr/lib.
|
||||
if test "X$dir" != "X/usr/$acl_libdirstem"; then
|
||||
rpathdirs="$rpathdirs $dir"
|
||||
fi
|
||||
next=
|
||||
else
|
||||
case $opt in
|
||||
-L) next=yes ;;
|
||||
-L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
|
||||
dnl No need to hardcode the standard /usr/lib.
|
||||
if test "X$dir" != "X/usr/$acl_libdirstem"; then
|
||||
rpathdirs="$rpathdirs $dir"
|
||||
fi
|
||||
next= ;;
|
||||
*) next= ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
if test "X$rpathdirs" != "X"; then
|
||||
if test -n ""$3""; then
|
||||
dnl libtool is used for linking. Use -R options.
|
||||
for dir in $rpathdirs; do
|
||||
$1="${$1}${$1:+ }-R$dir"
|
||||
done
|
||||
else
|
||||
dnl The linker is used for linking directly.
|
||||
if test -n "$acl_hardcode_libdir_separator"; then
|
||||
dnl Weird platform: only the last -rpath option counts, the user
|
||||
dnl must pass all path elements in one option.
|
||||
alldirs=
|
||||
for dir in $rpathdirs; do
|
||||
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
|
||||
done
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$alldirs"
|
||||
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
$1="$flag"
|
||||
else
|
||||
dnl The -rpath options are cumulative.
|
||||
for dir in $rpathdirs; do
|
||||
acl_save_libdir="$libdir"
|
||||
libdir="$dir"
|
||||
eval flag=\"$acl_hardcode_libdir_flag_spec\"
|
||||
libdir="$acl_save_libdir"
|
||||
$1="${$1}${$1:+ }$flag"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([$1])
|
||||
])
|
185
gl/m4/lib-prefix.m4
Normal file
185
gl/m4/lib-prefix.m4
Normal file
|
@ -0,0 +1,185 @@
|
|||
# lib-prefix.m4 serial 5 (gettext-0.15)
|
||||
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
|
||||
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
|
||||
dnl require excessive bracketing.
|
||||
ifdef([AC_HELP_STRING],
|
||||
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
|
||||
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
|
||||
|
||||
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
|
||||
dnl to access previously installed libraries. The basic assumption is that
|
||||
dnl a user will want packages to use other packages he previously installed
|
||||
dnl with the same --prefix option.
|
||||
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
|
||||
dnl libraries, but is otherwise very convenient.
|
||||
AC_DEFUN([AC_LIB_PREFIX],
|
||||
[
|
||||
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
|
||||
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
|
||||
dnl By default, look in $includedir and $libdir.
|
||||
use_additional=yes
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
AC_LIB_ARG_WITH([lib-prefix],
|
||||
[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
|
||||
--without-lib-prefix don't search for libraries in includedir and libdir],
|
||||
[
|
||||
if test "X$withval" = "Xno"; then
|
||||
use_additional=no
|
||||
else
|
||||
if test "X$withval" = "X"; then
|
||||
AC_LIB_WITH_FINAL_PREFIX([
|
||||
eval additional_includedir=\"$includedir\"
|
||||
eval additional_libdir=\"$libdir\"
|
||||
])
|
||||
else
|
||||
additional_includedir="$withval/include"
|
||||
additional_libdir="$withval/$acl_libdirstem"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
if test $use_additional = yes; then
|
||||
dnl Potentially add $additional_includedir to $CPPFLAGS.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/include,
|
||||
dnl 2. if it's already present in $CPPFLAGS,
|
||||
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_includedir" != "X/usr/include"; then
|
||||
haveit=
|
||||
for x in $CPPFLAGS; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-I$additional_includedir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test "X$additional_includedir" = "X/usr/local/include"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_includedir"; then
|
||||
dnl Really add $additional_includedir to $CPPFLAGS.
|
||||
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
dnl Potentially add $additional_libdir to $LDFLAGS.
|
||||
dnl But don't add it
|
||||
dnl 1. if it's the standard /usr/lib,
|
||||
dnl 2. if it's already present in $LDFLAGS,
|
||||
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
|
||||
dnl 4. if it doesn't exist as a directory.
|
||||
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
|
||||
haveit=
|
||||
for x in $LDFLAGS; do
|
||||
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
|
||||
if test "X$x" = "X-L$additional_libdir"; then
|
||||
haveit=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$haveit"; then
|
||||
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
|
||||
if test -n "$GCC"; then
|
||||
case $host_os in
|
||||
linux*) haveit=yes;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test -z "$haveit"; then
|
||||
if test -d "$additional_libdir"; then
|
||||
dnl Really add $additional_libdir to $LDFLAGS.
|
||||
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
|
||||
dnl acl_final_exec_prefix, containing the values to which $prefix and
|
||||
dnl $exec_prefix will expand at the end of the configure script.
|
||||
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
|
||||
[
|
||||
dnl Unfortunately, prefix and exec_prefix get only finally determined
|
||||
dnl at the end of configure.
|
||||
if test "X$prefix" = "XNONE"; then
|
||||
acl_final_prefix="$ac_default_prefix"
|
||||
else
|
||||
acl_final_prefix="$prefix"
|
||||
fi
|
||||
if test "X$exec_prefix" = "XNONE"; then
|
||||
acl_final_exec_prefix='${prefix}'
|
||||
else
|
||||
acl_final_exec_prefix="$exec_prefix"
|
||||
fi
|
||||
acl_save_prefix="$prefix"
|
||||
prefix="$acl_final_prefix"
|
||||
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
|
||||
prefix="$acl_save_prefix"
|
||||
])
|
||||
|
||||
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
|
||||
dnl variables prefix and exec_prefix bound to the values they will have
|
||||
dnl at the end of the configure script.
|
||||
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
|
||||
[
|
||||
acl_save_prefix="$prefix"
|
||||
prefix="$acl_final_prefix"
|
||||
acl_save_exec_prefix="$exec_prefix"
|
||||
exec_prefix="$acl_final_exec_prefix"
|
||||
$1
|
||||
exec_prefix="$acl_save_exec_prefix"
|
||||
prefix="$acl_save_prefix"
|
||||
])
|
||||
|
||||
dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
|
||||
dnl the basename of the libdir, either "lib" or "lib64".
|
||||
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
|
||||
[
|
||||
dnl There is no formal standard regarding lib and lib64. The current
|
||||
dnl practice is that on a system supporting 32-bit and 64-bit instruction
|
||||
dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
|
||||
dnl libraries go under $prefix/lib. We determine the compiler's default
|
||||
dnl mode by looking at the compiler's library search path. If at least
|
||||
dnl of its elements ends in /lib64 or points to a directory whose absolute
|
||||
dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
|
||||
dnl default, namely "lib".
|
||||
acl_libdirstem=lib
|
||||
searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
|
||||
if test -n "$searchpath"; then
|
||||
acl_save_IFS="${IFS= }"; IFS=":"
|
||||
for searchdir in $searchpath; do
|
||||
if test -d "$searchdir"; then
|
||||
case "$searchdir" in
|
||||
*/lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
|
||||
*) searchdir=`cd "$searchdir" && pwd`
|
||||
case "$searchdir" in
|
||||
*/lib64 ) acl_libdirstem=lib64 ;;
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
IFS="$acl_save_IFS"
|
||||
fi
|
||||
])
|
311
gl/m4/lock.m4
Normal file
311
gl/m4/lock.m4
Normal file
|
@ -0,0 +1,311 @@
|
|||
# lock.m4 serial 6 (gettext-0.16)
|
||||
dnl Copyright (C) 2005-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
dnl Tests for a multithreading library to be used.
|
||||
dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
|
||||
dnl USE_PTH_THREADS, USE_WIN32_THREADS
|
||||
dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
|
||||
dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
|
||||
dnl libtool).
|
||||
dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
|
||||
dnl programs that really need multithread functionality. The difference
|
||||
dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
|
||||
dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread".
|
||||
dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
|
||||
dnl multithread-safe programs.
|
||||
|
||||
AC_DEFUN([gl_LOCK_EARLY],
|
||||
[
|
||||
AC_REQUIRE([gl_LOCK_EARLY_BODY])
|
||||
])
|
||||
|
||||
dnl The guts of gl_LOCK_EARLY. Needs to be expanded only once.
|
||||
|
||||
AC_DEFUN([gl_LOCK_EARLY_BODY],
|
||||
[
|
||||
dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
|
||||
dnl influences the result of the autoconf tests that test for *_unlocked
|
||||
dnl declarations, on AIX 5 at least. Therefore it must come early.
|
||||
AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl
|
||||
AC_BEFORE([$0], [gl_ARGP])dnl
|
||||
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
|
||||
dnl Check for multithreading.
|
||||
AC_ARG_ENABLE(threads,
|
||||
AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
|
||||
AC_HELP_STRING([--disable-threads], [build without multithread safety]),
|
||||
[gl_use_threads=$enableval],
|
||||
[case "$host_os" in
|
||||
dnl Disable multithreading by default on OSF/1, because it interferes
|
||||
dnl with fork()/exec(): When msgexec is linked with -lpthread, its child
|
||||
dnl process gets an endless segmentation fault inside execvp().
|
||||
osf*) gl_use_threads=no ;;
|
||||
*) gl_use_threads=yes ;;
|
||||
esac
|
||||
])
|
||||
if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
|
||||
# For using <pthread.h>:
|
||||
case "$host_os" in
|
||||
osf*)
|
||||
# On OSF/1, the compiler needs the flag -D_REENTRANT so that it
|
||||
# groks <pthread.h>. cc also understands the flag -pthread, but
|
||||
# we don't use it because 1. gcc-2.95 doesn't understand -pthread,
|
||||
# 2. putting a flag into CPPFLAGS that has an effect on the linker
|
||||
# causes the AC_TRY_LINK test below to succeed unexpectedly,
|
||||
# leading to wrong values of LIBTHREAD and LTLIBTHREAD.
|
||||
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
|
||||
;;
|
||||
esac
|
||||
# Some systems optimize for single-threaded programs by default, and
|
||||
# need special flags to disable these optimizations. For example, the
|
||||
# definition of 'errno' in <errno.h>.
|
||||
case "$host_os" in
|
||||
aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
|
||||
solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
dnl The guts of gl_LOCK. Needs to be expanded only once.
|
||||
|
||||
AC_DEFUN([gl_LOCK_BODY],
|
||||
[
|
||||
AC_REQUIRE([gl_LOCK_EARLY_BODY])
|
||||
gl_threads_api=none
|
||||
LIBTHREAD=
|
||||
LTLIBTHREAD=
|
||||
LIBMULTITHREAD=
|
||||
LTLIBMULTITHREAD=
|
||||
if test "$gl_use_threads" != no; then
|
||||
dnl Check whether the compiler and linker support weak declarations.
|
||||
AC_MSG_CHECKING([whether imported symbols can be declared weak])
|
||||
gl_have_weak=no
|
||||
AC_TRY_LINK([extern void xyzzy ();
|
||||
#pragma weak xyzzy], [xyzzy();], [gl_have_weak=yes])
|
||||
AC_MSG_RESULT([$gl_have_weak])
|
||||
if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
|
||||
# On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
|
||||
# it groks <pthread.h>. It's added above, in gl_LOCK_EARLY_BODY.
|
||||
AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no)
|
||||
if test "$gl_have_pthread_h" = yes; then
|
||||
# Other possible tests:
|
||||
# -lpthreads (FSU threads, PCthreads)
|
||||
# -lgthreads
|
||||
gl_have_pthread=
|
||||
# Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
|
||||
# in libc. IRIX 6.5 has the first one in both libc and libpthread, but
|
||||
# the second one only in libpthread, and lock.c needs it.
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_mutex_lock((pthread_mutex_t*)0);
|
||||
pthread_mutexattr_init((pthread_mutexattr_t*)0);],
|
||||
[gl_have_pthread=yes])
|
||||
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
|
||||
# since it is defined as a macro on OSF/1.)
|
||||
if test -n "$gl_have_pthread"; then
|
||||
# The program links fine without libpthread. But it may actually
|
||||
# need to link with libpthread in order to create multiple threads.
|
||||
AC_CHECK_LIB(pthread, pthread_kill,
|
||||
[LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
|
||||
# On Solaris and HP-UX, most pthread functions exist also in libc.
|
||||
# Therefore pthread_in_use() needs to actually try to create a
|
||||
# thread: pthread_create from libc will fail, whereas
|
||||
# pthread_create will actually create a thread.
|
||||
case "$host_os" in
|
||||
solaris* | hpux*)
|
||||
AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], 1,
|
||||
[Define if the pthread_in_use() detection is hard.])
|
||||
esac
|
||||
])
|
||||
else
|
||||
# Some library is needed. Try libpthread and libc_r.
|
||||
AC_CHECK_LIB(pthread, pthread_kill,
|
||||
[gl_have_pthread=yes
|
||||
LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread
|
||||
LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread])
|
||||
if test -z "$gl_have_pthread"; then
|
||||
# For FreeBSD 4.
|
||||
AC_CHECK_LIB(c_r, pthread_kill,
|
||||
[gl_have_pthread=yes
|
||||
LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r
|
||||
LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r])
|
||||
fi
|
||||
fi
|
||||
if test -n "$gl_have_pthread"; then
|
||||
gl_threads_api=posix
|
||||
AC_DEFINE([USE_POSIX_THREADS], 1,
|
||||
[Define if the POSIX multithreading library can be used.])
|
||||
if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
|
||||
if test $gl_have_weak = yes; then
|
||||
AC_DEFINE([USE_POSIX_THREADS_WEAK], 1,
|
||||
[Define if references to the POSIX multithreading library should be made weak.])
|
||||
LIBTHREAD=
|
||||
LTLIBTHREAD=
|
||||
fi
|
||||
fi
|
||||
# OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the
|
||||
# pthread_rwlock_* functions.
|
||||
AC_CHECK_TYPE([pthread_rwlock_t],
|
||||
[AC_DEFINE([HAVE_PTHREAD_RWLOCK], 1,
|
||||
[Define if the POSIX multithreading library has read/write locks.])],
|
||||
[],
|
||||
[#include <pthread.h>])
|
||||
# glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
|
||||
AC_TRY_COMPILE([#include <pthread.h>],
|
||||
[#if __FreeBSD__ == 4
|
||||
error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
|
||||
#else
|
||||
int x = (int)PTHREAD_MUTEX_RECURSIVE;
|
||||
return !x;
|
||||
#endif],
|
||||
[AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1,
|
||||
[Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test -z "$gl_have_pthread"; then
|
||||
if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then
|
||||
gl_have_solaristhread=
|
||||
gl_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lthread"
|
||||
AC_TRY_LINK([#include <thread.h>
|
||||
#include <synch.h>],
|
||||
[thr_self();],
|
||||
[gl_have_solaristhread=yes])
|
||||
LIBS="$gl_save_LIBS"
|
||||
if test -n "$gl_have_solaristhread"; then
|
||||
gl_threads_api=solaris
|
||||
LIBTHREAD=-lthread
|
||||
LTLIBTHREAD=-lthread
|
||||
LIBMULTITHREAD="$LIBTHREAD"
|
||||
LTLIBMULTITHREAD="$LTLIBTHREAD"
|
||||
AC_DEFINE([USE_SOLARIS_THREADS], 1,
|
||||
[Define if the old Solaris multithreading library can be used.])
|
||||
if test $gl_have_weak = yes; then
|
||||
AC_DEFINE([USE_SOLARIS_THREADS_WEAK], 1,
|
||||
[Define if references to the old Solaris multithreading library should be made weak.])
|
||||
LIBTHREAD=
|
||||
LTLIBTHREAD=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$gl_use_threads" = pth; then
|
||||
gl_save_CPPFLAGS="$CPPFLAGS"
|
||||
AC_LIB_LINKFLAGS(pth)
|
||||
gl_have_pth=
|
||||
gl_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lpth"
|
||||
AC_TRY_LINK([#include <pth.h>], [pth_self();], gl_have_pth=yes)
|
||||
LIBS="$gl_save_LIBS"
|
||||
if test -n "$gl_have_pth"; then
|
||||
gl_threads_api=pth
|
||||
LIBTHREAD="$LIBPTH"
|
||||
LTLIBTHREAD="$LTLIBPTH"
|
||||
LIBMULTITHREAD="$LIBTHREAD"
|
||||
LTLIBMULTITHREAD="$LTLIBTHREAD"
|
||||
AC_DEFINE([USE_PTH_THREADS], 1,
|
||||
[Define if the GNU Pth multithreading library can be used.])
|
||||
if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
|
||||
if test $gl_have_weak = yes; then
|
||||
AC_DEFINE([USE_PTH_THREADS_WEAK], 1,
|
||||
[Define if references to the GNU Pth multithreading library should be made weak.])
|
||||
LIBTHREAD=
|
||||
LTLIBTHREAD=
|
||||
fi
|
||||
fi
|
||||
else
|
||||
CPPFLAGS="$gl_save_CPPFLAGS"
|
||||
fi
|
||||
fi
|
||||
if test -z "$gl_have_pthread"; then
|
||||
if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then
|
||||
if { case "$host_os" in
|
||||
mingw*) true;;
|
||||
*) false;;
|
||||
esac
|
||||
}; then
|
||||
gl_threads_api=win32
|
||||
AC_DEFINE([USE_WIN32_THREADS], 1,
|
||||
[Define if the Win32 multithreading API can be used.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING([for multithread API to use])
|
||||
AC_MSG_RESULT([$gl_threads_api])
|
||||
AC_SUBST(LIBTHREAD)
|
||||
AC_SUBST(LTLIBTHREAD)
|
||||
AC_SUBST(LIBMULTITHREAD)
|
||||
AC_SUBST(LTLIBMULTITHREAD)
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_LOCK],
|
||||
[
|
||||
AC_REQUIRE([gl_LOCK_EARLY])
|
||||
AC_REQUIRE([gl_LOCK_BODY])
|
||||
gl_PREREQ_LOCK
|
||||
])
|
||||
|
||||
# Prerequisites of lib/lock.c.
|
||||
AC_DEFUN([gl_PREREQ_LOCK], [
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
])
|
||||
|
||||
dnl Survey of platforms:
|
||||
dnl
|
||||
dnl Platform Available Compiler Supports test-lock
|
||||
dnl flavours option weak result
|
||||
dnl --------------- --------- --------- -------- ---------
|
||||
dnl Linux 2.4/glibc posix -lpthread Y OK
|
||||
dnl
|
||||
dnl GNU Hurd/glibc posix
|
||||
dnl
|
||||
dnl FreeBSD 5.3 posix -lc_r Y
|
||||
dnl posix -lkse ? Y
|
||||
dnl posix -lpthread ? Y
|
||||
dnl posix -lthr Y
|
||||
dnl
|
||||
dnl FreeBSD 5.2 posix -lc_r Y
|
||||
dnl posix -lkse Y
|
||||
dnl posix -lthr Y
|
||||
dnl
|
||||
dnl FreeBSD 4.0,4.10 posix -lc_r Y OK
|
||||
dnl
|
||||
dnl NetBSD 1.6 --
|
||||
dnl
|
||||
dnl OpenBSD 3.4 posix -lpthread Y OK
|
||||
dnl
|
||||
dnl MacOS X 10.[123] posix -lpthread Y OK
|
||||
dnl
|
||||
dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK
|
||||
dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK
|
||||
dnl
|
||||
dnl HP-UX 11 posix -lpthread N (cc) OK
|
||||
dnl Y (gcc)
|
||||
dnl
|
||||
dnl IRIX 6.5 posix -lpthread Y 0.5
|
||||
dnl
|
||||
dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
|
||||
dnl
|
||||
dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
|
||||
dnl -lpthread (gcc) Y
|
||||
dnl
|
||||
dnl Cygwin posix -lpthread Y OK
|
||||
dnl
|
||||
dnl Any of the above pth -lpth 0.0
|
||||
dnl
|
||||
dnl Mingw win32 N OK
|
||||
dnl
|
||||
dnl BeOS 5 --
|
||||
dnl
|
||||
dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
|
||||
dnl turned off:
|
||||
dnl OK if all three tests terminate OK,
|
||||
dnl 0.5 if the first test terminates OK but the second one loops endlessly,
|
||||
dnl 0.0 if the first test already loops endlessly.
|
31
gl/m4/longdouble.m4
Normal file
31
gl/m4/longdouble.m4
Normal file
|
@ -0,0 +1,31 @@
|
|||
# longdouble.m4 serial 2 (gettext-0.15)
|
||||
dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
dnl Test whether the compiler supports the 'long double' type.
|
||||
dnl Prerequisite: AC_PROG_CC
|
||||
|
||||
dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
|
||||
dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
|
||||
|
||||
AC_DEFUN([gt_TYPE_LONGDOUBLE],
|
||||
[
|
||||
AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
|
||||
[if test "$GCC" = yes; then
|
||||
gt_cv_c_long_double=yes
|
||||
else
|
||||
AC_TRY_COMPILE([
|
||||
/* The Stardent Vistra knows sizeof(long double), but does not support it. */
|
||||
long double foo = 0.0;
|
||||
/* On Ultrix 4.3 cc, long double is 4 and double is 8. */
|
||||
int array [2*(sizeof(long double) >= sizeof(double)) - 1];
|
||||
], ,
|
||||
gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
|
||||
fi])
|
||||
if test $gt_cv_c_long_double = yes; then
|
||||
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
|
||||
fi
|
||||
])
|
72
gl/m4/longlong.m4
Normal file
72
gl/m4/longlong.m4
Normal file
|
@ -0,0 +1,72 @@
|
|||
# longlong.m4 serial 10
|
||||
dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert.
|
||||
|
||||
# Define HAVE_LONG_LONG_INT if 'long long int' works.
|
||||
# This fixes a bug in Autoconf 2.60, but can be removed once we
|
||||
# assume 2.61 everywhere.
|
||||
|
||||
# Note: If the type 'long long int' exists but is only 32 bits large
|
||||
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
|
||||
# defined. In this case you can treat 'long long int' like 'long int'.
|
||||
|
||||
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
|
||||
[
|
||||
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
|
||||
[AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[long long int ll = 9223372036854775807ll;
|
||||
long long int nll = -9223372036854775807LL;
|
||||
typedef int a[((-9223372036854775807LL < 0
|
||||
&& 0 < 9223372036854775807ll)
|
||||
? 1 : -1)];
|
||||
int i = 63;]],
|
||||
[[long long int llmax = 9223372036854775807ll;
|
||||
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
|
||||
| (llmax / ll) | (llmax % ll));]])],
|
||||
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
|
||||
dnl If cross compiling, assume the bug isn't important, since
|
||||
dnl nobody cross compiles for this platform as far as we know.
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[@%:@include <limits.h>
|
||||
@%:@ifndef LLONG_MAX
|
||||
@%:@ define HALF \
|
||||
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
|
||||
@%:@ define LLONG_MAX (HALF - 1 + HALF)
|
||||
@%:@endif]],
|
||||
[[long long int n = 1;
|
||||
int i;
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
long long int m = n << i;
|
||||
if (m >> i != n)
|
||||
return 1;
|
||||
if (LLONG_MAX / 2 < m)
|
||||
break;
|
||||
}
|
||||
return 0;]])],
|
||||
[ac_cv_type_long_long_int=yes],
|
||||
[ac_cv_type_long_long_int=no],
|
||||
[ac_cv_type_long_long_int=yes])],
|
||||
[ac_cv_type_long_long_int=no])])
|
||||
if test $ac_cv_type_long_long_int = yes; then
|
||||
AC_DEFINE([HAVE_LONG_LONG_INT], 1,
|
||||
[Define to 1 if the system has the type `long long int'.])
|
||||
fi
|
||||
])
|
||||
|
||||
# This macro is obsolescent and should go away soon.
|
||||
AC_DEFUN([gl_AC_TYPE_LONG_LONG],
|
||||
[
|
||||
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
||||
ac_cv_type_long_long=$ac_cv_type_long_long_int
|
||||
if test $ac_cv_type_long_long = yes; then
|
||||
AC_DEFINE(HAVE_LONG_LONG, 1,
|
||||
[Define if you have the 'long long' type.])
|
||||
fi
|
||||
])
|
337
gl/m4/ls-mntd-fs.m4
Normal file
337
gl/m4/ls-mntd-fs.m4
Normal file
|
@ -0,0 +1,337 @@
|
|||
#serial 26
|
||||
# How to list mounted file systems.
|
||||
|
||||
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
|
||||
# Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Jim Meyering.
|
||||
dnl
|
||||
dnl This is not pretty. I've just taken the autoconf code and wrapped
|
||||
dnl it in an AC_DEFUN and made some other fixes.
|
||||
dnl
|
||||
|
||||
# Replace Autoconf's AC_FUNC_GETMNTENT to work around a bug in Autoconf
|
||||
# through Autoconf 2.59. We can remove this once we assume Autoconf 2.60
|
||||
# or later.
|
||||
AC_DEFUN([AC_FUNC_GETMNTENT],
|
||||
[# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4,
|
||||
# -lseq on Dynix/PTX, -lgen on Unixware.
|
||||
AC_SEARCH_LIBS(getmntent, [sun seq gen])
|
||||
AC_CHECK_FUNCS(getmntent)
|
||||
])
|
||||
|
||||
# gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS],
|
||||
[
|
||||
AC_CHECK_FUNCS(listmntent getmntinfo)
|
||||
AC_CHECK_HEADERS_ONCE(sys/param.h sys/statvfs.h)
|
||||
|
||||
# We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses
|
||||
# NGROUPS (as the array dimension for a struct member) without a definition.
|
||||
AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>])
|
||||
|
||||
AC_CHECK_HEADERS(sys/mount.h, [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif]])
|
||||
|
||||
AC_CHECK_HEADERS(mntent.h sys/fs_types.h)
|
||||
getfsstat_includes="\
|
||||
$ac_includes_default
|
||||
#if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
|
||||
#endif
|
||||
#if HAVE_SYS_UCRED_H
|
||||
# include <grp.h> /* needed for definition of NGROUPS */
|
||||
# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
|
||||
#endif
|
||||
#if HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FS_TYPES_H
|
||||
# include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
|
||||
#endif
|
||||
"
|
||||
AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
|
||||
|
||||
# Determine how to get the list of mounted file systems.
|
||||
ac_list_mounted_fs=
|
||||
|
||||
# If the getmntent function is available but not in the standard library,
|
||||
# make sure LIBS contains the appropriate -l option.
|
||||
AC_FUNC_GETMNTENT
|
||||
|
||||
# This test must precede the ones for getmntent because Unicos-9 is
|
||||
# reported to have the getmntent function, but its support is incompatible
|
||||
# with other getmntent implementations.
|
||||
|
||||
# NOTE: Normally, I wouldn't use a check for system type as I've done for
|
||||
# `CRAY' below since that goes against the whole autoconf philosophy. But
|
||||
# I think there is too great a chance that some non-Cray system has a
|
||||
# function named listmntent to risk the false positive.
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# Cray UNICOS 9
|
||||
AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
|
||||
[fu_cv_sys_mounted_cray_listmntent=no
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef _CRAY
|
||||
yes
|
||||
#endif
|
||||
], [test $ac_cv_func_listmntent = yes \
|
||||
&& fu_cv_sys_mounted_cray_listmntent=yes]
|
||||
)
|
||||
]
|
||||
)
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
|
||||
if test $fu_cv_sys_mounted_cray_listmntent = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_LISTMNTENT, 1,
|
||||
[Define if there is a function named listmntent that can be used to
|
||||
list all mounted file systems. (UNICOS)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# AIX.
|
||||
AC_MSG_CHECKING([for mntctl function and struct vmount])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
|
||||
[AC_TRY_CPP([#include <fshelp.h>],
|
||||
fu_cv_sys_mounted_vmount=yes,
|
||||
fu_cv_sys_mounted_vmount=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
|
||||
if test $fu_cv_sys_mounted_vmount = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_VMOUNT, 1,
|
||||
[Define if there is a function named mntctl that can be used to read
|
||||
the list of mounted file systems, and there is a system header file
|
||||
that declares `struct vmount.' (AIX)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_cv_func_getmntent = yes; then
|
||||
|
||||
# This system has the getmntent function.
|
||||
# Determine whether it's the one-argument variant or the two-argument one.
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# 4.3BSD, SunOS, HP-UX, Dynix, Irix
|
||||
AC_MSG_CHECKING([for one-argument getmntent function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
|
||||
[AC_TRY_COMPILE([
|
||||
/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mntent.h>
|
||||
#if !defined MOUNTED
|
||||
# if defined _PATH_MOUNTED /* GNU libc */
|
||||
# define MOUNTED _PATH_MOUNTED
|
||||
# endif
|
||||
# if defined MNT_MNTTAB /* HP-UX. */
|
||||
# define MOUNTED MNT_MNTTAB
|
||||
# endif
|
||||
# if defined MNTTABNAME /* Dynix. */
|
||||
# define MOUNTED MNTTABNAME
|
||||
# endif
|
||||
#endif
|
||||
],
|
||||
[ struct mntent *mnt = 0; char *table = MOUNTED;
|
||||
if (sizeof mnt && sizeof table) return 0;],
|
||||
fu_cv_sys_mounted_getmntent1=yes,
|
||||
fu_cv_sys_mounted_getmntent1=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
|
||||
if test $fu_cv_sys_mounted_getmntent1 = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTENT1, 1,
|
||||
[Define if there is a function named getmntent for reading the list
|
||||
of mounted file systems, and that function takes a single argument.
|
||||
(4.3BSD, SunOS, HP-UX, Dynix, Irix)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# SVR4
|
||||
AC_MSG_CHECKING([for two-argument getmntent function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
|
||||
[AC_EGREP_HEADER(getmntent, sys/mnttab.h,
|
||||
fu_cv_sys_mounted_getmntent2=yes,
|
||||
fu_cv_sys_mounted_getmntent2=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
|
||||
if test $fu_cv_sys_mounted_getmntent2 = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTENT2, 1,
|
||||
[Define if there is a function named getmntent for reading the list of
|
||||
mounted file systems, and that function takes two arguments. (SVR4)])
|
||||
AC_CHECK_FUNCS(hasmntopt)
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# DEC Alpha running OSF/1, and Apple Darwin 1.3.
|
||||
# powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
|
||||
|
||||
AC_MSG_CHECKING([for getfsstat function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat,
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
|
||||
# define FS_TYPE(Ent) ((Ent).f_fstypename)
|
||||
#else
|
||||
# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
|
||||
#endif
|
||||
]$getfsstat_includes
|
||||
,
|
||||
[struct statfs *stats;
|
||||
int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
|
||||
char *t = FS_TYPE (*stats); ],
|
||||
fu_cv_sys_mounted_getfsstat=yes,
|
||||
fu_cv_sys_mounted_getfsstat=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat)
|
||||
if test $fu_cv_sys_mounted_getfsstat = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETFSSTAT, 1,
|
||||
[Define if there is a function named getfsstat for reading the
|
||||
list of mounted file systems. (DEC Alpha running OSF/1)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# SVR3
|
||||
AC_MSG_CHECKING([for FIXME existence of three headers])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
|
||||
[AC_TRY_CPP([
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/fstyp.h>
|
||||
#include <mnttab.h>],
|
||||
fu_cv_sys_mounted_fread_fstyp=yes,
|
||||
fu_cv_sys_mounted_fread_fstyp=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
|
||||
if test $fu_cv_sys_mounted_fread_fstyp = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
|
||||
[Define if (like SVR2) there is no specific function for reading the
|
||||
list of mounted file systems, and your system has these header files:
|
||||
<sys/fstyp.h> and <sys/statfs.h>. (SVR3)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# 4.4BSD and DEC OSF/1.
|
||||
AC_MSG_CHECKING([for getmntinfo function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
|
||||
[
|
||||
test "$ac_cv_func_getmntinfo" = yes \
|
||||
&& fu_cv_sys_mounted_getmntinfo=yes \
|
||||
|| fu_cv_sys_mounted_getmntinfo=no
|
||||
])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
|
||||
if test $fu_cv_sys_mounted_getmntinfo = yes; then
|
||||
AC_MSG_CHECKING([whether getmntinfo returns statvfs structures])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo2,
|
||||
[
|
||||
AC_TRY_COMPILE([
|
||||
#if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#if HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
#if HAVE_SYS_STATVFS_H
|
||||
# include <sys/statvfs.h>
|
||||
#endif
|
||||
extern int getmntinfo (struct statfs **, int);
|
||||
], [],
|
||||
[fu_cv_sys_mounted_getmntinfo2=no],
|
||||
[fu_cv_sys_mounted_getmntinfo2=yes])
|
||||
])
|
||||
AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo2])
|
||||
if test $fu_cv_sys_mounted_getmntinfo2 = no; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTINFO, 1,
|
||||
[Define if there is a function named getmntinfo for reading the
|
||||
list of mounted file systems and it returns an array of
|
||||
'struct statfs'. (4.4BSD, Darwin)])
|
||||
else
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTINFO2, 1,
|
||||
[Define if there is a function named getmntinfo for reading the
|
||||
list of mounted file systems and it returns an array of
|
||||
'struct statvfs'. (NetBSD 3.0)])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# Ultrix
|
||||
AC_MSG_CHECKING([for getmnt function])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
|
||||
[AC_TRY_CPP([
|
||||
#include <sys/fs_types.h>
|
||||
#include <sys/mount.h>],
|
||||
fu_cv_sys_mounted_getmnt=yes,
|
||||
fu_cv_sys_mounted_getmnt=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
|
||||
if test $fu_cv_sys_mounted_getmnt = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNT, 1,
|
||||
[Define if there is a function named getmnt for reading the list of
|
||||
mounted file systems. (Ultrix)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# BeOS
|
||||
AC_CHECK_FUNCS(next_dev fs_stat_dev)
|
||||
AC_CHECK_HEADERS(fs_info.h)
|
||||
AC_MSG_CHECKING([for BEOS mounted file system support functions])
|
||||
if test $ac_cv_header_fs_info_h = yes \
|
||||
&& test $ac_cv_func_next_dev = yes \
|
||||
&& test $ac_cv_func_fs_stat_dev = yes; then
|
||||
fu_result=yes
|
||||
else
|
||||
fu_result=no
|
||||
fi
|
||||
AC_MSG_RESULT($fu_result)
|
||||
if test $fu_result = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
|
||||
[Define if there are functions named next_dev and fs_stat_dev for
|
||||
reading the list of mounted file systems. (BeOS)])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
# SVR2
|
||||
AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_fread,
|
||||
[AC_TRY_CPP([#include <mnttab.h>],
|
||||
fu_cv_sys_mounted_fread=yes,
|
||||
fu_cv_sys_mounted_fread=no)])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_fread)
|
||||
if test $fu_cv_sys_mounted_fread = yes; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_FREAD, 1,
|
||||
[Define if there is no specific function for reading the list of
|
||||
mounted file systems. fread will be used to read /etc/mnttab.
|
||||
(SVR2) ])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ac_list_mounted_fs"; then
|
||||
AC_MSG_ERROR([could not determine how to read list of mounted file systems])
|
||||
# FIXME -- no need to abort building the whole package
|
||||
# Can't build mountlist.c or anything that needs its functions
|
||||
fi
|
||||
|
||||
AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
|
||||
|
||||
])
|
14
gl/m4/mbchar.m4
Normal file
14
gl/m4/mbchar.m4
Normal file
|
@ -0,0 +1,14 @@
|
|||
# mbchar.m4 serial 5
|
||||
dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl autoconf tests required for use of mbchar.m4
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_MBCHAR],
|
||||
[
|
||||
AC_REQUIRE([AC_GNU_SOURCE])
|
||||
AC_LIBOBJ([mbchar])
|
||||
])
|
17
gl/m4/mbiter.m4
Normal file
17
gl/m4/mbiter.m4
Normal file
|
@ -0,0 +1,17 @@
|
|||
# mbiter.m4 serial 2
|
||||
dnl Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl autoconf tests required for use of mbiter.h
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_MBITER],
|
||||
[
|
||||
AC_REQUIRE([AC_TYPE_MBSTATE_T])
|
||||
dnl The following line is that so the user can test HAVE_MBRTOWC before
|
||||
dnl #include "mbiter.h" or "mbuiter.h".
|
||||
AC_REQUIRE([gl_FUNC_MBRTOWC])
|
||||
:
|
||||
])
|
31
gl/m4/mbrtowc.m4
Normal file
31
gl/m4/mbrtowc.m4
Normal file
|
@ -0,0 +1,31 @@
|
|||
# mbrtowc.m4 serial 8
|
||||
dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert
|
||||
|
||||
dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with
|
||||
dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere.
|
||||
|
||||
AC_DEFUN([gl_FUNC_MBRTOWC],
|
||||
[
|
||||
dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
|
||||
AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
|
||||
gl_cv_func_mbrtowc,
|
||||
[AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <wchar.h>]],
|
||||
[[wchar_t wc;
|
||||
char const s[] = "";
|
||||
size_t n = 1;
|
||||
mbstate_t state;
|
||||
return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
|
||||
gl_cv_func_mbrtowc=yes,
|
||||
gl_cv_func_mbrtowc=no)])
|
||||
if test $gl_cv_func_mbrtowc = yes; then
|
||||
AC_DEFINE([HAVE_MBRTOWC], 1,
|
||||
[Define to 1 if mbrtowc and mbstate_t are properly declared.])
|
||||
fi
|
||||
])
|
18
gl/m4/memchr.m4
Normal file
18
gl/m4/memchr.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
# memchr.m4 serial 4
|
||||
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_MEMCHR],
|
||||
[
|
||||
AC_REPLACE_FUNCS(memchr)
|
||||
if test $ac_cv_func_memchr = no; then
|
||||
gl_PREREQ_MEMCHR
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/memchr.c.
|
||||
AC_DEFUN([gl_PREREQ_MEMCHR], [
|
||||
AC_CHECK_HEADERS(bp-sym.h)
|
||||
])
|
41
gl/m4/minmax.m4
Normal file
41
gl/m4/minmax.m4
Normal file
|
@ -0,0 +1,41 @@
|
|||
# minmax.m4 serial 2
|
||||
dnl Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_PREREQ(2.52)
|
||||
|
||||
AC_DEFUN([gl_MINMAX],
|
||||
[
|
||||
AC_REQUIRE([gl_PREREQ_MINMAX])
|
||||
])
|
||||
|
||||
# Prerequisites of lib/minmax.h.
|
||||
AC_DEFUN([gl_PREREQ_MINMAX],
|
||||
[
|
||||
gl_MINMAX_IN_HEADER([limits.h])
|
||||
gl_MINMAX_IN_HEADER([sys/param.h])
|
||||
])
|
||||
|
||||
dnl gl_MINMAX_IN_HEADER(HEADER)
|
||||
dnl The parameter has to be a literal header name; it cannot be macro,
|
||||
dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
|
||||
dnl invocations with a literal macro name.)
|
||||
AC_DEFUN([gl_MINMAX_IN_HEADER],
|
||||
[
|
||||
m4_pushdef([header], AS_TR_SH([$1]))
|
||||
m4_pushdef([HEADER], AS_TR_CPP([$1]))
|
||||
AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
|
||||
[gl_cv_minmax_in_]header,
|
||||
[AC_TRY_COMPILE([#include <$1>
|
||||
int x = MIN (42, 17);], [],
|
||||
[gl_cv_minmax_in_]header[=yes],
|
||||
[gl_cv_minmax_in_]header[=no])])
|
||||
if test $gl_cv_minmax_in_[]header = yes; then
|
||||
AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
|
||||
[Define to 1 if <$1> defines the MIN and MAX macros.])
|
||||
fi
|
||||
m4_popdef([HEADER])
|
||||
m4_popdef([header])
|
||||
])
|
23
gl/m4/mountlist.m4
Normal file
23
gl/m4/mountlist.m4
Normal file
|
@ -0,0 +1,23 @@
|
|||
#serial 9
|
||||
dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_MOUNTLIST],
|
||||
[
|
||||
gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes],
|
||||
[gl_cv_list_mounted_fs=no])
|
||||
if test $gl_cv_list_mounted_fs = yes; then
|
||||
AC_LIBOBJ(mountlist)
|
||||
gl_PREREQ_MOUNTLIST_EXTRA
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILE_SYSTEMS.
|
||||
AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
|
||||
[
|
||||
dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h.
|
||||
AC_CHECK_HEADERS(sys/mntent.h)
|
||||
gl_FSTYPENAME
|
||||
])
|
18
gl/m4/netinet_in_h.m4
Normal file
18
gl/m4/netinet_in_h.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
# netinet_in_h.m4 serial 1
|
||||
dnl Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Written by Simon Josefsson
|
||||
|
||||
AC_DEFUN([gl_HEADER_NETINET_IN],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE([netinet/in.h])
|
||||
if test $ac_cv_header_netinet_in_h = yes; then
|
||||
NETINET_IN_H=''
|
||||
else
|
||||
NETINET_IN_H='netinet/in.h'
|
||||
fi
|
||||
AC_SUBST(NETINET_IN_H)
|
||||
])
|
31
gl/m4/nls.m4
Normal file
31
gl/m4/nls.m4
Normal file
|
@ -0,0 +1,31 @@
|
|||
# nls.m4 serial 3 (gettext-0.15)
|
||||
dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
dnl
|
||||
dnl This file can can be used in projects which are not available under
|
||||
dnl the GNU General Public License or the GNU Library General Public
|
||||
dnl License but which still want to provide support for the GNU gettext
|
||||
dnl functionality.
|
||||
dnl Please note that the actual code of the GNU gettext library is covered
|
||||
dnl by the GNU Library General Public License, and the rest of the GNU
|
||||
dnl gettext package package is covered by the GNU General Public License.
|
||||
dnl They are *not* in the public domain.
|
||||
|
||||
dnl Authors:
|
||||
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
|
||||
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
AC_DEFUN([AM_NLS],
|
||||
[
|
||||
AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
])
|
86
gl/m4/onceonly_2_57.m4
Normal file
86
gl/m4/onceonly_2_57.m4
Normal file
|
@ -0,0 +1,86 @@
|
|||
# onceonly_2_57.m4 serial 4
|
||||
dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
dnl Public License, this file may be distributed as part of a program
|
||||
dnl that contains a configuration script generated by Autoconf, under
|
||||
dnl the same distribution terms as the rest of that program.
|
||||
|
||||
dnl This file defines some "once only" variants of standard autoconf macros.
|
||||
dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
|
||||
dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
|
||||
dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
|
||||
dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
|
||||
dnl The advantage is that the check for each of the headers/functions/decls
|
||||
dnl will be put only once into the 'configure' file. It keeps the size of
|
||||
dnl the 'configure' file down, and avoids redundant output when 'configure'
|
||||
dnl is run.
|
||||
dnl The drawback is that the checks cannot be conditionalized. If you write
|
||||
dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
|
||||
dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
|
||||
dnl empty, and the check will be inserted before the body of the AC_DEFUNed
|
||||
dnl function.
|
||||
|
||||
dnl This is like onceonly.m4, except that it uses diversions to named sections
|
||||
dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
|
||||
dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
|
||||
dnl size reduction is ca. 9%.
|
||||
|
||||
dnl Autoconf version 2.57 or newer is recommended.
|
||||
AC_PREREQ(2.57)
|
||||
|
||||
# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
|
||||
# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
|
||||
AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
|
||||
:
|
||||
AC_FOREACH([gl_HEADER_NAME], [$1], [
|
||||
AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
|
||||
[./-], [___])), [
|
||||
m4_divert_text([INIT_PREPARE],
|
||||
[gl_header_list="$gl_header_list gl_HEADER_NAME"])
|
||||
gl_HEADERS_EXPANSION
|
||||
AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
|
||||
[Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
|
||||
])
|
||||
AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
|
||||
[./-], [___])))
|
||||
])
|
||||
])
|
||||
m4_define([gl_HEADERS_EXPANSION], [
|
||||
m4_divert_text([DEFAULTS], [gl_header_list=])
|
||||
AC_CHECK_HEADERS([$gl_header_list])
|
||||
m4_define([gl_HEADERS_EXPANSION], [])
|
||||
])
|
||||
|
||||
# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
|
||||
# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
|
||||
AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
|
||||
:
|
||||
AC_FOREACH([gl_FUNC_NAME], [$1], [
|
||||
AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
|
||||
m4_divert_text([INIT_PREPARE],
|
||||
[gl_func_list="$gl_func_list gl_FUNC_NAME"])
|
||||
gl_FUNCS_EXPANSION
|
||||
AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
|
||||
[Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
|
||||
])
|
||||
AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
|
||||
])
|
||||
])
|
||||
m4_define([gl_FUNCS_EXPANSION], [
|
||||
m4_divert_text([DEFAULTS], [gl_func_list=])
|
||||
AC_CHECK_FUNCS([$gl_func_list])
|
||||
m4_define([gl_FUNCS_EXPANSION], [])
|
||||
])
|
||||
|
||||
# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
|
||||
# AC_CHECK_DECLS(DECL1, DECL2, ...).
|
||||
AC_DEFUN([AC_CHECK_DECLS_ONCE], [
|
||||
:
|
||||
AC_FOREACH([gl_DECL_NAME], [$1], [
|
||||
AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
|
||||
AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
|
||||
])
|
||||
AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
|
||||
])
|
||||
])
|
428
gl/m4/po.m4
Normal file
428
gl/m4/po.m4
Normal file
|
@ -0,0 +1,428 @@
|
|||
# po.m4 serial 13 (gettext-0.15)
|
||||
dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
dnl
|
||||
dnl This file can can be used in projects which are not available under
|
||||
dnl the GNU General Public License or the GNU Library General Public
|
||||
dnl License but which still want to provide support for the GNU gettext
|
||||
dnl functionality.
|
||||
dnl Please note that the actual code of the GNU gettext library is covered
|
||||
dnl by the GNU Library General Public License, and the rest of the GNU
|
||||
dnl gettext package package is covered by the GNU General Public License.
|
||||
dnl They are *not* in the public domain.
|
||||
|
||||
dnl Authors:
|
||||
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
|
||||
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
dnl Checks for all prerequisites of the po subdirectory.
|
||||
AC_DEFUN([AM_PO_SUBDIRS],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
|
||||
AC_REQUIRE([AM_NLS])dnl
|
||||
|
||||
dnl Perform the following tests also if --disable-nls has been given,
|
||||
dnl because they are needed for "make dist" to work.
|
||||
|
||||
dnl Search for GNU msgfmt in the PATH.
|
||||
dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
|
||||
dnl The second test excludes FreeBSD msgfmt.
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
|
||||
(if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
|
||||
:)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
|
||||
dnl Test whether it is GNU msgfmt >= 0.15.
|
||||
changequote(,)dnl
|
||||
case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
|
||||
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
|
||||
*) MSGFMT_015=$MSGFMT ;;
|
||||
esac
|
||||
changequote([,])dnl
|
||||
AC_SUBST([MSGFMT_015])
|
||||
changequote(,)dnl
|
||||
case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
|
||||
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
|
||||
*) GMSGFMT_015=$GMSGFMT ;;
|
||||
esac
|
||||
changequote([,])dnl
|
||||
AC_SUBST([GMSGFMT_015])
|
||||
|
||||
dnl Search for GNU xgettext 0.12 or newer in the PATH.
|
||||
dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
|
||||
dnl The second test excludes FreeBSD xgettext.
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
|
||||
(if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
|
||||
:)
|
||||
dnl Remove leftover from FreeBSD xgettext call.
|
||||
rm -f messages.po
|
||||
|
||||
dnl Test whether it is GNU xgettext >= 0.15.
|
||||
changequote(,)dnl
|
||||
case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
|
||||
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
|
||||
*) XGETTEXT_015=$XGETTEXT ;;
|
||||
esac
|
||||
changequote([,])dnl
|
||||
AC_SUBST([XGETTEXT_015])
|
||||
|
||||
dnl Search for GNU msgmerge 0.11 or newer in the PATH.
|
||||
AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
|
||||
[$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
|
||||
|
||||
dnl Installation directories.
|
||||
dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
|
||||
dnl have to define it here, so that it can be used in po/Makefile.
|
||||
test -n "$localedir" || localedir='${datadir}/locale'
|
||||
AC_SUBST([localedir])
|
||||
|
||||
AC_CONFIG_COMMANDS([po-directories], [[
|
||||
for ac_file in $CONFIG_FILES; do
|
||||
# Support "outfile[:infile[:infile...]]"
|
||||
case "$ac_file" in
|
||||
*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
esac
|
||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
||||
case "$ac_file" in */Makefile.in)
|
||||
# Adjust a relative srcdir.
|
||||
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
|
||||
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
|
||||
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
|
||||
# In autoconf-2.13 it is called $ac_given_srcdir.
|
||||
# In autoconf-2.50 it is called $srcdir.
|
||||
test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
|
||||
case "$ac_given_srcdir" in
|
||||
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
|
||||
/*) top_srcdir="$ac_given_srcdir" ;;
|
||||
*) top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
# Treat a directory as a PO directory if and only if it has a
|
||||
# POTFILES.in file. This allows packages to have multiple PO
|
||||
# directories under different names or in different locations.
|
||||
if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
|
||||
rm -f "$ac_dir/POTFILES"
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
|
||||
cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
|
||||
POMAKEFILEDEPS="POTFILES.in"
|
||||
# ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
|
||||
# on $ac_dir but don't depend on user-specified configuration
|
||||
# parameters.
|
||||
if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
|
||||
# The LINGUAS file contains the set of available languages.
|
||||
if test -n "$OBSOLETE_ALL_LINGUAS"; then
|
||||
test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
|
||||
fi
|
||||
ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
|
||||
# Hide the ALL_LINGUAS assigment from automake < 1.5.
|
||||
eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
|
||||
POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
|
||||
else
|
||||
# The set of available languages was given in configure.in.
|
||||
# Hide the ALL_LINGUAS assigment from automake < 1.5.
|
||||
eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
|
||||
fi
|
||||
# Compute POFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
|
||||
# Compute UPDATEPOFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
|
||||
# Compute DUMMYPOFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
|
||||
# Compute GMOFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
|
||||
case "$ac_given_srcdir" in
|
||||
.) srcdirpre= ;;
|
||||
*) srcdirpre='$(srcdir)/' ;;
|
||||
esac
|
||||
POFILES=
|
||||
UPDATEPOFILES=
|
||||
DUMMYPOFILES=
|
||||
GMOFILES=
|
||||
for lang in $ALL_LINGUAS; do
|
||||
POFILES="$POFILES $srcdirpre$lang.po"
|
||||
UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
|
||||
DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
|
||||
GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
|
||||
done
|
||||
# CATALOGS depends on both $ac_dir and the user's LINGUAS
|
||||
# environment variable.
|
||||
INST_LINGUAS=
|
||||
if test -n "$ALL_LINGUAS"; then
|
||||
for presentlang in $ALL_LINGUAS; do
|
||||
useit=no
|
||||
if test "%UNSET%" != "$LINGUAS"; then
|
||||
desiredlanguages="$LINGUAS"
|
||||
else
|
||||
desiredlanguages="$ALL_LINGUAS"
|
||||
fi
|
||||
for desiredlang in $desiredlanguages; do
|
||||
# Use the presentlang catalog if desiredlang is
|
||||
# a. equal to presentlang, or
|
||||
# b. a variant of presentlang (because in this case,
|
||||
# presentlang can be used as a fallback for messages
|
||||
# which are not translated in the desiredlang catalog).
|
||||
case "$desiredlang" in
|
||||
"$presentlang"*) useit=yes;;
|
||||
esac
|
||||
done
|
||||
if test $useit = yes; then
|
||||
INST_LINGUAS="$INST_LINGUAS $presentlang"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
CATALOGS=
|
||||
if test -n "$INST_LINGUAS"; then
|
||||
for lang in $INST_LINGUAS; do
|
||||
CATALOGS="$CATALOGS $lang.gmo"
|
||||
done
|
||||
fi
|
||||
test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
|
||||
sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
|
||||
for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
|
||||
if test -f "$f"; then
|
||||
case "$f" in
|
||||
*.orig | *.bak | *~) ;;
|
||||
*) cat "$f" >> "$ac_dir/Makefile" ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done]],
|
||||
[# Capture the value of obsolete ALL_LINGUAS because we need it to compute
|
||||
# POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
|
||||
# from automake < 1.5.
|
||||
eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
|
||||
# Capture the value of LINGUAS because we need it to compute CATALOGS.
|
||||
LINGUAS="${LINGUAS-%UNSET%}"
|
||||
])
|
||||
])
|
||||
|
||||
dnl Postprocesses a Makefile in a directory containing PO files.
|
||||
AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
|
||||
[
|
||||
# When this code is run, in config.status, two variables have already been
|
||||
# set:
|
||||
# - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
|
||||
# - LINGUAS is the value of the environment variable LINGUAS at configure
|
||||
# time.
|
||||
|
||||
changequote(,)dnl
|
||||
# Adjust a relative srcdir.
|
||||
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
|
||||
ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
|
||||
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
|
||||
# In autoconf-2.13 it is called $ac_given_srcdir.
|
||||
# In autoconf-2.50 it is called $srcdir.
|
||||
test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
|
||||
case "$ac_given_srcdir" in
|
||||
.) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
|
||||
/*) top_srcdir="$ac_given_srcdir" ;;
|
||||
*) top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
|
||||
# Find a way to echo strings without interpreting backslash.
|
||||
if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
|
||||
gt_echo='echo'
|
||||
else
|
||||
if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
|
||||
gt_echo='printf %s\n'
|
||||
else
|
||||
echo_func () {
|
||||
cat <<EOT
|
||||
$*
|
||||
EOT
|
||||
}
|
||||
gt_echo='echo_func'
|
||||
fi
|
||||
fi
|
||||
|
||||
# A sed script that extracts the value of VARIABLE from a Makefile.
|
||||
sed_x_variable='
|
||||
# Test if the hold space is empty.
|
||||
x
|
||||
s/P/P/
|
||||
x
|
||||
ta
|
||||
# Yes it was empty. Look if we have the expected variable definition.
|
||||
/^[ ]*VARIABLE[ ]*=/{
|
||||
# Seen the first line of the variable definition.
|
||||
s/^[ ]*VARIABLE[ ]*=//
|
||||
ba
|
||||
}
|
||||
bd
|
||||
:a
|
||||
# Here we are processing a line from the variable definition.
|
||||
# Remove comment, more precisely replace it with a space.
|
||||
s/#.*$/ /
|
||||
# See if the line ends in a backslash.
|
||||
tb
|
||||
:b
|
||||
s/\\$//
|
||||
# Print the line, without the trailing backslash.
|
||||
p
|
||||
tc
|
||||
# There was no trailing backslash. The end of the variable definition is
|
||||
# reached. Clear the hold space.
|
||||
s/^.*$//
|
||||
x
|
||||
bd
|
||||
:c
|
||||
# A trailing backslash means that the variable definition continues in the
|
||||
# next line. Put a nonempty string into the hold space to indicate this.
|
||||
s/^.*$/P/
|
||||
x
|
||||
:d
|
||||
'
|
||||
changequote([,])dnl
|
||||
|
||||
# Set POTFILES to the value of the Makefile variable POTFILES.
|
||||
sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
|
||||
POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
|
||||
# Compute POTFILES_DEPS as
|
||||
# $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
|
||||
POTFILES_DEPS=
|
||||
for file in $POTFILES; do
|
||||
POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
|
||||
done
|
||||
POMAKEFILEDEPS=""
|
||||
|
||||
if test -n "$OBSOLETE_ALL_LINGUAS"; then
|
||||
test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
|
||||
fi
|
||||
if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
|
||||
# The LINGUAS file contains the set of available languages.
|
||||
ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
|
||||
POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
|
||||
else
|
||||
# Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
|
||||
sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
|
||||
ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
|
||||
fi
|
||||
# Hide the ALL_LINGUAS assigment from automake < 1.5.
|
||||
eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
|
||||
# Compute POFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
|
||||
# Compute UPDATEPOFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
|
||||
# Compute DUMMYPOFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
|
||||
# Compute GMOFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
|
||||
# Compute PROPERTIESFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
|
||||
# Compute CLASSFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
|
||||
# Compute QMFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
|
||||
# Compute MSGFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
|
||||
# Compute RESOURCESDLLFILES
|
||||
# as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
|
||||
case "$ac_given_srcdir" in
|
||||
.) srcdirpre= ;;
|
||||
*) srcdirpre='$(srcdir)/' ;;
|
||||
esac
|
||||
POFILES=
|
||||
UPDATEPOFILES=
|
||||
DUMMYPOFILES=
|
||||
GMOFILES=
|
||||
PROPERTIESFILES=
|
||||
CLASSFILES=
|
||||
QMFILES=
|
||||
MSGFILES=
|
||||
RESOURCESDLLFILES=
|
||||
for lang in $ALL_LINGUAS; do
|
||||
POFILES="$POFILES $srcdirpre$lang.po"
|
||||
UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
|
||||
DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
|
||||
GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
|
||||
PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
|
||||
CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
|
||||
QMFILES="$QMFILES $srcdirpre$lang.qm"
|
||||
frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
|
||||
MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
|
||||
frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
|
||||
RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
|
||||
done
|
||||
# CATALOGS depends on both $ac_dir and the user's LINGUAS
|
||||
# environment variable.
|
||||
INST_LINGUAS=
|
||||
if test -n "$ALL_LINGUAS"; then
|
||||
for presentlang in $ALL_LINGUAS; do
|
||||
useit=no
|
||||
if test "%UNSET%" != "$LINGUAS"; then
|
||||
desiredlanguages="$LINGUAS"
|
||||
else
|
||||
desiredlanguages="$ALL_LINGUAS"
|
||||
fi
|
||||
for desiredlang in $desiredlanguages; do
|
||||
# Use the presentlang catalog if desiredlang is
|
||||
# a. equal to presentlang, or
|
||||
# b. a variant of presentlang (because in this case,
|
||||
# presentlang can be used as a fallback for messages
|
||||
# which are not translated in the desiredlang catalog).
|
||||
case "$desiredlang" in
|
||||
"$presentlang"*) useit=yes;;
|
||||
esac
|
||||
done
|
||||
if test $useit = yes; then
|
||||
INST_LINGUAS="$INST_LINGUAS $presentlang"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
CATALOGS=
|
||||
JAVACATALOGS=
|
||||
QTCATALOGS=
|
||||
TCLCATALOGS=
|
||||
CSHARPCATALOGS=
|
||||
if test -n "$INST_LINGUAS"; then
|
||||
for lang in $INST_LINGUAS; do
|
||||
CATALOGS="$CATALOGS $lang.gmo"
|
||||
JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
|
||||
QTCATALOGS="$QTCATALOGS $lang.qm"
|
||||
frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
|
||||
TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
|
||||
frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
|
||||
CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
|
||||
done
|
||||
fi
|
||||
|
||||
sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
|
||||
if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
|
||||
# Add dependencies that cannot be formulated as a simple suffix rule.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
|
||||
cat >> "$ac_file.tmp" <<EOF
|
||||
$frobbedlang.msg: $lang.po
|
||||
@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
|
||||
\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
|
||||
# Add dependencies that cannot be formulated as a simple suffix rule.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
|
||||
cat >> "$ac_file.tmp" <<EOF
|
||||
$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
|
||||
@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
|
||||
\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
if test -n "$POMAKEFILEDEPS"; then
|
||||
cat >> "$ac_file.tmp" <<EOF
|
||||
Makefile: $POMAKEFILEDEPS
|
||||
EOF
|
||||
fi
|
||||
mv "$ac_file.tmp" "$ac_file"
|
||||
])
|
92
gl/m4/progtest.m4
Normal file
92
gl/m4/progtest.m4
Normal file
|
@ -0,0 +1,92 @@
|
|||
# progtest.m4 serial 4 (gettext-0.14.2)
|
||||
dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
dnl
|
||||
dnl This file can can be used in projects which are not available under
|
||||
dnl the GNU General Public License or the GNU Library General Public
|
||||
dnl License but which still want to provide support for the GNU gettext
|
||||
dnl functionality.
|
||||
dnl Please note that the actual code of the GNU gettext library is covered
|
||||
dnl by the GNU Library General Public License, and the rest of the GNU
|
||||
dnl gettext package package is covered by the GNU General Public License.
|
||||
dnl They are *not* in the public domain.
|
||||
|
||||
dnl Authors:
|
||||
dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
||||
[
|
||||
# Prepare PATH_SEPARATOR.
|
||||
# The user is always right.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
echo "#! /bin/sh" >conf$$.sh
|
||||
echo "exit 0" >>conf$$.sh
|
||||
chmod +x conf$$.sh
|
||||
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -f conf$$.sh
|
||||
fi
|
||||
|
||||
# Find out how to test for executable files. Don't use a zero-byte file,
|
||||
# as systems may use methods other than mode bits to determine executability.
|
||||
cat >conf$$.file <<_ASEOF
|
||||
#! /bin/sh
|
||||
exit 0
|
||||
_ASEOF
|
||||
chmod +x conf$$.file
|
||||
if test -x conf$$.file >/dev/null 2>&1; then
|
||||
ac_executable_p="test -x"
|
||||
else
|
||||
ac_executable_p="test -f"
|
||||
fi
|
||||
rm -f conf$$.file
|
||||
|
||||
# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
[[\\/]]* | ?:[[\\/]]*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
IFS="$ac_save_IFS"
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
|
||||
echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
|
||||
break 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS="$ac_save_IFS"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
198
gl/m4/regex.m4
Normal file
198
gl/m4/regex.m4
Normal file
|
@ -0,0 +1,198 @@
|
|||
#serial 42
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
||||
# 2006, 2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Initially derived from code in GNU grep.
|
||||
dnl Mostly written by Jim Meyering.
|
||||
|
||||
AC_PREREQ([2.50])
|
||||
|
||||
AC_DEFUN([gl_REGEX],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE([locale.h])
|
||||
|
||||
AC_ARG_WITH([included-regex],
|
||||
[AC_HELP_STRING([--without-included-regex],
|
||||
[don't compile regex; this is the default on
|
||||
systems with recent-enough versions of the GNU C
|
||||
Library (use with caution on other systems)])])
|
||||
|
||||
case $with_included_regex in #(
|
||||
yes|no) ac_use_included_regex=$with_included_regex
|
||||
;;
|
||||
'')
|
||||
# If the system regex support is good enough that it passes the
|
||||
# following run test, then default to *not* using the included regex.c.
|
||||
# If cross compiling, assume the test would fail and use the included
|
||||
# regex.c. The first failing regular expression is from `Spencer ere
|
||||
# test #75' in grep-2.3.
|
||||
AC_CACHE_CHECK([for working re_compile_pattern],
|
||||
[gl_cv_func_re_compile_pattern_working],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#if HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <regex.h>
|
||||
],
|
||||
[[static struct re_pattern_buffer regex;
|
||||
unsigned char folded_chars[UCHAR_MAX + 1];
|
||||
int i;
|
||||
const char *s;
|
||||
struct re_registers regs;
|
||||
|
||||
#if HAVE_LOCALE_H
|
||||
/* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
|
||||
This test needs valgrind to catch the bug on Debian
|
||||
GNU/Linux 3.1 x86, but it might catch the bug better
|
||||
on other platforms and it shouldn't hurt to try the
|
||||
test here. */
|
||||
if (setlocale (LC_ALL, "en_US.UTF-8"))
|
||||
{
|
||||
static char const pat[] = "insert into";
|
||||
static char const data[] =
|
||||
"\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
|
||||
re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
|
||||
| RE_ICASE);
|
||||
memset (®ex, 0, sizeof regex);
|
||||
s = re_compile_pattern (pat, sizeof pat - 1, ®ex);
|
||||
if (s)
|
||||
return 1;
|
||||
if (re_search (®ex, data, sizeof data - 1,
|
||||
0, sizeof data - 1, ®s)
|
||||
!= -1)
|
||||
return 1;
|
||||
if (! setlocale (LC_ALL, "C"))
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
re_set_syntax (RE_SYNTAX_POSIX_EGREP);
|
||||
memset (®ex, 0, sizeof (regex));
|
||||
for (i = 0; i <= UCHAR_MAX; i++)
|
||||
folded_chars[i] = i;
|
||||
regex.translate = folded_chars;
|
||||
s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex);
|
||||
/* This should fail with _Invalid character class name_ error. */
|
||||
if (!s)
|
||||
exit (1);
|
||||
|
||||
/* This should succeed, but does not for e.g. glibc-2.1.3. */
|
||||
memset (®ex, 0, sizeof (regex));
|
||||
s = re_compile_pattern ("{1", 2, ®ex);
|
||||
|
||||
if (s)
|
||||
exit (1);
|
||||
|
||||
/* The following example is derived from a problem report
|
||||
against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
|
||||
memset (®ex, 0, sizeof (regex));
|
||||
s = re_compile_pattern ("[an\371]*n", 7, ®ex);
|
||||
if (s)
|
||||
exit (1);
|
||||
|
||||
/* This should match, but does not for e.g. glibc-2.2.1. */
|
||||
if (re_match (®ex, "an", 2, 0, ®s) != 2)
|
||||
exit (1);
|
||||
|
||||
memset (®ex, 0, sizeof (regex));
|
||||
s = re_compile_pattern ("x", 1, ®ex);
|
||||
if (s)
|
||||
exit (1);
|
||||
|
||||
/* The version of regex.c in e.g. GNU libc-2.2.93 did not
|
||||
work with a negative RANGE argument. */
|
||||
if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1)
|
||||
exit (1);
|
||||
|
||||
/* The version of regex.c in older versions of gnulib
|
||||
ignored RE_ICASE. Detect that problem too. */
|
||||
memset (®ex, 0, sizeof (regex));
|
||||
re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
|
||||
s = re_compile_pattern ("x", 1, ®ex);
|
||||
if (s)
|
||||
exit (1);
|
||||
|
||||
if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0)
|
||||
exit (1);
|
||||
|
||||
/* REG_STARTEND was added to glibc on 2004-01-15.
|
||||
Reject older versions. */
|
||||
if (! REG_STARTEND)
|
||||
exit (1);
|
||||
|
||||
/* Reject hosts whose regoff_t values are too narrow.
|
||||
These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t
|
||||
and 32-bit int. */
|
||||
if (sizeof (regoff_t) < sizeof (ptrdiff_t)
|
||||
|| sizeof (regoff_t) < sizeof (ssize_t))
|
||||
exit (1);
|
||||
|
||||
exit (0);]])],
|
||||
[gl_cv_func_re_compile_pattern_working=yes],
|
||||
[gl_cv_func_re_compile_pattern_working=no],
|
||||
dnl When crosscompiling, assume it is not working.
|
||||
[gl_cv_func_re_compile_pattern_working=no])])
|
||||
case $gl_cv_func_re_compile_pattern_working in #(
|
||||
yes) ac_use_included_regex=no;; #(
|
||||
no) ac_use_included_regex=yes;;
|
||||
esac
|
||||
;;
|
||||
*) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $ac_use_included_regex = yes; then
|
||||
AC_DEFINE([_REGEX_LARGE_OFFSETS], 1,
|
||||
[Define if you want regoff_t to be at least as wide POSIX requires.])
|
||||
AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],
|
||||
[Define to rpl_re_syntax_options if the replacement should be used.])
|
||||
AC_DEFINE([re_set_syntax], [rpl_re_set_syntax],
|
||||
[Define to rpl_re_set_syntax if the replacement should be used.])
|
||||
AC_DEFINE([re_compile_pattern], [rpl_re_compile_pattern],
|
||||
[Define to rpl_re_compile_pattern if the replacement should be used.])
|
||||
AC_DEFINE([re_compile_fastmap], [rpl_re_compile_fastmap],
|
||||
[Define to rpl_re_compile_fastmap if the replacement should be used.])
|
||||
AC_DEFINE([re_search], [rpl_re_search],
|
||||
[Define to rpl_re_search if the replacement should be used.])
|
||||
AC_DEFINE([re_search_2], [rpl_re_search_2],
|
||||
[Define to rpl_re_search_2 if the replacement should be used.])
|
||||
AC_DEFINE([re_match], [rpl_re_match],
|
||||
[Define to rpl_re_match if the replacement should be used.])
|
||||
AC_DEFINE([re_match_2], [rpl_re_match_2],
|
||||
[Define to rpl_re_match_2 if the replacement should be used.])
|
||||
AC_DEFINE([re_set_registers], [rpl_re_set_registers],
|
||||
[Define to rpl_re_set_registers if the replacement should be used.])
|
||||
AC_DEFINE([re_comp], [rpl_re_comp],
|
||||
[Define to rpl_re_comp if the replacement should be used.])
|
||||
AC_DEFINE([re_exec], [rpl_re_exec],
|
||||
[Define to rpl_re_exec if the replacement should be used.])
|
||||
AC_DEFINE([regcomp], [rpl_regcomp],
|
||||
[Define to rpl_regcomp if the replacement should be used.])
|
||||
AC_DEFINE([regexec], [rpl_regexec],
|
||||
[Define to rpl_regexec if the replacement should be used.])
|
||||
AC_DEFINE([regerror], [rpl_regerror],
|
||||
[Define to rpl_regerror if the replacement should be used.])
|
||||
AC_DEFINE([regfree], [rpl_regfree],
|
||||
[Define to rpl_regfree if the replacement should be used.])
|
||||
AC_LIBOBJ([regex])
|
||||
gl_PREREQ_REGEX
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/regex.c and lib/regex_internal.c.
|
||||
AC_DEFUN([gl_PREREQ_REGEX],
|
||||
[
|
||||
AC_REQUIRE([AC_GNU_SOURCE])
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
AC_REQUIRE([AM_LANGINFO_CODESET])
|
||||
AC_CHECK_FUNCS_ONCE([iswctype mbrtowc mempcpy wcrtomb wcscoll])
|
||||
AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
|
||||
])
|
18
gl/m4/safe-read.m4
Normal file
18
gl/m4/safe-read.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
# safe-read.m4 serial 5
|
||||
dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_SAFE_READ],
|
||||
[
|
||||
AC_LIBOBJ([safe-read])
|
||||
|
||||
gl_PREREQ_SAFE_READ
|
||||
])
|
||||
|
||||
# Prerequisites of lib/safe-read.c.
|
||||
AC_DEFUN([gl_PREREQ_SAFE_READ],
|
||||
[
|
||||
AC_REQUIRE([gt_TYPE_SSIZE_T])
|
||||
])
|
18
gl/m4/safe-write.m4
Normal file
18
gl/m4/safe-write.m4
Normal file
|
@ -0,0 +1,18 @@
|
|||
# safe-write.m4 serial 3
|
||||
dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_SAFE_WRITE],
|
||||
[
|
||||
AC_LIBOBJ([safe-write])
|
||||
|
||||
gl_PREREQ_SAFE_WRITE
|
||||
])
|
||||
|
||||
# Prerequisites of lib/safe-write.c.
|
||||
AC_DEFUN([gl_PREREQ_SAFE_WRITE],
|
||||
[
|
||||
gl_PREREQ_SAFE_READ
|
||||
])
|
68
gl/m4/size_max.m4
Normal file
68
gl/m4/size_max.m4
Normal file
|
@ -0,0 +1,68 @@
|
|||
# size_max.m4 serial 6
|
||||
dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_SIZE_MAX],
|
||||
[
|
||||
AC_CHECK_HEADERS(stdint.h)
|
||||
dnl First test whether the system already has SIZE_MAX.
|
||||
AC_MSG_CHECKING([for SIZE_MAX])
|
||||
AC_CACHE_VAL([gl_cv_size_max], [
|
||||
gl_cv_size_max=
|
||||
AC_EGREP_CPP([Found it], [
|
||||
#include <limits.h>
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef SIZE_MAX
|
||||
Found it
|
||||
#endif
|
||||
], gl_cv_size_max=yes)
|
||||
if test -z "$gl_cv_size_max"; then
|
||||
dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
|
||||
dnl than the type 'unsigned long'. Try hard to find a definition that can
|
||||
dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
|
||||
AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
|
||||
[#include <stddef.h>
|
||||
#include <limits.h>], size_t_bits_minus_1=)
|
||||
AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
|
||||
[#include <stddef.h>], fits_in_uint=)
|
||||
if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
|
||||
if test $fits_in_uint = 1; then
|
||||
dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
|
||||
dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
|
||||
AC_TRY_COMPILE([#include <stddef.h>
|
||||
extern size_t foo;
|
||||
extern unsigned long foo;
|
||||
], [], fits_in_uint=0)
|
||||
fi
|
||||
dnl We cannot use 'expr' to simplify this expression, because 'expr'
|
||||
dnl works only with 'long' integers in the host environment, while we
|
||||
dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
|
||||
if test $fits_in_uint = 1; then
|
||||
gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
|
||||
else
|
||||
gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
|
||||
fi
|
||||
else
|
||||
dnl Shouldn't happen, but who knows...
|
||||
gl_cv_size_max='((size_t)~(size_t)0)'
|
||||
fi
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT([$gl_cv_size_max])
|
||||
if test "$gl_cv_size_max" != yes; then
|
||||
AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
|
||||
[Define as the maximum value of type 'size_t', if the system doesn't define it.])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
|
||||
dnl Remove this when we can assume autoconf >= 2.61.
|
||||
m4_ifdef([AC_COMPUTE_INT], [], [
|
||||
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
|
||||
])
|
15
gl/m4/snprintf.m4
Normal file
15
gl/m4/snprintf.m4
Normal file
|
@ -0,0 +1,15 @@
|
|||
# snprintf.m4 serial 2
|
||||
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_SNPRINTF],
|
||||
[
|
||||
AC_REPLACE_FUNCS(snprintf)
|
||||
AC_CHECK_DECLS_ONCE(snprintf)
|
||||
gl_PREREQ_SNPRINTF
|
||||
])
|
||||
|
||||
# Prerequisites of lib/snprintf.c.
|
||||
AC_DEFUN([gl_PREREQ_SNPRINTF], [:])
|
52
gl/m4/socklen.m4
Normal file
52
gl/m4/socklen.m4
Normal file
|
@ -0,0 +1,52 @@
|
|||
# socklen.m4 serial 4
|
||||
dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Albert Chin, Windows fixes from Simon Josefsson.
|
||||
|
||||
dnl Check for socklen_t: historically on BSD it is an int, and in
|
||||
dnl POSIX 1g it is a type of its own, but some platforms use different
|
||||
dnl types for the argument to getsockopt, getpeername, etc. So we
|
||||
dnl have to test to find something that will work.
|
||||
|
||||
dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
|
||||
dnl it there first. That file is included by gnulib's socket_.h, which
|
||||
dnl all users of this module should include. Cygwin must not include
|
||||
dnl ws2tcpip.h.
|
||||
AC_DEFUN([gl_TYPE_SOCKLEN_T],
|
||||
[AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
|
||||
AC_CHECK_TYPE([socklen_t], ,
|
||||
[AC_MSG_CHECKING([for socklen_t equivalent])
|
||||
AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv],
|
||||
[# Systems have either "struct sockaddr *" or
|
||||
# "void *" as the second argument to getpeername
|
||||
gl_cv_socklen_t_equiv=
|
||||
for arg2 in "struct sockaddr" void; do
|
||||
for t in int size_t "unsigned int" "long int" "unsigned long int"; do
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int getpeername (int, $arg2 *, $t *);],
|
||||
[$t len;
|
||||
getpeername (0, 0, &len);],
|
||||
[gl_cv_socklen_t_equiv="$t"])
|
||||
test "$gl_cv_socklen_t_equiv" != "" && break
|
||||
done
|
||||
test "$gl_cv_socklen_t_equiv" != "" && break
|
||||
done
|
||||
])
|
||||
if test "$gl_cv_socklen_t_equiv" = ""; then
|
||||
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
|
||||
fi
|
||||
AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
|
||||
AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
|
||||
[type to use in place of socklen_t if not defined])],
|
||||
[#include <sys/types.h>
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#elif HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
#endif])])
|
58
gl/m4/sockpfaf.m4
Normal file
58
gl/m4/sockpfaf.m4
Normal file
|
@ -0,0 +1,58 @@
|
|||
# sockpfaf.m4 serial 5
|
||||
dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
|
||||
dnl and some common address families (AF_INET, AF_INET6, ...).
|
||||
dnl This test assumes that a system supports an address family if and only if
|
||||
dnl it supports the corresponding protocol family.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([gl_SOCKET_FAMILIES],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
AC_CHECK_HEADERS_ONCE([netinet/in.h])
|
||||
|
||||
AC_MSG_CHECKING(for IPv4 sockets)
|
||||
AC_CACHE_VAL(gl_cv_socket_ipv4,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif],
|
||||
[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
|
||||
if (&x && &y && &z) return 0;],
|
||||
gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
|
||||
AC_MSG_RESULT($gl_cv_socket_ipv4)
|
||||
if test $gl_cv_socket_ipv4 = yes; then
|
||||
AC_DEFINE(HAVE_IPV4, 1, [Define to 1 if <sys/socket.h> defines AF_INET.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for IPv6 sockets)
|
||||
AC_CACHE_VAL(gl_cv_socket_ipv6,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif],
|
||||
[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
|
||||
if (&x && &y && &z) return 0;],
|
||||
gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
|
||||
AC_MSG_RESULT($gl_cv_socket_ipv6)
|
||||
if test $gl_cv_socket_ipv6 = yes; then
|
||||
AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if <sys/socket.h> defines AF_INET6.])
|
||||
fi
|
||||
])
|
21
gl/m4/ssize_t.m4
Normal file
21
gl/m4/ssize_t.m4
Normal file
|
@ -0,0 +1,21 @@
|
|||
# ssize_t.m4 serial 4 (gettext-0.15)
|
||||
dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
dnl Test whether ssize_t is defined.
|
||||
|
||||
AC_DEFUN([gt_TYPE_SSIZE_T],
|
||||
[
|
||||
AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>],
|
||||
[int x = sizeof (ssize_t *) + sizeof (ssize_t);
|
||||
return !x;],
|
||||
[gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
|
||||
if test $gt_cv_ssize_t = no; then
|
||||
AC_DEFINE([ssize_t], [int],
|
||||
[Define as a signed type of the same size as size_t.])
|
||||
fi
|
||||
])
|
115
gl/m4/stdbool.m4
Normal file
115
gl/m4/stdbool.m4
Normal file
|
@ -0,0 +1,115 @@
|
|||
# Check for stdbool.h that conforms to C99.
|
||||
|
||||
dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Prepare for substituting <stdbool.h> if it is not supported.
|
||||
|
||||
AC_DEFUN([AM_STDBOOL_H],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_STDBOOL])
|
||||
|
||||
# Define two additional variables used in the Makefile substitution.
|
||||
|
||||
if test "$ac_cv_header_stdbool_h" = yes; then
|
||||
STDBOOL_H=''
|
||||
else
|
||||
STDBOOL_H='stdbool.h'
|
||||
fi
|
||||
AC_SUBST([STDBOOL_H])
|
||||
|
||||
if test "$ac_cv_type__Bool" = yes; then
|
||||
HAVE__BOOL=1
|
||||
else
|
||||
HAVE__BOOL=0
|
||||
fi
|
||||
AC_SUBST([HAVE__BOOL])
|
||||
])
|
||||
|
||||
# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
|
||||
AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
|
||||
|
||||
# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf
|
||||
# have this macro built-in.
|
||||
|
||||
AC_DEFUN([AC_HEADER_STDBOOL],
|
||||
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
|
||||
[ac_cv_header_stdbool_h],
|
||||
[AC_TRY_COMPILE(
|
||||
[
|
||||
#include <stdbool.h>
|
||||
#ifndef bool
|
||||
"error: bool is not defined"
|
||||
#endif
|
||||
#ifndef false
|
||||
"error: false is not defined"
|
||||
#endif
|
||||
#if false
|
||||
"error: false is not 0"
|
||||
#endif
|
||||
#ifndef true
|
||||
"error: true is not defined"
|
||||
#endif
|
||||
#if true != 1
|
||||
"error: true is not 1"
|
||||
#endif
|
||||
#ifndef __bool_true_false_are_defined
|
||||
"error: __bool_true_false_are_defined is not defined"
|
||||
#endif
|
||||
|
||||
struct s { _Bool s: 1; _Bool t; } s;
|
||||
|
||||
char a[true == 1 ? 1 : -1];
|
||||
char b[false == 0 ? 1 : -1];
|
||||
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
|
||||
char d[(bool) 0.5 == true ? 1 : -1];
|
||||
bool e = &s;
|
||||
char f[(_Bool) 0.0 == false ? 1 : -1];
|
||||
char g[true];
|
||||
char h[sizeof (_Bool)];
|
||||
char i[sizeof s.t];
|
||||
enum { j = false, k = true, l = false * true, m = true * 256 };
|
||||
_Bool n[m];
|
||||
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
|
||||
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
|
||||
#if defined __xlc__ || defined __GNUC__
|
||||
/* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
|
||||
reported by James Lemley on 2005-10-05; see
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
|
||||
This test is not quite right, since xlc is allowed to
|
||||
reject this program, as the initializer for xlcbug is
|
||||
not one of the forms that C requires support for.
|
||||
However, doing the test right would require a run-time
|
||||
test, and that would make cross-compilation harder.
|
||||
Let us hope that IBM fixes the xlc bug, and also adds
|
||||
support for this kind of constant expression. In the
|
||||
meantime, this test will reject xlc, which is OK, since
|
||||
our stdbool.h substitute should suffice. We also test
|
||||
this with GCC, where it should work, to detect more
|
||||
quickly whether someone messes up the test in the
|
||||
future. */
|
||||
char digs[] = "0123456789";
|
||||
int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
|
||||
#endif
|
||||
/* Catch a bug in an HP-UX C compiler. See
|
||||
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
|
||||
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
|
||||
*/
|
||||
_Bool q = true;
|
||||
_Bool *pq = &q;
|
||||
],
|
||||
[
|
||||
*pq |= q;
|
||||
*pq |= ! q;
|
||||
/* Refer to every declared value, to avoid compiler optimizations. */
|
||||
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
|
||||
+ !m + !n + !o + !p + !q + !pq);
|
||||
],
|
||||
[ac_cv_header_stdbool_h=yes],
|
||||
[ac_cv_header_stdbool_h=no])])
|
||||
AC_CHECK_TYPES([_Bool])
|
||||
if test $ac_cv_header_stdbool_h = yes; then
|
||||
AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
|
||||
fi])
|
369
gl/m4/stdint.m4
Normal file
369
gl/m4/stdint.m4
Normal file
|
@ -0,0 +1,369 @@
|
|||
# stdint.m4 serial 22
|
||||
dnl Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert and Bruno Haible.
|
||||
dnl Test whether <stdint.h> is supported or must be substituted.
|
||||
|
||||
AC_DEFUN([gl_STDINT_H],
|
||||
[
|
||||
AC_PREREQ(2.59)dnl
|
||||
|
||||
dnl Check for long long int and unsigned long long int.
|
||||
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
||||
if test $ac_cv_type_long_long_int = yes; then
|
||||
HAVE_LONG_LONG_INT=1
|
||||
else
|
||||
HAVE_LONG_LONG_INT=0
|
||||
fi
|
||||
AC_SUBST([HAVE_LONG_LONG_INT])
|
||||
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
|
||||
if test $ac_cv_type_unsigned_long_long_int = yes; then
|
||||
HAVE_UNSIGNED_LONG_LONG_INT=1
|
||||
else
|
||||
HAVE_UNSIGNED_LONG_LONG_INT=0
|
||||
fi
|
||||
AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
|
||||
|
||||
dnl Check for <inttypes.h>.
|
||||
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
|
||||
if test $ac_cv_header_inttypes_h = yes; then
|
||||
HAVE_INTTYPES_H=1
|
||||
else
|
||||
HAVE_INTTYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_INTTYPES_H])
|
||||
|
||||
dnl Check for <sys/types.h>.
|
||||
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
|
||||
if test $ac_cv_header_sys_types_h = yes; then
|
||||
HAVE_SYS_TYPES_H=1
|
||||
else
|
||||
HAVE_SYS_TYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_TYPES_H])
|
||||
|
||||
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h.
|
||||
if test $ac_cv_header_stdint_h = yes; then
|
||||
gl_ABSOLUTE_HEADER([stdint.h])
|
||||
ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\"
|
||||
HAVE_STDINT_H=1
|
||||
else
|
||||
ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\"
|
||||
HAVE_STDINT_H=0
|
||||
fi
|
||||
AC_SUBST([ABSOLUTE_STDINT_H])
|
||||
AC_SUBST([HAVE_STDINT_H])
|
||||
|
||||
dnl Now see whether we need a substitute <stdint.h>. Use
|
||||
dnl ABSOLUTE_STDINT_H, not <stdint.h>, so that it also works during
|
||||
dnl a "config.status --recheck" if a stdint.h has been
|
||||
dnl created in the build directory.
|
||||
if test $ac_cv_header_stdint_h = yes; then
|
||||
AC_CACHE_CHECK([whether stdint.h conforms to C99],
|
||||
[gl_cv_header_working_stdint_h],
|
||||
[gl_cv_header_working_stdint_h=no
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#include <stddef.h>
|
||||
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
|
||||
#include ABSOLUTE_STDINT_H
|
||||
#ifdef INT8_MAX
|
||||
int8_t a1 = INT8_MAX;
|
||||
int8_t a1min = INT8_MIN;
|
||||
#endif
|
||||
#ifdef INT16_MAX
|
||||
int16_t a2 = INT16_MAX;
|
||||
int16_t a2min = INT16_MIN;
|
||||
#endif
|
||||
#ifdef INT32_MAX
|
||||
int32_t a3 = INT32_MAX;
|
||||
int32_t a3min = INT32_MIN;
|
||||
#endif
|
||||
#ifdef INT64_MAX
|
||||
int64_t a4 = INT64_MAX;
|
||||
int64_t a4min = INT64_MIN;
|
||||
#endif
|
||||
#ifdef UINT8_MAX
|
||||
uint8_t b1 = UINT8_MAX;
|
||||
#else
|
||||
typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
|
||||
#endif
|
||||
#ifdef UINT16_MAX
|
||||
uint16_t b2 = UINT16_MAX;
|
||||
#endif
|
||||
#ifdef UINT32_MAX
|
||||
uint32_t b3 = UINT32_MAX;
|
||||
#endif
|
||||
#ifdef UINT64_MAX
|
||||
uint64_t b4 = UINT64_MAX;
|
||||
#endif
|
||||
int_least8_t c1 = INT8_C (0x7f);
|
||||
int_least8_t c1max = INT_LEAST8_MAX;
|
||||
int_least8_t c1min = INT_LEAST8_MIN;
|
||||
int_least16_t c2 = INT16_C (0x7fff);
|
||||
int_least16_t c2max = INT_LEAST16_MAX;
|
||||
int_least16_t c2min = INT_LEAST16_MIN;
|
||||
int_least32_t c3 = INT32_C (0x7fffffff);
|
||||
int_least32_t c3max = INT_LEAST32_MAX;
|
||||
int_least32_t c3min = INT_LEAST32_MIN;
|
||||
int_least64_t c4 = INT64_C (0x7fffffffffffffff);
|
||||
int_least64_t c4max = INT_LEAST64_MAX;
|
||||
int_least64_t c4min = INT_LEAST64_MIN;
|
||||
uint_least8_t d1 = UINT8_C (0xff);
|
||||
uint_least8_t d1max = UINT_LEAST8_MAX;
|
||||
uint_least16_t d2 = UINT16_C (0xffff);
|
||||
uint_least16_t d2max = UINT_LEAST16_MAX;
|
||||
uint_least32_t d3 = UINT32_C (0xffffffff);
|
||||
uint_least32_t d3max = UINT_LEAST32_MAX;
|
||||
uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
|
||||
uint_least64_t d4max = UINT_LEAST64_MAX;
|
||||
int_fast8_t e1 = INT_FAST8_MAX;
|
||||
int_fast8_t e1min = INT_FAST8_MIN;
|
||||
int_fast16_t e2 = INT_FAST16_MAX;
|
||||
int_fast16_t e2min = INT_FAST16_MIN;
|
||||
int_fast32_t e3 = INT_FAST32_MAX;
|
||||
int_fast32_t e3min = INT_FAST32_MIN;
|
||||
int_fast64_t e4 = INT_FAST64_MAX;
|
||||
int_fast64_t e4min = INT_FAST64_MIN;
|
||||
uint_fast8_t f1 = UINT_FAST8_MAX;
|
||||
uint_fast16_t f2 = UINT_FAST16_MAX;
|
||||
uint_fast32_t f3 = UINT_FAST32_MAX;
|
||||
uint_fast64_t f4 = UINT_FAST64_MAX;
|
||||
#ifdef INTPTR_MAX
|
||||
intptr_t g = INTPTR_MAX;
|
||||
intptr_t gmin = INTPTR_MIN;
|
||||
#endif
|
||||
#ifdef UINTPTR_MAX
|
||||
uintptr_t h = UINTPTR_MAX;
|
||||
#endif
|
||||
intmax_t i = INTMAX_MAX;
|
||||
uintmax_t j = UINTMAX_MAX;
|
||||
struct s {
|
||||
int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1;
|
||||
int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1;
|
||||
int check_SIZE: 0 < SIZE_MAX ? 1 : -1;
|
||||
int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1;
|
||||
int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1;
|
||||
|
||||
/* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
|
||||
int check_UINT8_C:
|
||||
(-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
|
||||
int check_UINT16_C:
|
||||
(-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
|
||||
|
||||
/* Detect bugs in OpenBSD 3.9 stdint.h. */
|
||||
#ifdef UINT8_MAX
|
||||
int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
|
||||
#endif
|
||||
#ifdef UINT16_MAX
|
||||
int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
|
||||
#endif
|
||||
#ifdef UINT32_MAX
|
||||
int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
|
||||
#endif
|
||||
#ifdef UINT64_MAX
|
||||
int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
|
||||
#endif
|
||||
int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
|
||||
int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
|
||||
int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
|
||||
int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
|
||||
int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
|
||||
int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
|
||||
int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
|
||||
int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
|
||||
int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
|
||||
int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
|
||||
int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
|
||||
};
|
||||
]])],
|
||||
[gl_cv_header_working_stdint_h=yes])])
|
||||
fi
|
||||
if test "$gl_cv_header_working_stdint_h" = yes; then
|
||||
STDINT_H=
|
||||
else
|
||||
dnl Check for <sys/inttypes.h>, and for
|
||||
dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
|
||||
AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
|
||||
if test $ac_cv_header_sys_inttypes_h = yes; then
|
||||
HAVE_SYS_INTTYPES_H=1
|
||||
else
|
||||
HAVE_SYS_INTTYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_INTTYPES_H])
|
||||
if test $ac_cv_header_sys_bitypes_h = yes; then
|
||||
HAVE_SYS_BITYPES_H=1
|
||||
else
|
||||
HAVE_SYS_BITYPES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_BITYPES_H])
|
||||
|
||||
gl_STDINT_TYPE_PROPERTIES
|
||||
STDINT_H=stdint.h
|
||||
fi
|
||||
AC_SUBST(STDINT_H)
|
||||
])
|
||||
|
||||
dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
|
||||
dnl Determine the size of each of the given types in bits.
|
||||
AC_DEFUN([gl_STDINT_BITSIZEOF],
|
||||
[
|
||||
dnl Use a shell loop, to avoid bloating configure, and
|
||||
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
|
||||
dnl config.h.in,
|
||||
dnl - extra AC_SUBST calls, so that the right substitutions are made.
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
|
||||
[Define to the number of bits in type ']gltype['.])])
|
||||
for gltype in $1 ; do
|
||||
AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
|
||||
[AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
|
||||
[$2
|
||||
#include <limits.h>], [result=unknown])
|
||||
eval gl_cv_bitsizeof_${gltype}=\$result
|
||||
])
|
||||
eval result=\$gl_cv_bitsizeof_${gltype}
|
||||
if test $result = unknown; then
|
||||
dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
|
||||
dnl do a syntax check even on unused #if conditions and give an error
|
||||
dnl on valid C code like this:
|
||||
dnl #if 0
|
||||
dnl # if > 32
|
||||
dnl # endif
|
||||
dnl #endif
|
||||
result=0
|
||||
fi
|
||||
GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
|
||||
AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
|
||||
eval BITSIZEOF_${GLTYPE}=\$result
|
||||
done
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
|
||||
])
|
||||
|
||||
dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
|
||||
dnl Determine the signedness of each of the given types.
|
||||
dnl Define HAVE_SIGNED_TYPE if type is signed.
|
||||
AC_DEFUN([gl_CHECK_TYPES_SIGNED],
|
||||
[
|
||||
dnl Use a shell loop, to avoid bloating configure, and
|
||||
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
|
||||
dnl config.h.in,
|
||||
dnl - extra AC_SUBST calls, so that the right substitutions are made.
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
|
||||
[Define to 1 if ']gltype[' is a signed integer type.])])
|
||||
for gltype in $1 ; do
|
||||
AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([$2[
|
||||
int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
|
||||
result=yes, result=no)
|
||||
eval gl_cv_type_${gltype}_signed=\$result
|
||||
])
|
||||
eval result=\$gl_cv_type_${gltype}_signed
|
||||
GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
|
||||
if test "$result" = yes; then
|
||||
AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1)
|
||||
eval HAVE_SIGNED_${GLTYPE}=1
|
||||
else
|
||||
eval HAVE_SIGNED_${GLTYPE}=0
|
||||
fi
|
||||
done
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
|
||||
])
|
||||
|
||||
dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
|
||||
dnl Determine the suffix to use for integer constants of the given types.
|
||||
dnl Define t_SUFFIX for each such type.
|
||||
AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
|
||||
[
|
||||
dnl Use a shell loop, to avoid bloating configure, and
|
||||
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
|
||||
dnl config.h.in,
|
||||
dnl - extra AC_SUBST calls, so that the right substitutions are made.
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
|
||||
[Define to l, ll, u, ul, ull, etc., as suitable for
|
||||
constants of type ']gltype['.])])
|
||||
for gltype in $1 ; do
|
||||
AC_CACHE_CHECK([for $gltype integer literal suffix],
|
||||
[gl_cv_type_${gltype}_suffix],
|
||||
[eval gl_cv_type_${gltype}_suffix=no
|
||||
eval result=\$gl_cv_type_${gltype}_signed
|
||||
if test "$result" = yes; then
|
||||
glsufu=
|
||||
else
|
||||
glsufu=u
|
||||
fi
|
||||
for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
|
||||
case $glsuf in
|
||||
'') gltype1='int';;
|
||||
l) gltype1='long int';;
|
||||
ll) gltype1='long long int';;
|
||||
i64) gltype1='__int64';;
|
||||
u) gltype1='unsigned int';;
|
||||
ul) gltype1='unsigned long int';;
|
||||
ull) gltype1='unsigned long long int';;
|
||||
ui64)gltype1='unsigned __int64';;
|
||||
esac
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([$2
|
||||
extern $gltype foo;
|
||||
extern $gltype1 foo;])],
|
||||
[eval gl_cv_type_${gltype}_suffix=\$glsuf])
|
||||
eval result=\$gl_cv_type_${gltype}_suffix
|
||||
test "$result" != no && break
|
||||
done])
|
||||
GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
|
||||
eval result=\$gl_cv_type_${gltype}_suffix
|
||||
test "$result" = no && result=
|
||||
eval ${GLTYPE}_SUFFIX=\$result
|
||||
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
|
||||
done
|
||||
AC_FOREACH([gltype], [$1],
|
||||
[AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
|
||||
])
|
||||
|
||||
dnl gl_STDINT_INCLUDES
|
||||
AC_DEFUN([gl_STDINT_INCLUDES],
|
||||
[[
|
||||
/* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||
included before <wchar.h>. */
|
||||
#include <stddef.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
]])
|
||||
|
||||
dnl gl_STDINT_TYPE_PROPERTIES
|
||||
dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
|
||||
dnl of interest to stdint_.h.
|
||||
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
|
||||
[
|
||||
gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
gl_cv_type_ptrdiff_t_signed=yes
|
||||
gl_cv_type_size_t_signed=no
|
||||
gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
|
||||
[gl_STDINT_INCLUDES])
|
||||
])
|
||||
|
||||
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
|
||||
dnl Remove this when we can assume autoconf >= 2.61.
|
||||
m4_ifdef([AC_COMPUTE_INT], [], [
|
||||
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
|
||||
])
|
||||
|
||||
# Hey Emacs!
|
||||
# Local Variables:
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
26
gl/m4/stdint_h.m4
Normal file
26
gl/m4/stdint_h.m4
Normal file
|
@ -0,0 +1,26 @@
|
|||
# stdint_h.m4 serial 6
|
||||
dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert.
|
||||
|
||||
# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
|
||||
# doesn't clash with <sys/types.h>, and declares uintmax_t.
|
||||
|
||||
AC_DEFUN([gl_AC_HEADER_STDINT_H],
|
||||
[
|
||||
AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h,
|
||||
[AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>
|
||||
#include <stdint.h>],
|
||||
[uintmax_t i = (uintmax_t) -1; return !i;],
|
||||
gl_cv_header_stdint_h=yes,
|
||||
gl_cv_header_stdint_h=no)])
|
||||
if test $gl_cv_header_stdint_h = yes; then
|
||||
AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
|
||||
[Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
|
||||
and declares uintmax_t. ])
|
||||
fi
|
||||
])
|
39
gl/m4/strcase.m4
Normal file
39
gl/m4/strcase.m4
Normal file
|
@ -0,0 +1,39 @@
|
|||
# strcase.m4 serial 4
|
||||
dnl Copyright (C) 2002, 2005-2006 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_STRCASE],
|
||||
[
|
||||
gl_FUNC_STRCASECMP
|
||||
gl_FUNC_STRNCASECMP
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_STRCASECMP],
|
||||
[
|
||||
dnl No known system has a strcasecmp() function that works correctly in
|
||||
dnl multibyte locales. Therefore we use our version always.
|
||||
AC_LIBOBJ(strcasecmp)
|
||||
gl_PREREQ_STRCASECMP
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_STRNCASECMP],
|
||||
[
|
||||
AC_REPLACE_FUNCS(strncasecmp)
|
||||
AC_CHECK_DECLS(strncasecmp)
|
||||
if test $ac_cv_func_strncasecmp = no; then
|
||||
gl_PREREQ_STRNCASECMP
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/strcasecmp.c.
|
||||
AC_DEFUN([gl_PREREQ_STRCASECMP], [
|
||||
AC_REQUIRE([gl_FUNC_MBRTOWC])
|
||||
:
|
||||
])
|
||||
|
||||
# Prerequisites of lib/strncasecmp.c.
|
||||
AC_DEFUN([gl_PREREQ_STRNCASECMP], [
|
||||
:
|
||||
])
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue