Permalink
Browse files

Autotools-based build logic

  • Loading branch information...
1 parent 4387857 commit d58e903c477c727cc9a05284a8ade008e3d9d71e @nevali nevali committed Aug 31, 2010
Showing with 164 additions and 20 deletions.
  1. +35 −1 .gitignore
  2. +3 −0 .gitmodules
  3. +0 −19 Makefile
  4. +42 −0 Makefile.am
  5. +1 −0 buildtools
  6. +62 −0 configure.ac
  7. +10 −0 libradiodns-uninstalled.pc.in
  8. +11 −0 libradiodns.pc.in
View
@@ -1,4 +1,38 @@
+*~
*.a
+*.la
+*.diff
+*.dll*
+*.exe
+*.mo
*.o
+*.lo
+*.pc
+*.pot
+*.so*
+.*.swp
+.depend
+.deps
+.libs
+.dirstamp
+/config.h
+/config.h.in
+/config.log
+/stamp-h1
+/stamp-h2
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/configure
+/libtool
+/config.status
+/config.sub
+/config.guess
+/depcomp
+/install-sh
+/ltmain.sh
+/missing
+/libradiodns.pc
+/libradiodns-uninstalled.pc
/radiodns
-
View
@@ -0,0 +1,3 @@
+[submodule "buildtools"]
+ path = buildtools
+ url = git://github.com/nexgenta/buildtools.git
View
@@ -1,19 +0,0 @@
-CFLAGS = -W -Wall -O0 -g
-LDFLAGS =
-LIBS = -Wl,-Bstatic -lresolv -Wl,-Bdynamic
-
-LIBOUT = libradiodns.a
-LIBOBJ = context.o resolver.o
-
-OUT = radiodns
-OBJ = cli.o
-
-$(OUT): $(OBJ) $(LIBOUT)
- $(CC) $(LDFLAGS) -o $(OUT) $(OBJ) $(LIBOUT) $(LIBS)
-
-$(LIBOUT): $(LIBOBJ)
- ar rcs $(LIBOUT) $(LIBOBJ)
-
-clean:
- rm -f $(OUT) $(OBJ)
- rm -f $(LIBOUT) $(LIBOBJ)
View
@@ -0,0 +1,42 @@
+## libradiodns: The RadioDNS helper library
+##
+## Copyright 2010 Mo McRoberts.
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+
+EXTRA_DIST = libradiodns.pc.in libradiodns-uninstalled.pc.in
+
+DISTCLEANFILES = libradiodns.pc libradiodns-uninstalled.pc
+
+pkgconfig_DATA = libradiodns.pc
+
+noinst_DATA = libradiodns-uninstalled.pc
+
+include_HEADERS = libradiodns.h
+
+lib_LTLIBRARIES = libradiodns.la
+
+libradiodns_la_SOURCES = p_radiodns.h \
+ context.c resolver.c
+
+libradiodns_la_LDFLAGS = -avoid-version
+libradiodns_la_LIBADD = @RESOLVER_LIBS@
+
+bin_PROGRAMS = radiodns
+
+radiodns_SOURCES = cli.c
+
+radiodns_LDADD = libradiodns.la @EXTRA_LIBS@
+radiodns_LDFLAGS = -static-libtool-libs
+
+
Submodule buildtools added at e78a82
View
@@ -0,0 +1,62 @@
+dnl libradiodns: The RadioDNS helper library
+dnl
+dnl Copyright 2010 Mo McRoberts.
+dnl
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+AC_INIT([libradiodns],[master])
+AM_INIT_AUTOMAKE([foreign])
+AM_MAINTAINER_MODE
+BUILDTOOLS_INIT
+
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+pkgconfigdir='$(libdir)/pkgconfig'
+AC_SUBST([pkgconfigdir])
+
+have_libresolv=no
+glibc_resolver_hack=no
+orig_LIBS="$LIBS"
+
+AC_CHECK_LIB([resolv],[res_query],[have_libresolv=yes])
+AC_CHECK_LIB([resolv],[__res_query],[have_libresolv=yes])
+
+if test x"$have_libresolv" = x"yes" ; then
+ AC_CHECK_LIB([resolv],[ns_parserr],,[
+ AC_CHECK_LIB([resolv],[__ns_parserr],,[glibc_resolver_hack=yes])
+ ])
+fi
+
+if test x"$have_libresolv" = x"no" ; then
+ AC_MSG_ERROR([cannot locate libresolv required to build libradiodns])
+fi
+
+if test x"$glibc_resolver_hack" = x"yes" ; then
+ AC_MSG_RESULT([warning: old broken glibc -lresolv detected, forcing use of /usr/lib/libresolv.la])
+ EXTRA_LIBS="/usr/lib/libresolv.a"
+else
+ RESOLVER_LIBS="-lresolv"
+fi
+
+AC_SUBST([RESOLVER_LIBS])
+AC_SUBST([EXTRA_LIBS])
+LIBS="$orig_LIBS"
+
+AC_CONFIG_HEADER([config.h])
+AC_CONFIG_FILES([Makefile
+libradiodns.pc
+libradiodns-uninstalled.pc
+])
+
+AC_OUTPUT
@@ -0,0 +1,10 @@
+prefix=
+exec_prefix=
+libdir=${pcfiledir}
+includedir=${pcfiledir}
+
+Name: libradiodns-@VERSION@ uninstalled
+Description: RadioDNS client library
+Version: @VERSION@
+Libs: -L${libdir} -lradiodns @RESOLVER_LIBS@ @EXTRA_LIBS@
+Cflags: -I${includedir}
View
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+toolsdir=@bindir@
+
+Name: libradiodns-@VERSION@
+Description: RadioDNS client library
+Version: @VERSION@
+Libs: -L${libdir} -lradiodns @RESOLVER_LIBS@ @EXTRA_LIBS@
+Cflags: -I${includedir}

0 comments on commit d58e903

Please sign in to comment.