summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-07-17 00:22:29 +0200
committerGravatar Nikias Bassen2012-07-17 00:22:29 +0200
commit954c5504a03a061ff43ec6c5334f342bd919badd (patch)
tree6f8cbdc8c846d62128bc33e851e370a3b65de0e7
parent0e4fb99549e0a1b4f5330598ec30a222e0fb75cc (diff)
downloadlibirecovery-954c5504a03a061ff43ec6c5334f342bd919badd.tar.gz
libirecovery-954c5504a03a061ff43ec6c5334f342bd919badd.tar.bz2
changed build system to autofoo. previous Makefile is now Makefile.shared
-rw-r--r--Makefile.am12
-rw-r--r--Makefile.shared (renamed from Makefile)0
-rwxr-xr-xautogen.sh15
-rw-r--r--configure.ac110
-rw-r--r--include/Makefile.am1
-rw-r--r--libirecovery.pc.in11
-rw-r--r--m4/as-compiler-flag.m462
-rw-r--r--src/Makefile.am17
8 files changed, 228 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..3c8e304
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,12 @@
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = src include
+
+DISTCHECK_CONFIGURE_FLAGS =
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libirecovery.pc
+
+indent:
+ indent -kr -ut -ts4 -l120 src/*.c src/*.h
+
diff --git a/Makefile b/Makefile.shared
index 05fd4ef..05fd4ef 100644
--- a/Makefile
+++ b/Makefile.shared
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..3292973
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+gprefix=`which glibtoolize 2>&1 >/dev/null`
+if [ $? -eq 0 ]; then
+ glibtoolize --force
+else
+ libtoolize --force
+fi
+aclocal -I m4
+autoheader
+automake --add-missing
+autoconf
+
+if [ -z "$NOCONFIGURE" ]; then
+ ./configure "$@"
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..a5afb57
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,110 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.61)
+AC_INIT(libirecovery, 0.1.0, nospam@nowhere.com)
+AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
+AC_CONFIG_SRCDIR([src/])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+dnl libtool versioning
+# +1 : 0 : +1 == adds new functions to the interface
+# +1 : 0 : 0 == changes or removes functions (changes include both
+# changes to the signature and the semantic)
+# ? :+1 : ? == just internal changes
+# CURRENT : REVISION : AGE
+LIBIRECOVERY_SO_VERSION=0:0:0
+
+AC_SUBST(LIBIRECOVERY_SO_VERSION)
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL
+
+# Checks for libraries.
+ACCFLAGS=
+ACLDFLAGS=
+ACLIBS=
+
+#echo $host_os
+case "$host_os" in
+ darwin*)
+ ACCFLAGS+="-I\$(top_srcdir)/include -I/usr/local/include -I/opt/local/include"
+ ACLDFLAGS+="-L/usr/lib -L/usr/local/lib -L/opt/local/lib"
+ ACLIBS+="-lusb-1.0 -framework CoreFoundation -framework IOKit"
+ ;;
+ linux*)
+ ACCFLAGS+="-fPIC -O3 -I\$(top_srcdir)/include -I/usr/include -I/usr/local/include"
+ ACLDFLAGS+="-L/usr/lib -L/usr/local/lib"
+ ACLIBS+="-lusb-1.0"
+ ;;
+ mingw32*)
+ ACCFLAGS+="-O3 -DWIN32 -I$(top_srcdir)/include -Ic:/mingw/include"
+ ACLDFLAGS+="-static-libgcc -Lc:/mingw/lib -Lc:/mingw/bin"
+ ACLIBS+="-lkernel32 -lmsvcrt -lsetupapi"
+ ;;
+ cygwin*)
+ CC=gcc-3
+ ACCFLAGS+="-O3 -DWIN32 -mno-cygwin -I$(top_srcdir)/include -I/usr/include"
+ ACLDFLAGS+="-static-libgcc -L/lib -L/usr/lib -L/bin"
+ ACLIBS+="-lkernel32 -lmsvcrt -lsetupapi"
+ ;;
+ *)
+
+ ;;
+esac
+
+IRECOVERY_LIBS=-lreadline
+AC_SUBST(IRECOVERY_LIBS)
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT8_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([strcasecmp strdup strerror strndup])
+
+AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter")
+AC_SUBST(GLOBAL_CFLAGS)
+
+LIBIRECOVERY_CFLAGS=$ACCFLAGS
+LIBIRECOVERY_CFLAGS+=$GLOBAL_CFLAGS
+LIBIRECOVERY_LDFLAGS=$ACLDFLAGS
+LIBIRECOVERY_LIBS=$ACLIBS
+
+AC_SUBST(LIBIRECOVERY_CFLAGS)
+AC_SUBST(LIBIRECOVERY_LDFLAGS)
+AC_SUBST(LIBIRECOVERY_LIBS)
+
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+
+AC_OUTPUT([
+Makefile
+src/Makefile
+include/Makefile
+libirecovery.pc
+])
+
+echo "
+Configuration for $PACKAGE $VERSION:
+-------------------------------------------
+
+ Install prefix: .........: $prefix
+
+ Now type 'make' to build $PACKAGE $VERSION,
+ and then 'make install' for installation.
+"
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..d0e4bd4
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1 @@
+nobase_include_HEADERS = libirecovery.h
diff --git a/libirecovery.pc.in b/libirecovery.pc.in
new file mode 100644
index 0000000..71f8e93
--- /dev/null
+++ b/libirecovery.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libirecovery
+Description: A library to talk to iBoot/iBSS in iDevices via USB
+Version: @VERSION@
+Libs: -L${libdir} -lirecovery
+Cflags: -I${includedir}
+
diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4
new file mode 100644
index 0000000..0f660cf
--- /dev/null
+++ b/m4/as-compiler-flag.m4
@@ -0,0 +1,62 @@
+dnl as-compiler-flag.m4 0.1.0
+
+dnl autostars m4 macro for detection of compiler flags
+
+dnl David Schleef <ds@schleef.org>
+
+dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
+
+dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
+dnl Tries to compile with the given CFLAGS.
+dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
+dnl and ACTION-IF-NOT-ACCEPTED otherwise.
+
+AC_DEFUN([AS_COMPILER_FLAG],
+[
+ AC_MSG_CHECKING([to see if compiler understands $1])
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+
+ AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
+ CFLAGS="$save_CFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ m4_ifvaln([$2],[$2])
+ true
+ else
+ m4_ifvaln([$3],[$3])
+ true
+ fi
+ AC_MSG_RESULT([$flag_ok])
+])
+
+dnl AS_COMPILER_FLAGS(VAR, FLAGS)
+dnl Tries to compile with the given CFLAGS.
+
+AC_DEFUN([AS_COMPILER_FLAGS],
+[
+ list=$2
+ flags_supported=""
+ flags_unsupported=""
+ AC_MSG_CHECKING([for supported compiler flags])
+ for each in $list
+ do
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $each"
+ AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
+ CFLAGS="$save_CFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ flags_supported="$flags_supported $each"
+ else
+ flags_unsupported="$flags_unsupported $each"
+ fi
+ done
+ AC_MSG_RESULT([$flags_supported])
+ if test "X$flags_unsupported" != X ; then
+ AC_MSG_WARN([unsupported compiler flags: $flags_unsupported])
+ fi
+ $1="$$1 $flags_supported"
+])
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..a7027ee
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,17 @@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+AM_CFLAGS = $(LIBIRECOVERY_CFLAGS)
+AM_LDFLAGS = $(LIBIRECOVERY_LDFLAGS)
+AM_LIBS = $(LIBIRECOVERY_LIBS)
+
+lib_LTLIBRARIES = libirecovery.la
+libirecovery_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBIRECOVERY_SO_VERSION) -no-undefined $(AM_LIBS)
+libirecovery_la_SOURCES = \
+ libirecovery.c
+
+bin_PROGRAMS = irecovery
+
+irecovery_SOURCES = irecovery.c
+irecovery_CFLAGS = $(AM_CFLAGS)
+irecovery_LDFLAGS = $(AM_LDFLAGS) $(IRECOVERY_LIBS)
+irecovery_LDADD = ./libirecovery.la