author | Florian Forster <ff@octo.it> | |
Thu, 25 Sep 2014 00:22:44 +0000 (17:22 -0700) | ||
committer | Florian Forster <ff@octo.it> | |
Thu, 25 Sep 2014 00:22:44 +0000 (17:22 -0700) |
minor build system tweaks, to generate oping.pc file for pkg-config oping
1 | 2 | |||
---|---|---|---|---|
configure.ac | patch | | diff1 | | diff2 | | blob | history |
src/Makefile.am | patch | | diff1 | | diff2 | | blob | history |
diff --combined configure.ac
index f9be869823222ccc4ea30ccdb8dadd37c502e345,e2208225fe6c97dc23377cc58554f02bf4b3e8f9..6e775e2bb9db9d9871762ec0c52cea262a50c1da
--- 1/configure.ac
--- 2/configure.ac
+++ b/configure.ac
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
- AC_INIT([liboping],[1.6.2])
+ AC_INIT([liboping],[1.6.2],[ff@octo.it],,[http://github.com/octo/liboping/])
AC_CONFIG_SRCDIR([src/liboping.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
# configure libtool
LT_INIT([dlopen])
+ # pkg-config interface
+ PKG_INSTALLDIR
+
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
-AC_CHECK_HEADERS([math.h signal.h fcntl.h inttypes.h netdb.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
+AC_CHECK_HEADERS([math.h signal.h fcntl.h inttypes.h netdb.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h locale.h langinfo.h])
# This sucks, but what can I do..?
AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
AC_MSG_ERROR(cannot find nanosleep)))
AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
-with_ncurses="yes"
-AC_CHECK_HEADERS(ncurses.h, [with_ncurses="yes"], [with_ncurses="no"])
+with_ncurses="no"
+AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], [])
if test "x$with_ncurses" = "xyes"
then
- AC_CHECK_LIB(ncurses, mvwprintw, [with_ncurses="yes"], [with_ncurses="no"])
+ have_ncursesw="no"
+ have_ncurses="no"
+ NCURSES_LIB=""
+
+ AC_CHECK_LIB(ncursesw, mvwprintw, [have_ncursesw="yes"], [have_ncursesw="no"])
+ AC_CHECK_LIB(ncurses, mvwprintw, [have_ncurses="yes"], [have_ncurses="no"])
+
+ if test "x$have_ncursesw" = "xyes"; then
+ NCURSES_LIB="-lncursesw"
+ else if test "x$have_ncurses" = "xyes"; then
+ NCURSES_LIB="-lncurses"
+ else
+ with_ncurses="no"
+ fi; fi
+ AC_SUBST(NCURSES_LIB)
fi
AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
diff --combined src/Makefile.am
index 844e0a4d0eefe569c6cacca3fb3ee4be248d4026,7278c688342b042b6b2bed6f763a9be7bb020f3f..65d7adbe63f119f030247fc42d368e5d5f8842eb
--- 1/src/Makefile.am
--- 2/src/Makefile.am
+++ b/src/Makefile.am
liboping_la_LIBADD += -lxnet
endif
+ oping.pc:
+ echo 'prefix=$(prefix)' > $@
+ echo 'exec_prefix=$(exec_prefix)' >> $@
+ echo 'includedir=$(includedir)' >> $@
+ echo 'libdir=$(libdir)' >> $@
+ echo >> $@
+ echo 'Name: $(PACKAGE_TARNAME)' >> $@
+ echo 'Description: $(PACKAGE_NAME)' >> $@
+ echo 'URL: $(PACKAGE_URL)' >> $@
+ echo 'Version: $(PACKAGE_VERSION)' >> $@
+ echo 'Cflags: -I${includedir}' >> $@
+ echo 'Libs: -L${libdir} -loping' >> $@
+ echo 'Libs.private: $(AM_LDFLAGS) $(LIBS) $(liboping_la_LIBADD)' >> $@
+
+ pkgconfig_DATA = oping.pc
+
+ MOSTLYCLEANFILES = $(pkgconfig_DATA)
+
bin_PROGRAMS = oping
oping_SOURCES = oping.c
noping_SOURCES = oping.c
noping_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_NCURSES=1
-noping_LDADD = liboping.la -lm -lncurses
+noping_LDADD = liboping.la -lm $(NCURSES_LIB)
if BUILD_WITH_LIBRT
noping_LDADD += -lrt
endif