Allow compilation from a build directory
authornemunaire <nemunaire@nemunai.re>
Wed, 27 Sep 2017 16:47:13 +0000 (18:47 +0200)
committerGuus Sliepen <guus@sliepen.org>
Tue, 3 Oct 2017 19:09:29 +0000 (21:09 +0200)
configure.ac
doc/Makefile.am
m4/Makefile.am
src/Makefile.am
src/system.h
src/xmalloc.c

index 55002913ac3b66f97a6223b97dee0a4116313004..7f1a671843b87378f9214a284194bd95198c140a 100644 (file)
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.61)
 AC_INIT([tinc], [1.0.32])
 AC_CONFIG_SRCDIR([src/tincd.c])
 AC_PREREQ(2.61)
 AC_INIT([tinc], [1.0.32])
 AC_CONFIG_SRCDIR([src/tincd.c])
-AM_INIT_AUTOMAKE([1.11 check-news std-options subdir-objects nostdinc silent-rules -Wall])
+AM_INIT_AUTOMAKE([1.11 check-news std-options subdir-objects nostdinc silent-rules -Wall info-in-builddir])
 AC_CONFIG_HEADERS([config.h])
 AM_MAINTAINER_MODE
 AM_SILENT_RULES([yes])
 AC_CONFIG_HEADERS([config.h])
 AM_MAINTAINER_MODE
 AM_SILENT_RULES([yes])
@@ -179,6 +179,8 @@ dnl Checks for libraries.
 dnl Checks for header files.
 dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
 
 dnl Checks for header files.
 dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
 
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I${srcdir}"
 AC_HEADER_STDC
 AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h arpa/nameser.h dirent.h getopt.h])
 AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/if_utun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h netpacket/packet.h],
 AC_HEADER_STDC
 AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h arpa/nameser.h dirent.h getopt.h])
 AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/if_utun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h netpacket/packet.h],
@@ -227,6 +229,8 @@ AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
   [], [], [#include "src/have.h"]
 )
 
   [], [], [#include "src/have.h"]
 )
 
+CPPFLAGS="$save_CPPFLAGS"
+
 AC_CHECK_DECLS([res_init], [AC_CHECK_LIB(resolv, res_init)], [], [
   #include <netinet/in.h>
   #include <resolv.h>
 AC_CHECK_DECLS([res_init], [AC_CHECK_LIB(resolv, res_init)], [], [
   #include <netinet/in.h>
   #include <resolv.h>
index 91b5b8d33382410a418912837e58e3d4cc80af79..95580cabedfc91ef32199f8e64ad184ddd5a9d31 100644 (file)
@@ -16,11 +16,11 @@ transform = s/ginstall/install/; @program_transform_name@
 # For additional rules usually of interest only to the maintainer,
 # see GNUmakefile and Makefile.maint.
 
 # For additional rules usually of interest only to the maintainer,
 # see GNUmakefile and Makefile.maint.
 
-sample-config.tar.gz: sample-config
-       $(AM_V_GEN)GZIP=$(GZIP_ENV) $(AMTAR) chozf sample-config.tar.gz --exclude .svn sample-config
+sample-config.tar.gz: $(srcdir)/sample-config
+       $(AM_V_GEN)GZIP=$(GZIP_ENV) $(AMTAR) chozf $@ --exclude .svn $<
 
 texi2html: tinc.texi
 
 texi2html: tinc.texi
-       $(AM_V_GEN)texi2html -split=chapter tinc.texi
+       $(AM_V_GEN)texi2html -split=chapter $<
 
 tincd.8.html: tincd.8
        $(AM_V_GEN)w3mman2html $< > $@
 
 tincd.8.html: tincd.8
        $(AM_V_GEN)w3mman2html $< > $@
@@ -34,13 +34,13 @@ substitute = sed \
        -e s,'@sysconfdir\@',"$(sysconfdir)",g \
        -e s,'@localstatedir\@',"$(localstatedir)",g
 
        -e s,'@sysconfdir\@',"$(sysconfdir)",g \
        -e s,'@localstatedir\@',"$(localstatedir)",g
 
-tincd.8: tincd.8.in
-       $(AM_V_GEN)$(substitute) tincd.8.in > tincd.8
+tincd.8: $(srcdir)/tincd.8.in
+       $(AM_V_GEN)$(substitute) $< > $@
 
 
-tinc.conf.5: tinc.conf.5.in
-       $(AM_V_GEN)$(substitute) tinc.conf.5.in > tinc.conf.5
+tinc.conf.5: $(srcdir)/tinc.conf.5.in
+       $(AM_V_GEN)$(substitute) $< > $@
+
+tincinclude.texi: $(srcdir)/tincinclude.texi.in
+       $(AM_V_GEN)$(substitute) $< > $@
 
 
-tincinclude.texi: tincinclude.texi.in
-       $(AM_V_GEN)$(substitute) tincinclude.texi.in > tincinclude.texi
-       
 tinc.texi: tincinclude.texi
 tinc.texi: tincinclude.texi
index 0f58aefab462a12ea99ba65c017063979d60fe48..1ff32a7c67ae5f58533a8b62d834ace2200ed6ce 100644 (file)
@@ -1,4 +1,3 @@
 ## Process this file with automake to produce Makefile.in   -*-Makefile-*-
 
 ## Process this file with automake to produce Makefile.in   -*-Makefile-*-
 
-EXTRA_DIST = README *.m4
-
+EXTRA_DIST = README attribute.m4 ax_append_flag.m4 ax_cflags_warn_all.m4 ax_check_compile_flag.m4 ax_check_link_flag.m4 ax_require_defined.m4 lzo.m4 openssl.m4 zlib.m4
index a5a9692238cd5d19fd7cf9c2c149be3babc3dda8..0b28139ed04b626dcb12ad8aaca7d84a271dda9a 100644 (file)
@@ -88,4 +88,4 @@ if TUNEMU
 LIBS += -lpcap
 endif
 
 LIBS += -lpcap
 endif
 
-AM_CPPFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\"
+AM_CPPFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -I $(abs_top_builddir)/
index e1734268406ffb7553794640e4ca0f1c0c8201ae..dfb4c6d7c69ad49fd83765caecc4880c8a142ae0 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __TINC_SYSTEM_H__
 #define __TINC_SYSTEM_H__
 
 #ifndef __TINC_SYSTEM_H__
 #define __TINC_SYSTEM_H__
 
-#include "../config.h"
+#include "config.h"
 
 #include "have.h"
 
 
 #include "have.h"
 
index a1b1fe8be87704d3cacdf37de7e2f728f1b9a2f8..1f354dd1a0360e3a32851737c7581eaf641cc84d 100644 (file)
@@ -16,7 +16,7 @@
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
 
 #if HAVE_CONFIG_H
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
 
 #if HAVE_CONFIG_H
-# include "../config.h"
+# include "config.h"
 #endif
 
 #include <sys/types.h>
 #endif
 
 #include <sys/types.h>