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 @@
1AUTOMAKE_OPTIONS = foreign
2ACLOCAL_AMFLAGS = -I m4
3SUBDIRS = src include
4
5DISTCHECK_CONFIGURE_FLAGS =
6
7pkgconfigdir = $(libdir)/pkgconfig
8pkgconfig_DATA = libirecovery.pc
9
10indent:
11 indent -kr -ut -ts4 -l120 src/*.c src/*.h
12
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 @@
1#!/bin/sh
2gprefix=`which glibtoolize 2>&1 >/dev/null`
3if [ $? -eq 0 ]; then
4 glibtoolize --force
5else
6 libtoolize --force
7fi
8aclocal -I m4
9autoheader
10automake --add-missing
11autoconf
12
13if [ -z "$NOCONFIGURE" ]; then
14 ./configure "$@"
15fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..a5afb57
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,110 @@
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.61)
5AC_INIT(libirecovery, 0.1.0, nospam@nowhere.com)
6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
8AC_CONFIG_SRCDIR([src/])
9AC_CONFIG_HEADERS([config.h])
10AC_CONFIG_MACRO_DIR([m4])
11
12dnl libtool versioning
13# +1 : 0 : +1 == adds new functions to the interface
14# +1 : 0 : 0 == changes or removes functions (changes include both
15# changes to the signature and the semantic)
16# ? :+1 : ? == just internal changes
17# CURRENT : REVISION : AGE
18LIBIRECOVERY_SO_VERSION=0:0:0
19
20AC_SUBST(LIBIRECOVERY_SO_VERSION)
21
22# Checks for programs.
23AC_PROG_CC
24AC_PROG_CXX
25AM_PROG_CC_C_O
26AC_PROG_LIBTOOL
27
28# Checks for libraries.
29ACCFLAGS=
30ACLDFLAGS=
31ACLIBS=
32
33#echo $host_os
34case "$host_os" in
35 darwin*)
36 ACCFLAGS+="-I\$(top_srcdir)/include -I/usr/local/include -I/opt/local/include"
37 ACLDFLAGS+="-L/usr/lib -L/usr/local/lib -L/opt/local/lib"
38 ACLIBS+="-lusb-1.0 -framework CoreFoundation -framework IOKit"
39 ;;
40 linux*)
41 ACCFLAGS+="-fPIC -O3 -I\$(top_srcdir)/include -I/usr/include -I/usr/local/include"
42 ACLDFLAGS+="-L/usr/lib -L/usr/local/lib"
43 ACLIBS+="-lusb-1.0"
44 ;;
45 mingw32*)
46 ACCFLAGS+="-O3 -DWIN32 -I$(top_srcdir)/include -Ic:/mingw/include"
47 ACLDFLAGS+="-static-libgcc -Lc:/mingw/lib -Lc:/mingw/bin"
48 ACLIBS+="-lkernel32 -lmsvcrt -lsetupapi"
49 ;;
50 cygwin*)
51 CC=gcc-3
52 ACCFLAGS+="-O3 -DWIN32 -mno-cygwin -I$(top_srcdir)/include -I/usr/include"
53 ACLDFLAGS+="-static-libgcc -L/lib -L/usr/lib -L/bin"
54 ACLIBS+="-lkernel32 -lmsvcrt -lsetupapi"
55 ;;
56 *)
57
58 ;;
59esac
60
61IRECOVERY_LIBS=-lreadline
62AC_SUBST(IRECOVERY_LIBS)
63
64# Checks for header files.
65AC_HEADER_STDC
66AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
67
68# Checks for typedefs, structures, and compiler characteristics.
69AC_C_CONST
70AC_TYPE_SIZE_T
71AC_TYPE_SSIZE_T
72AC_TYPE_UINT16_T
73AC_TYPE_UINT32_T
74AC_TYPE_UINT8_T
75
76# Checks for library functions.
77AC_FUNC_MALLOC
78AC_FUNC_REALLOC
79AC_CHECK_FUNCS([strcasecmp strdup strerror strndup])
80
81AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter")
82AC_SUBST(GLOBAL_CFLAGS)
83
84LIBIRECOVERY_CFLAGS=$ACCFLAGS
85LIBIRECOVERY_CFLAGS+=$GLOBAL_CFLAGS
86LIBIRECOVERY_LDFLAGS=$ACLDFLAGS
87LIBIRECOVERY_LIBS=$ACLIBS
88
89AC_SUBST(LIBIRECOVERY_CFLAGS)
90AC_SUBST(LIBIRECOVERY_LDFLAGS)
91AC_SUBST(LIBIRECOVERY_LIBS)
92
93m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
94
95AC_OUTPUT([
96Makefile
97src/Makefile
98include/Makefile
99libirecovery.pc
100])
101
102echo "
103Configuration for $PACKAGE $VERSION:
104-------------------------------------------
105
106 Install prefix: .........: $prefix
107
108 Now type 'make' to build $PACKAGE $VERSION,
109 and then 'make install' for installation.
110"
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 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4includedir=@includedir@
5
6Name: libirecovery
7Description: A library to talk to iBoot/iBSS in iDevices via USB
8Version: @VERSION@
9Libs: -L${libdir} -lirecovery
10Cflags: -I${includedir}
11
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 @@
1dnl as-compiler-flag.m4 0.1.0
2
3dnl autostars m4 macro for detection of compiler flags
4
5dnl David Schleef <ds@schleef.org>
6
7dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
8
9dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
10dnl Tries to compile with the given CFLAGS.
11dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
12dnl and ACTION-IF-NOT-ACCEPTED otherwise.
13
14AC_DEFUN([AS_COMPILER_FLAG],
15[
16 AC_MSG_CHECKING([to see if compiler understands $1])
17
18 save_CFLAGS="$CFLAGS"
19 CFLAGS="$CFLAGS $1"
20
21 AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
22 CFLAGS="$save_CFLAGS"
23
24 if test "X$flag_ok" = Xyes ; then
25 m4_ifvaln([$2],[$2])
26 true
27 else
28 m4_ifvaln([$3],[$3])
29 true
30 fi
31 AC_MSG_RESULT([$flag_ok])
32])
33
34dnl AS_COMPILER_FLAGS(VAR, FLAGS)
35dnl Tries to compile with the given CFLAGS.
36
37AC_DEFUN([AS_COMPILER_FLAGS],
38[
39 list=$2
40 flags_supported=""
41 flags_unsupported=""
42 AC_MSG_CHECKING([for supported compiler flags])
43 for each in $list
44 do
45 save_CFLAGS="$CFLAGS"
46 CFLAGS="$CFLAGS $each"
47 AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
48 CFLAGS="$save_CFLAGS"
49
50 if test "X$flag_ok" = Xyes ; then
51 flags_supported="$flags_supported $each"
52 else
53 flags_unsupported="$flags_unsupported $each"
54 fi
55 done
56 AC_MSG_RESULT([$flags_supported])
57 if test "X$flags_unsupported" != X ; then
58 AC_MSG_WARN([unsupported compiler flags: $flags_unsupported])
59 fi
60 $1="$$1 $flags_supported"
61])
62
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 @@
1AM_CPPFLAGS = -I$(top_srcdir)/include
2
3AM_CFLAGS = $(LIBIRECOVERY_CFLAGS)
4AM_LDFLAGS = $(LIBIRECOVERY_LDFLAGS)
5AM_LIBS = $(LIBIRECOVERY_LIBS)
6
7lib_LTLIBRARIES = libirecovery.la
8libirecovery_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBIRECOVERY_SO_VERSION) -no-undefined $(AM_LIBS)
9libirecovery_la_SOURCES = \
10 libirecovery.c
11
12bin_PROGRAMS = irecovery
13
14irecovery_SOURCES = irecovery.c
15irecovery_CFLAGS = $(AM_CFLAGS)
16irecovery_LDFLAGS = $(AM_LDFLAGS) $(IRECOVERY_LIBS)
17irecovery_LDADD = ./libirecovery.la