Skip to content

Instantly share code, notes, and snippets.

@b4n
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save b4n/9751465 to your computer and use it in GitHub Desktop.

Select an option

Save b4n/9751465 to your computer and use it in GitHub Desktop.
No-libtool Autotools shared libraries: Welcome to Portability Hell
AC_PREREQ([2.64])
AC_INIT([tt], [0])
AC_CONFIG_SRCDIR([tt.c])
AC_CONFIG_AUX_DIR([build-auxf])
AC_CONFIG_MACRO_DIR([build-m4])
AM_INIT_AUTOMAKE([1.11 foreign -Wall])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
# alias libdir to prevent Automake from whining trying to be too smart
sodir = $(libdir)
so_PROGRAMS = libtt.so
bin_PROGRAMS = ttp
libtt_so_SOURCES = tt.c
libtt_so_CFLAGS = -fPIC
libtt_so_LDFLAGS = -shared
ttp_SOURCES = ttp.c
ttp_LDADD = -ltt -L$(builddir)
# FIXME: why does adding libtt.so as a dependency of "ttp$(EXEEXT)" breaks the
# build?? this is crazy. hack around by making target "all" depend on
# libtt.so before ttp$(EXEEXT)
#ttp$(EXEEXT): libtt.so
all: libtt.so ttp$(EXEEXT)
#include <stdio.h>
int foo (void) {
printf("foo!\n");
return 0;
}
extern int foo (void);
int main (void)
{
return foo ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment