Merge lp:~timo-jyrinki/ubuntu/trusty/libimobiledevice/git20140313.bafe6a9e into lp:ubuntu/trusty/libimobiledevice

Proposed by Timo Jyrinki
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 25
Merged at revision: 17
Proposed branch: lp:~timo-jyrinki/ubuntu/trusty/libimobiledevice/git20140313.bafe6a9e
Merge into: lp:ubuntu/trusty/libimobiledevice
Diff against target: 82651 lines (+5526/-73448)
223 files modified
.gitignore (+62/-0)
.pc/01-libs.private.patch/libimobiledevice-1.0.pc.in (+0/-12)
.pc/02-fix-link-errors.patch/src/Makefile.am (+0/-35)
.pc/02-fix-link-errors.patch/tools/Makefile.am (+0/-73)
.pc/09_use_python_config.patch/m4/ac_python_devel.m4 (+0/-265)
.pc/CVE-2013-2142.patch/src/Makefile.am (+0/-35)
.pc/CVE-2013-2142.patch/src/userpref.c (+0/-1161)
.pc/applied-patches (+0/-5)
.pc/git_explicitly_cast_ssl_enabled.patch/cython/lockdown.pxi (+0/-297)
Makefile.am (+1/-1)
Makefile.in (+0/-918)
NEWS (+20/-0)
README (+10/-3)
aclocal.m4 (+0/-1454)
autogen.sh (+15/-0)
common/Makefile.am (+18/-0)
common/debug.c (+169/-0)
common/debug.h (+59/-0)
common/socket.c (+392/-0)
common/socket.h (+65/-0)
common/thread.c (+83/-0)
common/thread.h (+45/-0)
common/userpref.c (+1196/-0)
common/userpref.h (+95/-0)
common/utils.c (+194/-0)
common/utils.h (+52/-0)
compile (+0/-342)
config.guess (+0/-1540)
config.h.in (+0/-167)
config.sub (+0/-1779)
configure (+0/-20637)
configure.ac (+16/-16)
cython/Makefile.in (+0/-698)
cython/afc.pxi (+59/-8)
cython/house_arrest.pxi (+2/-2)
cython/imobiledevice.pxd (+1/-1)
cython/lockdown.pxi (+1/-1)
debian/changelog (+21/-0)
debian/control (+2/-11)
debian/libimobiledevice-doc.doc-base (+0/-9)
debian/libimobiledevice-doc.install (+0/-1)
debian/libimobiledevice-doc.links (+0/-2)
debian/libimobiledevice-utils.manpages (+2/-1)
debian/libimobiledevice4.symbols (+58/-3)
debian/patches/01-libs.private.patch (+2/-2)
debian/patches/02-fix-link-errors.patch (+9/-9)
debian/patches/09_use_python_config.patch (+0/-22)
debian/patches/CVE-2013-2142.patch (+0/-308)
debian/patches/git_explicitly_cast_ssl_enabled.patch (+0/-20)
debian/patches/series (+0/-3)
depcomp (+0/-707)
dev/Makefile.in (+0/-771)
dev/afccheck.c (+5/-5)
dev/filerelaytest.c (+18/-4)
docs/Makefile (+0/-535)
docs/Makefile.am (+1/-1)
docs/Makefile.in (+0/-535)
docs/html/annotated.html (+0/-89)
docs/html/classes.html (+0/-86)
docs/html/dir_0839347dbfd1d6806a2d090799a179ba.html (+0/-94)
docs/html/dir_beb3b87d681f7237804f4f09a166e5a0.html (+0/-105)
docs/html/doxygen.css (+0/-1133)
docs/html/dynsections.js (+0/-78)
docs/html/files.html (+0/-80)
docs/html/functions.html (+0/-81)
docs/html/functions_vars.html (+0/-81)
docs/html/globals.html (+0/-186)
docs/html/globals_0x64.html (+0/-105)
docs/html/globals_0x66.html (+0/-96)
docs/html/globals_0x68.html (+0/-126)
docs/html/globals_0x69.html (+0/-186)
docs/html/globals_0x6c.html (+0/-162)
docs/html/globals_0x6d.html (+0/-279)
docs/html/globals_0x6e.html (+0/-111)
docs/html/globals_0x72.html (+0/-120)
docs/html/globals_0x73.html (+0/-123)
docs/html/globals_0x77.html (+0/-105)
docs/html/globals_defs.html (+0/-67)
docs/html/globals_enum.html (+0/-79)
docs/html/globals_eval.html (+0/-100)
docs/html/globals_func.html (+0/-652)
docs/html/globals_type.html (+0/-244)
docs/html/include_2libimobiledevice_2afc_8h.html (+0/-1172)
docs/html/include_2libimobiledevice_2diagnostics__relay_8h.html (+0/-353)
docs/html/include_2libimobiledevice_2file__relay_8h.html (+0/-254)
docs/html/include_2libimobiledevice_2heartbeat_8h.html (+0/-368)
docs/html/include_2libimobiledevice_2house__arrest_8h.html (+0/-363)
docs/html/include_2libimobiledevice_2installation__proxy_8h.html (+0/-743)
docs/html/include_2libimobiledevice_2lockdown_8h.html (+0/-1129)
docs/html/include_2libimobiledevice_2misagent_8h.html (+0/-340)
docs/html/include_2libimobiledevice_2mobile__image__mounter_8h.html (+0/-336)
docs/html/include_2libimobiledevice_2mobilebackup2_8h.html (+0/-559)
docs/html/include_2libimobiledevice_2mobilebackup_8h.html (+0/-561)
docs/html/include_2libimobiledevice_2mobilesync_8h.html (+0/-993)
docs/html/include_2libimobiledevice_2notification__proxy_8h.html (+0/-434)
docs/html/include_2libimobiledevice_2restore_8h.html (+0/-552)
docs/html/include_2libimobiledevice_2sbservices_8h.html (+0/-427)
docs/html/include_2libimobiledevice_2screenshotr_8h.html (+0/-244)
docs/html/include_2libimobiledevice_2webinspector_8h.html (+0/-369)
docs/html/index.html (+0/-50)
docs/html/jquery.js (+0/-8)
docs/html/libimobiledevice_8h.html (+0/-663)
docs/html/struct_a_f_c_file_packet.html (+0/-69)
docs/html/struct_a_f_c_packet.html (+0/-75)
docs/html/structafc__client__private.html (+0/-77)
docs/html/structdevice__link__service__client__private.html (+0/-67)
docs/html/structdiagnostics__relay__client__private.html (+0/-67)
docs/html/structfile__relay__client__private.html (+0/-67)
docs/html/structheartbeat__client__private.html (+0/-67)
docs/html/structhouse__arrest__client__private.html (+0/-69)
docs/html/structidevice__connection__private.html (+0/-71)
docs/html/structidevice__event__t.html (+0/-120)
docs/html/structidevice__private.html (+0/-71)
docs/html/structinstproxy__client__private.html (+0/-71)
docs/html/structlockdownd__client__private.html (+0/-75)
docs/html/structlockdownd__pair__record.html (+0/-82)
docs/html/structlockdownd__service__descriptor.html (+0/-69)
docs/html/structmisagent__client__private.html (+0/-69)
docs/html/structmobile__image__mounter__client__private.html (+0/-69)
docs/html/structmobilebackup2__client__private.html (+0/-67)
docs/html/structmobilebackup__client__private.html (+0/-67)
docs/html/structmobilesync__anchors.html (+0/-69)
docs/html/structmobilesync__client__private.html (+0/-71)
docs/html/structnp__client__private.html (+0/-71)
docs/html/structproperty__list__service__client__private.html (+0/-67)
docs/html/structrestored__client__private.html (+0/-73)
docs/html/structsbservices__client__private.html (+0/-69)
docs/html/structscreenshotr__client__private.html (+0/-67)
docs/html/structservice__client__private.html (+0/-67)
docs/html/structssl__data__private.html (+0/-77)
docs/html/structwebinspector__client__private.html (+0/-67)
docs/html/tabs.css (+0/-59)
docs/idevicecrashreport.1 (+36/-0)
docs/idevicename.1 (+28/-0)
docs/idevicescreenshot.1 (+6/-2)
include/Makefile.am (+3/-1)
include/Makefile.in (+0/-578)
include/libimobiledevice/afc.h (+5/-0)
include/libimobiledevice/diagnostics_relay.h (+3/-0)
include/libimobiledevice/file_relay.h (+4/-0)
include/libimobiledevice/house_arrest.h (+3/-0)
include/libimobiledevice/installation_proxy.h (+6/-0)
include/libimobiledevice/libimobiledevice.h (+2/-0)
include/libimobiledevice/lockdown.h (+4/-1)
include/libimobiledevice/misagent.h (+3/-0)
include/libimobiledevice/mobile_image_mounter.h (+9/-0)
include/libimobiledevice/mobilebackup.h (+4/-0)
include/libimobiledevice/mobilebackup2.h (+4/-0)
include/libimobiledevice/mobilesync.h (+3/-0)
include/libimobiledevice/notification_proxy.h (+4/-0)
include/libimobiledevice/sbservices.h (+4/-0)
include/libimobiledevice/screenshotr.h (+4/-0)
include/libimobiledevice/service.h (+67/-0)
include/libimobiledevice/syslog_relay.h (+69/-0)
install-sh (+0/-527)
libimobiledevice-1.0.pc.in (+1/-1)
ltmain.sh (+0/-9655)
m4/ac_python_devel.m4 (+19/-16)
m4/ax_swig_enable_cxx.m4 (+53/-0)
m4/libtool.m4 (+0/-7982)
m4/ltoptions.m4 (+0/-384)
m4/ltsugar.m4 (+0/-123)
m4/ltversion.m4 (+0/-23)
m4/lt~obsolete.m4 (+0/-98)
missing (+0/-330)
src/Makefile.am (+6/-7)
src/Makefile.in (+0/-696)
src/afc.c (+44/-26)
src/afc.h (+2/-10)
src/debug.c (+0/-169)
src/debug.h (+0/-59)
src/device_link_service.c (+1/-1)
src/diagnostics_relay.c (+21/-1)
src/file_relay.c (+60/-3)
src/heartbeat.c (+5/-5)
src/house_arrest.c (+47/-27)
src/idevice.c (+51/-33)
src/idevice.h (+2/-5)
src/installation_proxy.c (+149/-54)
src/installation_proxy.h (+3/-13)
src/lockdown.c (+245/-92)
src/lockdown.h (+4/-2)
src/misagent.c (+46/-26)
src/mobile_image_mounter.c (+147/-21)
src/mobile_image_mounter.h (+2/-11)
src/mobilebackup.c (+21/-1)
src/mobilebackup2.c (+33/-1)
src/mobilesync.c (+21/-1)
src/notification_proxy.c (+48/-53)
src/notification_proxy.h (+3/-13)
src/property_list_service.c (+27/-4)
src/property_list_service.h (+1/-0)
src/restore.c (+15/-12)
src/sbservices.c (+38/-34)
src/sbservices.h (+2/-11)
src/screenshotr.c (+21/-1)
src/service.c (+4/-1)
src/service.h (+1/-30)
src/syslog_relay.c (+301/-0)
src/syslog_relay.h (+36/-0)
src/userpref.c (+0/-1208)
src/userpref.h (+0/-73)
src/utils.c (+0/-85)
src/utils.h (+0/-27)
src/webinspector.c (+133/-52)
src/webinspector.h (+2/-0)
tools/Makefile.am (+19/-8)
tools/Makefile.in (+0/-1043)
tools/idevicebackup2.c (+107/-25)
tools/idevicecrashreport.c (+456/-0)
tools/idevicedate.c (+66/-33)
tools/idevicedebugserverproxy.c (+2/-2)
tools/idevicediagnostics.c (+2/-2)
tools/ideviceimagemounter.c (+99/-68)
tools/ideviceinfo.c (+3/-1)
tools/idevicename.c (+126/-0)
tools/idevicepair.c (+35/-20)
tools/idevicescreenshot.c (+24/-14)
tools/idevicesyslog.c (+28/-70)
tools/socket.c (+0/-392)
tools/socket.h (+0/-65)
tools/thread.c (+0/-47)
tools/thread.h (+0/-38)
To merge this branch: bzr merge lp:~timo-jyrinki/ubuntu/trusty/libimobiledevice/git20140313.bafe6a9e
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+210753@code.launchpad.net

Commit message

[ Matthias Niess ]
* Replace a duplicate 'backup' util man page with the one for 'crashreport'

[ Timo Jyrinki ]
* New upstream snapshot. (LP: #1207812)
* Drop patches included in the upstream snapshot:
  - debian/patches/CVE-2013-2142.patch
  - debian/patches/git_explicitly_cast_ssl_enabled.patch
* Drop the python patch, new upstream method seems to work:
  - debian/patches/09_use_python_config.patch
* Refreshed remaining patches:
  - debian/patches/01-libs.private.patch
  - debian/patches/02-fix-link-errors.patch
* Drop libimobiledevice-doc, the git does not include html documentation
* Updated libimobiledevice4.symbols
* Add missing man page for the 'idevicename' util

To post a comment you must log in.
Revision history for this message
Matthias Niess (mniess) wrote :

I can confirm that it works. Tested on an existing machine and a fresh install.

Revision history for this message
Matthias Niess (mniess) wrote :

You need to update the .manpages file. There is a duplicate entry of idevicebackup and idevicecrashreport is missing.

23. By Timo Jyrinki

[ Matthias Niess ]
Replace a duplicate 'backup' util man page with the one for 'crashreport'

24. By Timo Jyrinki

Add missing man page for the 'idevicename' util

25. By Timo Jyrinki

s/UNRELEASED/trusty/ for being able to be directly sponsored from the branch.

Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks, uploaded to trusty

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file '.gitignore'
--- .gitignore 1970-01-01 00:00:00 +0000
+++ .gitignore 2014-03-14 06:45:31 +0000
@@ -0,0 +1,62 @@
1# git-ls-files --others --exclude-from=.git/info/exclude
2# Lines that start with '#' are comments.
3# For a project mostly in C, the following would be a good set of
4# exclude patterns (uncomment them if you want to use them):
5*.[oa]
6*~
7*.po
8*.lo
9*.la
10autom4te.cache/*
11*.in
12*/.deps/*
13m4/*
14swig/*
15*.swp
16*.patch
17aclocal.m4
18config.h
19config.log
20config.sub
21config.guess
22config.status
23configure
24depcomp
25install-sh
26compile
27main
28ltmain.sh
29missing
30mkinstalldirs
31libtool
32*Makefile
33py-compile
34stamp-h1
35src/.libs
36docs/html
37libimobiledevice-1.0.pc
38dev/.libs/*
39dev/afccheck
40dev/ideviceclient
41dev/idevicesyslog
42dev/lckd-client
43dev/msyncclient
44dev/ideviceenterrecovery
45tools/.libs/*
46tools/idevice_id
47tools/ideviceinfo
48tools/idevicesyslog
49tools/idevicebackup
50tools/ideviceimagemounter
51tools/idevicescreenshot
52tools/idevicebackup2
53tools/idevicedate
54tools/idevicedebugserverproxy
55tools/idevicediagnostics
56tools/ideviceenterrecovery
57tools/idevicename
58tools/idevicepair
59tools/ideviceprovision
60cython/.libs/*
61cython/*.c
62doxygen.cfg
063
=== removed directory '.pc/01-libs.private.patch'
=== removed file '.pc/01-libs.private.patch/libimobiledevice-1.0.pc.in'
--- .pc/01-libs.private.patch/libimobiledevice-1.0.pc.in 2012-07-29 11:31:31 +0000
+++ .pc/01-libs.private.patch/libimobiledevice-1.0.pc.in 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4includedir=@includedir@
5
6Name: libimobiledevice
7Description: A library to communicate with services running on Apple iPhone/iPod Touch devices.
8Version: @VERSION@
9Requires: libplist >= 0.12 libusbmuxd >= 0.1.0 @ssl_requires@
10Libs: -L${libdir} -limobiledevice
11Cflags: -I${includedir}
12
130
=== removed directory '.pc/02-fix-link-errors.patch'
=== removed directory '.pc/02-fix-link-errors.patch/src'
=== removed file '.pc/02-fix-link-errors.patch/src/Makefile.am'
--- .pc/02-fix-link-errors.patch/src/Makefile.am 2013-10-28 23:01:08 +0000
+++ .pc/02-fix-link-errors.patch/src/Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1AM_CPPFLAGS = -I$(top_srcdir)/include
2
3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS) $(openssl_CFLAGS)
4AM_LDFLAGS = $(libgnutls_LIBS) $(libtasn1_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS) ${libpthread_LIBS} $(openssl_LIBS)
5
6lib_LTLIBRARIES = libimobiledevice.la
7libimobiledevice_la_LIBADD =
8libimobiledevice_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBIMOBILEDEVICE_SO_VERSION) -no-undefined
9libimobiledevice_la_SOURCES = idevice.c idevice.h \
10 debug.c debug.h\
11 userpref.c userpref.h\
12 service.c service.h\
13 property_list_service.c property_list_service.h\
14 device_link_service.c device_link_service.h\
15 lockdown.c lockdown.h\
16 afc.c afc.h\
17 file_relay.c file_relay.h\
18 notification_proxy.c notification_proxy.h\
19 installation_proxy.c installation_proxy.h\
20 sbservices.c sbservices.h\
21 mobile_image_mounter.c mobile_image_mounter.h\
22 screenshotr.c screenshotr.h\
23 mobilesync.c mobilesync.h\
24 mobilebackup.c mobilebackup.h\
25 house_arrest.c house_arrest.h\
26 mobilebackup2.c mobilebackup2.h\
27 misagent.c misagent.h\
28 restore.c restore.h\
29 diagnostics_relay.c diagnostics_relay.h\
30 heartbeat.c heartbeat.h\
31 webinspector.c webinspector.h
32
33if WIN32
34libimobiledevice_la_LIBADD += -lole32
35endif
360
=== removed directory '.pc/02-fix-link-errors.patch/tools'
=== removed file '.pc/02-fix-link-errors.patch/tools/Makefile.am'
--- .pc/02-fix-link-errors.patch/tools/Makefile.am 2013-10-28 23:01:08 +0000
+++ .pc/02-fix-link-errors.patch/tools/Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
1AM_CPPFLAGS = -I$(top_srcdir)/include
2
3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(openssl_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS)
4AM_LDFLAGS = $(libgnutls_LIBS) $(libtasn1_LIBS) $(openssl_LIBS) $(libplist_LIBS)
5
6bin_PROGRAMS = idevice_id ideviceinfo idevicepair idevicesyslog ideviceimagemounter idevicescreenshot ideviceenterrecovery idevicedate idevicebackup idevicebackup2 ideviceprovision idevicedebugserverproxy idevicediagnostics
7
8ideviceinfo_SOURCES = ideviceinfo.c
9ideviceinfo_CFLAGS = $(AM_CFLAGS)
10ideviceinfo_LDFLAGS = $(AM_LDFLAGS)
11ideviceinfo_LDADD = ../src/libimobiledevice.la
12
13idevicepair_SOURCES = idevicepair.c
14idevicepair_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/src
15idevicepair_LDFLAGS = $(AM_LDFLAGS)
16idevicepair_LDADD = ../src/libimobiledevice.la
17
18idevicesyslog_SOURCES = idevicesyslog.c
19idevicesyslog_CFLAGS = $(AM_CFLAGS)
20idevicesyslog_LDFLAGS = $(AM_LDFLAGS)
21idevicesyslog_LDADD = ../src/libimobiledevice.la
22
23idevice_id_SOURCES = idevice_id.c
24idevice_id_CFLAGS = $(AM_CFLAGS)
25idevice_id_LDFLAGS = $(AM_LDFLAGS)
26idevice_id_LDADD = ../src/libimobiledevice.la
27
28idevicebackup_SOURCES = idevicebackup.c
29idevicebackup_CFLAGS = $(AM_CFLAGS)
30idevicebackup_LDFLAGS = $(AM_LDFLAGS)
31idevicebackup_LDADD = ../src/libimobiledevice.la
32
33idevicebackup2_SOURCES = idevicebackup2.c
34idevicebackup2_CFLAGS = $(AM_CFLAGS)
35idevicebackup2_LDFLAGS = $(AM_LDFLAGS)
36idevicebackup2_LDADD = ../src/libimobiledevice.la
37
38ideviceimagemounter_SOURCES = ideviceimagemounter.c
39ideviceimagemounter_CFLAGS = $(AM_CFLAGS)
40ideviceimagemounter_LDFLAGS = $(AM_LDFLAGS)
41ideviceimagemounter_LDADD = ../src/libimobiledevice.la
42
43idevicescreenshot_SOURCES = idevicescreenshot.c
44idevicescreenshot_CFLAGS = $(AM_CFLAGS)
45idevicescreenshot_LDFLAGS = $(AM_LDFLAGS)
46idevicescreenshot_LDADD = ../src/libimobiledevice.la
47
48ideviceenterrecovery_SOURCES = ideviceenterrecovery.c
49ideviceenterrecovery_CFLAGS = $(AM_CFLAGS)
50ideviceenterrecovery_LDFLAGS = $(AM_LDFLAGS)
51ideviceenterrecovery_LDADD = ../src/libimobiledevice.la
52
53idevicedate_SOURCES = idevicedate.c
54idevicedate_CFLAGS = $(AM_CFLAGS)
55idevicedate_LDFLAGS = $(AM_LDFLAGS)
56idevicedate_LDADD = ../src/libimobiledevice.la
57
58ideviceprovision_SOURCES = ideviceprovision.c
59ideviceprovision_CFLAGS = $(AM_CFLAGS)
60ideviceprovision_LDFLAGS = $(AM_LDFLAGS)
61ideviceprovision_LDADD = ../src/libimobiledevice.la
62
63idevicedebugserverproxy_SOURCES = idevicedebugserverproxy.c socket.c thread.c
64idevicedebugserverproxy_CFLAGS = $(AM_CFLAGS)
65idevicedebugserverproxy_LDFLAGS = $(AM_LDFLAGS)
66idevicedebugserverproxy_LDADD = ../src/libimobiledevice.la
67
68idevicediagnostics_SOURCES = idevicediagnostics.c
69idevicediagnostics_CFLAGS = $(AM_CFLAGS)
70idevicediagnostics_LDFLAGS = $(AM_LDFLAGS)
71idevicediagnostics_LDADD = ../src/libimobiledevice.la
72
73EXTRA_DIST = socket.h thread.h
740
=== removed directory '.pc/09_use_python_config.patch'
=== removed directory '.pc/09_use_python_config.patch/m4'
=== removed file '.pc/09_use_python_config.patch/m4/ac_python_devel.m4'
--- .pc/09_use_python_config.patch/m4/ac_python_devel.m4 2013-01-19 06:11:28 +0000
+++ .pc/09_use_python_config.patch/m4/ac_python_devel.m4 1970-01-01 00:00:00 +0000
@@ -1,265 +0,0 @@
1# ===========================================================================
2# http://autoconf-archive.cryp.to/ac_python_devel.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# AC_PYTHON_DEVEL([version])
8#
9# DESCRIPTION
10#
11# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
12# in your configure.ac.
13#
14# This macro checks for Python and tries to get the include path to
15# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
16# output variables. It also exports $(PYTHON_EXTRA_LIBS) and
17# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
18#
19# You can search for some particular version of Python by passing a
20# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
21# note that you *have* to pass also an operator along with the version to
22# match, and pay special attention to the single quotes surrounding the
23# version number. Don't use "PYTHON_VERSION" for this: that environment
24# variable is declared as precious and thus reserved for the end-user.
25#
26# This macro should work for all versions of Python >= 2.1.0. As an end
27# user, you can disable the check for the python version by setting the
28# PYTHON_NOVERSIONCHECK environment variable to something else than the
29# empty string.
30#
31# If you need to use this macro for an older Python version, please
32# contact the authors. We're always open for feedback.
33#
34# LAST MODIFICATION
35#
36# 2008-04-12
37#
38# COPYLEFT
39#
40# Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
41# Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
42# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
43# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
44# Copyright (c) 2008 Matteo Settenvini <matteo@member.fsf.org>
45# Copyright (c) 2008 Horst Knorr <hk_classes@knoda.org>
46#
47# This program is free software: you can redistribute it and/or modify it
48# under the terms of the GNU General Public License as published by the
49# Free Software Foundation, either version 3 of the License, or (at your
50# option) any later version.
51#
52# This program is distributed in the hope that it will be useful, but
53# WITHOUT ANY WARRANTY; without even the implied warranty of
54# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
55# Public License for more details.
56#
57# You should have received a copy of the GNU General Public License along
58# with this program. If not, see <http://www.gnu.org/licenses/>.
59#
60# As a special exception, the respective Autoconf Macro's copyright owner
61# gives unlimited permission to copy, distribute and modify the configure
62# scripts that are the output of Autoconf when processing the Macro. You
63# need not follow the terms of the GNU General Public License when using
64# or distributing such scripts, even though portions of the text of the
65# Macro appear in them. The GNU General Public License (GPL) does govern
66# all other use of the material that constitutes the Autoconf Macro.
67#
68# This special exception to the GPL applies to versions of the Autoconf
69# Macro released by the Autoconf Macro Archive. When you make and
70# distribute a modified version of the Autoconf Macro, you may extend this
71# special exception to the GPL to apply to your modified version as well.
72
73AC_DEFUN([AC_PYTHON_DEVEL],[
74 #
75 # Allow the use of a (user set) custom python version
76 #
77 AC_ARG_VAR([PYTHON_VERSION],[The installed Python
78 version to use, for example '2.3'. This string
79 will be appended to the Python interpreter
80 canonical name.])
81
82 AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
83 if test -z "$PYTHON"; then
84 AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
85 PYTHON_VERSION=""
86 fi
87
88 #
89 # Check for a version of Python >= 2.1.0
90 #
91 AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
92 ac_supports_python_ver=`$PYTHON -c "import sys, string; \
93 ver = string.split(sys.version)[[0]]; \
94 print ver >= '2.1.0'"`
95 if test "$ac_supports_python_ver" != "True"; then
96 if test -z "$PYTHON_NOVERSIONCHECK"; then
97 AC_MSG_RESULT([no])
98 AC_MSG_FAILURE([
99This version of the AC@&t@_PYTHON_DEVEL macro
100doesn't work properly with versions of Python before
1012.1.0. You may need to re-run configure, setting the
102variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
103PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
104Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
105to something else than an empty string.
106])
107 else
108 AC_MSG_RESULT([skip at user request])
109 fi
110 else
111 AC_MSG_RESULT([yes])
112 fi
113
114 #
115 # if the macro parameter ``version'' is set, honour it
116 #
117 if test -n "$1"; then
118 AC_MSG_CHECKING([for a version of Python $1])
119 ac_supports_python_ver=`$PYTHON -c "import sys, string; \
120 ver = string.split(sys.version)[[0]]; \
121 print ver $1"`
122 if test "$ac_supports_python_ver" = "True"; then
123 AC_MSG_RESULT([yes])
124 else
125 AC_MSG_RESULT([no])
126 AC_MSG_ERROR([this package requires Python $1.
127If you have it installed, but it isn't the default Python
128interpreter in your system path, please pass the PYTHON_VERSION
129variable to configure. See ``configure --help'' for reference.
130])
131 PYTHON_VERSION=""
132 fi
133 fi
134
135 #
136 # Check if you have distutils, else fail
137 #
138 AC_MSG_CHECKING([for the distutils Python package])
139 ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
140 if test -z "$ac_distutils_result"; then
141 AC_MSG_RESULT([yes])
142 else
143 AC_MSG_RESULT([no])
144 AC_MSG_ERROR([cannot import Python module "distutils".
145Please check your Python installation. The error was:
146$ac_distutils_result])
147 PYTHON_VERSION=""
148 fi
149
150 #
151 # Check for Python include path
152 #
153 AC_MSG_CHECKING([for Python include path])
154 if test -z "$PYTHON_CPPFLAGS"; then
155 python_path=`$PYTHON -c "import distutils.sysconfig; \
156 print distutils.sysconfig.get_python_inc();"`
157 if test -n "${python_path}"; then
158 python_path="-I$python_path"
159 fi
160 PYTHON_CPPFLAGS=$python_path
161 fi
162 AC_MSG_RESULT([$PYTHON_CPPFLAGS])
163 AC_SUBST([PYTHON_CPPFLAGS])
164
165 #
166 # Check for Python library path
167 #
168 AC_MSG_CHECKING([for Python library path])
169 if test -z "$PYTHON_LDFLAGS"; then
170 # (makes two attempts to ensure we've got a version number
171 # from the interpreter)
172 py_version=`$PYTHON -c "from distutils.sysconfig import *; \
173 from string import join; \
174 print join(get_config_vars('VERSION'))"`
175 if test "$py_version" = "[None]"; then
176 if test -n "$PYTHON_VERSION"; then
177 py_version=$PYTHON_VERSION
178 else
179 py_version=`$PYTHON -c "import sys; \
180 print sys.version[[:3]]"`
181 fi
182 fi
183
184 PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
185 from string import join; \
186 print '-L' + get_python_lib(0,1), \
187 '-lpython';"`$py_version
188 fi
189 AC_MSG_RESULT([$PYTHON_LDFLAGS])
190 AC_SUBST([PYTHON_LDFLAGS])
191
192 #
193 # Check for site packages
194 #
195 AC_MSG_CHECKING([for Python site-packages path])
196 if test -z "$PYTHON_SITE_PKG"; then
197 PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
198 print distutils.sysconfig.get_python_lib(0,0);"`
199 fi
200 AC_MSG_RESULT([$PYTHON_SITE_PKG])
201 AC_SUBST([PYTHON_SITE_PKG])
202
203 #
204 # libraries which must be linked in when embedding
205 #
206 AC_MSG_CHECKING(python extra libraries)
207 if test -z "$PYTHON_EXTRA_LIBS"; then
208 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
209 conf = distutils.sysconfig.get_config_var; \
210 print conf('LOCALMODLIBS'), conf('LIBS')"`
211 fi
212 AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
213 AC_SUBST(PYTHON_EXTRA_LIBS)
214
215 #
216 # linking flags needed when embedding
217 #
218 AC_MSG_CHECKING(python extra linking flags)
219 if test -z "$PYTHON_EXTRA_LDFLAGS"; then
220 PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
221 conf = distutils.sysconfig.get_config_var; \
222 print conf('LINKFORSHARED')"`
223 fi
224 AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
225 AC_SUBST(PYTHON_EXTRA_LDFLAGS)
226
227 #
228 # final check to see if everything compiles alright
229 #
230 AC_MSG_CHECKING([consistency of all components of python development environment])
231 AC_LANG_PUSH([C])
232 # save current global flags
233 LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
234 CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
235 AC_TRY_LINK([
236 #include <Python.h>
237 ],[
238 Py_Initialize();
239 ],[pythonexists=yes],[pythonexists=no])
240
241 AC_MSG_RESULT([$pythonexists])
242
243 if test ! "$pythonexists" = "yes"; then
244 AC_MSG_ERROR([
245 Could not link test program to Python. Maybe the main Python library has been
246 installed in some non-standard library path. If so, pass it to configure,
247 via the LDFLAGS environment variable.
248 Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
249 ============================================================================
250 ERROR!
251 You probably have to install the development version of the Python package
252 for your distribution. The exact name of this package varies among them.
253 ============================================================================
254 ])
255 PYTHON_VERSION=""
256 fi
257 AC_LANG_POP
258 # turn back to default flags
259 CPPFLAGS="$ac_save_CPPFLAGS"
260 LIBS="$ac_save_LIBS"
261
262 #
263 # all done!
264 #
265])
2660
=== removed directory '.pc/CVE-2013-2142.patch'
=== removed directory '.pc/CVE-2013-2142.patch/src'
=== removed file '.pc/CVE-2013-2142.patch/src/Makefile.am'
--- .pc/CVE-2013-2142.patch/src/Makefile.am 2013-10-28 23:01:08 +0000
+++ .pc/CVE-2013-2142.patch/src/Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1AM_CPPFLAGS = -I$(top_srcdir)/include
2
3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS) $(openssl_CFLAGS)
4AM_LDFLAGS = $(libgnutls_LIBS) $(libtasn1_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS) ${libpthread_LIBS} $(openssl_LIBS) -pthread
5
6lib_LTLIBRARIES = libimobiledevice.la
7libimobiledevice_la_LIBADD =
8libimobiledevice_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBIMOBILEDEVICE_SO_VERSION) -no-undefined
9libimobiledevice_la_SOURCES = idevice.c idevice.h \
10 debug.c debug.h\
11 userpref.c userpref.h\
12 service.c service.h\
13 property_list_service.c property_list_service.h\
14 device_link_service.c device_link_service.h\
15 lockdown.c lockdown.h\
16 afc.c afc.h\
17 file_relay.c file_relay.h\
18 notification_proxy.c notification_proxy.h\
19 installation_proxy.c installation_proxy.h\
20 sbservices.c sbservices.h\
21 mobile_image_mounter.c mobile_image_mounter.h\
22 screenshotr.c screenshotr.h\
23 mobilesync.c mobilesync.h\
24 mobilebackup.c mobilebackup.h\
25 house_arrest.c house_arrest.h\
26 mobilebackup2.c mobilebackup2.h\
27 misagent.c misagent.h\
28 restore.c restore.h\
29 diagnostics_relay.c diagnostics_relay.h\
30 heartbeat.c heartbeat.h\
31 webinspector.c webinspector.h
32
33if WIN32
34libimobiledevice_la_LIBADD += -lole32
35endif
360
=== removed file '.pc/CVE-2013-2142.patch/src/userpref.c'
--- .pc/CVE-2013-2142.patch/src/userpref.c 2013-08-14 12:43:31 +0000
+++ .pc/CVE-2013-2142.patch/src/userpref.c 1970-01-01 00:00:00 +0000
@@ -1,1161 +0,0 @@
1/*
2 * userpref.c
3 * contains methods to access user specific certificates IDs and more.
4 *
5 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifdef HAVE_CONFIG_H
23#include <config.h>
24#endif
25#include <stdio.h>
26#include <stdint.h>
27#include <stdlib.h>
28#include <string.h>
29#ifdef HAVE_OPENSSL
30#include <openssl/pem.h>
31#include <openssl/rsa.h>
32#include <openssl/x509.h>
33#include <openssl/x509v3.h>
34#else
35#include <gnutls/gnutls.h>
36#include <gnutls/x509.h>
37#include <gcrypt.h>
38#endif
39
40#include <dirent.h>
41#include <libgen.h>
42#include <sys/stat.h>
43#include <errno.h>
44
45#ifdef WIN32
46#include <shlobj.h>
47#endif
48
49#include "userpref.h"
50#include "debug.h"
51
52#define LIBIMOBILEDEVICE_CONF_DIR "libimobiledevice"
53#define LIBIMOBILEDEVICE_CONF_FILE "libimobiledevicerc"
54
55#define LIBIMOBILEDEVICE_ROOT_PRIVKEY "RootPrivateKey.pem"
56#define LIBIMOBILEDEVICE_HOST_PRIVKEY "HostPrivateKey.pem"
57#define LIBIMOBILEDEVICE_ROOT_CERTIF "RootCertificate.pem"
58#define LIBIMOBILEDEVICE_HOST_CERTIF "HostCertificate.pem"
59
60#ifdef WIN32
61#define DIR_SEP '\\'
62#define DIR_SEP_S "\\"
63#else
64#define DIR_SEP '/'
65#define DIR_SEP_S "/"
66#endif
67
68static char __config_dir[512] = {0, };
69
70#ifdef WIN32
71static char *userpref_utf16_to_utf8(wchar_t *unistr, long len, long *items_read, long *items_written)
72{
73 if (!unistr || (len <= 0)) return NULL;
74 char *outbuf = (char*)malloc(3*(len+1));
75 int p = 0;
76 int i = 0;
77
78 wchar_t wc;
79
80 while (i < len) {
81 wc = unistr[i++];
82 if (wc >= 0x800) {
83 outbuf[p++] = (char)(0xE0 + ((wc >> 12) & 0xF));
84 outbuf[p++] = (char)(0x80 + ((wc >> 6) & 0x3F));
85 outbuf[p++] = (char)(0x80 + (wc & 0x3F));
86 } else if (wc >= 0x80) {
87 outbuf[p++] = (char)(0xC0 + ((wc >> 6) & 0x1F));
88 outbuf[p++] = (char)(0x80 + (wc & 0x3F));
89 } else {
90 outbuf[p++] = (char)(wc & 0x7F);
91 }
92 }
93 if (items_read) {
94 *items_read = i;
95 }
96 if (items_written) {
97 *items_written = p;
98 }
99 outbuf[p] = 0;
100
101 return outbuf;
102}
103#endif
104
105static const char *userpref_get_tmp_dir()
106{
107 const char *cdir = getenv("TMPDIR");
108 if (cdir && cdir[0])
109 return cdir;
110 cdir = getenv("TMP");
111 if (cdir && cdir[0])
112 return cdir;
113 cdir = getenv("TEMP");
114 if (cdir && cdir[0])
115 return cdir;
116 return "/tmp";
117}
118
119static const char *userpref_get_config_dir()
120{
121 if (__config_dir[0]) return __config_dir;
122#ifdef WIN32
123 wchar_t path[MAX_PATH+1];
124 HRESULT hr;
125 LPITEMIDLIST pidl = NULL;
126 BOOL b = FALSE;
127
128 hr = SHGetSpecialFolderLocation (NULL, CSIDL_LOCAL_APPDATA, &pidl);
129 if (hr == S_OK) {
130 b = SHGetPathFromIDListW (pidl, path);
131 if (b) {
132 char *cdir = userpref_utf16_to_utf8 (path, wcslen(path), NULL, NULL);
133 strcpy(__config_dir, cdir);
134 free(cdir);
135 CoTaskMemFree (pidl);
136 }
137 }
138#else
139 const char *cdir = getenv("XDG_CONFIG_HOME");
140 if (!cdir) {
141 cdir = getenv("HOME");
142 if (!cdir || !cdir[0]) {
143 const char *tdir = userpref_get_tmp_dir();
144 strcpy(__config_dir, tdir);
145 strcat(__config_dir, DIR_SEP_S);
146 strcat(__config_dir, "root");
147 } else {
148 strcpy(__config_dir, cdir);
149 }
150 strcat(__config_dir, DIR_SEP_S);
151 strcat(__config_dir, ".config");
152 } else {
153 strcpy(__config_dir, cdir);
154 }
155#endif
156 strcat(__config_dir, DIR_SEP_S);
157 strcat(__config_dir, LIBIMOBILEDEVICE_CONF_DIR);
158
159 int i = strlen(__config_dir)-1;
160 while ((i > 0) && (__config_dir[i] == DIR_SEP)) {
161 __config_dir[i--] = '\0';
162 }
163
164 return __config_dir;
165}
166
167static int __mkdir(const char *dir, int mode)
168{
169#ifdef WIN32
170 return mkdir(dir);
171#else
172 return mkdir(dir, mode);
173#endif
174}
175
176static int mkdir_with_parents(const char *dir, int mode)
177{
178 if (!dir) return -1;
179 if (__mkdir(dir, mode) == 0) {
180 return 0;
181 } else {
182 if (errno == EEXIST) return 0;
183 }
184 int res;
185 char *parent = strdup(dir);
186 parent = dirname(parent);
187 if (parent) {
188 res = mkdir_with_parents(parent, mode);
189 } else {
190 res = -1;
191 }
192 free(parent);
193 if (res == 0) {
194 mkdir_with_parents(dir, mode);
195 }
196 return res;
197}
198
199static int config_write(const char *cfgfile, plist_t dict)
200{
201 if (!cfgfile || !dict || (plist_get_node_type(dict) != PLIST_DICT)) {
202 return -1;
203 }
204 int res = -1;
205
206#if 1 // old style config
207 plist_t hostid = plist_dict_get_item(dict, "HostID");
208 if (hostid && (plist_get_node_type(hostid) == PLIST_STRING)) {
209 char *hostidstr = NULL;
210 plist_get_string_val(hostid, &hostidstr);
211 if (hostidstr) {
212 FILE *fd = fopen(cfgfile, "wb");
213 if (fd) {
214 fprintf(fd, "\n[Global]\nHostID=%s\n", hostidstr);
215 fclose(fd);
216 res = 0;
217 } else {
218 debug_info("could not open '%s' for writing: %s", cfgfile, strerror(errno));
219 }
220 free(hostidstr);
221 }
222 }
223#endif
224#if 0
225 char *xml = NULL;
226 uint32_t length = 0;
227
228 plist_to_xml(dict, &xml, &length);
229 if (!xml) {
230 return res;
231 }
232
233 FILE *fd = fopen(cfgfile, "wb");
234 if (!fd) {
235 free(xml);
236 return res;
237 }
238
239 if (fwrite(xml, 1, length, fd) == length) {
240 res = 0;
241 } else {
242 fprintf(stderr, "%s: ERROR: failed to write configuration to '%s'\n", __func__, cfgfile);
243 }
244 fclose(fd);
245
246 free(xml);
247#endif
248 return res;
249}
250
251static int config_read(const char *cfgfile, plist_t *dict)
252{
253 if (!cfgfile || !dict) {
254 return -1;
255 }
256
257 int res = -1;
258 FILE *fd = fopen(cfgfile, "rb");
259 if (!fd) {
260 debug_info("could not open '%s' for reading: %s", cfgfile, strerror(errno));
261 return -1;
262 }
263
264 fseek(fd, 0, SEEK_END);
265 unsigned long int size = ftell(fd);
266 fseek(fd, 0, SEEK_SET);
267 unsigned char *contents = NULL;
268
269 contents = malloc(size);
270 if (fread(contents, 1, size, fd) != size) {
271 free(contents);
272 fclose(fd);
273 return -1;
274 }
275 plist_t plist = NULL;
276
277 if (!memcmp(contents, "bplist00", 8)) {
278 plist_from_bin((const char*)contents, (uint32_t)size, &plist);
279 fclose(fd);
280 } else {
281 if (memchr(contents, '<', size)) {
282 plist_from_xml((const char*)contents, (uint32_t)size, &plist);
283 }
284 if (plist) {
285 fclose(fd);
286 } else {
287 // try parsing old format config file
288 char line[256];
289 fseek(fd, 0, SEEK_SET);
290 while (fgets(line, 256, fd)) {
291 char *p = &line[0];
292 size_t llen = strlen(p)-1;
293 while ((llen > 0) && ((p[llen] == '\n') || (p[llen] == '\r'))) {
294 p[llen] = '\0';
295 llen--;
296 }
297 if (llen == 0) continue;
298 while ((p[0] == '\n') || (p[0] == '\r')) {
299 p++;
300 }
301 if (!strncmp(p, "HostID=", 7)) {
302 plist = plist_new_dict();
303 plist_dict_insert_item(plist, "HostID", plist_new_string(p+7));
304 break;
305 }
306 }
307 fclose(fd);
308#if 0
309 if (plist) {
310 // write new format config
311 config_write(cfgfile, plist);
312 }
313#endif
314 }
315 }
316 free(contents);
317 if (plist) {
318 *dict = plist;
319 res = 0;
320 }
321 return res;
322}
323
324/**
325 * Creates a freedesktop compatible configuration directory.
326 */
327static void userpref_create_config_dir(void)
328{
329 const char *config_path = userpref_get_config_dir();
330 struct stat st;
331 if (stat(config_path, &st) != 0) {
332 mkdir_with_parents(config_path, 0755);
333 }
334}
335
336static int get_rand(int min, int max)
337{
338 int retval = (rand() % (max - min)) + min;
339 return retval;
340}
341
342/**
343 * Generates a valid HostID (which is actually a UUID).
344 *
345 * @return A null terminated string containing a valid HostID.
346 */
347static char *userpref_generate_host_id()
348{
349 /* HostID's are just UUID's, and UUID's are 36 characters long */
350 char *hostid = (char *) malloc(sizeof(char) * 37);
351 const char *chars = "ABCDEF0123456789";
352 srand(time(NULL));
353 int i = 0;
354
355 for (i = 0; i < 36; i++) {
356 if (i == 8 || i == 13 || i == 18 || i == 23) {
357 hostid[i] = '-';
358 continue;
359 } else {
360 hostid[i] = chars[get_rand(0, 16)];
361 }
362 }
363 /* make it a real string */
364 hostid[36] = '\0';
365 return hostid;
366}
367
368/**
369 * Store HostID in config file.
370 *
371 * @param host_id A null terminated string containing a valid HostID.
372 */
373static int userpref_set_host_id(const char *host_id)
374{
375 const char *config_path;
376 char *config_file;
377
378 if (!host_id)
379 return 0;
380
381 /* Make sure config directory exists */
382 userpref_create_config_dir();
383
384 config_path = userpref_get_config_dir();
385 config_file = (char*)malloc(strlen(config_path)+1+strlen(LIBIMOBILEDEVICE_CONF_FILE)+1);
386 strcpy(config_file, config_path);
387 strcat(config_file, DIR_SEP_S);
388 strcat(config_file, LIBIMOBILEDEVICE_CONF_FILE);
389
390 /* Now parse file to get the HostID */
391 plist_t config = NULL;
392 config_read(config_file, &config);
393 if (!config) {
394 config = plist_new_dict();
395 plist_dict_insert_item(config, "HostID", plist_new_string(host_id));
396 } else {
397 plist_t n = plist_dict_get_item(config, "HostID");
398 if (n) {
399 plist_set_string_val(n, host_id);
400 } else {
401 plist_dict_insert_item(config, "HostID", plist_new_string(host_id));
402 }
403 }
404
405 /* Store in config file */
406 debug_info("setting hostID to %s", host_id);
407
408 config_write(config_file, config);
409 plist_free(config);
410
411 free(config_file);
412 return 1;
413}
414
415/**
416 * Reads the HostID from a previously generated configuration file.
417 *
418 * @note It is the responsibility of the calling function to free the returned host_id
419 *
420 * @return The string containing the HostID or NULL
421 */
422void userpref_get_host_id(char **host_id)
423{
424 const char *config_path;
425 char *config_file;
426
427 config_path = userpref_get_config_dir();
428 config_file = (char*)malloc(strlen(config_path)+1+strlen(LIBIMOBILEDEVICE_CONF_FILE)+1);
429 strcpy(config_file, config_path);
430 strcat(config_file, DIR_SEP_S);
431 strcat(config_file, LIBIMOBILEDEVICE_CONF_FILE);
432
433 /* now parse file to get the HostID */
434 plist_t config = NULL;
435 if (config_read(config_file, &config) == 0) {
436 plist_t n_host_id = plist_dict_get_item(config, "HostID");
437 if (n_host_id && (plist_get_node_type(n_host_id) == PLIST_STRING)) {
438 plist_get_string_val(n_host_id, host_id);
439 }
440 }
441 plist_free(config);
442 free(config_file);
443
444 if (!*host_id) {
445 /* no config, generate host_id */
446 *host_id = userpref_generate_host_id();
447 userpref_set_host_id(*host_id);
448 }
449
450 debug_info("Using %s as HostID", *host_id);
451}
452
453/**
454 * Determines whether this device has been connected to this system before.
455 *
456 * @param udid The device UDID as given by the device.
457 *
458 * @return 1 if the device has been connected previously to this configuration
459 * or 0 otherwise.
460 */
461int userpref_has_device_public_key(const char *udid)
462{
463 int ret = 0;
464 const char *config_path;
465 char *config_file;
466 struct stat st;
467
468 if (!udid) return 0;
469
470 /* first get config file */
471 config_path = userpref_get_config_dir();
472 config_file = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1);
473 strcpy(config_file, config_path);
474 strcat(config_file, DIR_SEP_S);
475 strcat(config_file, udid);
476 strcat(config_file, ".pem");
477
478 if ((stat(config_file, &st) == 0) && S_ISREG(st.st_mode))
479 ret = 1;
480 free(config_file);
481 return ret;
482}
483
484/**
485 * Fills a list with UDIDs of devices that have been connected to this
486 * system before, i.e. for which a public key file exists.
487 *
488 * @param list A pointer to a char** initially pointing to NULL that will
489 * hold a newly allocated list of UDIDs upon successful return.
490 * The caller is responsible for freeing the memory. Note that if
491 * no public key file was found the list has to be freed too as it
492 * points to a terminating NULL element.
493 * @param count The number of UDIDs found. This parameter can be NULL if it
494 * is not required.
495 *
496 * @return USERPREF_E_SUCCESS on success, or USERPREF_E_INVALID_ARG if the
497 * list parameter is not pointing to NULL.
498 */
499userpref_error_t userpref_get_paired_udids(char ***list, unsigned int *count)
500{
501 struct slist_t {
502 char *name;
503 void *next;
504 };
505 DIR *config_dir;
506 const char *config_path;
507 struct slist_t *udids = NULL;
508 unsigned int i;
509 unsigned int found = 0;
510
511 if (!list || (list && *list)) {
512 debug_info("ERROR: The list parameter needs to point to NULL!");
513 return USERPREF_E_INVALID_ARG;
514 }
515
516 if (count) {
517 *count = 0;
518 }
519
520 config_path = userpref_get_config_dir();
521 config_dir = opendir(config_path);
522 if (config_dir) {
523 struct dirent *entry;
524 struct slist_t *listp = udids;
525 while ((entry = readdir(config_dir))) {
526 char *ext = strstr(entry->d_name, ".pem");
527 if (ext && ((ext - entry->d_name) == 40) && (strlen(entry->d_name) == 44)) {
528 struct slist_t *ne = (struct slist_t*)malloc(sizeof(struct slist_t));
529 ne->name = (char*)malloc(41);
530 strncpy(ne->name, entry->d_name, 40);
531 ne->name[40] = 0;
532 ne->next = NULL;
533 if (!listp) {
534 listp = ne;
535 udids = listp;
536 } else {
537 listp->next = ne;
538 listp = listp->next;
539 }
540 found++;
541 }
542 }
543 closedir(config_dir);
544 }
545 *list = (char**)malloc(sizeof(char*) * (found+1));
546 i = 0;
547 while (udids) {
548 (*list)[i++] = udids->name;
549 struct slist_t *old = udids;
550 udids = udids->next;
551 free(old);
552 }
553 (*list)[i] = NULL;
554
555 if (count) {
556 *count = found;
557 }
558
559 return USERPREF_E_SUCCESS;
560}
561
562/**
563 * Mark the device (as represented by the key) as having connected to this
564 * configuration.
565 *
566 * @param udid The device UDID as given by the device
567 * @param public_key The public key given by the device
568 *
569 * @return 1 on success and 0 if no public key is given or if it has already
570 * been marked as connected previously.
571 */
572userpref_error_t userpref_set_device_public_key(const char *udid, key_data_t public_key)
573{
574 if (NULL == public_key.data)
575 return USERPREF_E_INVALID_ARG;
576
577 if (userpref_has_device_public_key(udid))
578 return USERPREF_E_SUCCESS;
579
580 /* ensure config directory exists */
581 userpref_create_config_dir();
582
583 /* build file path */
584 const char *config_path = userpref_get_config_dir();
585 char *pem = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1);
586 strcpy(pem, config_path);
587 strcat(pem, DIR_SEP_S);
588 strcat(pem, udid);
589 strcat(pem, ".pem");
590
591 /* store file */
592 FILE *pFile = fopen(pem, "wb");
593 if (pFile) {
594 fwrite(public_key.data, 1, public_key.size, pFile);
595 fclose(pFile);
596 } else {
597 debug_info("could not open '%s' for writing: %s", pem, strerror(errno));
598 }
599 free(pem);
600
601 return USERPREF_E_SUCCESS;
602}
603
604/**
605 * Remove the public key stored for the device with udid from this host.
606 *
607 * @param udid The udid of the device
608 *
609 * @return USERPREF_E_SUCCESS on success.
610 */
611userpref_error_t userpref_remove_device_public_key(const char *udid)
612{
613 if (!userpref_has_device_public_key(udid))
614 return USERPREF_E_SUCCESS;
615
616 /* build file path */
617 const char *config_path = userpref_get_config_dir();
618 char *pem = (char*)malloc(strlen(config_path)+1+strlen(udid)+4+1);
619 strcpy(pem, config_path);
620 strcat(pem, DIR_SEP_S);
621 strcat(pem, udid);
622 strcat(pem, ".pem");
623
624 /* remove file */
625 remove(pem);
626
627 free(pem);
628
629 return USERPREF_E_SUCCESS;
630}
631
632/**
633 * Private function which reads the given file into a key_data_t structure.
634 *
635 * @param file The filename of the file to read
636 * @param data The pointer at which to store the data.
637 *
638 * @return 1 if the file contents where read successfully and 0 otherwise.
639 */
640static int userpref_get_file_contents(const char *file, key_data_t * data)
641{
642 int success = 0;
643 unsigned long int size = 0;
644 unsigned char *content = NULL;
645 const char *config_path;
646 char *filepath;
647 FILE *fd;
648
649 if (NULL == file || NULL == data)
650 return 0;
651
652 /* Read file */
653 config_path = userpref_get_config_dir();
654 filepath = (char*)malloc(strlen(config_path)+1+strlen(file)+1);
655 strcpy(filepath, config_path);
656 strcat(filepath, DIR_SEP_S);
657 strcat(filepath, file);
658
659 fd = fopen(filepath, "rb");
660 if (fd) {
661 fseek(fd, 0, SEEK_END);
662 size = ftell(fd);
663 fseek(fd, 0, SEEK_SET);
664
665 // prevent huge files
666 if (size > 0xFFFFFF) {
667 fprintf(stderr, "%s: file is too big (> 16MB). Refusing to read the contents to memory!", __func__);
668 } else {
669 size_t p = 0;
670 content = (unsigned char*)malloc(size);
671 while (!feof(fd)) {
672 p += fread(content+p, 1, size-p, fd);
673 if (ferror(fd) != 0) {
674 break;
675 }
676 if (p >= size) {
677 success = 1;
678 break;
679 }
680 }
681 }
682 fclose(fd);
683 }
684
685 free(filepath);
686
687 /* Add it to the key_data_t structure */
688 if (success) {
689 data->data = (uint8_t*) content;
690 data->size = size;
691 }
692
693 return success;
694}
695
696/**
697 * Private function which generate private keys and certificates.
698 *
699 * @return 1 if keys were successfully generated, 0 otherwise
700 */
701static userpref_error_t userpref_gen_keys_and_cert(void)
702{
703 userpref_error_t ret = USERPREF_E_SSL_ERROR;
704
705 key_data_t root_key_pem = { NULL, 0 };
706 key_data_t root_cert_pem = { NULL, 0 };
707 key_data_t host_key_pem = { NULL, 0 };
708 key_data_t host_cert_pem = { NULL, 0 };
709
710 debug_info("Generating keys and certificates");
711#ifdef HAVE_OPENSSL
712 RSA* root_keypair = RSA_generate_key(2048, 65537, NULL, NULL);
713 RSA* host_keypair = RSA_generate_key(2048, 65537, NULL, NULL);
714
715 EVP_PKEY* root_pkey = EVP_PKEY_new();
716 EVP_PKEY_assign_RSA(root_pkey, root_keypair);
717
718 EVP_PKEY* host_pkey = EVP_PKEY_new();
719 EVP_PKEY_assign_RSA(host_pkey, host_keypair);
720
721 /* generate root certificate */
722 X509* root_cert = X509_new();
723 {
724 /* set serial number */
725 ASN1_INTEGER* sn = ASN1_INTEGER_new();
726 ASN1_INTEGER_set(sn, 0);
727 X509_set_serialNumber(root_cert, sn);
728 ASN1_INTEGER_free(sn);
729
730 /* set version */
731 X509_set_version(root_cert, 2);
732
733 /* set x509v3 basic constraints */
734 X509_EXTENSION* ext;
735 if (!(ext = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints, (char*)"critical,CA:TRUE"))) {
736 debug_info("ERROR: X509V3_EXT_conf_nid failed");
737 }
738 X509_add_ext(root_cert, ext, -1);
739
740 /* set key validity */
741 ASN1_TIME* asn1time = ASN1_TIME_new();
742 ASN1_TIME_set(asn1time, time(NULL));
743 X509_set_notBefore(root_cert, asn1time);
744 ASN1_TIME_set(asn1time, time(NULL) + (60 * 60 * 24 * 365 * 10));
745 X509_set_notAfter(root_cert, asn1time);
746 ASN1_TIME_free(asn1time);
747
748 /* use root public key for root cert */
749 X509_set_pubkey(root_cert, root_pkey);
750 /* sign root cert with root private key */
751 X509_sign(root_cert, root_pkey, EVP_sha1());
752 }
753
754 /* create host certificate */
755 X509* host_cert = X509_new();
756 {
757 /* set serial number */
758 ASN1_INTEGER* sn = ASN1_INTEGER_new();
759 ASN1_INTEGER_set(sn, 0);
760 X509_set_serialNumber(host_cert, sn);
761 ASN1_INTEGER_free(sn);
762
763 /* set version */
764 X509_set_version(host_cert, 2);
765
766 /* set x509v3 basic constraints */
767 X509_EXTENSION* ext;
768 if (!(ext = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints, (char*)"critical,CA:FALSE"))) {
769 debug_info("ERROR: X509V3_EXT_conf_nid failed");
770 }
771 X509_add_ext(host_cert, ext, -1);
772
773 /* set x509v3 key usage */
774 if (!(ext = X509V3_EXT_conf_nid(NULL, NULL, NID_key_usage, (char*)"digitalSignature,keyEncipherment"))) {
775 debug_info("ERROR: X509V3_EXT_conf_nid failed");
776 }
777 X509_add_ext(host_cert, ext, -1);
778
779 /* set key validity */
780 ASN1_TIME* asn1time = ASN1_TIME_new();
781 ASN1_TIME_set(asn1time, time(NULL));
782 X509_set_notBefore(host_cert, asn1time);
783 ASN1_TIME_set(asn1time, time(NULL) + (60 * 60 * 24 * 365 * 10));
784 X509_set_notAfter(host_cert, asn1time);
785 ASN1_TIME_free(asn1time);
786
787 /* use host public key for host cert */
788 X509_set_pubkey(host_cert, host_pkey);
789
790 /* sign host cert with root private key */
791 X509_sign(host_cert, root_pkey, EVP_sha1());
792 }
793
794 if (root_cert && root_pkey && host_cert && host_pkey) {
795 BIO* membp;
796
797 membp = BIO_new(BIO_s_mem());
798 if (PEM_write_bio_X509(membp, root_cert) > 0) {
799 root_cert_pem.size = BIO_get_mem_data(membp, &root_cert_pem.data);
800 }
801 membp = BIO_new(BIO_s_mem());
802 if (PEM_write_bio_PrivateKey(membp, root_pkey, NULL, NULL, 0, 0, NULL) > 0) {
803 root_key_pem.size = BIO_get_mem_data(membp, &root_key_pem.data);
804 }
805 membp = BIO_new(BIO_s_mem());
806 if (PEM_write_bio_X509(membp, host_cert) > 0) {
807 host_cert_pem.size = BIO_get_mem_data(membp, &host_cert_pem.data);
808 }
809 membp = BIO_new(BIO_s_mem());
810 if (PEM_write_bio_PrivateKey(membp, host_pkey, NULL, NULL, 0, 0, NULL) > 0) {
811 host_key_pem.size = BIO_get_mem_data(membp, &host_key_pem.data);
812 }
813 }
814
815 EVP_PKEY_free(root_pkey);
816 EVP_PKEY_free(host_pkey);
817
818 X509_free(host_cert);
819 X509_free(root_cert);
820#else
821 gnutls_x509_privkey_t root_privkey;
822 gnutls_x509_crt_t root_cert;
823 gnutls_x509_privkey_t host_privkey;
824 gnutls_x509_crt_t host_cert;
825
826 gnutls_global_deinit();
827 gnutls_global_init();
828
829 //use less secure random to speed up key generation
830 gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM);
831
832 gnutls_x509_privkey_init(&root_privkey);
833 gnutls_x509_privkey_init(&host_privkey);
834
835 gnutls_x509_crt_init(&root_cert);
836 gnutls_x509_crt_init(&host_cert);
837
838 /* generate root key */
839 gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0);
840 gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0);
841
842 /* generate certificates */
843 gnutls_x509_crt_set_key(root_cert, root_privkey);
844 gnutls_x509_crt_set_serial(root_cert, "\x00", 1);
845 gnutls_x509_crt_set_version(root_cert, 3);
846 gnutls_x509_crt_set_ca_status(root_cert, 1);
847 gnutls_x509_crt_set_activation_time(root_cert, time(NULL));
848 gnutls_x509_crt_set_expiration_time(root_cert, time(NULL) + (60 * 60 * 24 * 365 * 10));
849 gnutls_x509_crt_sign(root_cert, root_cert, root_privkey);
850
851 gnutls_x509_crt_set_key(host_cert, host_privkey);
852 gnutls_x509_crt_set_serial(host_cert, "\x00", 1);
853 gnutls_x509_crt_set_version(host_cert, 3);
854 gnutls_x509_crt_set_ca_status(host_cert, 0);
855 gnutls_x509_crt_set_key_usage(host_cert, GNUTLS_KEY_KEY_ENCIPHERMENT | GNUTLS_KEY_DIGITAL_SIGNATURE);
856 gnutls_x509_crt_set_activation_time(host_cert, time(NULL));
857 gnutls_x509_crt_set_expiration_time(host_cert, time(NULL) + (60 * 60 * 24 * 365 * 10));
858 gnutls_x509_crt_sign(host_cert, root_cert, root_privkey);
859
860 /* export to PEM format */
861 size_t root_key_export_size = 0;
862 size_t host_key_export_size = 0;
863
864 gnutls_x509_privkey_export(root_privkey, GNUTLS_X509_FMT_PEM, NULL, &root_key_export_size);
865 gnutls_x509_privkey_export(host_privkey, GNUTLS_X509_FMT_PEM, NULL, &host_key_export_size);
866
867 root_key_pem.data = gnutls_malloc(root_key_export_size);
868 host_key_pem.data = gnutls_malloc(host_key_export_size);
869
870 gnutls_x509_privkey_export(root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &root_key_export_size);
871 root_key_pem.size = root_key_export_size;
872 gnutls_x509_privkey_export(host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &host_key_export_size);
873 host_key_pem.size = host_key_export_size;
874
875 size_t root_cert_export_size = 0;
876 size_t host_cert_export_size = 0;
877
878 gnutls_x509_crt_export(root_cert, GNUTLS_X509_FMT_PEM, NULL, &root_cert_export_size);
879 gnutls_x509_crt_export(host_cert, GNUTLS_X509_FMT_PEM, NULL, &host_cert_export_size);
880
881 root_cert_pem.data = gnutls_malloc(root_cert_export_size);
882 host_cert_pem.data = gnutls_malloc(host_cert_export_size);
883
884 gnutls_x509_crt_export(root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_export_size);
885 root_cert_pem.size = root_cert_export_size;
886 gnutls_x509_crt_export(host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_export_size);
887 host_cert_pem.size = host_cert_export_size;
888
889 //restore gnutls env
890 gnutls_global_deinit();
891 gnutls_global_init();
892#endif
893 if (NULL != root_cert_pem.data && 0 != root_cert_pem.size &&
894 NULL != host_cert_pem.data && 0 != host_cert_pem.size)
895 ret = USERPREF_E_SUCCESS;
896
897 /* store values in config file */
898 userpref_set_keys_and_certs( &root_key_pem, &root_cert_pem, &host_key_pem, &host_cert_pem);
899
900 if (root_key_pem.data)
901 free(root_key_pem.data);
902 if (root_cert_pem.data)
903 free(root_cert_pem.data);
904 if (host_key_pem.data)
905 free(host_key_pem.data);
906 if (host_cert_pem.data)
907 free(host_cert_pem.data);
908
909 return ret;
910}
911
912/**
913 * Private function which import the given key into a gnutls structure.
914 *
915 * @param key_name The filename of the private key to import.
916 * @param key the gnutls key structure.
917 *
918 * @return 1 if the key was successfully imported.
919 */
920#ifdef HAVE_OPENSSL
921static userpref_error_t userpref_import_key(const char* key_name, key_data_t* key)
922#else
923static userpref_error_t userpref_import_key(const char* key_name, gnutls_x509_privkey_t key)
924#endif
925{
926#ifdef HAVE_OPENSSL
927 if (!key)
928 return USERPREF_E_SUCCESS;
929#endif
930 userpref_error_t ret = USERPREF_E_INVALID_CONF;
931 key_data_t pem_key = { NULL, 0 };
932 if (userpref_get_file_contents(key_name, &pem_key)) {
933#ifdef HAVE_OPENSSL
934 key->data = (unsigned char*)malloc(pem_key.size);
935 memcpy(key->data, pem_key.data, pem_key.size);
936 key->size = pem_key.size;
937 ret = USERPREF_E_SUCCESS;
938#else
939 if (GNUTLS_E_SUCCESS == gnutls_x509_privkey_import(key, &pem_key, GNUTLS_X509_FMT_PEM))
940 ret = USERPREF_E_SUCCESS;
941 else
942 ret = USERPREF_E_SSL_ERROR;
943#endif
944 }
945 if (pem_key.data)
946 free(pem_key.data);
947 return ret;
948}
949
950/**
951 * Private function which import the given certificate into a gnutls structure.
952 *
953 * @param crt_name The filename of the certificate to import.
954 * @param cert the gnutls certificate structure.
955 *
956 * @return IDEVICE_E_SUCCESS if the certificate was successfully imported.
957 */
958#ifdef HAVE_OPENSSL
959static userpref_error_t userpref_import_crt(const char* crt_name, key_data_t* cert)
960#else
961static userpref_error_t userpref_import_crt(const char* crt_name, gnutls_x509_crt_t cert)
962#endif
963{
964#ifdef HAVE_OPENSSL
965 if (!cert)
966 return USERPREF_E_SUCCESS;
967#endif
968 userpref_error_t ret = USERPREF_E_INVALID_CONF;
969 key_data_t pem_cert = { NULL, 0 };
970
971 if (userpref_get_file_contents(crt_name, &pem_cert)) {
972#ifdef HAVE_OPENSSL
973 cert->data = (unsigned char*)malloc(pem_cert.size);
974 memcpy(cert->data, pem_cert.data, pem_cert.size);
975 cert->size = pem_cert.size;
976 ret = USERPREF_E_SUCCESS;
977#else
978 if (GNUTLS_E_SUCCESS == gnutls_x509_crt_import(cert, &pem_cert, GNUTLS_X509_FMT_PEM))
979 ret = USERPREF_E_SUCCESS;
980 else
981 ret = USERPREF_E_SSL_ERROR;
982#endif
983 }
984 if (pem_cert.data)
985 free(pem_cert.data);
986 return ret;
987}
988
989/**
990 * Function to retrieve host keys and certificates.
991 * This function trigger key generation if they do not exists yet or are invalid.
992 *
993 * @note This function can take few seconds to complete (typically 5 seconds)
994 *
995 * @param root_privkey The root private key.
996 * @param root_crt The root certificate.
997 * @param host_privkey The host private key.
998 * @param host_crt The host certificate.
999 *
1000 * @return 1 if the keys and certificates were successfully retrieved, 0 otherwise
1001 */
1002#ifdef HAVE_OPENSSL
1003userpref_error_t userpref_get_keys_and_certs(key_data_t* root_privkey, key_data_t* root_crt, key_data_t* host_privkey, key_data_t* host_crt)
1004#else
1005userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey, gnutls_x509_crt_t root_crt, gnutls_x509_privkey_t host_privkey, gnutls_x509_crt_t host_crt)
1006#endif
1007{
1008 userpref_error_t ret = USERPREF_E_SUCCESS;
1009
1010 if (ret == USERPREF_E_SUCCESS)
1011 ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey);
1012
1013 if (ret == USERPREF_E_SUCCESS)
1014 ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey);
1015
1016 if (ret == USERPREF_E_SUCCESS)
1017 ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt);
1018
1019 if (ret == USERPREF_E_SUCCESS)
1020 ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt);
1021
1022 if (USERPREF_E_SUCCESS != ret) {
1023 //we had problem reading or importing root cert
1024 //try with a new ones.
1025 ret = userpref_gen_keys_and_cert();
1026
1027 if (ret == USERPREF_E_SUCCESS)
1028 ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey);
1029
1030 if (ret == USERPREF_E_SUCCESS)
1031 ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey);
1032
1033 if (ret == USERPREF_E_SUCCESS)
1034 ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt);
1035
1036 if (ret == USERPREF_E_SUCCESS)
1037 ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt);
1038 }
1039
1040 return ret;
1041}
1042
1043/**
1044 * Function to retrieve certificates encoded in PEM format.
1045 *
1046 * @param pem_root_cert The root certificate.
1047 * @param pem_host_cert The host certificate.
1048 *
1049 * @return 1 if the certificates were successfully retrieved, 0 otherwise
1050 */
1051userpref_error_t userpref_get_certs_as_pem(key_data_t *pem_root_cert, key_data_t *pem_host_cert)
1052{
1053 if (!pem_root_cert || !pem_host_cert)
1054 return USERPREF_E_INVALID_ARG;
1055
1056 if (userpref_get_file_contents(LIBIMOBILEDEVICE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIMOBILEDEVICE_HOST_CERTIF, pem_host_cert))
1057 return USERPREF_E_SUCCESS;
1058 else {
1059 if (pem_root_cert->data) {
1060 free(pem_root_cert->data);
1061 pem_root_cert->size = 0;
1062 }
1063 if (pem_host_cert->data) {
1064 free(pem_host_cert->data);
1065 pem_host_cert->size = 0;
1066 }
1067 }
1068 debug_info("configuration invalid");
1069 return USERPREF_E_INVALID_CONF;
1070}
1071
1072/**
1073 * Create and save a configuration file containing the given data.
1074 *
1075 * @note: All fields must specified and be non-null
1076 *
1077 * @param root_key The root key
1078 * @param root_cert The root certificate
1079 * @param host_key The host key
1080 * @param host_cert The host certificate
1081 *
1082 * @return 1 on success and 0 otherwise.
1083 */
1084userpref_error_t userpref_set_keys_and_certs(key_data_t * root_key, key_data_t * root_cert, key_data_t * host_key, key_data_t * host_cert)
1085{
1086 FILE *pFile;
1087 char *pem;
1088 const char *config_path;
1089 userpref_error_t ret = USERPREF_E_SUCCESS;
1090
1091 debug_info("saving keys and certs");
1092
1093 if (!root_key || !host_key || !root_cert || !host_cert) {
1094 debug_info("missing key or cert (root_key=%p, host_key=%p, root=cert=%p, host_cert=%p", root_key, host_key, root_cert, host_cert);
1095 return USERPREF_E_INVALID_ARG;
1096 }
1097
1098 /* Make sure config directory exists */
1099 userpref_create_config_dir();
1100
1101 config_path = userpref_get_config_dir();
1102
1103 /* Now write keys and certificates to disk */
1104 pem = (char*)malloc(strlen(config_path)+1+strlen(LIBIMOBILEDEVICE_ROOT_PRIVKEY)+1);
1105 strcpy(pem, config_path);
1106 strcat(pem, DIR_SEP_S);
1107 strcat(pem, LIBIMOBILEDEVICE_ROOT_PRIVKEY);
1108 pFile = fopen(pem, "wb");
1109 if (pFile) {
1110 fwrite(root_key->data, 1, root_key->size, pFile);
1111 fclose(pFile);
1112 } else {
1113 debug_info("could not open '%s' for writing: %s", pem, strerror(errno));
1114 ret = USERPREF_E_WRITE_ERROR;
1115 }
1116 free(pem);
1117
1118 pem = (char*)malloc(strlen(config_path)+1+strlen(LIBIMOBILEDEVICE_HOST_PRIVKEY)+1);
1119 strcpy(pem, config_path);
1120 strcat(pem, DIR_SEP_S);
1121 strcat(pem, LIBIMOBILEDEVICE_HOST_PRIVKEY);
1122 pFile = fopen(pem, "wb");
1123 if (pFile) {
1124 fwrite(host_key->data, 1, host_key->size, pFile);
1125 fclose(pFile);
1126 } else {
1127 debug_info("could not open '%s' for writing: %s", pem, strerror(errno));
1128 ret = USERPREF_E_WRITE_ERROR;
1129 }
1130 free(pem);
1131
1132 pem = (char*)malloc(strlen(config_path)+1+strlen(LIBIMOBILEDEVICE_ROOT_CERTIF)+1);
1133 strcpy(pem, config_path);
1134 strcat(pem, DIR_SEP_S);
1135 strcat(pem, LIBIMOBILEDEVICE_ROOT_CERTIF);
1136 pFile = fopen(pem, "wb");
1137 if (pFile) {
1138 fwrite(root_cert->data, 1, root_cert->size, pFile);
1139 fclose(pFile);
1140 } else {
1141 debug_info("could not open '%s' for writing: %s", pem, strerror(errno));
1142 ret = USERPREF_E_WRITE_ERROR;
1143 }
1144 free(pem);
1145
1146 pem = (char*)malloc(strlen(config_path)+1+strlen(LIBIMOBILEDEVICE_HOST_CERTIF)+1);
1147 strcpy(pem, config_path);
1148 strcat(pem, DIR_SEP_S);
1149 strcat(pem, LIBIMOBILEDEVICE_HOST_CERTIF);
1150 pFile = fopen(pem, "wb");
1151 if (pFile) {
1152 fwrite(host_cert->data, 1, host_cert->size, pFile);
1153 fclose(pFile);
1154 } else {
1155 debug_info("could not open '%s' for writing: %s", pem, strerror(errno));
1156 ret = USERPREF_E_WRITE_ERROR;
1157 }
1158 free(pem);
1159
1160 return ret;
1161}
11620
=== removed file '.pc/CVE-2013-2142.patch/src/utils.c'
=== removed file '.pc/CVE-2013-2142.patch/src/utils.h'
=== removed file '.pc/applied-patches'
--- .pc/applied-patches 2013-10-28 23:01:08 +0000
+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
101-libs.private.patch
202-fix-link-errors.patch
3CVE-2013-2142.patch
409_use_python_config.patch
5git_explicitly_cast_ssl_enabled.patch
60
=== removed directory '.pc/git_explicitly_cast_ssl_enabled.patch'
=== removed directory '.pc/git_explicitly_cast_ssl_enabled.patch/cython'
=== removed file '.pc/git_explicitly_cast_ssl_enabled.patch/cython/lockdown.pxi'
--- .pc/git_explicitly_cast_ssl_enabled.patch/cython/lockdown.pxi 2013-07-31 15:34:39 +0000
+++ .pc/git_explicitly_cast_ssl_enabled.patch/cython/lockdown.pxi 1970-01-01 00:00:00 +0000
@@ -1,297 +0,0 @@
1cdef extern from "libimobiledevice/lockdown.h":
2 ctypedef enum lockdownd_error_t:
3 LOCKDOWN_E_SUCCESS = 0
4 LOCKDOWN_E_INVALID_ARG = -1
5 LOCKDOWN_E_INVALID_CONF = -2
6 LOCKDOWN_E_PLIST_ERROR = -3
7 LOCKDOWN_E_PAIRING_FAILED = -4
8 LOCKDOWN_E_SSL_ERROR = -5
9 LOCKDOWN_E_DICT_ERROR = -6
10 LOCKDOWN_E_START_SERVICE_FAILED = -7
11 LOCKDOWN_E_NOT_ENOUGH_DATA = -8
12 LOCKDOWN_E_SET_VALUE_PROHIBITED = -9
13 LOCKDOWN_E_GET_VALUE_PROHIBITED = -10
14 LOCKDOWN_E_REMOVE_VALUE_PROHIBITED = -11
15 LOCKDOWN_E_MUX_ERROR = -12
16 LOCKDOWN_E_ACTIVATION_FAILED = -13
17 LOCKDOWN_E_PASSWORD_PROTECTED = -14
18 LOCKDOWN_E_NO_RUNNING_SESSION = -15
19 LOCKDOWN_E_INVALID_HOST_ID = -16
20 LOCKDOWN_E_INVALID_SERVICE = -17
21 LOCKDOWN_E_INVALID_ACTIVATION_RECORD = -18
22 LOCKDOWN_E_UNKNOWN_ERROR = -256
23
24 lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, char *label)
25 lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, char *label)
26 lockdownd_error_t lockdownd_client_free(lockdownd_client_t client)
27
28 lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **tp)
29 lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t *value)
30 lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t value)
31 lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, char *domain, char *key)
32 lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, char *identifier, lockdownd_service_descriptor_t *service)
33 lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, char *host_id, char **session_id, int *ssl_enabled)
34 lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, char *session_id)
35 lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist.plist_t plist)
36 lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist.plist_t *plist)
37 lockdownd_error_t lockdownd_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record)
38 lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record)
39 lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, lockdownd_pair_record_t pair_record)
40 lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist.plist_t activation_record)
41 lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client)
42 lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client)
43 lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client)
44 lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count)
45 lockdownd_error_t lockdownd_data_classes_free(char **classes)
46 lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service)
47
48cdef class LockdownError(BaseError):
49 def __init__(self, *args, **kwargs):
50 self._lookup_table = {
51 LOCKDOWN_E_SUCCESS: "Success",
52 LOCKDOWN_E_INVALID_ARG: "Invalid argument",
53 LOCKDOWN_E_INVALID_CONF: "Invalid configuration",
54 LOCKDOWN_E_PLIST_ERROR: "Property list error",
55 LOCKDOWN_E_PAIRING_FAILED: "Pairing failed",
56 LOCKDOWN_E_SSL_ERROR: "SSL error",
57 LOCKDOWN_E_DICT_ERROR: "Dict error",
58 LOCKDOWN_E_START_SERVICE_FAILED: "Start service failed",
59 LOCKDOWN_E_NOT_ENOUGH_DATA: "Not enough data",
60 LOCKDOWN_E_SET_VALUE_PROHIBITED: "Set value prohibited",
61 LOCKDOWN_E_GET_VALUE_PROHIBITED: "Get value prohibited",
62 LOCKDOWN_E_REMOVE_VALUE_PROHIBITED: "Remove value prohibited",
63 LOCKDOWN_E_MUX_ERROR: "MUX Error",
64 LOCKDOWN_E_ACTIVATION_FAILED: "Activation failed",
65 LOCKDOWN_E_PASSWORD_PROTECTED: "Password protected",
66 LOCKDOWN_E_NO_RUNNING_SESSION: "No running session",
67 LOCKDOWN_E_INVALID_HOST_ID: "Invalid host ID",
68 LOCKDOWN_E_INVALID_SERVICE: "Invalid service",
69 LOCKDOWN_E_INVALID_ACTIVATION_RECORD: "Invalid activation record",
70 LOCKDOWN_E_UNKNOWN_ERROR: "Unknown error"
71 }
72 BaseError.__init__(self, *args, **kwargs)
73
74cdef class LockdownPairRecord:
75 #def __cinit__(self, bytes device_certificate, bytes host_certificate, bytes host_id, bytes root_certificate, *args, **kwargs):
76 property device_certificate:
77 def __get__(self):
78 cdef bytes result = self._c_record.device_certificate
79 return result
80 property host_certificate:
81 def __get__(self):
82 cdef bytes result = self._c_record.host_certificate
83 return result
84 property host_id:
85 def __get__(self):
86 cdef bytes result = self._c_record.host_id
87 return result
88 property root_certificate:
89 def __get__(self):
90 cdef bytes result = self._c_record.root_certificate
91 return result
92
93cdef class LockdownServiceDescriptor:
94 #def __cinit__(self, uint16_t port, uint8_t ssl_enabled, *args, **kwargs):
95 def __dealloc__(self):
96 cdef lockdownd_error_t err
97 if self._c_service_descriptor is not NULL:
98 err = lockdownd_service_descriptor_free(self._c_service_descriptor)
99 self._c_service_descriptor = NULL
100 self.handle_error(err)
101 property port:
102 def __get__(self):
103 return self._c_service_descriptor.port
104 property ssl_enabled:
105 def __get__(self):
106 return self._c_service_descriptor.ssl_enabled
107
108cdef class LockdownClient(PropertyListService):
109 def __cinit__(self, iDevice device not None, bytes label=b'', bint handshake=True, *args, **kwargs):
110 cdef:
111 lockdownd_error_t err
112 char* c_label = NULL
113 if label:
114 c_label = label
115 if handshake:
116 err = lockdownd_client_new_with_handshake(device._c_dev, &self._c_client, c_label)
117 else:
118 err = lockdownd_client_new(device._c_dev, &self._c_client, c_label)
119 self.handle_error(err)
120
121 self.device = device
122
123 def __dealloc__(self):
124 cdef lockdownd_error_t err
125 if self._c_client is not NULL:
126 err = lockdownd_client_free(self._c_client)
127 self.handle_error(err)
128
129 cpdef bytes query_type(self):
130 cdef:
131 lockdownd_error_t err
132 char* c_type = NULL
133 bytes result
134 err = lockdownd_query_type(self._c_client, &c_type)
135 try:
136 self.handle_error(err)
137 result = c_type
138
139 return result
140 except BaseError, e:
141 raise
142 finally:
143 if c_type != NULL:
144 free(c_type)
145
146 cpdef plist.Node get_value(self, bytes domain=None, bytes key=None):
147 cdef:
148 lockdownd_error_t err
149 plist.plist_t c_node = NULL
150 char* c_domain = NULL
151 char* c_key = NULL
152 if domain is not None:
153 c_domain = domain
154 if key is not None:
155 c_key = key
156
157 err = lockdownd_get_value(self._c_client, c_domain, c_key, &c_node)
158
159 try:
160 self.handle_error(err)
161
162 return plist.plist_t_to_node(c_node)
163 except BaseError, e:
164 if c_node != NULL:
165 plist.plist_free(c_node)
166 raise
167
168 cpdef set_value(self, bytes domain, bytes key, object value):
169 cdef plist.plist_t c_node = plist.native_to_plist_t(value)
170 try:
171 self.handle_error(lockdownd_set_value(self._c_client, domain, key, c_node))
172 except BaseError, e:
173 raise
174 finally:
175 if c_node != NULL:
176 plist.plist_free(c_node)
177
178 cpdef remove_value(self, bytes domain, bytes key):
179 self.handle_error(lockdownd_remove_value(self._c_client, domain, key))
180
181 cpdef object start_service(self, object service):
182 cdef:
183 char* c_service_name = NULL
184 lockdownd_service_descriptor_t c_descriptor = NULL
185 LockdownServiceDescriptor result
186
187 if issubclass(service, BaseService) and \
188 service.__service_name__ is not None \
189 and isinstance(service.__service_name__, basestring):
190 c_service_name = <bytes>service.__service_name__
191 elif isinstance(service, basestring):
192 c_service_name = <bytes>service
193 else:
194 raise TypeError("LockdownClient.start_service() takes a BaseService or string as its first argument")
195
196 try:
197 self.handle_error(lockdownd_start_service(self._c_client, c_service_name, &c_descriptor))
198
199 result = LockdownServiceDescriptor.__new__(LockdownServiceDescriptor)
200 result._c_service_descriptor = c_descriptor
201
202 return result
203 except BaseError, e:
204 raise
205
206 cpdef object get_service_client(self, object service_class):
207 cdef:
208 LockdownServiceDescriptor descriptor
209
210 if not hasattr(service_class, '__service_name__') and \
211 not service_class.__service_name__ is not None \
212 and not isinstance(service_class.__service_name__, basestring):
213 raise TypeError("LockdownClient.get_service_client() takes a BaseService as its first argument")
214
215 descriptor = self.start_service(service_class)
216 return service_class(self.device, descriptor)
217
218 cpdef tuple start_session(self, bytes host_id):
219 cdef:
220 lockdownd_error_t err
221 char* c_session_id = NULL
222 bint ssl_enabled
223 bytes session_id
224 err = lockdownd_start_session(self._c_client, host_id, &c_session_id, &ssl_enabled)
225 try:
226 self.handle_error(err)
227
228 session_id = c_session_id
229 return (session_id, ssl_enabled)
230 except BaseError, e:
231 raise
232 finally:
233 if c_session_id != NULL:
234 free(c_session_id)
235
236 cpdef stop_session(self, bytes session_id):
237 self.handle_error(lockdownd_stop_session(self._c_client, session_id))
238
239 cpdef pair(self, object pair_record=None):
240 cdef lockdownd_pair_record_t c_pair_record = NULL
241 if pair_record is not None:
242 c_pair_record = (<LockdownPairRecord>pair_record)._c_record
243 self.handle_error(lockdownd_pair(self._c_client, c_pair_record))
244
245 cpdef validate_pair(self, object pair_record=None):
246 cdef lockdownd_pair_record_t c_pair_record = NULL
247 if pair_record is not None:
248 c_pair_record = (<LockdownPairRecord>pair_record)._c_record
249 self.handle_error(lockdownd_validate_pair(self._c_client, c_pair_record))
250
251 cpdef unpair(self, object pair_record=None):
252 cdef lockdownd_pair_record_t c_pair_record = NULL
253 if pair_record is not None:
254 c_pair_record = (<LockdownPairRecord>pair_record)._c_record
255 self.handle_error(lockdownd_unpair(self._c_client, c_pair_record))
256
257 cpdef activate(self, plist.Node activation_record):
258 self.handle_error(lockdownd_activate(self._c_client, activation_record._c_node))
259
260 cpdef deactivate(self):
261 self.handle_error(lockdownd_deactivate(self._c_client))
262
263 cpdef enter_recovery(self):
264 self.handle_error(lockdownd_enter_recovery(self._c_client))
265
266 cpdef goodbye(self):
267 self.handle_error(lockdownd_goodbye(self._c_client))
268
269 cpdef list get_sync_data_classes(self):
270 cdef:
271 char **classes = NULL
272 int count = 0
273 list result = []
274 bytes data_class
275
276 try:
277 self.handle_error(lockdownd_get_sync_data_classes(self._c_client, &classes, &count))
278
279 for i from 0 <= i < count:
280 data_class = classes[i]
281 result.append(data_class)
282
283 return result
284 except Exception, e:
285 raise
286 finally:
287 if classes != NULL:
288 lockdownd_data_classes_free(classes)
289
290 cdef inline int16_t _send(self, plist.plist_t node):
291 return lockdownd_send(self._c_client, node)
292
293 cdef inline int16_t _receive(self, plist.plist_t* node):
294 return lockdownd_receive(self._c_client, node)
295
296 cdef inline BaseError _error(self, int16_t ret):
297 return LockdownError(ret)
2980
=== modified file 'Makefile.am'
--- Makefile.am 2012-07-29 11:31:31 +0000
+++ Makefile.am 2014-03-14 06:45:31 +0000
@@ -1,6 +1,6 @@
1AUTOMAKE_OPTIONS = foreign1AUTOMAKE_OPTIONS = foreign
2ACLOCAL_AMFLAGS = -I m42ACLOCAL_AMFLAGS = -I m4
3SUBDIRS = src include $(CYTHON_SUB) $(DEV_SUB) tools docs3SUBDIRS = common src include $(CYTHON_SUB) $(DEV_SUB) tools docs
44
5DISTCHECK_CONFIGURE_FLAGS = --enable-dev-tools5DISTCHECK_CONFIGURE_FLAGS = --enable-dev-tools
66
77
=== removed file 'Makefile.in'
--- Makefile.in 2013-10-28 23:01:08 +0000
+++ Makefile.in 1970-01-01 00:00:00 +0000
@@ -1,918 +0,0 @@
1# Makefile.in generated by automake 1.12.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994-2012 Free Software Foundation, Inc.
5
6# This Makefile.in is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13# PARTICULAR PURPOSE.
14
15@SET_MAKE@
16
17VPATH = @srcdir@
18am__make_dryrun = \
19 { \
20 am__dry=no; \
21 case $$MAKEFLAGS in \
22 *\\[\ \ ]*) \
23 echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
24 | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
25 *) \
26 for am__flg in $$MAKEFLAGS; do \
27 case $$am__flg in \
28 *=*|--*) ;; \
29 *n*) am__dry=yes; break;; \
30 esac; \
31 done;; \
32 esac; \
33 test $$am__dry = yes; \
34 }
35pkgdatadir = $(datadir)/@PACKAGE@
36pkgincludedir = $(includedir)/@PACKAGE@
37pkglibdir = $(libdir)/@PACKAGE@
38pkglibexecdir = $(libexecdir)/@PACKAGE@
39am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
40install_sh_DATA = $(install_sh) -c -m 644
41install_sh_PROGRAM = $(install_sh) -c
42install_sh_SCRIPT = $(install_sh) -c
43INSTALL_HEADER = $(INSTALL_DATA)
44transform = $(program_transform_name)
45NORMAL_INSTALL = :
46PRE_INSTALL = :
47POST_INSTALL = :
48NORMAL_UNINSTALL = :
49PRE_UNINSTALL = :
50POST_UNINSTALL = :
51build_triplet = @build@
52host_triplet = @host@
53subdir = .
54DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
55 $(srcdir)/Makefile.in $(srcdir)/config.h.in \
56 $(srcdir)/doxygen.cfg.in $(srcdir)/libimobiledevice-1.0.pc.in \
57 $(top_srcdir)/configure AUTHORS COPYING COPYING.LESSER NEWS \
58 compile config.guess config.sub depcomp install-sh ltmain.sh \
59 missing
60ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
61am__aclocal_m4_deps = $(top_srcdir)/m4/ac_pkg_cython.m4 \
62 $(top_srcdir)/m4/ac_python_devel.m4 \
63 $(top_srcdir)/m4/as-compiler-flag.m4 \
64 $(top_srcdir)/m4/cython_python.m4 $(top_srcdir)/m4/libtool.m4 \
65 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
66 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
67 $(top_srcdir)/configure.ac
68am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
69 $(ACLOCAL_M4)
70am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
71 configure.lineno config.status.lineno
72mkinstalldirs = $(install_sh) -d
73CONFIG_HEADER = config.h
74CONFIG_CLEAN_FILES = libimobiledevice-1.0.pc doxygen.cfg
75CONFIG_CLEAN_VPATH_FILES =
76AM_V_GEN = $(am__v_GEN_@AM_V@)
77am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
78am__v_GEN_0 = @echo " GEN " $@;
79AM_V_at = $(am__v_at_@AM_V@)
80am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
81am__v_at_0 = @
82SOURCES =
83DIST_SOURCES =
84RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
85 html-recursive info-recursive install-data-recursive \
86 install-dvi-recursive install-exec-recursive \
87 install-html-recursive install-info-recursive \
88 install-pdf-recursive install-ps-recursive install-recursive \
89 installcheck-recursive installdirs-recursive pdf-recursive \
90 ps-recursive uninstall-recursive
91am__can_run_installinfo = \
92 case $$AM_UPDATE_INFO_DIR in \
93 n|no|NO) false;; \
94 *) (install-info --version) >/dev/null 2>&1;; \
95 esac
96am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
97am__vpath_adj = case $$p in \
98 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
99 *) f=$$p;; \
100 esac;
101am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
102am__install_max = 40
103am__nobase_strip_setup = \
104 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
105am__nobase_strip = \
106 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
107am__nobase_list = $(am__nobase_strip_setup); \
108 for p in $$list; do echo "$$p $$p"; done | \
109 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
110 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
111 if (++n[$$2] == $(am__install_max)) \
112 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
113 END { for (dir in files) print dir, files[dir] }'
114am__base_list = \
115 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
116 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
117am__uninstall_files_from_dir = { \
118 test -z "$$files" \
119 || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
120 || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
121 $(am__cd) "$$dir" && rm -f $$files; }; \
122 }
123am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
124DATA = $(pkgconfig_DATA)
125RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
126 distclean-recursive maintainer-clean-recursive
127AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
128 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
129 cscope distdir dist dist-all distcheck
130ETAGS = etags
131CTAGS = ctags
132CSCOPE = cscope
133DIST_SUBDIRS = $(SUBDIRS)
134DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
135distdir = $(PACKAGE)-$(VERSION)
136top_distdir = $(distdir)
137am__remove_distdir = \
138 if test -d "$(distdir)"; then \
139 find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
140 && rm -rf "$(distdir)" \
141 || { sleep 5 && rm -rf "$(distdir)"; }; \
142 else :; fi
143am__post_remove_distdir = $(am__remove_distdir)
144am__relativize = \
145 dir0=`pwd`; \
146 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
147 sed_rest='s,^[^/]*/*,,'; \
148 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
149 sed_butlast='s,/*[^/]*$$,,'; \
150 while test -n "$$dir1"; do \
151 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
152 if test "$$first" != "."; then \
153 if test "$$first" = ".."; then \
154 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
155 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
156 else \
157 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
158 if test "$$first2" = "$$first"; then \
159 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
160 else \
161 dir2="../$$dir2"; \
162 fi; \
163 dir0="$$dir0"/"$$first"; \
164 fi; \
165 fi; \
166 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
167 done; \
168 reldir="$$dir2"
169GZIP_ENV = --best
170DIST_ARCHIVES = $(distdir).tar.bz2
171DIST_TARGETS = dist-bzip2
172distuninstallcheck_listfiles = find . -type f -print
173am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
174 | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
175distcleancheck_listfiles = find . -type f -print
176ACLOCAL = @ACLOCAL@
177AMTAR = @AMTAR@
178AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
179AR = @AR@
180AUTOCONF = @AUTOCONF@
181AUTOHEADER = @AUTOHEADER@
182AUTOMAKE = @AUTOMAKE@
183AWK = @AWK@
184CC = @CC@
185CCDEPMODE = @CCDEPMODE@
186CFLAGS = @CFLAGS@
187CPP = @CPP@
188CPPFLAGS = @CPPFLAGS@
189CXX = @CXX@
190CXXCPP = @CXXCPP@
191CXXDEPMODE = @CXXDEPMODE@
192CXXFLAGS = @CXXFLAGS@
193CYGPATH_W = @CYGPATH_W@
194CYTHON = @CYTHON@
195CYTHON_LIB = @CYTHON_LIB@
196CYTHON_PLIST_INCLUDE_DIR = @CYTHON_PLIST_INCLUDE_DIR@
197CYTHON_PYTHON_CPPFLAGS = @CYTHON_PYTHON_CPPFLAGS@
198CYTHON_PYTHON_OPT = @CYTHON_PYTHON_OPT@
199CYTHON_SUB = @CYTHON_SUB@
200DEFS = @DEFS@
201DEPDIR = @DEPDIR@
202DEV_SUB = @DEV_SUB@
203DLLTOOL = @DLLTOOL@
204DSYMUTIL = @DSYMUTIL@
205DUMPBIN = @DUMPBIN@
206ECHO_C = @ECHO_C@
207ECHO_N = @ECHO_N@
208ECHO_T = @ECHO_T@
209EGREP = @EGREP@
210EXEEXT = @EXEEXT@
211FGREP = @FGREP@
212GLOBAL_CFLAGS = @GLOBAL_CFLAGS@
213GREP = @GREP@
214INSTALL = @INSTALL@
215INSTALL_DATA = @INSTALL_DATA@
216INSTALL_PROGRAM = @INSTALL_PROGRAM@
217INSTALL_SCRIPT = @INSTALL_SCRIPT@
218INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
219LD = @LD@
220LDFLAGS = @LDFLAGS@
221LFS_CFLAGS = @LFS_CFLAGS@
222LIBIMOBILEDEVICE_SO_VERSION = @LIBIMOBILEDEVICE_SO_VERSION@
223LIBOBJS = @LIBOBJS@
224LIBS = @LIBS@
225LIBTOOL = @LIBTOOL@
226LIPO = @LIPO@
227LN_S = @LN_S@
228LTLIBOBJS = @LTLIBOBJS@
229MAKEINFO = @MAKEINFO@
230MANIFEST_TOOL = @MANIFEST_TOOL@
231MKDIR_P = @MKDIR_P@
232NM = @NM@
233NMEDIT = @NMEDIT@
234OBJDUMP = @OBJDUMP@
235OBJEXT = @OBJEXT@
236OTOOL = @OTOOL@
237OTOOL64 = @OTOOL64@
238PACKAGE = @PACKAGE@
239PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
240PACKAGE_NAME = @PACKAGE_NAME@
241PACKAGE_STRING = @PACKAGE_STRING@
242PACKAGE_TARNAME = @PACKAGE_TARNAME@
243PACKAGE_URL = @PACKAGE_URL@
244PACKAGE_VERSION = @PACKAGE_VERSION@
245PATH_SEPARATOR = @PATH_SEPARATOR@
246PKG_CONFIG = @PKG_CONFIG@
247PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
248PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
249PYTHON = @PYTHON@
250PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
251PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
252PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
253PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
254PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
255PYTHON_PLATFORM = @PYTHON_PLATFORM@
256PYTHON_PREFIX = @PYTHON_PREFIX@
257PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
258PYTHON_VERSION = @PYTHON_VERSION@
259RANLIB = @RANLIB@
260SED = @SED@
261SET_MAKE = @SET_MAKE@
262SHELL = @SHELL@
263STRIP = @STRIP@
264VERSION = @VERSION@
265WINDRES = @WINDRES@
266abs_builddir = @abs_builddir@
267abs_srcdir = @abs_srcdir@
268abs_top_builddir = @abs_top_builddir@
269abs_top_srcdir = @abs_top_srcdir@
270ac_ct_AR = @ac_ct_AR@
271ac_ct_CC = @ac_ct_CC@
272ac_ct_CXX = @ac_ct_CXX@
273ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
274am__include = @am__include@
275am__leading_dot = @am__leading_dot@
276am__quote = @am__quote@
277am__tar = @am__tar@
278am__untar = @am__untar@
279bindir = @bindir@
280build = @build@
281build_alias = @build_alias@
282build_cpu = @build_cpu@
283build_os = @build_os@
284build_vendor = @build_vendor@
285builddir = @builddir@
286datadir = @datadir@
287datarootdir = @datarootdir@
288docdir = @docdir@
289dvidir = @dvidir@
290exec_prefix = @exec_prefix@
291host = @host@
292host_alias = @host_alias@
293host_cpu = @host_cpu@
294host_os = @host_os@
295host_vendor = @host_vendor@
296htmldir = @htmldir@
297includedir = @includedir@
298infodir = @infodir@
299install_sh = @install_sh@
300libdir = @libdir@
301libexecdir = @libexecdir@
302libgcrypt_LIBS = @libgcrypt_LIBS@
303libgnutls_CFLAGS = @libgnutls_CFLAGS@
304libgnutls_LIBS = @libgnutls_LIBS@
305libplist_CFLAGS = @libplist_CFLAGS@
306libplist_LIBS = @libplist_LIBS@
307libplistmm_CFLAGS = @libplistmm_CFLAGS@
308libplistmm_LIBS = @libplistmm_LIBS@
309libpthread_LIBS = @libpthread_LIBS@
310libtasn1_CFLAGS = @libtasn1_CFLAGS@
311libtasn1_LIBS = @libtasn1_LIBS@
312libusbmuxd_CFLAGS = @libusbmuxd_CFLAGS@
313libusbmuxd_LIBS = @libusbmuxd_LIBS@
314localedir = @localedir@
315localstatedir = @localstatedir@
316mandir = @mandir@
317mkdir_p = @mkdir_p@
318oldincludedir = @oldincludedir@
319openssl_CFLAGS = @openssl_CFLAGS@
320openssl_LIBS = @openssl_LIBS@
321pdfdir = @pdfdir@
322pkgpyexecdir = @pkgpyexecdir@
323pkgpythondir = @pkgpythondir@
324prefix = @prefix@
325program_transform_name = @program_transform_name@
326psdir = @psdir@
327pyexecdir = @pyexecdir@
328pythondir = @pythondir@
329sbindir = @sbindir@
330sharedstatedir = @sharedstatedir@
331srcdir = @srcdir@
332ssl_requires = @ssl_requires@
333sysconfdir = @sysconfdir@
334target_alias = @target_alias@
335top_build_prefix = @top_build_prefix@
336top_builddir = @top_builddir@
337top_srcdir = @top_srcdir@
338AUTOMAKE_OPTIONS = foreign
339ACLOCAL_AMFLAGS = -I m4
340SUBDIRS = src include $(CYTHON_SUB) $(DEV_SUB) tools docs
341DISTCHECK_CONFIGURE_FLAGS = --enable-dev-tools
342pkgconfigdir = $(libdir)/pkgconfig
343pkgconfig_DATA = libimobiledevice-1.0.pc
344EXTRA_DIST = docs
345all: config.h
346 $(MAKE) $(AM_MAKEFLAGS) all-recursive
347
348.SUFFIXES:
349am--refresh: Makefile
350 @:
351$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
352 @for dep in $?; do \
353 case '$(am__configure_deps)' in \
354 *$$dep*) \
355 echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
356 $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
357 && exit 0; \
358 exit 1;; \
359 esac; \
360 done; \
361 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
362 $(am__cd) $(top_srcdir) && \
363 $(AUTOMAKE) --foreign Makefile
364.PRECIOUS: Makefile
365Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
366 @case '$?' in \
367 *config.status*) \
368 echo ' $(SHELL) ./config.status'; \
369 $(SHELL) ./config.status;; \
370 *) \
371 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
372 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
373 esac;
374
375$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
376 $(SHELL) ./config.status --recheck
377
378$(top_srcdir)/configure: $(am__configure_deps)
379 $(am__cd) $(srcdir) && $(AUTOCONF)
380$(ACLOCAL_M4): $(am__aclocal_m4_deps)
381 $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
382$(am__aclocal_m4_deps):
383
384config.h: stamp-h1
385 @if test ! -f $@; then rm -f stamp-h1; else :; fi
386 @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
387
388stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
389 @rm -f stamp-h1
390 cd $(top_builddir) && $(SHELL) ./config.status config.h
391$(srcdir)/config.h.in: $(am__configure_deps)
392 ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
393 rm -f stamp-h1
394 touch $@
395
396distclean-hdr:
397 -rm -f config.h stamp-h1
398libimobiledevice-1.0.pc: $(top_builddir)/config.status $(srcdir)/libimobiledevice-1.0.pc.in
399 cd $(top_builddir) && $(SHELL) ./config.status $@
400doxygen.cfg: $(top_builddir)/config.status $(srcdir)/doxygen.cfg.in
401 cd $(top_builddir) && $(SHELL) ./config.status $@
402
403mostlyclean-libtool:
404 -rm -f *.lo
405
406clean-libtool:
407 -rm -rf .libs _libs
408
409distclean-libtool:
410 -rm -f libtool config.lt
411install-pkgconfigDATA: $(pkgconfig_DATA)
412 @$(NORMAL_INSTALL)
413 @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
414 if test -n "$$list"; then \
415 echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
416 $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
417 fi; \
418 for p in $$list; do \
419 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
420 echo "$$d$$p"; \
421 done | $(am__base_list) | \
422 while read files; do \
423 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
424 $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
425 done
426
427uninstall-pkgconfigDATA:
428 @$(NORMAL_UNINSTALL)
429 @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
430 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
431 dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
432
433# This directory's subdirectories are mostly independent; you can cd
434# into them and run 'make' without going through this Makefile.
435# To change the values of 'make' variables: instead of editing Makefiles,
436# (1) if the variable is set in 'config.status', edit 'config.status'
437# (which will cause the Makefiles to be regenerated when you run 'make');
438# (2) otherwise, pass the desired values on the 'make' command line.
439$(RECURSIVE_TARGETS):
440 @fail= failcom='exit 1'; \
441 for f in x $$MAKEFLAGS; do \
442 case $$f in \
443 *=* | --[!k]*);; \
444 *k*) failcom='fail=yes';; \
445 esac; \
446 done; \
447 dot_seen=no; \
448 target=`echo $@ | sed s/-recursive//`; \
449 list='$(SUBDIRS)'; for subdir in $$list; do \
450 echo "Making $$target in $$subdir"; \
451 if test "$$subdir" = "."; then \
452 dot_seen=yes; \
453 local_target="$$target-am"; \
454 else \
455 local_target="$$target"; \
456 fi; \
457 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
458 || eval $$failcom; \
459 done; \
460 if test "$$dot_seen" = "no"; then \
461 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
462 fi; test -z "$$fail"
463
464$(RECURSIVE_CLEAN_TARGETS):
465 @fail= failcom='exit 1'; \
466 for f in x $$MAKEFLAGS; do \
467 case $$f in \
468 *=* | --[!k]*);; \
469 *k*) failcom='fail=yes';; \
470 esac; \
471 done; \
472 dot_seen=no; \
473 case "$@" in \
474 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
475 *) list='$(SUBDIRS)' ;; \
476 esac; \
477 rev=''; for subdir in $$list; do \
478 if test "$$subdir" = "."; then :; else \
479 rev="$$subdir $$rev"; \
480 fi; \
481 done; \
482 rev="$$rev ."; \
483 target=`echo $@ | sed s/-recursive//`; \
484 for subdir in $$rev; do \
485 echo "Making $$target in $$subdir"; \
486 if test "$$subdir" = "."; then \
487 local_target="$$target-am"; \
488 else \
489 local_target="$$target"; \
490 fi; \
491 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
492 || eval $$failcom; \
493 done && test -z "$$fail"
494tags-recursive:
495 list='$(SUBDIRS)'; for subdir in $$list; do \
496 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
497 done
498ctags-recursive:
499 list='$(SUBDIRS)'; for subdir in $$list; do \
500 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
501 done
502cscopelist-recursive:
503 list='$(SUBDIRS)'; for subdir in $$list; do \
504 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
505 done
506
507ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
508 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
509 unique=`for i in $$list; do \
510 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
511 done | \
512 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
513 END { if (nonempty) { for (i in files) print i; }; }'`; \
514 mkid -fID $$unique
515tags: TAGS
516
517TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
518 $(TAGS_FILES) $(LISP)
519 set x; \
520 here=`pwd`; \
521 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
522 include_option=--etags-include; \
523 empty_fix=.; \
524 else \
525 include_option=--include; \
526 empty_fix=; \
527 fi; \
528 list='$(SUBDIRS)'; for subdir in $$list; do \
529 if test "$$subdir" = .; then :; else \
530 test ! -f $$subdir/TAGS || \
531 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
532 fi; \
533 done; \
534 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
535 unique=`for i in $$list; do \
536 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
537 done | \
538 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
539 END { if (nonempty) { for (i in files) print i; }; }'`; \
540 shift; \
541 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
542 test -n "$$unique" || unique=$$empty_fix; \
543 if test $$# -gt 0; then \
544 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
545 "$$@" $$unique; \
546 else \
547 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
548 $$unique; \
549 fi; \
550 fi
551ctags: CTAGS
552CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
553 $(TAGS_FILES) $(LISP)
554 list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
555 unique=`for i in $$list; do \
556 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
557 done | \
558 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
559 END { if (nonempty) { for (i in files) print i; }; }'`; \
560 test -z "$(CTAGS_ARGS)$$unique" \
561 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
562 $$unique
563
564GTAGS:
565 here=`$(am__cd) $(top_builddir) && pwd` \
566 && $(am__cd) $(top_srcdir) \
567 && gtags -i $(GTAGS_ARGS) "$$here"
568
569cscope: cscope.files
570 test ! -s cscope.files \
571 || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
572
573clean-cscope:
574 -rm -f cscope.files
575
576cscope.files: clean-cscope cscopelist-recursive cscopelist
577
578cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
579 list='$(SOURCES) $(HEADERS) $(LISP)'; \
580 case "$(srcdir)" in \
581 [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
582 *) sdir=$(subdir)/$(srcdir) ;; \
583 esac; \
584 for i in $$list; do \
585 if test -f "$$i"; then \
586 echo "$(subdir)/$$i"; \
587 else \
588 echo "$$sdir/$$i"; \
589 fi; \
590 done >> $(top_builddir)/cscope.files
591
592distclean-tags:
593 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
594 -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
595
596distdir: $(DISTFILES)
597 $(am__remove_distdir)
598 test -d "$(distdir)" || mkdir "$(distdir)"
599 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
600 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
601 list='$(DISTFILES)'; \
602 dist_files=`for file in $$list; do echo $$file; done | \
603 sed -e "s|^$$srcdirstrip/||;t" \
604 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
605 case $$dist_files in \
606 */*) $(MKDIR_P) `echo "$$dist_files" | \
607 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
608 sort -u` ;; \
609 esac; \
610 for file in $$dist_files; do \
611 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
612 if test -d $$d/$$file; then \
613 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
614 if test -d "$(distdir)/$$file"; then \
615 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
616 fi; \
617 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
618 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
619 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
620 fi; \
621 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
622 else \
623 test -f "$(distdir)/$$file" \
624 || cp -p $$d/$$file "$(distdir)/$$file" \
625 || exit 1; \
626 fi; \
627 done
628 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
629 if test "$$subdir" = .; then :; else \
630 $(am__make_dryrun) \
631 || test -d "$(distdir)/$$subdir" \
632 || $(MKDIR_P) "$(distdir)/$$subdir" \
633 || exit 1; \
634 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
635 $(am__relativize); \
636 new_distdir=$$reldir; \
637 dir1=$$subdir; dir2="$(top_distdir)"; \
638 $(am__relativize); \
639 new_top_distdir=$$reldir; \
640 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
641 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
642 ($(am__cd) $$subdir && \
643 $(MAKE) $(AM_MAKEFLAGS) \
644 top_distdir="$$new_top_distdir" \
645 distdir="$$new_distdir" \
646 am__remove_distdir=: \
647 am__skip_length_check=: \
648 am__skip_mode_fix=: \
649 distdir) \
650 || exit 1; \
651 fi; \
652 done
653 -test -n "$(am__skip_mode_fix)" \
654 || find "$(distdir)" -type d ! -perm -755 \
655 -exec chmod u+rwx,go+rx {} \; -o \
656 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
657 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
658 ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
659 || chmod -R a+r "$(distdir)"
660dist-gzip: distdir
661 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
662 $(am__post_remove_distdir)
663dist-bzip2: distdir
664 tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
665 $(am__post_remove_distdir)
666
667dist-lzip: distdir
668 tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
669 $(am__post_remove_distdir)
670
671dist-xz: distdir
672 tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
673 $(am__post_remove_distdir)
674
675dist-tarZ: distdir
676 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
677 $(am__post_remove_distdir)
678
679dist-shar: distdir
680 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
681 $(am__post_remove_distdir)
682
683dist-zip: distdir
684 -rm -f $(distdir).zip
685 zip -rq $(distdir).zip $(distdir)
686 $(am__post_remove_distdir)
687
688dist dist-all:
689 $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
690 $(am__post_remove_distdir)
691
692# This target untars the dist file and tries a VPATH configuration. Then
693# it guarantees that the distribution is self-contained by making another
694# tarfile.
695distcheck: dist
696 case '$(DIST_ARCHIVES)' in \
697 *.tar.gz*) \
698 GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
699 *.tar.bz2*) \
700 bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
701 *.tar.lz*) \
702 lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
703 *.tar.xz*) \
704 xz -dc $(distdir).tar.xz | $(am__untar) ;;\
705 *.tar.Z*) \
706 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
707 *.shar.gz*) \
708 GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
709 *.zip*) \
710 unzip $(distdir).zip ;;\
711 esac
712 chmod -R a-w $(distdir); chmod u+w $(distdir)
713 mkdir $(distdir)/_build
714 mkdir $(distdir)/_inst
715 chmod a-w $(distdir)
716 test -d $(distdir)/_build || exit 0; \
717 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
718 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
719 && am__cwd=`pwd` \
720 && $(am__cd) $(distdir)/_build \
721 && ../configure --srcdir=.. --prefix="$$dc_install_base" \
722 $(AM_DISTCHECK_CONFIGURE_FLAGS) \
723 $(DISTCHECK_CONFIGURE_FLAGS) \
724 && $(MAKE) $(AM_MAKEFLAGS) \
725 && $(MAKE) $(AM_MAKEFLAGS) dvi \
726 && $(MAKE) $(AM_MAKEFLAGS) check \
727 && $(MAKE) $(AM_MAKEFLAGS) install \
728 && $(MAKE) $(AM_MAKEFLAGS) installcheck \
729 && $(MAKE) $(AM_MAKEFLAGS) uninstall \
730 && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
731 distuninstallcheck \
732 && chmod -R a-w "$$dc_install_base" \
733 && ({ \
734 (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
735 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
736 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
737 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
738 distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
739 } || { rm -rf "$$dc_destdir"; exit 1; }) \
740 && rm -rf "$$dc_destdir" \
741 && $(MAKE) $(AM_MAKEFLAGS) dist \
742 && rm -rf $(DIST_ARCHIVES) \
743 && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
744 && cd "$$am__cwd" \
745 || exit 1
746 $(am__post_remove_distdir)
747 @(echo "$(distdir) archives ready for distribution: "; \
748 list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
749 sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
750distuninstallcheck:
751 @test -n '$(distuninstallcheck_dir)' || { \
752 echo 'ERROR: trying to run $@ with an empty' \
753 '$$(distuninstallcheck_dir)' >&2; \
754 exit 1; \
755 }; \
756 $(am__cd) '$(distuninstallcheck_dir)' || { \
757 echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
758 exit 1; \
759 }; \
760 test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
761 || { echo "ERROR: files left after uninstall:" ; \
762 if test -n "$(DESTDIR)"; then \
763 echo " (check DESTDIR support)"; \
764 fi ; \
765 $(distuninstallcheck_listfiles) ; \
766 exit 1; } >&2
767distcleancheck: distclean
768 @if test '$(srcdir)' = . ; then \
769 echo "ERROR: distcleancheck can only run from a VPATH build" ; \
770 exit 1 ; \
771 fi
772 @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
773 || { echo "ERROR: files left in build directory after distclean:" ; \
774 $(distcleancheck_listfiles) ; \
775 exit 1; } >&2
776check-am: all-am
777check: check-recursive
778all-am: Makefile $(DATA) config.h
779installdirs: installdirs-recursive
780installdirs-am:
781 for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
782 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
783 done
784install: install-recursive
785install-exec: install-exec-recursive
786install-data: install-data-recursive
787uninstall: uninstall-recursive
788
789install-am: all-am
790 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
791
792installcheck: installcheck-recursive
793install-strip:
794 if test -z '$(STRIP)'; then \
795 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
796 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
797 install; \
798 else \
799 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
800 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
801 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
802 fi
803mostlyclean-generic:
804
805clean-generic:
806
807distclean-generic:
808 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
809 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
810
811maintainer-clean-generic:
812 @echo "This command is intended for maintainers to use"
813 @echo "it deletes files that may require special tools to rebuild."
814clean: clean-recursive
815
816clean-am: clean-generic clean-libtool mostlyclean-am
817
818distclean: distclean-recursive
819 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
820 -rm -f Makefile
821distclean-am: clean-am distclean-generic distclean-hdr \
822 distclean-libtool distclean-tags
823
824dvi: dvi-recursive
825
826dvi-am:
827
828html: html-recursive
829
830html-am:
831
832info: info-recursive
833
834info-am:
835
836install-data-am: install-pkgconfigDATA
837
838install-dvi: install-dvi-recursive
839
840install-dvi-am:
841
842install-exec-am:
843
844install-html: install-html-recursive
845
846install-html-am:
847
848install-info: install-info-recursive
849
850install-info-am:
851
852install-man:
853
854install-pdf: install-pdf-recursive
855
856install-pdf-am:
857
858install-ps: install-ps-recursive
859
860install-ps-am:
861
862installcheck-am:
863
864maintainer-clean: maintainer-clean-recursive
865 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
866 -rm -rf $(top_srcdir)/autom4te.cache
867 -rm -f Makefile
868maintainer-clean-am: distclean-am maintainer-clean-generic
869
870mostlyclean: mostlyclean-recursive
871
872mostlyclean-am: mostlyclean-generic mostlyclean-libtool
873
874pdf: pdf-recursive
875
876pdf-am:
877
878ps: ps-recursive
879
880ps-am:
881
882uninstall-am: uninstall-pkgconfigDATA
883
884.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
885 cscopelist-recursive ctags-recursive install-am install-strip \
886 tags-recursive
887
888.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
889 all all-am am--refresh check check-am clean clean-cscope \
890 clean-generic clean-libtool cscope cscopelist \
891 cscopelist-recursive ctags ctags-recursive dist dist-all \
892 dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \
893 dist-zip distcheck distclean distclean-generic distclean-hdr \
894 distclean-libtool distclean-tags distcleancheck distdir \
895 distuninstallcheck dvi dvi-am html html-am info info-am \
896 install install-am install-data install-data-am install-dvi \
897 install-dvi-am install-exec install-exec-am install-html \
898 install-html-am install-info install-info-am install-man \
899 install-pdf install-pdf-am install-pkgconfigDATA install-ps \
900 install-ps-am install-strip installcheck installcheck-am \
901 installdirs installdirs-am maintainer-clean \
902 maintainer-clean-generic mostlyclean mostlyclean-generic \
903 mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
904 uninstall uninstall-am uninstall-pkgconfigDATA
905
906
907docs/html: $(top_builddir)/doxygen.cfg $(top_srcdir)/src/*.c $(top_srcdir)/src/*.h $(top_srcdir)/include/libimobiledevice/*.h
908 rm -rf docs/html
909 doxygen doxygen.cfg
910
911docs: doxygen.cfg docs/html
912
913indent:
914 indent -kr -ut -ts4 -l120 src/*.c src/*.h dev/*.c
915
916# Tell versions [3.59,3.63) of GNU make to not export all variables.
917# Otherwise a system limit (for SysV at least) may be exceeded.
918.NOEXPORT:
9190
=== modified file 'NEWS'
--- NEWS 2013-10-28 23:01:08 +0000
+++ NEWS 2014-03-14 06:45:31 +0000
@@ -1,3 +1,23 @@
1Version 1.1.6
2~~~~~~~~~~~~~
3
4* Development release
5* Changes:
6 - Security: Fix insecure use of the /tmp directory (CVE-2013-2142)
7 - A bunch of memory leak fixes
8 - Python: Various fixes and support for "with" statement for AfcFile class
9 - Python: Add Afc2Client class to allow jailbroken filesystem access
10 - Fix linking issue with newer libtool as reported for Ubuntu
11 - Fix stuck thread in idevicesyslog which broke quit from within the tool
12 - Add syslog_relay service implementation and use it in idevicesyslog
13 - API: Add instproxy_client_get_path_for_bundle_identifier() helper
14 - API: Add afc_dictionary_free() helper
15 - Move thread, socket, debug and userpref code to "common" source directory
16 in order to improve code reuse
17 - Fix broken byte order detection in configure.ac which could lead to broken
18 AFC protocol communication on platforms without endian.h (Raspberry PI)
19* API is UNSTABLE
20
1Version 1.1.521Version 1.1.5
2~~~~~~~~~~~~~22~~~~~~~~~~~~~
323
424
=== modified file 'README'
--- README 2013-07-31 15:34:39 +0000
+++ README 2014-03-14 06:45:31 +0000
@@ -19,6 +19,7 @@
19 automake19 automake
20 autoconf20 autoconf
21 libtool21 libtool
22 pkg-config
22 gcc23 gcc
2324
24Optional:25Optional:
@@ -29,7 +30,7 @@
29============30============
3031
31To compile run:32To compile run:
32 ./configure33 ./autogen.sh
33 make34 make
34 sudo make install35 sudo make install
3536
@@ -42,12 +43,18 @@
42Code:43Code:
43 git clone http://git.sukimashita.com/libimobiledevice.git44 git clone http://git.sukimashita.com/libimobiledevice.git
4445
46Code (Mirror):
47 git clone https://github.com/libimobiledevice/libimobiledevice.git
48
45Tickets:49Tickets:
46 http://libiphone.lighthouseapp.com/50 http://github.com/libimobiledevice/libimobiledevice/issues
4751
48Mailing List:52Mailing List:
49 http://lists.libimobiledevice.org/mailman/listinfo/libimobiledevice-devel53 http://lists.libimobiledevice.org/mailman/listinfo/libimobiledevice-devel
5054
55IRC:
56 irc://irc.freenode.net#libimobiledevice
57
51Credits58Credits
52=======59=======
5360
@@ -56,4 +63,4 @@
56authorized, sponsored, or otherwise approved by Apple Inc.63authorized, sponsored, or otherwise approved by Apple Inc.
5764
58README Updated on:65README Updated on:
59 2013-03-1866 2014-02-02
6067
=== removed file 'aclocal.m4'
--- aclocal.m4 2013-10-28 23:01:08 +0000
+++ aclocal.m4 1970-01-01 00:00:00 +0000
@@ -1,1454 +0,0 @@
1# generated automatically by aclocal 1.12.1 -*- Autoconf -*-
2
3# Copyright (C) 1996-2012 Free Software Foundation, Inc.
4
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_ifndef([AC_AUTOCONF_VERSION],
15 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
17[m4_warning([this file was generated for autoconf 2.69.
18You have another version of autoconf. It may work, but is not guaranteed to.
19If you have problems, you may need to regenerate the build system entirely.
20To do so, use the procedure documented by the package, typically 'autoreconf'.])])
21
22# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23# serial 1 (pkg-config-0.24)
24#
25# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
26#
27# This program is free software; you can redistribute it and/or modify
28# it under the terms of the GNU General Public License as published by
29# the Free Software Foundation; either version 2 of the License, or
30# (at your option) any later version.
31#
32# This program is distributed in the hope that it will be useful, but
33# WITHOUT ANY WARRANTY; without even the implied warranty of
34# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35# General Public License for more details.
36#
37# You should have received a copy of the GNU General Public License
38# along with this program; if not, write to the Free Software
39# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40#
41# As a special exception to the GNU General Public License, if you
42# distribute this file as part of a program that contains a
43# configuration script generated by Autoconf, you may include it under
44# the same distribution terms that you use for the rest of that program.
45
46# PKG_PROG_PKG_CONFIG([MIN-VERSION])
47# ----------------------------------
48AC_DEFUN([PKG_PROG_PKG_CONFIG],
49[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
50m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
51AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
52AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
53AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
54
55if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
56 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
57fi
58if test -n "$PKG_CONFIG"; then
59 _pkg_min_version=m4_default([$1], [0.9.0])
60 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
61 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
62 AC_MSG_RESULT([yes])
63 else
64 AC_MSG_RESULT([no])
65 PKG_CONFIG=""
66 fi
67fi[]dnl
68])# PKG_PROG_PKG_CONFIG
69
70# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
71#
72# Check to see whether a particular set of modules exists. Similar
73# to PKG_CHECK_MODULES(), but does not set variables or print errors.
74#
75# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
76# only at the first occurence in configure.ac, so if the first place
77# it's called might be skipped (such as if it is within an "if", you
78# have to call PKG_CHECK_EXISTS manually
79# --------------------------------------------------------------
80AC_DEFUN([PKG_CHECK_EXISTS],
81[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
82if test -n "$PKG_CONFIG" && \
83 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
84 m4_default([$2], [:])
85m4_ifvaln([$3], [else
86 $3])dnl
87fi])
88
89# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
90# ---------------------------------------------
91m4_define([_PKG_CONFIG],
92[if test -n "$$1"; then
93 pkg_cv_[]$1="$$1"
94 elif test -n "$PKG_CONFIG"; then
95 PKG_CHECK_EXISTS([$3],
96 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
97 [pkg_failed=yes])
98 else
99 pkg_failed=untried
100fi[]dnl
101])# _PKG_CONFIG
102
103# _PKG_SHORT_ERRORS_SUPPORTED
104# -----------------------------
105AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
106[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
107if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
108 _pkg_short_errors_supported=yes
109else
110 _pkg_short_errors_supported=no
111fi[]dnl
112])# _PKG_SHORT_ERRORS_SUPPORTED
113
114
115# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
116# [ACTION-IF-NOT-FOUND])
117#
118#
119# Note that if there is a possibility the first call to
120# PKG_CHECK_MODULES might not happen, you should be sure to include an
121# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
122#
123#
124# --------------------------------------------------------------
125AC_DEFUN([PKG_CHECK_MODULES],
126[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
127AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
128AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129
130pkg_failed=no
131AC_MSG_CHECKING([for $1])
132
133_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
134_PKG_CONFIG([$1][_LIBS], [libs], [$2])
135
136m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
137and $1[]_LIBS to avoid the need to call pkg-config.
138See the pkg-config man page for more details.])
139
140if test $pkg_failed = yes; then
141 AC_MSG_RESULT([no])
142 _PKG_SHORT_ERRORS_SUPPORTED
143 if test $_pkg_short_errors_supported = yes; then
144 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
145 else
146 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
147 fi
148 # Put the nasty error message in config.log where it belongs
149 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
150
151 m4_default([$4], [AC_MSG_ERROR(
152[Package requirements ($2) were not met:
153
154$$1_PKG_ERRORS
155
156Consider adjusting the PKG_CONFIG_PATH environment variable if you
157installed software in a non-standard prefix.
158
159_PKG_TEXT])[]dnl
160 ])
161elif test $pkg_failed = untried; then
162 AC_MSG_RESULT([no])
163 m4_default([$4], [AC_MSG_FAILURE(
164[The pkg-config script could not be found or is too old. Make sure it
165is in your PATH or set the PKG_CONFIG environment variable to the full
166path to pkg-config.
167
168_PKG_TEXT
169
170To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
171 ])
172else
173 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
174 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
175 AC_MSG_RESULT([yes])
176 $3
177fi[]dnl
178])# PKG_CHECK_MODULES
179
180# Copyright (C) 2002-2012 Free Software Foundation, Inc.
181#
182# This file is free software; the Free Software Foundation
183# gives unlimited permission to copy and/or distribute it,
184# with or without modifications, as long as this notice is preserved.
185
186# serial 8
187
188# AM_AUTOMAKE_VERSION(VERSION)
189# ----------------------------
190# Automake X.Y traces this macro to ensure aclocal.m4 has been
191# generated from the m4 files accompanying Automake X.Y.
192# (This private macro should not be called outside this file.)
193AC_DEFUN([AM_AUTOMAKE_VERSION],
194[am__api_version='1.12'
195dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
196dnl require some minimum version. Point them to the right macro.
197m4_if([$1], [1.12.1], [],
198 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
199])
200
201# _AM_AUTOCONF_VERSION(VERSION)
202# -----------------------------
203# aclocal traces this macro to find the Autoconf version.
204# This is a private macro too. Using m4_define simplifies
205# the logic in aclocal, which can simply ignore this definition.
206m4_define([_AM_AUTOCONF_VERSION], [])
207
208# AM_SET_CURRENT_AUTOMAKE_VERSION
209# -------------------------------
210# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
211# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
212AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
213[AM_AUTOMAKE_VERSION([1.12.1])dnl
214m4_ifndef([AC_AUTOCONF_VERSION],
215 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
216_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
217
218# AM_AUX_DIR_EXPAND -*- Autoconf -*-
219
220# Copyright (C) 2001-2012 Free Software Foundation, Inc.
221#
222# This file is free software; the Free Software Foundation
223# gives unlimited permission to copy and/or distribute it,
224# with or without modifications, as long as this notice is preserved.
225
226# serial 2
227
228# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
229# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
230# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
231#
232# Of course, Automake must honor this variable whenever it calls a
233# tool from the auxiliary directory. The problem is that $srcdir (and
234# therefore $ac_aux_dir as well) can be either absolute or relative,
235# depending on how configure is run. This is pretty annoying, since
236# it makes $ac_aux_dir quite unusable in subdirectories: in the top
237# source directory, any form will work fine, but in subdirectories a
238# relative path needs to be adjusted first.
239#
240# $ac_aux_dir/missing
241# fails when called from a subdirectory if $ac_aux_dir is relative
242# $top_srcdir/$ac_aux_dir/missing
243# fails if $ac_aux_dir is absolute,
244# fails when called from a subdirectory in a VPATH build with
245# a relative $ac_aux_dir
246#
247# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
248# are both prefixed by $srcdir. In an in-source build this is usually
249# harmless because $srcdir is '.', but things will broke when you
250# start a VPATH build or use an absolute $srcdir.
251#
252# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
253# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
254# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
255# and then we would define $MISSING as
256# MISSING="\${SHELL} $am_aux_dir/missing"
257# This will work as long as MISSING is not called from configure, because
258# unfortunately $(top_srcdir) has no meaning in configure.
259# However there are other variables, like CC, which are often used in
260# configure, and could therefore not use this "fixed" $ac_aux_dir.
261#
262# Another solution, used here, is to always expand $ac_aux_dir to an
263# absolute PATH. The drawback is that using absolute paths prevent a
264# configured tree to be moved without reconfiguration.
265
266AC_DEFUN([AM_AUX_DIR_EXPAND],
267[dnl Rely on autoconf to set up CDPATH properly.
268AC_PREREQ([2.50])dnl
269# expand $ac_aux_dir to an absolute path
270am_aux_dir=`cd $ac_aux_dir && pwd`
271])
272
273# AM_CONDITIONAL -*- Autoconf -*-
274
275# Copyright (C) 1997-2012 Free Software Foundation, Inc.
276#
277# This file is free software; the Free Software Foundation
278# gives unlimited permission to copy and/or distribute it,
279# with or without modifications, as long as this notice is preserved.
280
281# serial 10
282
283# AM_CONDITIONAL(NAME, SHELL-CONDITION)
284# -------------------------------------
285# Define a conditional.
286AC_DEFUN([AM_CONDITIONAL],
287[AC_PREREQ([2.52])dnl
288 m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
289 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
290AC_SUBST([$1_TRUE])dnl
291AC_SUBST([$1_FALSE])dnl
292_AM_SUBST_NOTMAKE([$1_TRUE])dnl
293_AM_SUBST_NOTMAKE([$1_FALSE])dnl
294m4_define([_AM_COND_VALUE_$1], [$2])dnl
295if $2; then
296 $1_TRUE=
297 $1_FALSE='#'
298else
299 $1_TRUE='#'
300 $1_FALSE=
301fi
302AC_CONFIG_COMMANDS_PRE(
303[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
304 AC_MSG_ERROR([[conditional "$1" was never defined.
305Usually this means the macro was only invoked conditionally.]])
306fi])])
307
308# Copyright (C) 1999-2012 Free Software Foundation, Inc.
309#
310# This file is free software; the Free Software Foundation
311# gives unlimited permission to copy and/or distribute it,
312# with or without modifications, as long as this notice is preserved.
313
314# serial 17
315
316# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
317# written in clear, in which case automake, when reading aclocal.m4,
318# will think it sees a *use*, and therefore will trigger all it's
319# C support machinery. Also note that it means that autoscan, seeing
320# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
321
322
323# _AM_DEPENDENCIES(NAME)
324# ----------------------
325# See how the compiler implements dependency checking.
326# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
327# We try a few techniques and use that to set a single cache variable.
328#
329# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
330# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
331# dependency, and given that the user is not expected to run this macro,
332# just rely on AC_PROG_CC.
333AC_DEFUN([_AM_DEPENDENCIES],
334[AC_REQUIRE([AM_SET_DEPDIR])dnl
335AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
336AC_REQUIRE([AM_MAKE_INCLUDE])dnl
337AC_REQUIRE([AM_DEP_TRACK])dnl
338
339m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
340 [$1], [CXX], [depcc="$CXX" am_compiler_list=],
341 [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
342 [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
343 [$1], [UPC], [depcc="$UPC" am_compiler_list=],
344 [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
345 [depcc="$$1" am_compiler_list=])
346
347AC_CACHE_CHECK([dependency style of $depcc],
348 [am_cv_$1_dependencies_compiler_type],
349[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
350 # We make a subdir and do the tests there. Otherwise we can end up
351 # making bogus files that we don't know about and never remove. For
352 # instance it was reported that on HP-UX the gcc test will end up
353 # making a dummy file named 'D' -- because '-MD' means "put the output
354 # in D".
355 rm -rf conftest.dir
356 mkdir conftest.dir
357 # Copy depcomp to subdir because otherwise we won't find it if we're
358 # using a relative directory.
359 cp "$am_depcomp" conftest.dir
360 cd conftest.dir
361 # We will build objects and dependencies in a subdirectory because
362 # it helps to detect inapplicable dependency modes. For instance
363 # both Tru64's cc and ICC support -MD to output dependencies as a
364 # side effect of compilation, but ICC will put the dependencies in
365 # the current directory while Tru64 will put them in the object
366 # directory.
367 mkdir sub
368
369 am_cv_$1_dependencies_compiler_type=none
370 if test "$am_compiler_list" = ""; then
371 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
372 fi
373 am__universal=false
374 m4_case([$1], [CC],
375 [case " $depcc " in #(
376 *\ -arch\ *\ -arch\ *) am__universal=true ;;
377 esac],
378 [CXX],
379 [case " $depcc " in #(
380 *\ -arch\ *\ -arch\ *) am__universal=true ;;
381 esac])
382
383 for depmode in $am_compiler_list; do
384 # Setup a source with many dependencies, because some compilers
385 # like to wrap large dependency lists on column 80 (with \), and
386 # we should not choose a depcomp mode which is confused by this.
387 #
388 # We need to recreate these files for each test, as the compiler may
389 # overwrite some of them when testing with obscure command lines.
390 # This happens at least with the AIX C compiler.
391 : > sub/conftest.c
392 for i in 1 2 3 4 5 6; do
393 echo '#include "conftst'$i'.h"' >> sub/conftest.c
394 # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
395 # Solaris 10 /bin/sh.
396 echo '/* dummy */' > sub/conftst$i.h
397 done
398 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
399
400 # We check with '-c' and '-o' for the sake of the "dashmstdout"
401 # mode. It turns out that the SunPro C++ compiler does not properly
402 # handle '-M -o', and we need to detect this. Also, some Intel
403 # versions had trouble with output in subdirs.
404 am__obj=sub/conftest.${OBJEXT-o}
405 am__minus_obj="-o $am__obj"
406 case $depmode in
407 gcc)
408 # This depmode causes a compiler race in universal mode.
409 test "$am__universal" = false || continue
410 ;;
411 nosideeffect)
412 # After this tag, mechanisms are not by side-effect, so they'll
413 # only be used when explicitly requested.
414 if test "x$enable_dependency_tracking" = xyes; then
415 continue
416 else
417 break
418 fi
419 ;;
420 msvc7 | msvc7msys | msvisualcpp | msvcmsys)
421 # This compiler won't grok '-c -o', but also, the minuso test has
422 # not run yet. These depmodes are late enough in the game, and
423 # so weak that their functioning should not be impacted.
424 am__obj=conftest.${OBJEXT-o}
425 am__minus_obj=
426 ;;
427 none) break ;;
428 esac
429 if depmode=$depmode \
430 source=sub/conftest.c object=$am__obj \
431 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
432 $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
433 >/dev/null 2>conftest.err &&
434 grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
435 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
436 grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
437 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
438 # icc doesn't choke on unknown options, it will just issue warnings
439 # or remarks (even with -Werror). So we grep stderr for any message
440 # that says an option was ignored or not supported.
441 # When given -MP, icc 7.0 and 7.1 complain thusly:
442 # icc: Command line warning: ignoring option '-M'; no argument required
443 # The diagnosis changed in icc 8.0:
444 # icc: Command line remark: option '-MP' not supported
445 if (grep 'ignoring option' conftest.err ||
446 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
447 am_cv_$1_dependencies_compiler_type=$depmode
448 break
449 fi
450 fi
451 done
452
453 cd ..
454 rm -rf conftest.dir
455else
456 am_cv_$1_dependencies_compiler_type=none
457fi
458])
459AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
460AM_CONDITIONAL([am__fastdep$1], [
461 test "x$enable_dependency_tracking" != xno \
462 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
463])
464
465
466# AM_SET_DEPDIR
467# -------------
468# Choose a directory name for dependency files.
469# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
470AC_DEFUN([AM_SET_DEPDIR],
471[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
472AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
473])
474
475
476# AM_DEP_TRACK
477# ------------
478AC_DEFUN([AM_DEP_TRACK],
479[AC_ARG_ENABLE([dependency-tracking], [dnl
480AS_HELP_STRING(
481 [--enable-dependency-tracking],
482 [do not reject slow dependency extractors])
483AS_HELP_STRING(
484 [--disable-dependency-tracking],
485 [speeds up one-time build])])
486if test "x$enable_dependency_tracking" != xno; then
487 am_depcomp="$ac_aux_dir/depcomp"
488 AMDEPBACKSLASH='\'
489 am__nodep='_no'
490fi
491AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
492AC_SUBST([AMDEPBACKSLASH])dnl
493_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
494AC_SUBST([am__nodep])dnl
495_AM_SUBST_NOTMAKE([am__nodep])dnl
496])
497
498# Generate code to set up dependency tracking. -*- Autoconf -*-
499
500# Copyright (C) 1999-2012 Free Software Foundation, Inc.
501#
502# This file is free software; the Free Software Foundation
503# gives unlimited permission to copy and/or distribute it,
504# with or without modifications, as long as this notice is preserved.
505
506# serial 6
507
508# _AM_OUTPUT_DEPENDENCY_COMMANDS
509# ------------------------------
510AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
511[{
512 # Autoconf 2.62 quotes --file arguments for eval, but not when files
513 # are listed without --file. Let's play safe and only enable the eval
514 # if we detect the quoting.
515 case $CONFIG_FILES in
516 *\'*) eval set x "$CONFIG_FILES" ;;
517 *) set x $CONFIG_FILES ;;
518 esac
519 shift
520 for mf
521 do
522 # Strip MF so we end up with the name of the file.
523 mf=`echo "$mf" | sed -e 's/:.*$//'`
524 # Check whether this is an Automake generated Makefile or not.
525 # We used to match only the files named 'Makefile.in', but
526 # some people rename them; so instead we look at the file content.
527 # Grep'ing the first line is not enough: some people post-process
528 # each Makefile.in and add a new line on top of each file to say so.
529 # Grep'ing the whole file is not good either: AIX grep has a line
530 # limit of 2048, but all sed's we know have understand at least 4000.
531 if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
532 dirpart=`AS_DIRNAME("$mf")`
533 else
534 continue
535 fi
536 # Extract the definition of DEPDIR, am__include, and am__quote
537 # from the Makefile without running 'make'.
538 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
539 test -z "$DEPDIR" && continue
540 am__include=`sed -n 's/^am__include = //p' < "$mf"`
541 test -z "am__include" && continue
542 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
543 # Find all dependency output files, they are included files with
544 # $(DEPDIR) in their names. We invoke sed twice because it is the
545 # simplest approach to changing $(DEPDIR) to its actual value in the
546 # expansion.
547 for file in `sed -n "
548 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
549 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
550 # Make sure the directory exists.
551 test -f "$dirpart/$file" && continue
552 fdir=`AS_DIRNAME(["$file"])`
553 AS_MKDIR_P([$dirpart/$fdir])
554 # echo "creating $dirpart/$file"
555 echo '# dummy' > "$dirpart/$file"
556 done
557 done
558}
559])# _AM_OUTPUT_DEPENDENCY_COMMANDS
560
561
562# AM_OUTPUT_DEPENDENCY_COMMANDS
563# -----------------------------
564# This macro should only be invoked once -- use via AC_REQUIRE.
565#
566# This code is only required when automatic dependency tracking
567# is enabled. FIXME. This creates each '.P' file that we will
568# need in order to bootstrap the dependency handling code.
569AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
570[AC_CONFIG_COMMANDS([depfiles],
571 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
572 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
573])
574
575# Do all the work for Automake. -*- Autoconf -*-
576
577# Copyright (C) 1996-2012 Free Software Foundation, Inc.
578#
579# This file is free software; the Free Software Foundation
580# gives unlimited permission to copy and/or distribute it,
581# with or without modifications, as long as this notice is preserved.
582
583# serial 19
584
585# This macro actually does too much. Some checks are only needed if
586# your package does certain things. But this isn't really a big deal.
587
588# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
589# AM_INIT_AUTOMAKE([OPTIONS])
590# -----------------------------------------------
591# The call with PACKAGE and VERSION arguments is the old style
592# call (pre autoconf-2.50), which is being phased out. PACKAGE
593# and VERSION should now be passed to AC_INIT and removed from
594# the call to AM_INIT_AUTOMAKE.
595# We support both call styles for the transition. After
596# the next Automake release, Autoconf can make the AC_INIT
597# arguments mandatory, and then we can depend on a new Autoconf
598# release and drop the old call support.
599AC_DEFUN([AM_INIT_AUTOMAKE],
600[AC_PREREQ([2.62])dnl
601dnl Autoconf wants to disallow AM_ names. We explicitly allow
602dnl the ones we care about.
603m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
604AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
605AC_REQUIRE([AC_PROG_INSTALL])dnl
606if test "`cd $srcdir && pwd`" != "`pwd`"; then
607 # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
608 # is not polluted with repeated "-I."
609 AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
610 # test to see if srcdir already configured
611 if test -f $srcdir/config.status; then
612 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
613 fi
614fi
615
616# test whether we have cygpath
617if test -z "$CYGPATH_W"; then
618 if (cygpath --version) >/dev/null 2>/dev/null; then
619 CYGPATH_W='cygpath -w'
620 else
621 CYGPATH_W=echo
622 fi
623fi
624AC_SUBST([CYGPATH_W])
625
626# Define the identity of the package.
627dnl Distinguish between old-style and new-style calls.
628m4_ifval([$2],
629[AC_DIAGNOSE([obsolete],
630[$0: two- and three-arguments forms are deprecated. For more info, see:
631http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
632m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
633 AC_SUBST([PACKAGE], [$1])dnl
634 AC_SUBST([VERSION], [$2])],
635[_AM_SET_OPTIONS([$1])dnl
636dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
637m4_if(
638 m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
639 [ok:ok],,
640 [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
641 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
642 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
643
644_AM_IF_OPTION([no-define],,
645[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
646 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
647
648# Some tools Automake needs.
649AC_REQUIRE([AM_SANITY_CHECK])dnl
650AC_REQUIRE([AC_ARG_PROGRAM])dnl
651AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
652AM_MISSING_PROG([AUTOCONF], [autoconf])
653AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
654AM_MISSING_PROG([AUTOHEADER], [autoheader])
655AM_MISSING_PROG([MAKEINFO], [makeinfo])
656AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
657AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
658AC_REQUIRE([AC_PROG_MKDIR_P])dnl
659AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
660# We need awk for the "check" target. The system "awk" is bad on
661# some platforms.
662AC_REQUIRE([AC_PROG_AWK])dnl
663AC_REQUIRE([AC_PROG_MAKE_SET])dnl
664AC_REQUIRE([AM_SET_LEADING_DOT])dnl
665_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
666 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
667 [_AM_PROG_TAR([v7])])])
668_AM_IF_OPTION([no-dependencies],,
669[AC_PROVIDE_IFELSE([AC_PROG_CC],
670 [_AM_DEPENDENCIES([CC])],
671 [m4_define([AC_PROG_CC],
672 m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
673AC_PROVIDE_IFELSE([AC_PROG_CXX],
674 [_AM_DEPENDENCIES([CXX])],
675 [m4_define([AC_PROG_CXX],
676 m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
677AC_PROVIDE_IFELSE([AC_PROG_OBJC],
678 [_AM_DEPENDENCIES([OBJC])],
679 [m4_define([AC_PROG_OBJC],
680 m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
681dnl Support for Objective C++ was only introduced in Autoconf 2.65,
682dnl but we still cater to Autoconf 2.62.
683m4_ifdef([AC_PROG_OBJCXX],
684[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
685 [_AM_DEPENDENCIES([OBJCXX])],
686 [m4_define([AC_PROG_OBJCXX],
687 m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
688])
689_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
690dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
691dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
692dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
693AC_CONFIG_COMMANDS_PRE(dnl
694[m4_provide_if([_AM_COMPILER_EXEEXT],
695 [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
696])
697
698dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
699dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
700dnl mangled by Autoconf and run in a shell conditional statement.
701m4_define([_AC_COMPILER_EXEEXT],
702m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
703
704
705# When config.status generates a header, we must update the stamp-h file.
706# This file resides in the same directory as the config header
707# that is generated. The stamp files are numbered to have different names.
708
709# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
710# loop where config.status creates the headers, so we can generate
711# our stamp files there.
712AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
713[# Compute $1's index in $config_headers.
714_am_arg=$1
715_am_stamp_count=1
716for _am_header in $config_headers :; do
717 case $_am_header in
718 $_am_arg | $_am_arg:* )
719 break ;;
720 * )
721 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
722 esac
723done
724echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
725
726# Copyright (C) 2001-2012 Free Software Foundation, Inc.
727#
728# This file is free software; the Free Software Foundation
729# gives unlimited permission to copy and/or distribute it,
730# with or without modifications, as long as this notice is preserved.
731
732# serial 8
733
734# AM_PROG_INSTALL_SH
735# ------------------
736# Define $install_sh.
737AC_DEFUN([AM_PROG_INSTALL_SH],
738[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
739if test x"${install_sh}" != xset; then
740 case $am_aux_dir in
741 *\ * | *\ *)
742 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
743 *)
744 install_sh="\${SHELL} $am_aux_dir/install-sh"
745 esac
746fi
747AC_SUBST([install_sh])])
748
749# Copyright (C) 2003-2012 Free Software Foundation, Inc.
750#
751# This file is free software; the Free Software Foundation
752# gives unlimited permission to copy and/or distribute it,
753# with or without modifications, as long as this notice is preserved.
754
755# serial 2
756
757# Check whether the underlying file-system supports filenames
758# with a leading dot. For instance MS-DOS doesn't.
759AC_DEFUN([AM_SET_LEADING_DOT],
760[rm -rf .tst 2>/dev/null
761mkdir .tst 2>/dev/null
762if test -d .tst; then
763 am__leading_dot=.
764else
765 am__leading_dot=_
766fi
767rmdir .tst 2>/dev/null
768AC_SUBST([am__leading_dot])])
769
770# Check to see how 'make' treats includes. -*- Autoconf -*-
771
772# Copyright (C) 2001-2012 Free Software Foundation, Inc.
773#
774# This file is free software; the Free Software Foundation
775# gives unlimited permission to copy and/or distribute it,
776# with or without modifications, as long as this notice is preserved.
777
778# serial 5
779
780# AM_MAKE_INCLUDE()
781# -----------------
782# Check to see how make treats includes.
783AC_DEFUN([AM_MAKE_INCLUDE],
784[am_make=${MAKE-make}
785cat > confinc << 'END'
786am__doit:
787 @echo this is the am__doit target
788.PHONY: am__doit
789END
790# If we don't find an include directive, just comment out the code.
791AC_MSG_CHECKING([for style of include used by $am_make])
792am__include="#"
793am__quote=
794_am_result=none
795# First try GNU make style include.
796echo "include confinc" > confmf
797# Ignore all kinds of additional output from 'make'.
798case `$am_make -s -f confmf 2> /dev/null` in #(
799*the\ am__doit\ target*)
800 am__include=include
801 am__quote=
802 _am_result=GNU
803 ;;
804esac
805# Now try BSD make style include.
806if test "$am__include" = "#"; then
807 echo '.include "confinc"' > confmf
808 case `$am_make -s -f confmf 2> /dev/null` in #(
809 *the\ am__doit\ target*)
810 am__include=.include
811 am__quote="\""
812 _am_result=BSD
813 ;;
814 esac
815fi
816AC_SUBST([am__include])
817AC_SUBST([am__quote])
818AC_MSG_RESULT([$_am_result])
819rm -f confinc confmf
820])
821
822# Copyright (C) 1999-2012 Free Software Foundation, Inc.
823#
824# This file is free software; the Free Software Foundation
825# gives unlimited permission to copy and/or distribute it,
826# with or without modifications, as long as this notice is preserved.
827
828# serial 6
829
830# AM_PROG_CC_C_O
831# --------------
832# Like AC_PROG_CC_C_O, but changed for automake.
833AC_DEFUN([AM_PROG_CC_C_O],
834[AC_REQUIRE([AC_PROG_CC_C_O])dnl
835AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
836AC_REQUIRE_AUX_FILE([compile])dnl
837# FIXME: we rely on the cache variable name because
838# there is no other way.
839set dummy $CC
840am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
841eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
842if test "$am_t" != yes; then
843 # Losing compiler, so override with the script.
844 # FIXME: It is wrong to rewrite CC.
845 # But if we don't then we get into trouble of one sort or another.
846 # A longer-term fix would be to have automake use am__CC in this case,
847 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
848 CC="$am_aux_dir/compile $CC"
849fi
850dnl Make sure AC_PROG_CC is never called again, or it will override our
851dnl setting of CC.
852m4_define([AC_PROG_CC],
853 [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
854])
855
856# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
857
858# Copyright (C) 1997-2012 Free Software Foundation, Inc.
859#
860# This file is free software; the Free Software Foundation
861# gives unlimited permission to copy and/or distribute it,
862# with or without modifications, as long as this notice is preserved.
863
864# serial 7
865
866# AM_MISSING_PROG(NAME, PROGRAM)
867# ------------------------------
868AC_DEFUN([AM_MISSING_PROG],
869[AC_REQUIRE([AM_MISSING_HAS_RUN])
870$1=${$1-"${am_missing_run}$2"}
871AC_SUBST($1)])
872
873
874# AM_MISSING_HAS_RUN
875# ------------------
876# Define MISSING if not defined so far and test if it supports --run.
877# If it does, set am_missing_run to use it, otherwise, to nothing.
878AC_DEFUN([AM_MISSING_HAS_RUN],
879[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
880AC_REQUIRE_AUX_FILE([missing])dnl
881if test x"${MISSING+set}" != xset; then
882 case $am_aux_dir in
883 *\ * | *\ *)
884 MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
885 *)
886 MISSING="\${SHELL} $am_aux_dir/missing" ;;
887 esac
888fi
889# Use eval to expand $SHELL
890if eval "$MISSING --run true"; then
891 am_missing_run="$MISSING --run "
892else
893 am_missing_run=
894 AC_MSG_WARN(['missing' script is too old or missing])
895fi
896])
897
898# Helper functions for option handling. -*- Autoconf -*-
899
900# Copyright (C) 2001-2012 Free Software Foundation, Inc.
901#
902# This file is free software; the Free Software Foundation
903# gives unlimited permission to copy and/or distribute it,
904# with or without modifications, as long as this notice is preserved.
905
906# serial 6
907
908# _AM_MANGLE_OPTION(NAME)
909# -----------------------
910AC_DEFUN([_AM_MANGLE_OPTION],
911[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
912
913# _AM_SET_OPTION(NAME)
914# --------------------
915# Set option NAME. Presently that only means defining a flag for this option.
916AC_DEFUN([_AM_SET_OPTION],
917[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
918
919# _AM_SET_OPTIONS(OPTIONS)
920# ------------------------
921# OPTIONS is a space-separated list of Automake options.
922AC_DEFUN([_AM_SET_OPTIONS],
923[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
924
925# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
926# -------------------------------------------
927# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
928AC_DEFUN([_AM_IF_OPTION],
929[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
930
931# Copyright (C) 1999-2012 Free Software Foundation, Inc.
932#
933# This file is free software; the Free Software Foundation
934# gives unlimited permission to copy and/or distribute it,
935# with or without modifications, as long as this notice is preserved.
936
937# serial 9
938
939# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
940# ---------------------------------------------------------------------------
941# Adds support for distributing Python modules and packages. To
942# install modules, copy them to $(pythondir), using the python_PYTHON
943# automake variable. To install a package with the same name as the
944# automake package, install to $(pkgpythondir), or use the
945# pkgpython_PYTHON automake variable.
946#
947# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
948# locations to install python extension modules (shared libraries).
949# Another macro is required to find the appropriate flags to compile
950# extension modules.
951#
952# If your package is configured with a different prefix to python,
953# users will have to add the install directory to the PYTHONPATH
954# environment variable, or create a .pth file (see the python
955# documentation for details).
956#
957# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
958# cause an error if the version of python installed on the system
959# doesn't meet the requirement. MINIMUM-VERSION should consist of
960# numbers and dots only.
961AC_DEFUN([AM_PATH_PYTHON],
962 [
963 dnl Find a Python interpreter. Python versions prior to 2.0 are not
964 dnl supported. (2.0 was released on October 16, 2000).
965 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
966[python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl
967 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
968
969 AC_ARG_VAR([PYTHON], [the Python interpreter])
970
971 m4_if([$1],[],[
972 dnl No version check is needed.
973 # Find any Python interpreter.
974 if test -z "$PYTHON"; then
975 AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
976 fi
977 am_display_PYTHON=python
978 ], [
979 dnl A version check is needed.
980 if test -n "$PYTHON"; then
981 # If the user set $PYTHON, use it and don't search something else.
982 AC_MSG_CHECKING([whether $PYTHON version is >= $1])
983 AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
984 [AC_MSG_RESULT([yes])],
985 [AC_MSG_RESULT([no])
986 AC_MSG_ERROR([Python interpreter is too old])])
987 am_display_PYTHON=$PYTHON
988 else
989 # Otherwise, try each interpreter until we find one that satisfies
990 # VERSION.
991 AC_CACHE_CHECK([for a Python interpreter with version >= $1],
992 [am_cv_pathless_PYTHON],[
993 for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
994 test "$am_cv_pathless_PYTHON" = none && break
995 AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
996 done])
997 # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
998 if test "$am_cv_pathless_PYTHON" = none; then
999 PYTHON=:
1000 else
1001 AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
1002 fi
1003 am_display_PYTHON=$am_cv_pathless_PYTHON
1004 fi
1005 ])
1006
1007 if test "$PYTHON" = :; then
1008 dnl Run any user-specified action, or abort.
1009 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
1010 else
1011
1012 dnl Query Python for its version number. Getting [:3] seems to be
1013 dnl the best way to do this; it's what "site.py" does in the standard
1014 dnl library.
1015
1016 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
1017 [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
1018 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
1019
1020 dnl Use the values of $prefix and $exec_prefix for the corresponding
1021 dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
1022 dnl distinct variables so they can be overridden if need be. However,
1023 dnl general consensus is that you shouldn't need this ability.
1024
1025 AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
1026 AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
1027
1028 dnl At times (like when building shared libraries) you may want
1029 dnl to know which OS platform Python thinks this is.
1030
1031 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
1032 [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
1033 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
1034
1035
1036 dnl Set up 4 directories:
1037
1038 dnl pythondir -- where to install python scripts. This is the
1039 dnl site-packages directory, not the python standard library
1040 dnl directory like in previous automake betas. This behavior
1041 dnl is more consistent with lispdir.m4 for example.
1042 dnl Query distutils for this directory.
1043 AC_CACHE_CHECK([for $am_display_PYTHON script directory],
1044 [am_cv_python_pythondir],
1045 [if test "x$prefix" = xNONE
1046 then
1047 am_py_prefix=$ac_default_prefix
1048 else
1049 am_py_prefix=$prefix
1050 fi
1051 am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null`
1052 case $am_cv_python_pythondir in
1053 $am_py_prefix*)
1054 am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
1055 am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
1056 ;;
1057 *)
1058 case $am_py_prefix in
1059 /usr|/System*) ;;
1060 *)
1061 am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
1062 ;;
1063 esac
1064 ;;
1065 esac
1066 ])
1067 AC_SUBST([pythondir], [$am_cv_python_pythondir])
1068
1069 dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
1070 dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
1071 dnl more consistent with the rest of automake.
1072
1073 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
1074
1075 dnl pyexecdir -- directory for installing python extension modules
1076 dnl (shared libraries)
1077 dnl Query distutils for this directory.
1078 AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
1079 [am_cv_python_pyexecdir],
1080 [if test "x$exec_prefix" = xNONE
1081 then
1082 am_py_exec_prefix=$am_py_prefix
1083 else
1084 am_py_exec_prefix=$exec_prefix
1085 fi
1086 am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null`
1087 case $am_cv_python_pyexecdir in
1088 $am_py_exec_prefix*)
1089 am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
1090 am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
1091 ;;
1092 *)
1093 case $am_py_exec_prefix in
1094 /usr|/System*) ;;
1095 *)
1096 am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
1097 ;;
1098 esac
1099 ;;
1100 esac
1101 ])
1102 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
1103
1104 dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
1105
1106 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
1107
1108 dnl Run any user-specified action.
1109 $2
1110 fi
1111
1112])
1113
1114
1115# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
1116# ---------------------------------------------------------------------------
1117# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
1118# Run ACTION-IF-FALSE otherwise.
1119# This test uses sys.hexversion instead of the string equivalent (first
1120# word of sys.version), in order to cope with versions such as 2.2c1.
1121# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
1122AC_DEFUN([AM_PYTHON_CHECK_VERSION],
1123 [prog="import sys
1124# split strings by '.' and convert to numeric. Append some zeros
1125# because we need at least 4 digits for the hex conversion.
1126# map returns an iterator in Python 3.0 and a list in 2.x
1127minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
1128minverhex = 0
1129# xrange is not present in Python 3.0 and range returns an iterator
1130for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
1131sys.exit(sys.hexversion < minverhex)"
1132 AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
1133
1134# Copyright (C) 2001-2012 Free Software Foundation, Inc.
1135#
1136# This file is free software; the Free Software Foundation
1137# gives unlimited permission to copy and/or distribute it,
1138# with or without modifications, as long as this notice is preserved.
1139
1140# serial 1
1141
1142# AM_RUN_LOG(COMMAND)
1143# -------------------
1144# Run COMMAND, save the exit status in ac_status, and log it.
1145# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
1146AC_DEFUN([AM_RUN_LOG],
1147[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
1148 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
1149 ac_status=$?
1150 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1151 (exit $ac_status); }])
1152
1153# Check to make sure that the build environment is sane. -*- Autoconf -*-
1154
1155# Copyright (C) 1996-2012 Free Software Foundation, Inc.
1156#
1157# This file is free software; the Free Software Foundation
1158# gives unlimited permission to copy and/or distribute it,
1159# with or without modifications, as long as this notice is preserved.
1160
1161# serial 9
1162
1163# AM_SANITY_CHECK
1164# ---------------
1165AC_DEFUN([AM_SANITY_CHECK],
1166[AC_MSG_CHECKING([whether build environment is sane])
1167# Reject unsafe characters in $srcdir or the absolute working directory
1168# name. Accept space and tab only in the latter.
1169am_lf='
1170'
1171case `pwd` in
1172 *[[\\\"\#\$\&\'\`$am_lf]]*)
1173 AC_MSG_ERROR([unsafe absolute working directory name]);;
1174esac
1175case $srcdir in
1176 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
1177 AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
1178esac
1179
1180# Do 'set' in a subshell so we don't clobber the current shell's
1181# arguments. Must try -L first in case configure is actually a
1182# symlink; some systems play weird games with the mod time of symlinks
1183# (eg FreeBSD returns the mod time of the symlink's containing
1184# directory).
1185if (
1186 am_has_slept=no
1187 for am_try in 1 2; do
1188 echo "timestamp, slept: $am_has_slept" > conftest.file
1189 set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
1190 if test "$[*]" = "X"; then
1191 # -L didn't work.
1192 set X `ls -t "$srcdir/configure" conftest.file`
1193 fi
1194 if test "$[*]" != "X $srcdir/configure conftest.file" \
1195 && test "$[*]" != "X conftest.file $srcdir/configure"; then
1196
1197 # If neither matched, then we have a broken ls. This can happen
1198 # if, for instance, CONFIG_SHELL is bash and it inherits a
1199 # broken ls alias from the environment. This has actually
1200 # happened. Such a system could not be considered "sane".
1201 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1202 alias in your environment])
1203 fi
1204 if test "$[2]" = conftest.file || test $am_try -eq 2; then
1205 break
1206 fi
1207 # Just in case.
1208 sleep 1
1209 am_has_slept=yes
1210 done
1211 test "$[2]" = conftest.file
1212 )
1213then
1214 # Ok.
1215 :
1216else
1217 AC_MSG_ERROR([newly created file is older than distributed files!
1218Check your system clock])
1219fi
1220AC_MSG_RESULT([yes])
1221# If we didn't sleep, we still need to ensure time stamps of config.status and
1222# generated files are strictly newer.
1223am_sleep_pid=
1224if grep 'slept: no' conftest.file >/dev/null 2>&1; then
1225 ( sleep 1 ) &
1226 am_sleep_pid=$!
1227fi
1228AC_CONFIG_COMMANDS_PRE(
1229 [AC_MSG_CHECKING([that generated files are newer than configure])
1230 if test -n "$am_sleep_pid"; then
1231 # Hide warnings about reused PIDs.
1232 wait $am_sleep_pid 2>/dev/null
1233 fi
1234 AC_MSG_RESULT([done])])
1235rm -f conftest.file
1236])
1237
1238# Copyright (C) 2009-2012 Free Software Foundation, Inc.
1239#
1240# This file is free software; the Free Software Foundation
1241# gives unlimited permission to copy and/or distribute it,
1242# with or without modifications, as long as this notice is preserved.
1243
1244# serial 3
1245
1246# AM_SILENT_RULES([DEFAULT])
1247# --------------------------
1248# Enable less verbose build rules; with the default set to DEFAULT
1249# ("yes" being less verbose, "no" or empty being verbose).
1250AC_DEFUN([AM_SILENT_RULES],
1251[AC_ARG_ENABLE([silent-rules], [dnl
1252AS_HELP_STRING(
1253 [--enable-silent-rules],
1254 [less verbose build output (undo: "make V=1")])
1255AS_HELP_STRING(
1256 [--disable-silent-rules],
1257 [verbose build output (undo: "make V=0")])dnl
1258])
1259case $enable_silent_rules in @%:@ (((
1260 yes) AM_DEFAULT_VERBOSITY=0;;
1261 no) AM_DEFAULT_VERBOSITY=1;;
1262 *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
1263esac
1264dnl
1265dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1266dnl do not support nested variable expansions.
1267dnl See automake bug#9928 and bug#10237.
1268am_make=${MAKE-make}
1269AC_CACHE_CHECK([whether $am_make supports nested variables],
1270 [am_cv_make_support_nested_variables],
1271 [if AS_ECHO([['TRUE=$(BAR$(V))
1272BAR0=false
1273BAR1=true
1274V=1
1275am__doit:
1276 @$(TRUE)
1277.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1278 am_cv_make_support_nested_variables=yes
1279else
1280 am_cv_make_support_nested_variables=no
1281fi])
1282if test $am_cv_make_support_nested_variables = yes; then
1283 dnl Using '$V' instead of '$(V)' breaks IRIX make.
1284 AM_V='$(V)'
1285 AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1286else
1287 AM_V=$AM_DEFAULT_VERBOSITY
1288 AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1289fi
1290AC_SUBST([AM_V])dnl
1291AM_SUBST_NOTMAKE([AM_V])dnl
1292AC_SUBST([AM_DEFAULT_V])dnl
1293AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1294AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1295AM_BACKSLASH='\'
1296AC_SUBST([AM_BACKSLASH])dnl
1297_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1298])
1299
1300# Copyright (C) 2001-2012 Free Software Foundation, Inc.
1301#
1302# This file is free software; the Free Software Foundation
1303# gives unlimited permission to copy and/or distribute it,
1304# with or without modifications, as long as this notice is preserved.
1305
1306# serial 2
1307
1308# AM_PROG_INSTALL_STRIP
1309# ---------------------
1310# One issue with vendor 'install' (even GNU) is that you can't
1311# specify the program used to strip binaries. This is especially
1312# annoying in cross-compiling environments, where the build's strip
1313# is unlikely to handle the host's binaries.
1314# Fortunately install-sh will honor a STRIPPROG variable, so we
1315# always use install-sh in "make install-strip", and initialize
1316# STRIPPROG with the value of the STRIP variable (set by the user).
1317AC_DEFUN([AM_PROG_INSTALL_STRIP],
1318[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1319# Installed binaries are usually stripped using 'strip' when the user
1320# run "make install-strip". However 'strip' might not be the right
1321# tool to use in cross-compilation environments, therefore Automake
1322# will honor the 'STRIP' environment variable to overrule this program.
1323dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1324if test "$cross_compiling" != no; then
1325 AC_CHECK_TOOL([STRIP], [strip], :)
1326fi
1327INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1328AC_SUBST([INSTALL_STRIP_PROGRAM])])
1329
1330# Copyright (C) 2006-2012 Free Software Foundation, Inc.
1331#
1332# This file is free software; the Free Software Foundation
1333# gives unlimited permission to copy and/or distribute it,
1334# with or without modifications, as long as this notice is preserved.
1335
1336# serial 3
1337
1338# _AM_SUBST_NOTMAKE(VARIABLE)
1339# ---------------------------
1340# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1341# This macro is traced by Automake.
1342AC_DEFUN([_AM_SUBST_NOTMAKE])
1343
1344# AM_SUBST_NOTMAKE(VARIABLE)
1345# --------------------------
1346# Public sister of _AM_SUBST_NOTMAKE.
1347AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1348
1349# Check how to create a tarball. -*- Autoconf -*-
1350
1351# Copyright (C) 2004-2012 Free Software Foundation, Inc.
1352#
1353# This file is free software; the Free Software Foundation
1354# gives unlimited permission to copy and/or distribute it,
1355# with or without modifications, as long as this notice is preserved.
1356
1357# serial 3
1358
1359# _AM_PROG_TAR(FORMAT)
1360# --------------------
1361# Check how to create a tarball in format FORMAT.
1362# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1363#
1364# Substitute a variable $(am__tar) that is a command
1365# writing to stdout a FORMAT-tarball containing the directory
1366# $tardir.
1367# tardir=directory && $(am__tar) > result.tar
1368#
1369# Substitute a variable $(am__untar) that extract such
1370# a tarball read from stdin.
1371# $(am__untar) < result.tar
1372AC_DEFUN([_AM_PROG_TAR],
1373[# Always define AMTAR for backward compatibility. Yes, it's still used
1374# in the wild :-( We should find a proper way to deprecate it ...
1375AC_SUBST([AMTAR], ['$${TAR-tar}'])
1376m4_if([$1], [v7],
1377 [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1378 [m4_case([$1], [ustar],, [pax],,
1379 [m4_fatal([Unknown tar format])])
1380AC_MSG_CHECKING([how to create a $1 tar archive])
1381# Loop over all known methods to create a tar archive until one works.
1382_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1383_am_tools=${am_cv_prog_tar_$1-$_am_tools}
1384# Do not fold the above two line into one, because Tru64 sh and
1385# Solaris sh will not grok spaces in the rhs of '-'.
1386for _am_tool in $_am_tools
1387do
1388 case $_am_tool in
1389 gnutar)
1390 for _am_tar in tar gnutar gtar;
1391 do
1392 AM_RUN_LOG([$_am_tar --version]) && break
1393 done
1394 am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1395 am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1396 am__untar="$_am_tar -xf -"
1397 ;;
1398 plaintar)
1399 # Must skip GNU tar: if it does not support --format= it doesn't create
1400 # ustar tarball either.
1401 (tar --version) >/dev/null 2>&1 && continue
1402 am__tar='tar chf - "$$tardir"'
1403 am__tar_='tar chf - "$tardir"'
1404 am__untar='tar xf -'
1405 ;;
1406 pax)
1407 am__tar='pax -L -x $1 -w "$$tardir"'
1408 am__tar_='pax -L -x $1 -w "$tardir"'
1409 am__untar='pax -r'
1410 ;;
1411 cpio)
1412 am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1413 am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1414 am__untar='cpio -i -H $1 -d'
1415 ;;
1416 none)
1417 am__tar=false
1418 am__tar_=false
1419 am__untar=false
1420 ;;
1421 esac
1422
1423 # If the value was cached, stop now. We just wanted to have am__tar
1424 # and am__untar set.
1425 test -n "${am_cv_prog_tar_$1}" && break
1426
1427 # tar/untar a dummy directory, and stop if the command works
1428 rm -rf conftest.dir
1429 mkdir conftest.dir
1430 echo GrepMe > conftest.dir/file
1431 AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1432 rm -rf conftest.dir
1433 if test -s conftest.tar; then
1434 AM_RUN_LOG([$am__untar <conftest.tar])
1435 grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1436 fi
1437done
1438rm -rf conftest.dir
1439
1440AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1441AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1442AC_SUBST([am__tar])
1443AC_SUBST([am__untar])
1444]) # _AM_PROG_TAR
1445
1446m4_include([m4/ac_pkg_cython.m4])
1447m4_include([m4/ac_python_devel.m4])
1448m4_include([m4/as-compiler-flag.m4])
1449m4_include([m4/cython_python.m4])
1450m4_include([m4/libtool.m4])
1451m4_include([m4/ltoptions.m4])
1452m4_include([m4/ltsugar.m4])
1453m4_include([m4/ltversion.m4])
1454m4_include([m4/lt~obsolete.m4])
14550
=== added file 'autogen.sh'
--- autogen.sh 1970-01-01 00:00:00 +0000
+++ autogen.sh 2014-03-14 06:45:31 +0000
@@ -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
016
=== added directory 'common'
=== added file 'common/Makefile.am'
--- common/Makefile.am 1970-01-01 00:00:00 +0000
+++ common/Makefile.am 2014-03-14 06:45:31 +0000
@@ -0,0 +1,18 @@
1AM_CPPFLAGS = -I$(top_srcdir)/include
2
3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS)
4AM_LDFLAGS = $(libplist_LIBS) ${libpthread_LIBS}
5
6noinst_LTLIBRARIES = libinternalcommon.la
7libinternalcommon_la_LIBADD =
8libinternalcommon_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined
9libinternalcommon_la_SOURCES = \
10 socket.c socket.h \
11 thread.c thread.h \
12 debug.c debug.h \
13 userpref.c userpref.h \
14 utils.c utils.h
15
16if WIN32
17libinternalcommon_la_LIBADD += -lole32
18endif
019
=== added file 'common/debug.c'
--- common/debug.c 1970-01-01 00:00:00 +0000
+++ common/debug.c 2014-03-14 06:45:31 +0000
@@ -0,0 +1,169 @@
1/*
2 * debug.c
3 * contains utilitary functions for debugging
4 *
5 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
6 * Copyright (c) 2010 Martin S. All Rights Reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifdef HAVE_CONFIG_H
24#include <config.h>
25#endif
26#include <stdarg.h>
27#define _GNU_SOURCE 1
28#define __USE_GNU 1
29#include <stdio.h>
30#include <stdint.h>
31#include <stdlib.h>
32#include <time.h>
33
34#include "debug.h"
35#include "libimobiledevice/libimobiledevice.h"
36
37#ifndef STRIP_DEBUG_CODE
38#include "asprintf.h"
39#endif
40
41int debug_level = 0;
42
43/**
44 * Sets the level of debugging. Currently the only acceptable values are 0 and
45 * 1.
46 *
47 * @param level Set to 0 for no debugging or 1 for debugging.
48 */
49void idevice_set_debug_level(int level)
50{
51 debug_level = level;
52}
53
54#ifndef STRIP_DEBUG_CODE
55static void debug_print_line(const char *func, const char *file, int line, const char *buffer)
56{
57 char *str_time = NULL;
58 char *header = NULL;
59 time_t the_time;
60
61 time(&the_time);
62 str_time = (char*)malloc(255);
63 strftime(str_time, 254, "%H:%M:%S", localtime (&the_time));
64
65 /* generate header text */
66 (void)asprintf(&header, "%s %s:%d %s()", str_time, file, line, func);
67 free (str_time);
68
69 /* trim ending newlines */
70
71 /* print header */
72 printf ("%s: ", header);
73
74 /* print actual debug content */
75 printf ("%s\n", buffer);
76
77 /* flush this output, as we need to debug */
78 fflush (stdout);
79
80 free (header);
81}
82#endif
83
84void debug_info_real(const char *func, const char *file, int line, const char *format, ...)
85{
86#ifndef STRIP_DEBUG_CODE
87 va_list args;
88 char *buffer = NULL;
89
90 if (!debug_level)
91 return;
92
93 /* run the real fprintf */
94 va_start(args, format);
95 (void)vasprintf(&buffer, format, args);
96 va_end(args);
97
98 debug_print_line(func, file, line, buffer);
99
100 free(buffer);
101#endif
102}
103
104void debug_buffer(const char *data, const int length)
105{
106#ifndef STRIP_DEBUG_CODE
107 int i;
108 int j;
109 unsigned char c;
110
111 if (debug_level) {
112 for (i = 0; i < length; i += 16) {
113 fprintf(stderr, "%04x: ", i);
114 for (j = 0; j < 16; j++) {
115 if (i + j >= length) {
116 fprintf(stderr, " ");
117 continue;
118 }
119 fprintf(stderr, "%02x ", *(data + i + j) & 0xff);
120 }
121 fprintf(stderr, " | ");
122 for (j = 0; j < 16; j++) {
123 if (i + j >= length)
124 break;
125 c = *(data + i + j);
126 if ((c < 32) || (c > 127)) {
127 fprintf(stderr, ".");
128 continue;
129 }
130 fprintf(stderr, "%c", c);
131 }
132 fprintf(stderr, "\n");
133 }
134 fprintf(stderr, "\n");
135 }
136#endif
137}
138
139void debug_buffer_to_file(const char *file, const char *data, const int length)
140{
141#ifndef STRIP_DEBUG_CODE
142 if (debug_level) {
143 FILE *f = fopen(file, "wb");
144 fwrite(data, 1, length, f);
145 fflush(f);
146 fclose(f);
147 }
148#endif
149}
150
151void debug_plist_real(const char *func, const char *file, int line, plist_t plist)
152{
153#ifndef STRIP_DEBUG_CODE
154 if (!plist)
155 return;
156
157 char *buffer = NULL;
158 uint32_t length = 0;
159 plist_to_xml(plist, &buffer, &length);
160
161 /* get rid of ending newline as one is already added in the debug line */
162 if (buffer[length-1] == '\n')
163 buffer[length-1] = '\0';
164
165 debug_info_real(func, file, line, "printing %i bytes plist:\n%s", length, buffer);
166 free(buffer);
167#endif
168}
169
0170
=== added file 'common/debug.h'
--- common/debug.h 1970-01-01 00:00:00 +0000
+++ common/debug.h 2014-03-14 06:45:31 +0000
@@ -0,0 +1,59 @@
1/*
2 * debug.h
3 * contains utilitary functions for debugging
4 *
5 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
6 * Copyright (c) 2010 Martin S. All Rights Reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef __DEBUG_H
24#define __DEBUG_H
25
26#include <plist/plist.h>
27
28#ifndef LIBIMOBILEDEVICE_INTERNAL
29#ifdef WIN32
30#define LIBIMOBILEDEVICE_INTERNAL
31#else
32#define LIBIMOBILEDEVICE_INTERNAL __attribute__((visibility("hidden")))
33#endif
34#endif
35
36#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(STRIP_DEBUG_CODE)
37#define debug_info(...) debug_info_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
38#define debug_plist(a) debug_plist_real (__func__, __FILE__, __LINE__, a)
39#elif defined(__GNUC__) && __GNUC__ >= 3 && !defined(STRIP_DEBUG_CODE)
40#define debug_info(...) debug_info_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
41#define debug_plist(a) debug_plist_real (__FUNCTION__, __FILE__, __LINE__, a)
42#else
43#define debug_info(...)
44#define debug_plist(a)
45#endif
46
47LIBIMOBILEDEVICE_INTERNAL void debug_info_real(const char *func,
48 const char *file,
49 int line,
50 const char *format, ...);
51
52LIBIMOBILEDEVICE_INTERNAL void debug_buffer(const char *data, const int length);
53LIBIMOBILEDEVICE_INTERNAL void debug_buffer_to_file(const char *file, const char *data, const int length);
54LIBIMOBILEDEVICE_INTERNAL void debug_plist_real(const char *func,
55 const char *file,
56 int line,
57 plist_t plist);
58
59#endif
060
=== added file 'common/socket.c'
--- common/socket.c 1970-01-01 00:00:00 +0000
+++ common/socket.c 2014-03-14 06:45:31 +0000
@@ -0,0 +1,392 @@
1/*
2 * socket.c
3 *
4 * Copyright (c) 2012 Martin Szulecki All Rights Reserved.
5 * Copyright (c) 2012 Nikias Bassen All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <stdio.h>
23#include <stddef.h>
24#include <stdlib.h>
25#include <string.h>
26#include <unistd.h>
27#include <errno.h>
28#include <sys/time.h>
29#include <sys/stat.h>
30#ifdef WIN32
31#include <winsock2.h>
32#include <windows.h>
33static int wsa_init = 0;
34#else
35#include <sys/socket.h>
36#include <sys/un.h>
37#include <netinet/in.h>
38#include <netdb.h>
39#include <arpa/inet.h>
40#endif
41#include "socket.h"
42
43#define RECV_TIMEOUT 20000
44
45static int verbose = 0;
46
47void socket_set_verbose(int level)
48{
49 verbose = level;
50}
51
52#ifndef WIN32
53int socket_create_unix(const char *filename)
54{
55 struct sockaddr_un name;
56 int sock;
57 size_t size;
58
59 // remove if still present
60 unlink(filename);
61
62 /* Create the socket. */
63 sock = socket(PF_LOCAL, SOCK_STREAM, 0);
64 if (sock < 0) {
65 perror("socket");
66 return -1;
67 }
68
69 /* Bind a name to the socket. */
70 name.sun_family = AF_LOCAL;
71 strncpy(name.sun_path, filename, sizeof(name.sun_path));
72 name.sun_path[sizeof(name.sun_path) - 1] = '\0';
73
74 /* The size of the address is
75 the offset of the start of the filename,
76 plus its length,
77 plus one for the terminating null byte.
78 Alternatively you can just do:
79 size = SUN_LEN (&name);
80 */
81 size = (offsetof(struct sockaddr_un, sun_path)
82 + strlen(name.sun_path) + 1);
83
84 if (bind(sock, (struct sockaddr *) &name, size) < 0) {
85 perror("bind");
86 socket_close(sock);
87 return -1;
88 }
89
90 if (listen(sock, 10) < 0) {
91 perror("listen");
92 socket_close(sock);
93 return -1;
94 }
95
96 return sock;
97}
98
99int socket_connect_unix(const char *filename)
100{
101 struct sockaddr_un name;
102 int sfd = -1;
103 size_t size;
104 struct stat fst;
105
106 // check if socket file exists...
107 if (stat(filename, &fst) != 0) {
108 if (verbose >= 2)
109 fprintf(stderr, "%s: stat '%s': %s\n", __func__, filename,
110 strerror(errno));
111 return -1;
112 }
113 // ... and if it is a unix domain socket
114 if (!S_ISSOCK(fst.st_mode)) {
115 if (verbose >= 2)
116 fprintf(stderr, "%s: File '%s' is not a socket!\n", __func__,
117 filename);
118 return -1;
119 }
120 // make a new socket
121 if ((sfd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
122 if (verbose >= 2)
123 fprintf(stderr, "%s: socket: %s\n", __func__, strerror(errno));
124 return -1;
125 }
126 // and connect to 'filename'
127 name.sun_family = AF_LOCAL;
128 strncpy(name.sun_path, filename, sizeof(name.sun_path));
129 name.sun_path[sizeof(name.sun_path) - 1] = 0;
130
131 size = (offsetof(struct sockaddr_un, sun_path)
132 + strlen(name.sun_path) + 1);
133
134 if (connect(sfd, (struct sockaddr *) &name, size) < 0) {
135 socket_close(sfd);
136 if (verbose >= 2)
137 fprintf(stderr, "%s: connect: %s\n", __func__,
138 strerror(errno));
139 return -1;
140 }
141
142 return sfd;
143}
144#endif
145
146int socket_create(uint16_t port)
147{
148 int sfd = -1;
149 int yes = 1;
150#ifdef WIN32
151 WSADATA wsa_data;
152 if (!wsa_init) {
153 if (WSAStartup(MAKEWORD(2,2), &wsa_data) != ERROR_SUCCESS) {
154 fprintf(stderr, "WSAStartup failed!\n");
155 ExitProcess(-1);
156 }
157 wsa_init = 1;
158 }
159#endif
160 struct sockaddr_in saddr;
161
162 if (0 > (sfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP))) {
163 perror("socket()");
164 return -1;
165 }
166
167 if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (void*)&yes, sizeof(int)) == -1) {
168 perror("setsockopt()");
169 socket_close(sfd);
170 return -1;
171 }
172
173 memset((void *) &saddr, 0, sizeof(saddr));
174 saddr.sin_family = AF_INET;
175 saddr.sin_addr.s_addr = htonl(INADDR_ANY);
176 saddr.sin_port = htons(port);
177
178 if (0 > bind(sfd, (struct sockaddr *) &saddr, sizeof(saddr))) {
179 perror("bind()");
180 socket_close(sfd);
181 return -1;
182 }
183
184 if (listen(sfd, 1) == -1) {
185 perror("listen()");
186 socket_close(sfd);
187 return -1;
188 }
189
190 return sfd;
191}
192
193int socket_connect(const char *addr, uint16_t port)
194{
195 int sfd = -1;
196 int yes = 1;
197 struct hostent *hp;
198 struct sockaddr_in saddr;
199#ifdef WIN32
200 WSADATA wsa_data;
201 if (!wsa_init) {
202 if (WSAStartup(MAKEWORD(2,2), &wsa_data) != ERROR_SUCCESS) {
203 fprintf(stderr, "WSAStartup failed!\n");
204 ExitProcess(-1);
205 }
206 wsa_init = 1;
207 }
208#endif
209
210 if (!addr) {
211 errno = EINVAL;
212 return -1;
213 }
214
215 if ((hp = gethostbyname(addr)) == NULL) {
216 if (verbose >= 2)
217 fprintf(stderr, "%s: unknown host '%s'\n", __func__, addr);
218 return -1;
219 }
220
221 if (!hp->h_addr) {
222 if (verbose >= 2)
223 fprintf(stderr, "%s: gethostbyname returned NULL address!\n",
224 __func__);
225 return -1;
226 }
227
228 if (0 > (sfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP))) {
229 perror("socket()");
230 return -1;
231 }
232
233 if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (void*)&yes, sizeof(int)) == -1) {
234 perror("setsockopt()");
235 socket_close(sfd);
236 return -1;
237 }
238
239 memset((void *) &saddr, 0, sizeof(saddr));
240 saddr.sin_family = AF_INET;
241 saddr.sin_addr.s_addr = *(uint32_t *) hp->h_addr;
242 saddr.sin_port = htons(port);
243
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: