diff options
| author | 2012-07-17 00:22:29 +0200 | |
|---|---|---|
| committer | 2012-07-17 00:22:29 +0200 | |
| commit | 954c5504a03a061ff43ec6c5334f342bd919badd (patch) | |
| tree | 6f8cbdc8c846d62128bc33e851e370a3b65de0e7 | |
| parent | 0e4fb99549e0a1b4f5330598ec30a222e0fb75cc (diff) | |
| download | libirecovery-954c5504a03a061ff43ec6c5334f342bd919badd.tar.gz libirecovery-954c5504a03a061ff43ec6c5334f342bd919badd.tar.bz2 | |
changed build system to autofoo. previous Makefile is now Makefile.shared
| -rw-r--r-- | Makefile.am | 12 | ||||
| -rw-r--r-- | Makefile.shared (renamed from Makefile) | 0 | ||||
| -rwxr-xr-x | autogen.sh | 15 | ||||
| -rw-r--r-- | configure.ac | 110 | ||||
| -rw-r--r-- | include/Makefile.am | 1 | ||||
| -rw-r--r-- | libirecovery.pc.in | 11 | ||||
| -rw-r--r-- | m4/as-compiler-flag.m4 | 62 | ||||
| -rw-r--r-- | src/Makefile.am | 17 |
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 @@ | |||
| 1 | AUTOMAKE_OPTIONS = foreign | ||
| 2 | ACLOCAL_AMFLAGS = -I m4 | ||
| 3 | SUBDIRS = src include | ||
| 4 | |||
| 5 | DISTCHECK_CONFIGURE_FLAGS = | ||
| 6 | |||
| 7 | pkgconfigdir = $(libdir)/pkgconfig | ||
| 8 | pkgconfig_DATA = libirecovery.pc | ||
| 9 | |||
| 10 | indent: | ||
| 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 | ||
| 2 | gprefix=`which glibtoolize 2>&1 >/dev/null` | ||
| 3 | if [ $? -eq 0 ]; then | ||
| 4 | glibtoolize --force | ||
| 5 | else | ||
| 6 | libtoolize --force | ||
| 7 | fi | ||
| 8 | aclocal -I m4 | ||
| 9 | autoheader | ||
| 10 | automake --add-missing | ||
| 11 | autoconf | ||
| 12 | |||
| 13 | if [ -z "$NOCONFIGURE" ]; then | ||
| 14 | ./configure "$@" | ||
| 15 | 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 @@ | |||
| 1 | # -*- Autoconf -*- | ||
| 2 | # Process this file with autoconf to produce a configure script. | ||
| 3 | |||
| 4 | AC_PREREQ(2.61) | ||
| 5 | AC_INIT(libirecovery, 0.1.0, nospam@nowhere.com) | ||
| 6 | AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) | ||
| 7 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) | ||
| 8 | AC_CONFIG_SRCDIR([src/]) | ||
| 9 | AC_CONFIG_HEADERS([config.h]) | ||
| 10 | AC_CONFIG_MACRO_DIR([m4]) | ||
| 11 | |||
| 12 | dnl 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 | ||
| 18 | LIBIRECOVERY_SO_VERSION=0:0:0 | ||
| 19 | |||
| 20 | AC_SUBST(LIBIRECOVERY_SO_VERSION) | ||
| 21 | |||
| 22 | # Checks for programs. | ||
| 23 | AC_PROG_CC | ||
| 24 | AC_PROG_CXX | ||
| 25 | AM_PROG_CC_C_O | ||
| 26 | AC_PROG_LIBTOOL | ||
| 27 | |||
| 28 | # Checks for libraries. | ||
| 29 | ACCFLAGS= | ||
| 30 | ACLDFLAGS= | ||
| 31 | ACLIBS= | ||
| 32 | |||
| 33 | #echo $host_os | ||
| 34 | case "$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 | ;; | ||
| 59 | esac | ||
| 60 | |||
| 61 | IRECOVERY_LIBS=-lreadline | ||
| 62 | AC_SUBST(IRECOVERY_LIBS) | ||
| 63 | |||
| 64 | # Checks for header files. | ||
| 65 | AC_HEADER_STDC | ||
| 66 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) | ||
| 67 | |||
| 68 | # Checks for typedefs, structures, and compiler characteristics. | ||
| 69 | AC_C_CONST | ||
| 70 | AC_TYPE_SIZE_T | ||
| 71 | AC_TYPE_SSIZE_T | ||
| 72 | AC_TYPE_UINT16_T | ||
| 73 | AC_TYPE_UINT32_T | ||
| 74 | AC_TYPE_UINT8_T | ||
| 75 | |||
| 76 | # Checks for library functions. | ||
| 77 | AC_FUNC_MALLOC | ||
| 78 | AC_FUNC_REALLOC | ||
| 79 | AC_CHECK_FUNCS([strcasecmp strdup strerror strndup]) | ||
| 80 | |||
| 81 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") | ||
| 82 | AC_SUBST(GLOBAL_CFLAGS) | ||
| 83 | |||
| 84 | LIBIRECOVERY_CFLAGS=$ACCFLAGS | ||
| 85 | LIBIRECOVERY_CFLAGS+=$GLOBAL_CFLAGS | ||
| 86 | LIBIRECOVERY_LDFLAGS=$ACLDFLAGS | ||
| 87 | LIBIRECOVERY_LIBS=$ACLIBS | ||
| 88 | |||
| 89 | AC_SUBST(LIBIRECOVERY_CFLAGS) | ||
| 90 | AC_SUBST(LIBIRECOVERY_LDFLAGS) | ||
| 91 | AC_SUBST(LIBIRECOVERY_LIBS) | ||
| 92 | |||
| 93 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | ||
| 94 | |||
| 95 | AC_OUTPUT([ | ||
| 96 | Makefile | ||
| 97 | src/Makefile | ||
| 98 | include/Makefile | ||
| 99 | libirecovery.pc | ||
| 100 | ]) | ||
| 101 | |||
| 102 | echo " | ||
| 103 | Configuration 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 @@ | |||
| 1 | prefix=@prefix@ | ||
| 2 | exec_prefix=@exec_prefix@ | ||
| 3 | libdir=@libdir@ | ||
| 4 | includedir=@includedir@ | ||
| 5 | |||
| 6 | Name: libirecovery | ||
| 7 | Description: A library to talk to iBoot/iBSS in iDevices via USB | ||
| 8 | Version: @VERSION@ | ||
| 9 | Libs: -L${libdir} -lirecovery | ||
| 10 | Cflags: -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 @@ | |||
| 1 | dnl as-compiler-flag.m4 0.1.0 | ||
| 2 | |||
| 3 | dnl autostars m4 macro for detection of compiler flags | ||
| 4 | |||
| 5 | dnl David Schleef <ds@schleef.org> | ||
| 6 | |||
| 7 | dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $ | ||
| 8 | |||
| 9 | dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) | ||
| 10 | dnl Tries to compile with the given CFLAGS. | ||
| 11 | dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, | ||
| 12 | dnl and ACTION-IF-NOT-ACCEPTED otherwise. | ||
| 13 | |||
| 14 | AC_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 | |||
| 34 | dnl AS_COMPILER_FLAGS(VAR, FLAGS) | ||
| 35 | dnl Tries to compile with the given CFLAGS. | ||
| 36 | |||
| 37 | AC_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 @@ | |||
| 1 | AM_CPPFLAGS = -I$(top_srcdir)/include | ||
| 2 | |||
| 3 | AM_CFLAGS = $(LIBIRECOVERY_CFLAGS) | ||
| 4 | AM_LDFLAGS = $(LIBIRECOVERY_LDFLAGS) | ||
| 5 | AM_LIBS = $(LIBIRECOVERY_LIBS) | ||
| 6 | |||
| 7 | lib_LTLIBRARIES = libirecovery.la | ||
| 8 | libirecovery_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBIRECOVERY_SO_VERSION) -no-undefined $(AM_LIBS) | ||
| 9 | libirecovery_la_SOURCES = \ | ||
| 10 | libirecovery.c | ||
| 11 | |||
| 12 | bin_PROGRAMS = irecovery | ||
| 13 | |||
| 14 | irecovery_SOURCES = irecovery.c | ||
| 15 | irecovery_CFLAGS = $(AM_CFLAGS) | ||
| 16 | irecovery_LDFLAGS = $(AM_LDFLAGS) $(IRECOVERY_LIBS) | ||
| 17 | irecovery_LDADD = ./libirecovery.la | ||
