Skip to content

Commit

Permalink
update Expat and Xerces autoconf files
Browse files Browse the repository at this point in the history
  • Loading branch information
msheby committed Sep 1, 2023
1 parent 50958df commit b0df1c8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 59 deletions.
66 changes: 34 additions & 32 deletions m4/ax_lib_expat.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
##### http://autoconf-archive.cryp.to/ax_lib_expat.html
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_lib_expat.html
# ===========================================================================
#
# SYNOPSIS
#
Expand Down Expand Up @@ -26,29 +28,29 @@
# This macro calls:
#
# AC_SUBST(EXPAT_CFLAGS)
# AC_SUBST(EXPAT_LIBS)
# AC_SUBST(EXPAT_LDFLAGS)
# AC_SUBST(EXPAT_VERSION) -- only if version requirement is used
#
# And sets:
#
# HAVE_EXPAT
#
# LAST MODIFICATION
# LICENSE
#
# 2007-12-05
# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
#
# COPYLEFT
#
# Copyright (c) 2007 Mateusz Loskot <mateusz@loskot.net>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.

#serial 11

AC_DEFUN([AX_LIB_EXPAT],
[
AC_ARG_WITH([expat],
AC_HELP_STRING([--with-expat=@<:@ARG@:>@],
AS_HELP_STRING([--with-expat=@<:@ARG@:>@],
[use Expat XML Parser from given prefix (ARG=path); check standard prefixes (ARG=yes); disable (ARG=no)]
),
[
Expand All @@ -70,37 +72,34 @@ AC_DEFUN([AX_LIB_EXPAT],
fi
],
[
# dnl Default behavior is implicit yes
# if test -f /usr/local/include/expat.h ; then
# expat_prefix=/usr/local
# elif test -f /usr/include/expat.h ; then
# expat_prefix=/usr
# else
# expat_prefix=""
# fi
dnl Default behavior is implicit no
expat_prefix=""
expat_requested="no"
dnl Default behavior is implicit yes
if test -f /usr/local/include/expat.h ; then
expat_prefix=/usr/local
elif test -f /usr/include/expat.h ; then
expat_prefix=/usr
else
expat_prefix=""
fi
]
)
AC_ARG_WITH([expat-inc],
AC_HELP_STRING([--with-expat-inc=@<:@DIR@:>@],
AS_HELP_STRING([--with-expat-inc=@<:@DIR@:>@],
[path to Expat XML Parser headers]
),
[expat_include_dir="$withval"],
[expat_include_dir=""]
)
AC_ARG_WITH([expat-lib],
AC_HELP_STRING([--with-expat-lib=@<:@ARG@:>@],
AS_HELP_STRING([--with-expat-lib=@<:@ARG@:>@],
[link options for Expat XML Parser libraries]
),
[expat_lib_flags="$withval"],
[expat_lib_flags=""]
)
EXPAT_CFLAGS=""
EXPAT_LDFLAGS=""
EXPAT_LIBS=""
EXPAT_VERSION=""
dnl
Expand All @@ -110,7 +109,8 @@ AC_DEFUN([AX_LIB_EXPAT],
if test -n "$expat_prefix"; then
expat_include_dir="$expat_prefix/include"
expat_lib_flags="-L$expat_prefix/lib64 -L$expat_prefix/lib -lexpat"
expat_ld_flags="-L$expat_prefix/lib"
expat_lib_flags="-lexpat"
run_expat_test="yes"
elif test "$expat_requested" = "yes"; then
if test -n "$expat_include_dir" -a -n "$expat_lib_flags"; then
Expand All @@ -128,8 +128,11 @@ AC_DEFUN([AX_LIB_EXPAT],
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$expat_include_dir"
saved_LIBS="$LIBS"
LIBS="$LIBS $expat_lib_flags"
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $expat_lib_flags"
LDFLAGS="$LDFLAGS $expat_ld_flags"
dnl
dnl Check Expat headers
Expand Down Expand Up @@ -176,7 +179,8 @@ p = NULL;
]]
)],
[
EXPAT_LDFLAGS="$expat_lib_flags"
EXPAT_LIBS="$expat_lib_flags"
EXPAT_LDFLAGS="$expat_ld_flags"
expat_lib_found="yes"
AC_MSG_RESULT([found])
],
Expand All @@ -190,6 +194,7 @@ p = NULL;
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS"
fi
AC_MSG_CHECKING([for Expat XML Parser])
Expand All @@ -199,6 +204,7 @@ p = NULL;
AC_SUBST([EXPAT_CFLAGS])
AC_SUBST([EXPAT_LDFLAGS])
AC_SUBST([EXPAT_LIBS])
HAVE_EXPAT="yes"
else
Expand Down Expand Up @@ -274,8 +280,4 @@ p = NULL;
AC_MSG_WARN([Expat XML Parser support requested but headers or library not found. Specify valid prefix of Expat using --with-expat=@<:@DIR@:>@ or provide include directory and linker flags using --with-expat-inc and --with-expat-lib])
fi
fi
if test "$HAVE_EXPAT" = "yes"; then
CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS -DHAVE_EXPAT=1"
LDFLAGS="$LDFLAGS $EXPAT_LDFLAGS"
fi
])
46 changes: 19 additions & 27 deletions m4/ax_lib_xerces.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_lib_xerces.html
# https://www.gnu.org/software/autoconf-archive/ax_lib_xerces.html
# ===========================================================================
#
# SYNOPSIS
Expand Down Expand Up @@ -34,24 +34,23 @@
#
# HAVE_XERCES
#
# LAST MODIFICATION
#
# 2008-04-12
#
# COPYLEFT
# LICENSE
#
# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
# and this notice are preserved. This file is offered as-is, without any
# warranty.

#serial 11

AC_DEFUN([AX_LIB_XERCES],
[
# AC_REQUIRE([ACX_PTHREAD])
AC_REQUIRE([AX_PTHREAD])
AC_ARG_WITH([xerces],
AC_HELP_STRING([--with-xerces=@<:@ARG@:>@],
AS_HELP_STRING([--with-xerces=@<:@ARG@:>@],
[use Xerces C++ Parser from given prefix (ARG=path); check standard prefixes (ARG=yes); disable (ARG=no)]
),
[
Expand All @@ -73,29 +72,26 @@ AC_DEFUN([AX_LIB_XERCES],
fi
],
[
# dnl Default behavior is implicit yes
# if test -d /usr/local/include/xercesc ; then
# xerces_prefix=/usr/local
# elif test -d /usr/include/xercesc ; then
# xerces_prefix=/usr
# else
# xerces_prefix=""
# fi
dnl Default behavior is implicit no
xerces_prefix=""
xerces_requested="no"
dnl Default behavior is implicit yes
if test -d /usr/local/include/xercesc ; then
xerces_prefix=/usr/local
elif test -d /usr/include/xercesc ; then
xerces_prefix=/usr
else
xerces_prefix=""
fi
]
)
AC_ARG_WITH([xerces-inc],
AC_HELP_STRING([--with-xerces-inc=@<:@DIR@:>@],
AS_HELP_STRING([--with-xerces-inc=@<:@DIR@:>@],
[path to Xerces C++ Parser headers]
),
[xerces_include_dir="$withval"],
[xerces_include_dir=""]
)
AC_ARG_WITH([xerces-lib],
AC_HELP_STRING([--with-xerces-lib=@<:@ARG@:>@],
AS_HELP_STRING([--with-xerces-lib=@<:@ARG@:>@],
[link options for Xerces C++ Parser libraries]
),
[xerces_ldflags="$withval"],
Expand Down Expand Up @@ -136,7 +132,7 @@ AC_DEFUN([AX_LIB_XERCES],
CPPFLAGS="$CPPFLAGS -I$xerces_include_dir -I$xerces_include_dir2"
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$xerces_ldflags $PTHREAD_LDFLAGS $LDFLAGS"
LDFLAGS="$LDFLAGS $xerces_ldflags $PTHREAD_LDFLAGS"
saved_LIBS="$LIBS"
LIBS="$xerces_libs $PTHREAD_LIBS $LIBS"
Expand Down Expand Up @@ -290,8 +286,4 @@ XMLPlatformUtils::Initialize();
AC_MSG_WARN([Xerces C++ Parser support requested but headers or library not found. Specify valid prefix of Xerces C++ using --with-xerces=@<:@DIR@:>@ or provide include directory and linker flags using --with-xerces-inc and --with-xerces-lib])
fi
fi
if test "$HAVE_XERCES" = "yes"; then
CPPFLAGS="$CPPFLAGS $XERCES_CPPFLAGS -DHAVE_XERCES_C=1"
LDFLAGS="$LDFLAGS $XERCES_LDFLAGS $XERCES_LIBS"
fi
])

0 comments on commit b0df1c8

Please sign in to comment.