popt library for Windows.
[fedora-mingw.git] / popt / popt-win.patch
diff --git a/popt/popt-win.patch b/popt/popt-win.patch
new file mode 100644 (file)
index 0000000..8ad868c
--- /dev/null
@@ -0,0 +1,158 @@
+diff -urN --exclude CVS popt/autogen.sh popt.win/autogen.sh
+--- popt/autogen.sh    2008-02-11 16:48:11.000000000 +0000
++++ popt.win/autogen.sh        2008-10-25 14:54:06.000000000 +0100
+@@ -5,6 +5,8 @@
+ THEDIR="`pwd`"
++../gnulib/gnulib-tool --update
++
+ libtoolize=`which glibtoolize 2>/dev/null`
+ case $libtoolize in
+ /*) ;;
+diff -urN --exclude CVS popt/configure.ac popt.win/configure.ac
+--- popt/configure.ac  2008-10-04 20:23:50.000000000 +0100
++++ popt.win/configure.ac      2008-10-25 14:57:59.000000000 +0100
+@@ -1,4 +1,4 @@
+-AC_PREREQ(2.57)
++AC_PREREQ([2.59])
+ AC_INIT(popt, 1.15, popt-devel@rpm5.org)
+ AC_CANONICAL_TARGET
+ AC_CONFIG_SRCDIR([popt.h])
+@@ -17,6 +17,7 @@
+ ALL_LINGUAS="cs da de eo es fi fr ga gl hu id is it ja ko nb nl pl pt ro ru sk sl sv th tr uk vi wa zh_TW zh_CN"
+ AC_PROG_CC
++gl_EARLY
+ AC_PROG_INSTALL
+ AC_PROG_LIBTOOL
+@@ -44,7 +45,10 @@
+ AC_ISC_POSIX
+ AM_C_PROTOTYPES
+-AC_CHECK_HEADERS(float.h glob.h langinfo.h libintl.h mcheck.h unistd.h)
++dnl Gnulib tests.
++gl_INIT
++
++AC_CHECK_HEADERS(float.h glob.h langinfo.h libintl.h mcheck.h unistd.h sys/ioctl.h)
+ # For some systems we know that we have ld_version scripts.
+ # Use it then as default.
+@@ -68,7 +72,7 @@
+ AC_CHECK_FUNC(setreuid, [], [
+     AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
+ ])
+-AC_CHECK_FUNCS(getuid geteuid iconv mtrace __secure_getenv setregid stpcpy strerror vasprintf)
++AC_CHECK_FUNCS(getuid geteuid iconv mtrace __secure_getenv setregid stpcpy strerror vasprintf random srandom)
+ AM_GNU_GETTEXT([external])
+ AM_ICONV_LINK
+@@ -82,4 +86,4 @@
+       [Full path to popt top_srcdir.])
+ AC_SUBST(POPT_SOURCE_PATH)
+-AC_OUTPUT([Doxyfile Makefile po/Makefile.in])
++AC_OUTPUT([Doxyfile Makefile lib/Makefile])
+diff -urN --exclude CVS popt/.cvsignore popt.win/.cvsignore
+--- popt/.cvsignore    2008-05-05 20:27:31.000000000 +0100
++++ popt.win/.cvsignore        2008-10-25 14:27:02.000000000 +0100
+@@ -41,3 +41,4 @@
+ *.lo
+ *.swp
+ popt-*.tar.gz
++link-warning.h
+diff -urN --exclude CVS popt/m4/gnulib-cache.m4 popt.win/m4/gnulib-cache.m4
+--- popt/m4/gnulib-cache.m4    1970-01-01 01:00:00.000000000 +0100
++++ popt.win/m4/gnulib-cache.m4        2008-10-25 14:27:02.000000000 +0100
+@@ -0,0 +1,35 @@
++# Copyright (C) 2002-2008 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 specification of how gnulib-tool is used.
++# It acts as a cache: It is written and read by gnulib-tool.
++# In projects using CVS, this file is meant to be stored in CVS,
++# like the configure.ac and various Makefile.am files.
++
++
++# Specification in the form of a command-line invocation:
++#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --libtool --macro-prefix=gl glob
++
++# Specification in the form of a few gnulib-tool.m4 macro invocations:
++gl_LOCAL_DIR([])
++gl_MODULES([
++  glob
++])
++gl_AVOID([])
++gl_SOURCE_BASE([lib])
++gl_M4_BASE([m4])
++gl_PO_BASE([])
++gl_DOC_BASE([doc])
++gl_TESTS_BASE([tests])
++gl_LIB([libgnu])
++gl_MAKEFILE_NAME([])
++gl_LIBTOOL
++gl_MACRO_PREFIX([gl])
++gl_PO_DOMAIN([])
+diff -urN --exclude CVS popt/Makefile.am popt.win/Makefile.am
+--- popt/Makefile.am   2008-09-18 19:08:58.000000000 +0100
++++ popt.win/Makefile.am       2008-10-25 14:56:28.000000000 +0100
+@@ -8,9 +8,10 @@
+       footer_no_timestamp.html libpopt.vers \
+       testit.sh test-poptrc test3-data/0* \
+       po/*.in po/*.po po/popt.pot \
+-      popt.ps
++      popt.ps \
++      m4/gnulib-cache.m4
+-SUBDIRS = po
++SUBDIRS = lib po
+ INCLUDES = -I. -I$(top_srcdir)
+diff -urN --exclude CVS popt/popt.c popt.win/popt.c
+--- popt/popt.c        2008-05-05 18:38:33.000000000 +0100
++++ popt.win/popt.c    2008-10-25 14:38:29.000000000 +0100
+@@ -725,6 +725,21 @@
+ /*@=unqualifiedtrans =nullstate@*/
+ }
++/* Win32 typically lacks random/srandom, but has rand/srand which
++ * produces frankly rubbish random numbers and has RAND_MAX = 0x7FFF.
++ */
++#ifndef HAVE_RANDOM
++static int
++random ()
++{
++  return rand () << 15 | rand ();
++}
++#endif
++
++#ifndef HAVE_SRANDOM
++#define srandom srand
++#endif
++
+ /*@unchecked@*/
+ static unsigned int seed = 0;
+diff -urN --exclude CVS popt/popthelp.c popt.win/popthelp.c
+--- popt/popthelp.c    2008-04-26 22:57:32.000000000 +0100
++++ popt.win/popthelp.c        2008-10-25 14:35:01.000000000 +0100
+@@ -12,8 +12,10 @@
+ #define        POPT_USE_TIOCGWINSZ
+ #ifdef POPT_USE_TIOCGWINSZ
++#ifdef HAVE_SYS_IOCTL_H
+ #include <sys/ioctl.h>
+ #endif
++#endif
+ #define       POPT_WCHAR_HACK
+ #ifdef        POPT_WCHAR_HACK