Skip to content

Commit

Permalink
Use gnulib to provide getopt_long()
Browse files Browse the repository at this point in the history
  • Loading branch information
mywave82 committed Apr 2, 2023
1 parent aa5d1a2 commit 1e2b5fd
Show file tree
Hide file tree
Showing 47 changed files with 9,395 additions and 1,424 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ compile
src/adplay
src/config.h*
src/.libs/
gnulib/*.a
gnulib/stddef.h
gnulib/sys/
gnulib/unistd.h
6 changes: 4 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SUBDIRS = src doc
SUBDIRS = gnulib src doc

EXTRA_DIST = adplay.spec adplay.qpg
EXTRA_DIST = adplay.spec adplay.qpg m4/gnulib/gnulib-cache.m4

AUTOMAKE_OPTIONS = dist-bzip2

ACLOCAL_AMFLAGS="-Im4" "-Im4/gnulib"
15 changes: 8 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Tell autoconf we're compiling a C++ program using automake and libtool.
AC_INIT([adplay],[1.9])
AC_CONFIG_SRCDIR(src/adplay.cc)
AC_CONFIG_FILES(Makefile src/Makefile doc/Makefile)
AC_CONFIG_FILES(Makefile gnulib/Makefile src/Makefile doc/Makefile)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([src/config.h])
LT_INIT
AC_LANG(C++)

# Check if we got a sane C/C++ compilation environment.
AC_PROG_INSTALL
AC_PROG_CC
gl_EARLY
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_CXXCPP

LT_INIT

AC_LANG(C++)

# Nothing works without these libraries...
AC_CHECK_LIB(stdc++,main,,AC_MSG_ERROR([libstdc++ not installed]))
PKG_CHECK_MODULES([adplug], [adplug >= 2.0],,[
Expand All @@ -23,10 +26,6 @@ I will try to do the old-style library search for which i cannot check \
versions. Please bear in mind that i am requiring at least version 1.4.])
AC_CHECK_LIB(adplug,main,,AC_MSG_ERROR([*** AdPlug not installed ***]))])

# Check if getopt header is installed on this system
AC_CHECK_HEADERS([getopt.h], ,
AC_SUBST(GETOPT_SOURCES, [getopt.c getopt1.c getopt.h]))

# Save compiler flags and set up for compiling test programs
oldlibs="$LIBS"
oldcppflags="$CPPFLAGS"
Expand Down Expand Up @@ -194,6 +193,8 @@ fi

AC_SUBST([drivers])

gl_INIT

AC_OUTPUT

# Display user informative configuration output
Expand Down
16 changes: 16 additions & 0 deletions gnulib.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
gnulib is a tool and library that can provide implementation of functionality not available on all operating systems and libc implementations.

Adplug currently uses gnulib to provide getopt_long().

To refresh to the latest version, do the following steps.

* Remove the old instance
* clone the gnulib repository outside of the Adplug source tree (In this example it is done in the parent directory)
* Reimport gnulib

rm -Rf m4/gnulib gnulib
pushd .
cd ..
git clone https://git.savannah.gnu.org/git/gnulib.git
popd
../gnulib/gnulib-tool --m4-base m4/gnulib/ --source-base gnulib --no-vc-files --import getopt-gnu
Loading

0 comments on commit 1e2b5fd

Please sign in to comment.